mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-05 06:18:12 +00:00
Dodano wersję developerską; dodano nowy JSON z danymi scenerii
This commit is contained in:
+2
-1
@@ -5,7 +5,8 @@
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
"build": "vue-cli-service build",
|
||||
"deploy": "npm run build && firebase deploy --only hosting"
|
||||
"deploy-prod": "npm run build && firebase deploy --only hosting:prod",
|
||||
"deploy-dev": "npm run build && firebase deploy --only hosting:dev"
|
||||
},
|
||||
"dependencies": {
|
||||
"core-js": "^3.12.1",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export const URLs = {
|
||||
sceneryData: "https://spythere.github.io/api/stationData.json",
|
||||
sceneryData: "https://spythere.github.io/api/stationDataDev.json",
|
||||
sceneryDataDev: "http://127.0.0.1:8000/data",
|
||||
stations: "https://api.td2.info.pl:9640/?method=getStationsOnline",
|
||||
trains: "https://api.td2.info.pl:9640/?method=getTrainsOnline",
|
||||
|
||||
+40
-31
@@ -43,7 +43,41 @@ export interface State {
|
||||
listenerLaunched: boolean;
|
||||
}
|
||||
|
||||
type StationJSONData = [string, string, string, string, string, string, string, string, boolean, string, string, number, number, number, number, string | null, boolean, boolean, boolean];
|
||||
interface StationJSONData {
|
||||
name: string;
|
||||
url: string;
|
||||
lines: string;
|
||||
project: string;
|
||||
|
||||
reqLevel: number;
|
||||
|
||||
supportersOnly: boolean;
|
||||
|
||||
signalType: string;
|
||||
controlType: string;
|
||||
|
||||
SUP: boolean;
|
||||
|
||||
SBL: string;
|
||||
TWB: string;
|
||||
|
||||
routes: {
|
||||
oneWay: {
|
||||
catenary: number;
|
||||
noCatenary: number;
|
||||
};
|
||||
twoWay: {
|
||||
catenary: number;
|
||||
noCatenary: number;
|
||||
}
|
||||
};
|
||||
|
||||
checkpoints: string | null;
|
||||
|
||||
default: boolean;
|
||||
nonPublic: boolean;
|
||||
unavailable: boolean;
|
||||
}
|
||||
|
||||
export const key: InjectionKey<Store<State>> = Symbol()
|
||||
|
||||
@@ -304,41 +338,16 @@ export const store = createStore<State>({
|
||||
|
||||
mutations: {
|
||||
SET_SCENERY_DATA(state, data: StationJSONData[]) {
|
||||
state.stationList = data.map(station => ({
|
||||
name: station[0],
|
||||
state.stationList = data.map(stationData => ({
|
||||
name: stationData.name,
|
||||
|
||||
generalInfo: {
|
||||
name: station[0],
|
||||
url: station[1],
|
||||
lines: station[2],
|
||||
project: station[3],
|
||||
reqLevel: station[4] == "" || station[4] === null ? -1 : Number(station[4]),
|
||||
supportersOnly: station[5] == "TAK",
|
||||
signalType: station[6],
|
||||
controlType: station[7],
|
||||
|
||||
SUP: station[8],
|
||||
|
||||
SBL: station[9],
|
||||
TWB: station[10],
|
||||
routes: {
|
||||
oneWay: {
|
||||
catenary: station[11],
|
||||
noCatenary: station[12]
|
||||
},
|
||||
twoWay: {
|
||||
catenary: station[13],
|
||||
noCatenary: station[14]
|
||||
}
|
||||
},
|
||||
checkpoints: station[15] ? (station[15]).split(";").map(sub => ({ checkpointName: sub, scheduledTrains: [] })) : [],
|
||||
|
||||
default: station[16],
|
||||
nonPublic: station[17],
|
||||
unavailable: station[18],
|
||||
...stationData,
|
||||
checkpoints: stationData.checkpoints ? stationData.checkpoints.split(";").map(sub => ({ checkpointName: sub, scheduledTrains: [] })) : [],
|
||||
}
|
||||
}));
|
||||
|
||||
console.log(state.stationList);
|
||||
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user