mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 05:18:11 +00:00
Zmiana API z danymi scenerii
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { Availability } from "@/store/types";
|
||||
import ScheduledTrain from "./ScheduledTrain";
|
||||
import StationRoutes from "./StationRoutes";
|
||||
|
||||
@@ -19,11 +20,7 @@ export default interface Station {
|
||||
|
||||
SUP: boolean;
|
||||
|
||||
default: boolean;
|
||||
nonPublic: boolean;
|
||||
unavailable: boolean;
|
||||
abandoned?: boolean;
|
||||
|
||||
availability: Availability;
|
||||
routes: StationRoutes;
|
||||
|
||||
checkpoints: {
|
||||
|
||||
@@ -54,7 +54,7 @@ const sortStations = (a: Station, b: Station, sorter: { index: number; dir: numb
|
||||
const filterStations = (station: Station, filters: Filter) => {
|
||||
const returnMode = false;
|
||||
|
||||
if ((station.generalInfo?.nonPublic || !station.generalInfo) && filters['nonPublic']) return returnMode;
|
||||
if ((station.generalInfo?.availability == 'nonPublic' || !station.generalInfo) && filters['nonPublic']) return returnMode;
|
||||
|
||||
if (station.onlineInfo?.statusID == 'ending' && filters['ending']) return returnMode;
|
||||
|
||||
@@ -74,22 +74,28 @@ const filterStations = (station: Station, filters: Filter) => {
|
||||
|
||||
if (station.onlineInfo && filters['occupied']) return returnMode;
|
||||
if (!station.onlineInfo && filters['free']) return returnMode;
|
||||
if (station.generalInfo?.unavailable && filters['unavailable'] && !station.onlineInfo) return returnMode;
|
||||
if (station.generalInfo?.availability == 'unavailable' && filters['unavailable'] && !station.onlineInfo) return returnMode;
|
||||
|
||||
if (station.generalInfo) {
|
||||
const routes = station.generalInfo.routes;
|
||||
const availability = station.generalInfo.availability;
|
||||
|
||||
if (filters['abandoned'] && station.generalInfo.abandoned) return returnMode;
|
||||
if (filters['abandoned'] && availability == 'abandoned') return returnMode;
|
||||
|
||||
if (station.generalInfo.default && filters['default']) return returnMode;
|
||||
if (!station.generalInfo.default && filters['notDefault'] && (!station.generalInfo.abandoned && !station.generalInfo.unavailable)) return returnMode;
|
||||
if (availability == 'default' && filters['default']) return returnMode;
|
||||
if (availability != 'default' && filters['notDefault'] && !(availability == 'abandoned' || availability == 'unavailable')) return returnMode;
|
||||
|
||||
if (filters['real'] && station.generalInfo.lines != '') return returnMode;
|
||||
if (filters['fictional'] && station.generalInfo.lines == '' && (!station.generalInfo.abandoned && !station.generalInfo.unavailable)) return returnMode;
|
||||
if (filters['fictional'] && station.generalInfo.lines == '' && (availability != 'abandoned' && availability != 'unavailable')) return returnMode;
|
||||
|
||||
|
||||
if (station.generalInfo.reqLevel + ((station.generalInfo.nonPublic || station.generalInfo.unavailable || station.generalInfo.abandoned) ? 1 : 0) < filters['minLevel']) return returnMode;
|
||||
if (station.generalInfo.reqLevel + ((station.generalInfo.nonPublic || station.generalInfo.unavailable || station.generalInfo.abandoned) ? 1 : 0) > filters['maxLevel']) return returnMode;
|
||||
if (station.generalInfo.reqLevel + ((availability == 'nonPublic' || availability == 'unavailable' || availability == 'abandoned') ? 1 : 0) < filters['minLevel']) return returnMode;
|
||||
if (
|
||||
station.generalInfo.reqLevel +
|
||||
(availability == 'nonPublic' || availability == 'unavailable' || availability == 'abandoned' ? 1 : 0) >
|
||||
filters['maxLevel']
|
||||
)
|
||||
return returnMode;
|
||||
|
||||
if (filters['no-1track'] && (routes.oneWayCatenaryRouteNames.length != 0 || routes.oneWayNoCatenaryRouteNames.length != 0)) return returnMode;
|
||||
if (filters['no-2track'] && (routes.twoWayCatenaryRouteNames.length != 0 || routes.twoWayNoCatenaryRouteNames.length != 0)) return returnMode;
|
||||
|
||||
Reference in New Issue
Block a user