enhanced wiki list

This commit is contained in:
2023-10-26 00:55:13 +02:00
parent 665ffb9dce
commit 45b2bd01a2
6 changed files with 173 additions and 264 deletions
+51 -122
View File
@@ -1,56 +1,38 @@
<template> <template>
<div class="stock-generator tab"> <div class="stock-generator tab">
<div class="tab_header"> <div class="tab_header">
<h2>{{ $t("stockgen.title") }}</h2> <h2>{{ $t('stockgen.title') }}</h2>
</div> </div>
<div class="tab_content"> <div class="tab_content">
<div> <div>
<h2>{{ $t("stockgen.properties-title") }}</h2> <h2>{{ $t('stockgen.properties-title') }}</h2>
<b class="text--accent"> <b class="text--accent">
{{ $t("stockgen.properties-desc") }} {{ $t('stockgen.properties-desc') }}
</b> </b>
<div class="tab_attributes"> <div class="tab_attributes">
<label> <label>
{{ $t("stockgen.input-mass") }} {{ $t('stockgen.input-mass') }}
<input <input type="number" v-model="maxMass" step="100" max="4000" min="0" />
type="number"
v-model="maxMass"
step="100"
max="4000"
min="0"
/>
</label> </label>
<label> <label>
{{ $t("stockgen.input-length") }} {{ $t('stockgen.input-length') }}
<input <input type="number" v-model="maxLength" step="25" max="650" min="0" />
type="number"
v-model="maxLength"
step="25"
max="650"
min="0"
/>
</label> </label>
<label> <label>
{{ $t("stockgen.input-carcount") }} {{ $t('stockgen.input-carcount') }}
<input <input type="number" v-model="maxCarCount" step="1" max="60" min="1" />
type="number"
v-model="maxCarCount"
step="1"
max="60"
min="1"
/>
</label> </label>
</div> </div>
</div> </div>
<div> <div>
<h2>{{ $t("stockgen.cargo-title") }}</h2> <h2>{{ $t('stockgen.cargo-title') }}</h2>
<b>{{ $t("stockgen.cargo-desc") }}</b> <b>{{ $t('stockgen.cargo-desc') }}</b>
</div> </div>
<div class="generator_cargo"> <div class="generator_cargo">
@@ -66,15 +48,15 @@
</div> </div>
<div> <div>
<h2>{{ $t("stockgen.chosen-title") }}</h2> <h2>{{ $t('stockgen.chosen-title') }}</h2>
<div class="generator_warning"> <div class="generator_warning">
<span v-if="computedChosenCarTypes.size == 0"> <span v-if="computedChosenCarTypes.size == 0">
{{ $t("stockgen.chosen-empty-warning") }} {{ $t('stockgen.chosen-empty-warning') }}
</span> </span>
<span v-else> <span v-else>
{{ $t("stockgen.chosen-warning") }} {{ $t('stockgen.chosen-warning') }}
</span> </span>
</div> </div>
</div> </div>
@@ -97,28 +79,16 @@
<hr /> <hr />
<div class="tab_actions"> <div class="tab_actions">
<button <button class="btn" :data-disabled="computedChosenCarTypes.size == 0" @click="generateStock()">
class="btn" {{ $t('stockgen.action-generate') }}
:data-disabled="computedChosenCarTypes.size == 0"
@click="generateStock()"
>
{{ $t("stockgen.action-generate") }}
</button> </button>
<button <button class="btn" :data-disabled="computedChosenCarTypes.size == 0" @click="generateStock(true)">
class="btn" {{ $t('stockgen.action-generate-empty') }}
:data-disabled="computedChosenCarTypes.size == 0"
@click="generateStock(true)"
>
{{ $t("stockgen.action-generate-empty") }}
</button> </button>
<button <button class="btn" :data-disabled="computedChosenCarTypes.size == 0" @click="resetChosenCargo">
class="btn" {{ $t('stockgen.action-reset') }}
:data-disabled="computedChosenCarTypes.size == 0"
@click="resetChosenCargo"
>
{{ $t("stockgen.action-reset") }}
</button> </button>
</div> </div>
</div> </div>
@@ -126,15 +96,15 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent } from "vue"; import { defineComponent } from 'vue';
import { useStore } from "../../store"; import { useStore } from '../../store';
import stockMixin from "../../mixins/stockMixin"; import stockMixin from '../../mixins/stockMixin';
import { ICargo, ICarWagon, IStock } from "../../types"; import { ICargo, ICarWagon, IStock } from '../../types';
import warningsMixin from "../../mixins/warningsMixin"; import warningsMixin from '../../mixins/warningsMixin';
export default defineComponent({ export default defineComponent({
name: "stock-generator", name: 'stock-generator',
mixins: [stockMixin, warningsMixin], mixins: [stockMixin, warningsMixin],
@@ -157,9 +127,7 @@ export default defineComponent({
computed: { computed: {
computedChosenCarTypes() { computedChosenCarTypes() {
return new Set<string>( return new Set<string>(this.chosenCarTypes.slice().sort((c1, c2) => (c1 > c2 ? 1 : -1)));
this.chosenCarTypes.slice().sort((c1, c2) => (c1 > c2 ? 1 : -1)),
);
}, },
}, },
@@ -186,38 +154,27 @@ export default defineComponent({
const generatedChosenStockList = this.chosenCargoTypes.reduce( const generatedChosenStockList = this.chosenCargoTypes.reduce(
(acc, type) => { (acc, type) => {
this.store.stockData?.generator.cargo[type] this.store.stockData?.generator.cargo[type]
.filter((c) => !this.excludedCarTypes.includes(c.split(":")[0])) .filter((c) => !this.excludedCarTypes.includes(c.split(':')[0]))
.forEach((c) => { .forEach((c) => {
const [type, cargoType] = c.split(":"); const [type, cargoType] = c.split(':');
const carWagonObjs = this.store.carDataList.filter((cw) => const carWagonObjs = this.store.carDataList.filter((cw) => cw.type.startsWith(type));
cw.type.startsWith(type),
);
const cargoObjs = [] as (ICargo | undefined)[]; const cargoObjs = [] as (ICargo | undefined)[];
if (!cargoType || empty) cargoObjs.push(undefined); if (!cargoType || empty) cargoObjs.push(undefined);
else if (cargoType == "all") else if (cargoType == 'all') cargoObjs.push(...carWagonObjs[0]!.cargoList);
cargoObjs.push(...carWagonObjs[0]!.cargoList); else cargoObjs.push(carWagonObjs[0]?.cargoList.find((cargo) => cargo.id == cargoType));
else
cargoObjs.push(
carWagonObjs[0]?.cargoList.find(
(cargo) => cargo.id == cargoType,
),
);
carWagonObjs.forEach((cw) => { carWagonObjs.forEach((cw) => {
cargoObjs.forEach((cargoObj) => { cargoObjs.forEach((cargoObj) => {
const chosenStock = acc.find((a) => const chosenStock = acc.find((a) => a.constructionType.includes(cw.constructionType));
a.constructionType.includes(cw.constructionType),
);
if (!chosenStock) if (!chosenStock)
acc.push({ acc.push({
constructionType: cw.constructionType, constructionType: cw.constructionType,
carPool: [{ carWagon: cw, cargo: cargoObj }], carPool: [{ carWagon: cw, cargo: cargoObj }],
}); });
else else chosenStock.carPool.push({ carWagon: cw, cargo: cargoObj });
chosenStock.carPool.push({ carWagon: cw, cargo: cargoObj });
}); });
}); });
}); });
@@ -227,7 +184,7 @@ export default defineComponent({
[] as { [] as {
constructionType: string; constructionType: string;
carPool: { carWagon: ICarWagon; cargo?: ICargo }[]; carPool: { carWagon: ICarWagon; cargo?: ICargo }[];
}[], }[]
); );
let bestGeneration: { stockList: IStock[]; value: number } = { let bestGeneration: { stockList: IStock[]; value: number } = {
@@ -236,31 +193,19 @@ export default defineComponent({
}; };
for (let i = 0; i < 10; i++) { for (let i = 0; i < 10; i++) {
const headingLoco = this.store.stockList[0]?.isLoco const headingLoco = this.store.stockList[0]?.isLoco ? this.store.stockList[0] : undefined;
? this.store.stockList[0]
: undefined;
this.store.stockList.length = headingLoco ? 1 : 0; this.store.stockList.length = headingLoco ? 1 : 0;
const maxMass = const maxMass = this.store.acceptableMass > 0 ? Math.min(this.store.acceptableMass, this.maxMass) : this.maxMass;
this.store.acceptableMass > 0
? Math.min(this.store.acceptableMass, this.maxMass)
: this.maxMass;
let exceeded = false; let exceeded = false;
while (!exceeded) { while (!exceeded) {
const randomStockType = const randomStockType = generatedChosenStockList[~~(Math.random() * generatedChosenStockList.length)];
generatedChosenStockList[ const { carWagon, cargo } = randomStockType.carPool[~~(Math.random() * randomStockType.carPool.length)];
~~(Math.random() * generatedChosenStockList.length)
];
const { carWagon, cargo } =
randomStockType.carPool[
~~(Math.random() * randomStockType.carPool.length)
];
if ( if (
this.store.totalMass + (cargo?.totalMass || carWagon.mass) > this.store.totalMass + (cargo?.totalMass || carWagon.mass) > maxMass ||
maxMass ||
this.store.totalLength + carWagon.length > this.maxLength || this.store.totalLength + carWagon.length > this.maxLength ||
this.store.stockList.length > this.maxCarCount this.store.stockList.length > this.maxCarCount
) { ) {
@@ -271,10 +216,7 @@ export default defineComponent({
this.addCarWagon(carWagon, cargo); this.addCarWagon(carWagon, cargo);
} }
const currentGenerationValue = const currentGenerationValue = this.store.totalLength + this.store.totalMass + this.store.stockList.length;
this.store.totalLength +
this.store.totalMass +
this.store.stockList.length;
if (bestGeneration.value < currentGenerationValue) { if (bestGeneration.value < currentGenerationValue) {
bestGeneration.stockList = this.store.stockList; bestGeneration.stockList = this.store.stockList;
@@ -283,12 +225,11 @@ export default defineComponent({
} }
this.store.stockList = bestGeneration.stockList; this.store.stockList = bestGeneration.stockList;
this.store.stockSectionMode = "stock-list"; this.store.stockSectionMode = 'stock-list';
}, },
previewCar(type: string) { previewCar(type: string) {
const c = const c = this.store.carDataList.find((c) => c.type.startsWith(type)) || null;
this.store.carDataList.find((c) => c.type.startsWith(type)) || null;
this.store.chosenVehicle = c; this.store.chosenVehicle = c;
this.store.chosenCar = c; this.store.chosenCar = c;
@@ -301,38 +242,33 @@ export default defineComponent({
toggleCargoChosen(cargoType: string, vehicles: string[]) { toggleCargoChosen(cargoType: string, vehicles: string[]) {
if (this.chosenCargoTypes.includes(cargoType)) { if (this.chosenCargoTypes.includes(cargoType)) {
vehicles.forEach((v) => { vehicles.forEach((v) => {
const [type] = v.split(":"); const [type] = v.split(':');
this.chosenCarTypes.splice(this.chosenCarTypes.indexOf(type), 1); this.chosenCarTypes.splice(this.chosenCarTypes.indexOf(type), 1);
}); });
this.chosenCargoTypes.splice( this.chosenCargoTypes.splice(this.chosenCargoTypes.indexOf(cargoType), 1);
this.chosenCargoTypes.indexOf(cargoType),
1,
);
return; return;
} }
this.chosenCargoTypes.push(cargoType); this.chosenCargoTypes.push(cargoType);
vehicles.forEach((v) => { vehicles.forEach((v) => {
const [type] = v.split(":"); const [type] = v.split(':');
this.chosenCarTypes.push(type); this.chosenCarTypes.push(type);
}); });
}, },
toggleCarExclusion(type: string) { toggleCarExclusion(type: string) {
if (!this.excludedCarTypes.includes(type)) if (!this.excludedCarTypes.includes(type)) this.excludedCarTypes.push(type);
this.excludedCarTypes.push(type); else this.excludedCarTypes = this.excludedCarTypes.filter((c) => c != type);
else
this.excludedCarTypes = this.excludedCarTypes.filter((c) => c != type);
}, },
}, },
}); });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "../../styles/global.scss"; @import '../../styles/global.scss';
@import "../../styles/tab.scss"; @import '../../styles/tab.scss';
.generator_cargo, .generator_cargo,
.generator_vehicles { .generator_vehicles {
@@ -350,14 +286,7 @@ export default defineComponent({
background-color: $secondaryColor; background-color: $secondaryColor;
&[data-chosen="true"] { &[data-excluded='true'] {
background-color: $accentColor;
color: black;
box-shadow: 0 0 5px 1px $accentColor;
}
&[data-excluded="true"] {
background-color: gray; background-color: gray;
box-shadow: none; box-shadow: none;
} }
+98 -132
View File
@@ -7,10 +7,10 @@
<div class="tab_content"> <div class="tab_content">
<div class="actions-panel"> <div class="actions-panel">
<div class="actions-panel_vehicles"> <div class="actions-panel_vehicles">
<button class="btn btn--choice" @click="changeWikiMode('locomotives')"> <button class="btn" :data-chosen="filters.tractions" @click="toggleFilter('tractions')">
{{ $t('wiki.action-vehicles') }} {{ $t('wiki.action-vehicles') }}
</button> </button>
<button class="btn btn--choice" @click="changeWikiMode('carWagons')"> <button class="btn" :data-chosen="filters.carriages" @click="toggleFilter('carriages')">
{{ $t('wiki.action-carriages') }} {{ $t('wiki.action-carriages') }}
</button> </button>
</div> </div>
@@ -20,79 +20,52 @@
</div> </div>
</div> </div>
<div class="table-wrapper" @scroll="scrollEvent" ref="table-wrapper"> <div class="table-wrapper" ref="table-wrapper">
<table> <table>
<thead> <thead>
<tr> <tr>
<th v-for="header in wikiMode == 'locomotives' ? locoHeaders : carHeaders" @click="toggleSorter(header)" :key="header.id"> <th v-for="header in visibleHeaders" @click="toggleSorter(header)" :key="header.id">
{{ $t(`wiki.header.${header.id}`) }} {{ $t(`wiki.header.${header.id}`) }}
<span v-if="currentModeSorter.id == header.id"> <span v-if="currentSorter.id == header.id">
{{ currentModeSorter.direction == 1 ? `&uArr;` : `&dArr;` }} {{ currentSorter.direction == 1 ? `&uArr;` : `&dArr;` }}
</span> </span>
</th> </th>
</tr> </tr>
</thead> </thead>
<tbody v-if="wikiMode == 'locomotives'"> <!-- @click="previewLocomotive(vehicle)"
<tr @keydown.enter="previewLocomotive(vehicle)"
v-for="loco in computedLocoList" @dblclick="addLocomotive(vehicle)"
:key="loco.type" -->
@click="previewLocomotive(loco)" <tbody>
@keydown.enter="previewLocomotive(loco)" <tr v-for="vehicle in computedVehicleList" v-show="vehicle.show" :key="vehicle.type" tabindex="0">
@dblclick="addLocomotive(loco)" <td style="width: 120px">
tabindex="0" <img
> width="120"
<td> :src="getThumbnailURL(vehicle.type, 'small')"
<object :data="getThumbnailURL(loco.type, 'small')" type="image/jpeg"> :alt="`${vehicle.type}`"
<!-- <img src="default.jpg" /> -->
<div>?</div>
</object>
</td>
<td>{{ loco.type }}</td>
<td>{{ $t(`wiki.${loco.power}`) }}</td>
<td>{{ loco.constructionType }}</td>
<td>
{{ locoSupportsColdStart(loco.constructionType) ? `&check;` : '&cross;' }}
</td>
<td>{{ loco.length }}m</td>
<td>{{ loco.mass }}t</td>
<td>{{ loco.maxSpeed }}km/h</td>
</tr>
</tbody>
<tbody v-else>
<tr
v-for="car in computedCarList"
:key="car.type"
@keydow.enter="previewCarWagon(car)"
@click="previewCarWagon(car)"
@dblclick="addCarWagon(car)"
tabindex="0"
>
<td>
<!-- <img
:src="getThumbnailURL(car.type, 'small')"
loading="lazy" loading="lazy"
:alt="`${car.type}`" @error="(e) => ((e.target as HTMLElement).style.display = 'none')"
/> --> />
<object :data="getThumbnailURL(car.type, 'small')" type="image/jpeg" loading="lazy">
<!-- <img src="default.jpg" /> -->
<div>?</div>
</object>
</td> </td>
<td>{{ car.type }}</td> <td>{{ vehicle.type }}</td>
<td>{{ car.constructionType }}</td> <!-- <td>{{ $t(`wiki.${vehicle.power || vehicle.}`) }}</td> -->
<td>{{ car.length }}m</td> <td v-if="isLocomotive(vehicle)">{{ $t(`wiki.${vehicle.power}`) }}</td>
<td>{{ car.mass }}t</td> <td v-else>{{ $t(`wiki.${vehicle.useType}`) }}</td>
<td>{{ car.maxSpeed }}km/h</td> <td>{{ vehicle.constructionType }}</td>
<td> <td>{{ vehicle.length }}m</td>
{{ car.cargoList.length == 0 ? '-' : car.cargoList.length }} <td>{{ vehicle.mass }}t</td>
<td>{{ vehicle.maxSpeed }}km/h</td>
<td v-if="!filters.tractions && filters.carriages">{{ !isLocomotive(vehicle) ? vehicle.cargoList.length ?? '---' : 'niedost.' }}</td>
<td v-if="filters.tractions && !filters.carriages">
{{ isLocomotive(vehicle) ? (locoSupportsColdStart(vehicle.constructionType) ? `&check;` : '&cross;') : '---' }}
</td> </td>
</tr> </tr>
</tbody> </tbody>
<span ref="table-bottom"></span>
</table> </table>
</div> </div>
</div> </div>
@@ -109,34 +82,35 @@ import stockMixin from '../../mixins/stockMixin';
import imageMixin from '../../mixins/imageMixin'; import imageMixin from '../../mixins/imageMixin';
import { locoSupportsColdStart } from '../../utils/locoUtils'; import { locoSupportsColdStart } from '../../utils/locoUtils';
type WikiMode = 'locomotives' | 'carWagons';
type SorterID = 'type' | 'constructionType' | 'image' | 'length' | 'mass' | 'maxSpeed' | 'cargoCount' | 'power' | 'coldStart'; type SorterID = 'type' | 'constructionType' | 'image' | 'length' | 'mass' | 'maxSpeed' | 'cargoCount' | 'power' | 'coldStart';
interface WikiHeader { interface WikiHeader {
id: SorterID; id: SorterID;
sortable: boolean; sortable: boolean;
for: 'all' | 'carriages' | 'tractions';
} }
const locoHeaders: WikiHeader[] = [ const headers: WikiHeader[] = [
{ id: 'image', sortable: false }, { id: 'image', sortable: false, for: 'all' },
{ id: 'type', sortable: true }, { id: 'type', sortable: true, for: 'all' },
{ id: 'power', sortable: true }, { id: 'power', sortable: true, for: 'all' },
{ id: 'constructionType', sortable: true }, { id: 'constructionType', sortable: true, for: 'all' },
{ id: 'coldStart', sortable: true }, { id: 'length', sortable: true, for: 'all' },
{ id: 'length', sortable: true }, { id: 'mass', sortable: true, for: 'all' },
{ id: 'mass', sortable: true }, { id: 'maxSpeed', sortable: true, for: 'all' },
{ id: 'maxSpeed', sortable: true }, { id: 'coldStart', sortable: true, for: 'tractions' },
{ id: 'cargoCount', sortable: true, for: 'carriages' },
]; ];
const carHeaders: WikiHeader[] = [ // const carHeaders: WikiHeader[] = [
{ id: 'image', sortable: false }, // { id: 'image', sortable: false },
{ id: 'type', sortable: true }, // { id: 'type', sortable: true },
{ id: 'constructionType', sortable: true }, // { id: 'constructionType', sortable: true },
{ id: 'length', sortable: true }, // { id: 'length', sortable: true },
{ id: 'mass', sortable: true }, // { id: 'mass', sortable: true },
{ id: 'maxSpeed', sortable: true }, // { id: 'maxSpeed', sortable: true },
{ id: 'cargoCount', sortable: true }, // { id: 'cargoCount', sortable: true },
]; // ];
export default defineComponent({ export default defineComponent({
mixins: [stockPreviewMixin, stockMixin, imageMixin], mixins: [stockPreviewMixin, stockMixin, imageMixin],
@@ -144,58 +118,50 @@ export default defineComponent({
data() { data() {
return { return {
store: useStore(), store: useStore(),
locoHeaders, headers,
carHeaders,
locosScrollTop: 0, locosScrollTop: 0,
carsScrollTop: 0, carsScrollTop: 0,
wikiMode: 'locomotives' as WikiMode,
searchedVehicleTypeName: '', searchedVehicleTypeName: '',
currentLocoSorter: { currentSorter: {
id: 'type' as SorterID, id: 'type' as SorterID,
direction: 1, direction: 1,
}, },
currentCarSorter: { filters: {
id: 'type' as SorterID, tractions: true,
direction: 1, carriages: true,
}, },
}; };
}, },
activated() { activated() {
const tableWrapperRef = this.$refs['table-wrapper'] as HTMLElement; const tableWrapperRef = this.$refs['table-wrapper'] as HTMLElement;
tableWrapperRef.scrollTo({
top: this.wikiMode == 'locomotives' ? this.locosScrollTop : this.carsScrollTop, // tableWrapperRef.scrollTo({
}); // top: this.wikiMode == 'locomotives' ? this.locosScrollTop : this.carsScrollTop,
// });
}, },
methods: { methods: {
locoSupportsColdStart, locoSupportsColdStart,
isLocomotive,
scrollEvent(e: Event) { toggleFilter(name: keyof typeof this.filters) {
const tableScrollTop = (e.target as HTMLElement).scrollTop; this.filters[name] = !this.filters[name];
if (this.wikiMode == 'locomotives') this.locosScrollTop = tableScrollTop;
else this.carsScrollTop = tableScrollTop;
},
changeWikiMode(wikiMode: WikiMode) {
this.searchedVehicleTypeName = '';
this.wikiMode = wikiMode;
}, },
toggleSorter(header: WikiHeader) { toggleSorter(header: WikiHeader) {
if (!header.sortable) return; if (!header.sortable) return;
if (header.id == this.currentModeSorter.id) this.currentModeSorter.direction *= -1; if (header.id == this.currentSorter.id) this.currentSorter.direction *= -1;
this.currentModeSorter.id = header.id; this.currentSorter.id = header.id;
}, },
sortVehicles(vA: Vehicle, vB: Vehicle) { sortVehicles(vA: Vehicle, vB: Vehicle) {
const { id, direction } = this.currentModeSorter; const { id, direction } = this.currentSorter;
const vehiclesAreLocos = isLocomotive(vA) && isLocomotive(vB); const vehiclesAreLocos = isLocomotive(vA) && isLocomotive(vB);
const vehiclesAreCars = !isLocomotive(vA) && !isLocomotive(vB); const vehiclesAreCars = !isLocomotive(vA) && !isLocomotive(vB);
@@ -226,21 +192,33 @@ export default defineComponent({
}, },
computed: { computed: {
currentModeSorter() { computedVehicleList() {
return this.wikiMode == 'carWagons' ? this.currentCarSorter : this.currentLocoSorter; return this.store.vehicleDataList
.map((vehicle) => ({
...vehicle,
show:
new RegExp(`${this.searchedVehicleTypeName.trim()}`, 'i').test(vehicle.type) &&
((this.filters.tractions && isLocomotive(vehicle)) || (this.filters.carriages && !isLocomotive(vehicle))),
}))
.sort(this.sortVehicles);
}, },
computedLocoList() { visibleHeaders() {
const trimmedSearchValue = this.searchedVehicleTypeName.trim(); const filtersActive =
this.filters.carriages && this.filters.tractions ? 'all' : this.filters.carriages ? 'carriages' : this.filters.tractions ? 'tractions' : null;
return this.store.locoDataList.filter((loco) => new RegExp(`${trimmedSearchValue}`, 'i').test(loco.type)).sort(this.sortVehicles); console.log(filtersActive);
return this.headers.filter((header) => header.for == 'all' || header.for == filtersActive);
}, },
computedCarList() { // computedCarList() {
const trimmedSearchValue = this.searchedVehicleTypeName.trim(); // const trimmedSearchValue = this.searchedVehicleTypeName.trim();
return this.store.carDataList.filter((car) => new RegExp(`${trimmedSearchValue}`, 'i').test(car.type)).sort(this.sortVehicles); // return this.store.carDataList.map((car) =>({
},
// })).sort(this.sortVehicles);
// },
}, },
}); });
</script> </script>
@@ -297,6 +275,10 @@ export default defineComponent({
cursor: pointer; cursor: pointer;
background-color: #333; background-color: #333;
&:first-child {
min-width: 120px;
}
&:nth-child(odd) { &:nth-child(odd) {
background-color: #444; background-color: #444;
} }
@@ -308,34 +290,18 @@ export default defineComponent({
td { td {
text-align: center; text-align: center;
padding: 0.25em; height: 70px;
height: 85px;
}
td:first-child {
width: 120px;
}
td object[type='image/jpeg'] {
display: flex;
max-width: 120px;
min-height: 60px;
div {
margin: auto;
}
} }
} }
@media screen and (max-width: $breakpointMd) { @media screen and (max-width: $breakpointMd) {
.wiki-list table { .wiki-list table {
td { th {
width: 100px; min-width: 100px;
height: auto; }
img { img {
width: 6em; max-width: 100px;
}
} }
} }
} }
+4 -2
View File
@@ -35,7 +35,7 @@
"loco-ezt": "ELECTRIC M.U.", "loco-ezt": "ELECTRIC M.U.",
"loco-szt": "DIESEL M.U.", "loco-szt": "DIESEL M.U.",
"car-passenger": "PASSENGER CARRIAGE", "car-passenger": "PASSENGER CARRIAGE",
"car-cargo": "FREIGHT CAR", "car-cargo": "FREIGHT CARRIAGE",
"cabin": "Cabin type:", "cabin": "Cabin type:",
"construction": "Construction type:" "construction": "Construction type:"
}, },
@@ -139,7 +139,9 @@
"loco-ezt": "EMU", "loco-ezt": "EMU",
"loco-szt": "DMU", "loco-szt": "DMU",
"loco-s": "Diesel locomotive", "loco-s": "Diesel locomotive",
"loco-e": "Electric locomotive" "loco-e": "Electric locomotive",
"car-passenger": "Passenger carriage",
"car-cargo": "Frieght carriage"
}, },
"realstock": { "realstock": {
"title": "POLISH TRAIN COMPOSITIONS by", "title": "POLISH TRAIN COMPOSITIONS by",
+3 -1
View File
@@ -139,7 +139,9 @@
"loco-ezt": "EZT", "loco-ezt": "EZT",
"loco-szt": "SZT", "loco-szt": "SZT",
"loco-s": "Spalinowóz", "loco-s": "Spalinowóz",
"loco-e": "Elektrowóz" "loco-e": "Elektrowóz",
"car-passenger": "Wagon pasażerski",
"car-cargo": "Wagon towarowy"
}, },
"realstock": { "realstock": {
"title": "ZESTAWIENIA REALNE by", "title": "ZESTAWIENIA REALNE by",
+1
View File
@@ -52,6 +52,7 @@ export const useStore = defineStore({
getters: { getters: {
locoDataList: (state) => locoDataList(state), locoDataList: (state) => locoDataList(state),
carDataList: (state) => carDataList(state), carDataList: (state) => carDataList(state),
vehicleDataList: (state) => ([...locoDataList(state), ...carDataList(state)]),
totalMass: (state) => totalMass(state), totalMass: (state) => totalMass(state),
totalLength: (state) => totalLength(state), totalLength: (state) => totalLength(state),
maxStockSpeed: (state) => maxStockSpeed(state), maxStockSpeed: (state) => maxStockSpeed(state),
+16 -7
View File
@@ -1,4 +1,4 @@
@import url("https://fonts.googleapis.com/css2?family=Lato:wght@400;700;900&display=swap"); @import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;700;900&display=swap');
$breakpointMd: 960px; $breakpointMd: 960px;
$breakpointSm: 550px; $breakpointSm: 550px;
@@ -32,7 +32,7 @@ html {
margin: 0; margin: 0;
padding: 0; padding: 0;
font-family: "Lato", sans-serif; font-family: 'Lato', sans-serif;
background-color: $bgColor; background-color: $bgColor;
overflow-x: hidden; overflow-x: hidden;
@@ -64,7 +64,7 @@ select,
option, option,
input, input,
button { button {
font-family: "Lato", sans-serif; font-family: 'Lato', sans-serif;
font-size: 1em; font-size: 1em;
} }
@@ -94,7 +94,9 @@ button {
border-radius: 8px; border-radius: 8px;
font-weight: bold; font-weight: bold;
transition: all 250ms; transition:
color 150ms,
background-color 150ms;
&:hover { &:hover {
color: $accentColor; color: $accentColor;
@@ -111,7 +113,14 @@ button {
outline: 1px solid white; outline: 1px solid white;
} }
&[data-disabled="true"] { &[data-chosen='true'] {
background-color: $accentColor;
color: black;
box-shadow: 0 0 5px 1px $accentColor;
}
&[data-disabled='true'] {
user-select: none; user-select: none;
pointer-events: none; pointer-events: none;
-moz-user-select: none; -moz-user-select: none;
@@ -146,8 +155,8 @@ button {
} }
select, select,
input[type="text"], input[type='text'],
input[type="number"] { input[type='number'] {
background: none; background: none;
border: 2px solid #aaa; border: 2px solid #aaa;
outline: none; outline: none;