mirror of
https://github.com/Spythere/pojazdownik.git
synced 2026-05-04 20:18:12 +00:00
added double manning checkbox & support
This commit is contained in:
@@ -79,11 +79,20 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="stock_cold-start">
|
<div class="stock_spawn-settings">
|
||||||
<label>
|
<label v-if="store.stockSupportsColdStart">
|
||||||
<input type="checkbox" v-model="store.isColdStart" :disabled="!locoSupportsColdStart(store.stockList[0]?.constructionType || '')" />
|
<input type="checkbox" v-model="store.isColdStart" />
|
||||||
{{ $t('stocklist.coldstart-info') }}
|
{{ $t('stocklist.coldstart-info') }}
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
|
<label v-if="store.stockSupportsDoubleManning">
|
||||||
|
<input type="checkbox" v-model="store.isDoubleManned" />
|
||||||
|
{{ $t('stocklist.doublemanning-info') }}
|
||||||
|
</label>
|
||||||
|
<!-- <label v-if="store.stockList.length > 0 && locoSupportsDoubleManning(store.stockList[0].constructionType)">
|
||||||
|
<input type="checkbox" v-model="store.isDoubleManned" />
|
||||||
|
{{ $t('stocklist.coldstart-info') }}
|
||||||
|
</label> -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="stock_warnings" v-if="stockHasWarnings">
|
<div class="stock_warnings" v-if="stockHasWarnings">
|
||||||
@@ -158,7 +167,6 @@ import { defineComponent } from 'vue';
|
|||||||
|
|
||||||
import { useStore } from '../../store';
|
import { useStore } from '../../store';
|
||||||
|
|
||||||
import { locoSupportsColdStart } from '../../utils/locoUtils';
|
|
||||||
import warningsMixin from '../../mixins/warningsMixin';
|
import warningsMixin from '../../mixins/warningsMixin';
|
||||||
import imageMixin from '../../mixins/imageMixin';
|
import imageMixin from '../../mixins/imageMixin';
|
||||||
import stockPreviewMixin from '../../mixins/stockPreviewMixin';
|
import stockPreviewMixin from '../../mixins/stockPreviewMixin';
|
||||||
@@ -188,12 +196,19 @@ export default defineComponent({
|
|||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
stockString() {
|
stockString() {
|
||||||
|
if (this.store.stockList.length == 0) return '';
|
||||||
|
|
||||||
|
const includeColdStart = this.store.isColdStart && this.store.stockSupportsColdStart;
|
||||||
|
const includeDoubleManned = this.store.isDoubleManned && this.store.stockSupportsDoubleManning;
|
||||||
|
|
||||||
return this.store.stockList
|
return this.store.stockList
|
||||||
.map((stock, i) => {
|
.map((stock, i) => {
|
||||||
let stockTypeStr = stock.isLoco || !stock.cargo ? stock.type : `${stock.type}:${stock.cargo.id}`;
|
let stockTypeStr = stock.isLoco || !stock.cargo ? stock.type : `${stock.type}:${stock.cargo.id}`;
|
||||||
let coldStart = i == 0 && this.store.isColdStart && locoSupportsColdStart(stock.constructionType || '') ? ',c' : '';
|
|
||||||
|
|
||||||
return stockTypeStr + coldStart;
|
if (i == 0 && (includeColdStart || includeDoubleManned))
|
||||||
|
return `${stockTypeStr},${includeColdStart ? 'c' : ''}${includeDoubleManned ? 'd' : ''}`;
|
||||||
|
|
||||||
|
return stockTypeStr;
|
||||||
})
|
})
|
||||||
.join(';');
|
.join(';');
|
||||||
},
|
},
|
||||||
@@ -212,8 +227,6 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
locoSupportsColdStart,
|
|
||||||
|
|
||||||
copyToClipboard() {
|
copyToClipboard() {
|
||||||
navigator.clipboard.writeText(this.stockString);
|
navigator.clipboard.writeText(this.stockString);
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@
|
|||||||
|
|
||||||
<td v-if="currentFilterMode == 'carriages'">{{ !isLocomotive(vehicle) ? vehicle.cargoList.length : '---' }}</td>
|
<td v-if="currentFilterMode == 'carriages'">{{ !isLocomotive(vehicle) ? vehicle.cargoList.length : '---' }}</td>
|
||||||
<td v-if="currentFilterMode == 'tractions'">
|
<td v-if="currentFilterMode == 'tractions'">
|
||||||
{{ isLocomotive(vehicle) ? (locoSupportsColdStart(vehicle.constructionType) ? `✓` : '✗') : '---' }}
|
{{ isLocomotive(vehicle) ? (vehicle.coldStart ? `✓` : '✗') : '---' }}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -86,7 +86,6 @@ import { Vehicle } from '../../types';
|
|||||||
import { isLocomotive } from '../../utils/vehicleUtils';
|
import { isLocomotive } from '../../utils/vehicleUtils';
|
||||||
import stockMixin from '../../mixins/stockMixin';
|
import stockMixin from '../../mixins/stockMixin';
|
||||||
import imageMixin from '../../mixins/imageMixin';
|
import imageMixin from '../../mixins/imageMixin';
|
||||||
import { locoSupportsColdStart } from '../../utils/locoUtils';
|
|
||||||
|
|
||||||
type SorterID = 'type' | 'constructionType' | 'image' | 'length' | 'mass' | 'maxSpeed' | 'cargoCount' | 'group' | 'coldStart';
|
type SorterID = 'type' | 'constructionType' | 'image' | 'length' | 'mass' | 'maxSpeed' | 'cargoCount' | 'group' | 'coldStart';
|
||||||
|
|
||||||
@@ -143,7 +142,6 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
locoSupportsColdStart,
|
|
||||||
isLocomotive,
|
isLocomotive,
|
||||||
|
|
||||||
toggleFilter(name: typeof this.currentFilterMode) {
|
toggleFilter(name: typeof this.currentFilterMode) {
|
||||||
@@ -180,7 +178,10 @@ export default defineComponent({
|
|||||||
);
|
);
|
||||||
|
|
||||||
case 'coldStart':
|
case 'coldStart':
|
||||||
return (locoSupportsColdStart(row1.vehicle.constructionType) > locoSupportsColdStart(row2.vehicle.constructionType) ? 1 : -1) * direction;
|
return (
|
||||||
|
((isLocomotive(row1.vehicle) && row1.vehicle.coldStart ? 1 : -1) - (isLocomotive(row2.vehicle) && row2.vehicle.coldStart ? 1 : -1)) *
|
||||||
|
direction
|
||||||
|
);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -200,8 +201,6 @@ export default defineComponent({
|
|||||||
(this.currentFilterMode == 'all' ||
|
(this.currentFilterMode == 'all' ||
|
||||||
(this.currentFilterMode == 'tractions' && isLocomotive(vehicle)) ||
|
(this.currentFilterMode == 'tractions' && isLocomotive(vehicle)) ||
|
||||||
(this.currentFilterMode == 'carriages' && !isLocomotive(vehicle))),
|
(this.currentFilterMode == 'carriages' && !isLocomotive(vehicle))),
|
||||||
|
|
||||||
// ((this.filters.tractions && isLocomotive(vehicle)) || (this.filters.carriages && !isLocomotive(vehicle))),
|
|
||||||
}))
|
}))
|
||||||
.sort((a, b) => this.sortTableRows(a, b));
|
.sort((a, b) => this.sortTableRows(a, b));
|
||||||
},
|
},
|
||||||
|
|||||||
+2
-1
@@ -64,7 +64,8 @@
|
|||||||
"mass-accepted": "accepted",
|
"mass-accepted": "accepted",
|
||||||
"length": "Length",
|
"length": "Length",
|
||||||
"vmax": "vMax",
|
"vmax": "vMax",
|
||||||
"coldstart-info": "Cold start heading locomotive (only locos 303E & 203E type)",
|
"coldstart-info": "Locomotive cold start",
|
||||||
|
"doublemanning-info": "Double manning",
|
||||||
"list-empty": "Stock list is empty!",
|
"list-empty": "Stock list is empty!",
|
||||||
"warning-not-suitable": "EP07 & EP08 type locomotives are designed for passenger traffic only!",
|
"warning-not-suitable": "EP07 & EP08 type locomotives are designed for passenger traffic only!",
|
||||||
"warning-passenger-too-long": "Maximum length of a passenger train may not be greater than 350m!",
|
"warning-passenger-too-long": "Maximum length of a passenger train may not be greater than 350m!",
|
||||||
|
|||||||
+4
-3
@@ -29,7 +29,7 @@
|
|||||||
"title": "PODGLĄD WYBRANEGO POJAZDU",
|
"title": "PODGLĄD WYBRANEGO POJAZDU",
|
||||||
"loading": "ŁADOWANIE OBRAZU...",
|
"loading": "ŁADOWANIE OBRAZU...",
|
||||||
"desc": "Wybierz pojazd lub wagon, aby zobaczyć jego podgląd powyżej",
|
"desc": "Wybierz pojazd lub wagon, aby zobaczyć jego podgląd powyżej",
|
||||||
"sponsor-only": "* TYLKO DLA SPONSORÓW DO {0}",
|
"sponsor-only": "* TYLKO DLA SPONSORÓW DO {0}",
|
||||||
"loco-e": "ELEKTROWÓZ",
|
"loco-e": "ELEKTROWÓZ",
|
||||||
"loco-s": "SPALINOWÓZ",
|
"loco-s": "SPALINOWÓZ",
|
||||||
"loco-ezt": "EZT",
|
"loco-ezt": "EZT",
|
||||||
@@ -64,7 +64,8 @@
|
|||||||
"mass-accepted": "dopuszczalna",
|
"mass-accepted": "dopuszczalna",
|
||||||
"length": "Długość",
|
"length": "Długość",
|
||||||
"vmax": "vMax",
|
"vmax": "vMax",
|
||||||
"coldstart-info": "Zimny start lokomotywy czołowej (tylko elektrowozy typów 303E i 203E)",
|
"coldstart-info": "Zimny start",
|
||||||
|
"doublemanning-info": "Podwójna obsada",
|
||||||
"list-empty": "Lista pojazdów jest pusta!",
|
"list-empty": "Lista pojazdów jest pusta!",
|
||||||
"warning-not-suitable": "Lokomotywy EP07 i EP08 są przeznaczone jedynie do ruchu pasażerskiego!",
|
"warning-not-suitable": "Lokomotywy EP07 i EP08 są przeznaczone jedynie do ruchu pasażerskiego!",
|
||||||
"warning-passenger-too-long": "Maksymalna długość składów pasażerskich nie może przekraczać 350m!",
|
"warning-passenger-too-long": "Maksymalna długość składów pasażerskich nie może przekraczać 350m!",
|
||||||
@@ -141,7 +142,7 @@
|
|||||||
"loco-s": "Spalinowóz",
|
"loco-s": "Spalinowóz",
|
||||||
"loco-e": "Elektrowóz",
|
"loco-e": "Elektrowóz",
|
||||||
"car-passenger": "Wagon pasażerski",
|
"car-passenger": "Wagon pasażerski",
|
||||||
"car-cargo": "Wagon towarowy"
|
"car-cargo": "Wagon towarowy"
|
||||||
},
|
},
|
||||||
"realstock": {
|
"realstock": {
|
||||||
"title": "ZESTAWIENIA REALNE by",
|
"title": "ZESTAWIENIA REALNE by",
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ export const useStore = defineStore({
|
|||||||
chosenVehicle: null,
|
chosenVehicle: null,
|
||||||
|
|
||||||
isColdStart: false,
|
isColdStart: false,
|
||||||
|
isDoubleManned: false,
|
||||||
|
|
||||||
showSupporter: false,
|
showSupporter: false,
|
||||||
imageLoading: false,
|
imageLoading: false,
|
||||||
@@ -61,6 +62,24 @@ export const useStore = defineStore({
|
|||||||
isTrainPassenger: (state) => isTrainPassenger(state),
|
isTrainPassenger: (state) => isTrainPassenger(state),
|
||||||
chosenRealStock: (state) => chosenRealStock(state),
|
chosenRealStock: (state) => chosenRealStock(state),
|
||||||
acceptableMass: (state) => acceptableMass(state),
|
acceptableMass: (state) => acceptableMass(state),
|
||||||
|
|
||||||
|
stockSupportsColdStart: (state) => {
|
||||||
|
if (state.stockList.length == 0) return false;
|
||||||
|
if (!state.stockList[0].isLoco) return false;
|
||||||
|
|
||||||
|
const headingLoco = state.stockList[0];
|
||||||
|
|
||||||
|
return state.stockData?.props.find((stock) => stock.type == headingLoco.constructionType)?.coldStart ?? false;
|
||||||
|
},
|
||||||
|
|
||||||
|
stockSupportsDoubleManning: (state) => {
|
||||||
|
if (state.stockList.length == 0) return false;
|
||||||
|
if (!state.stockList[0].isLoco) return false;
|
||||||
|
|
||||||
|
const headingLoco = state.stockList[0];
|
||||||
|
|
||||||
|
return state.stockData?.props.find((stock) => stock.type == headingLoco.constructionType)?.doubleManned ?? false;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|||||||
+6
-3
@@ -8,6 +8,7 @@ export interface IStore {
|
|||||||
chosenVehicle: Vehicle | null;
|
chosenVehicle: Vehicle | null;
|
||||||
|
|
||||||
isColdStart: boolean;
|
isColdStart: boolean;
|
||||||
|
isDoubleManned: boolean;
|
||||||
|
|
||||||
showSupporter: boolean;
|
showSupporter: boolean;
|
||||||
imageLoading: boolean;
|
imageLoading: boolean;
|
||||||
@@ -41,7 +42,9 @@ export interface IStockProps {
|
|||||||
type: string;
|
type: string;
|
||||||
length: number;
|
length: number;
|
||||||
mass: number;
|
mass: number;
|
||||||
cargo: string;
|
cargo?: string | null;
|
||||||
|
coldStart?: boolean;
|
||||||
|
doubleManned?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IStockData {
|
export interface IStockData {
|
||||||
@@ -64,8 +67,6 @@ export interface IStockData {
|
|||||||
};
|
};
|
||||||
|
|
||||||
props: IStockProps[];
|
props: IStockProps[];
|
||||||
|
|
||||||
usage: { [key: string]: string };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ILocomotive {
|
export interface ILocomotive {
|
||||||
@@ -81,6 +82,8 @@ export interface ILocomotive {
|
|||||||
|
|
||||||
mass: number;
|
mass: number;
|
||||||
length: number;
|
length: number;
|
||||||
|
coldStart: boolean;
|
||||||
|
doubleManned: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ICarWagon {
|
export interface ICarWagon {
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
const supportedConstructions = ["303e", "203e"];
|
|
||||||
|
|
||||||
export function locoSupportsColdStart(constructionType: string) {
|
|
||||||
return new RegExp(`(${supportedConstructions.join("|")})`).test(
|
|
||||||
constructionType,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -16,5 +16,7 @@ export function calculateSpeedLimit(locoType: SpeedLimitLocoType, stockMass: num
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function calculateMassLimit(locoType: MassLimitLocoType, isTrainPassenger: boolean) {
|
export function calculateMassLimit(locoType: MassLimitLocoType, isTrainPassenger: boolean) {
|
||||||
|
if(massLimits[locoType] === undefined) return 0;
|
||||||
|
|
||||||
return massLimits[locoType][isTrainPassenger ? 0 : 1] || 0;
|
return massLimits[locoType][isTrainPassenger ? 0 : 1] || 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,8 +33,11 @@ export function locoDataList(state: IStore) {
|
|||||||
sponsorsOnlyTimestamp: Number(sponsorsTimestamp),
|
sponsorsOnlyTimestamp: Number(sponsorsTimestamp),
|
||||||
imageSrc: '',
|
imageSrc: '',
|
||||||
|
|
||||||
length: locoProps?.length && type.startsWith('2EN') ? locoProps.length * 2 : locoProps?.length || 0,
|
length: locoProps?.length && type.startsWith('2EN') ? locoProps.length * 2 : locoProps?.length ?? 0,
|
||||||
mass: locoProps?.mass && type.startsWith('2EN') ? 253 : locoProps?.mass || 0,
|
mass: locoProps?.mass && type.startsWith('2EN') ? 253 : locoProps?.mass ?? 0,
|
||||||
|
|
||||||
|
coldStart: locoProps?.coldStart ?? false,
|
||||||
|
doubleManned: locoProps?.doubleManned ?? false,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -70,12 +73,10 @@ export function carDataList(state: IStore) {
|
|||||||
maxSpeed: Number(maxSpeed),
|
maxSpeed: Number(maxSpeed),
|
||||||
imageSrc: '',
|
imageSrc: '',
|
||||||
cargoList:
|
cargoList:
|
||||||
!carPropsData || carPropsData.cargo === null
|
carPropsData?.cargo?.split(';').map((cargo) => ({
|
||||||
? []
|
id: cargo.split(':')[0],
|
||||||
: carPropsData.cargo.split(';').map((cargo) => ({
|
totalMass: Number(cargo.split(':')[1]),
|
||||||
id: cargo.split(':')[0],
|
})) || [],
|
||||||
totalMass: Number(cargo.split(':')[1]),
|
|
||||||
})),
|
|
||||||
|
|
||||||
mass: carPropsData?.mass || 0,
|
mass: carPropsData?.mass || 0,
|
||||||
length: carPropsData?.length || 0,
|
length: carPropsData?.length || 0,
|
||||||
|
|||||||
+2
-2
@@ -32,7 +32,7 @@ export default defineConfig({
|
|||||||
runtimeCaching: [
|
runtimeCaching: [
|
||||||
{
|
{
|
||||||
urlPattern: /^https:\/\/rj.td2.info.pl\/dist\/img\/thumbnails\/.*/i,
|
urlPattern: /^https:\/\/rj.td2.info.pl\/dist\/img\/thumbnails\/.*/i,
|
||||||
handler: 'CacheFirst',
|
handler: 'NetworkFirst',
|
||||||
options: {
|
options: {
|
||||||
cacheName: 'swdr-images-cache',
|
cacheName: 'swdr-images-cache',
|
||||||
expiration: {
|
expiration: {
|
||||||
@@ -46,7 +46,7 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
urlPattern: /^https:\/\/spythere.github.io\/api\/td2\/.*/i,
|
urlPattern: /^https:\/\/spythere.github.io\/api\/td2\/.*/i,
|
||||||
handler: 'CacheFirst',
|
handler: 'NetworkFirst',
|
||||||
options: {
|
options: {
|
||||||
cacheName: 'spythere-api-cache',
|
cacheName: 'spythere-api-cache',
|
||||||
expiration: {
|
expiration: {
|
||||||
|
|||||||
Reference in New Issue
Block a user