From e4c5f6a3226a0a6ed50bbabe510da4ec22a3b07b Mon Sep 17 00:00:00 2001 From: Spythere Date: Wed, 15 Mar 2023 17:56:27 +0100 Subject: [PATCH] =?UTF-8?q?filtry=20poci=C4=85g=C3=B3w?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/TrainsView/TrainOptions.vue | 8 ++++++-- src/constants/Trains/TrainOptionsConsts.ts | 5 +++++ src/locales/en.json | 1 + src/locales/pl.json | 5 +++-- src/scripts/enums/TrainFilterType.ts | 2 ++ src/scripts/managers/trainFilterManager.ts | 15 +++++++++------ src/styles/filters_options.scss | 2 +- src/styles/global.scss | 4 ---- 8 files changed, 27 insertions(+), 15 deletions(-) diff --git a/src/components/TrainsView/TrainOptions.vue b/src/components/TrainsView/TrainOptions.vue index 9552e9f..ea18d4e 100644 --- a/src/components/TrainsView/TrainOptions.vue +++ b/src/components/TrainsView/TrainOptions.vue @@ -195,13 +195,17 @@ export default defineComponent({ display: flex; width: 100%; - gap: 0.25em; + gap: 0.5em; margin-bottom: 0.5em; button { width: 100%; - color: $accentCol; + color: springgreen; font-weight: bold; + + &[data-inactive=true] { + color: #aaa; + } } } diff --git a/src/constants/Trains/TrainOptionsConsts.ts b/src/constants/Trains/TrainOptionsConsts.ts index 0a2f5c9..6f5dc14 100644 --- a/src/constants/Trains/TrainOptionsConsts.ts +++ b/src/constants/Trains/TrainOptionsConsts.ts @@ -12,6 +12,11 @@ export const trainFilters: TrainFilter[] = [ section: TrainFilterSection.TRAIN_TYPE, isActive: true, }, + { + id: TrainFilterType.common, + section: TrainFilterSection.TRAIN_TYPE, + isActive: true, + }, { id: TrainFilterType.passenger, diff --git a/src/locales/en.json b/src/locales/en.json index 7d57733..34e4e54 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -116,6 +116,7 @@ "filter-withComments": "COMMENTS", "filter-twr": "HIGH RISK CARGO", "filter-skr": "EXCEEDED GAUGE", + "filter-common": "NO WARNINGS", "filter-passenger": "PASSENGER", "filter-freight": "FREIGHT", "filter-other": "OTHER", diff --git a/src/locales/pl.json b/src/locales/pl.json index d7d496b..dc321d4 100644 --- a/src/locales/pl.json +++ b/src/locales/pl.json @@ -117,8 +117,9 @@ "filter-withComments": "UWAGI EKSPLOATACYJNE", "filter-noComments": "BEZ UWAG", - "filter-twr": "WYSOKIEGO RYZYKA", - "filter-skr": "PRZEKR. SKRAJNIA", + "filter-twr": "WYS. RYZYKA", + "filter-skr": "SKRAJNIA", + "filter-common": "ZWYKŁE", "filter-passenger": "PASAŻERSKIE", "filter-freight": "TOWAROWE", "filter-other": "INNE", diff --git a/src/scripts/enums/TrainFilterType.ts b/src/scripts/enums/TrainFilterType.ts index dc19774..efb2494 100644 --- a/src/scripts/enums/TrainFilterType.ts +++ b/src/scripts/enums/TrainFilterType.ts @@ -11,6 +11,8 @@ export const enum TrainFilterType { twr = 'twr', skr = 'skr', + common = 'common', + passenger = 'passenger', freight = 'freight', other = 'other', diff --git a/src/scripts/managers/trainFilterManager.ts b/src/scripts/managers/trainFilterManager.ts index 758043e..05c10f9 100644 --- a/src/scripts/managers/trainFilterManager.ts +++ b/src/scripts/managers/trainFilterManager.ts @@ -31,17 +31,20 @@ function filterTrainList(trainList: Train[], searchedTrain: string, searchedDriv case TrainFilterType.withTimetable: return !train.timetableData; - case TrainFilterType.noComments: - return train.timetableData?.followingStops.some((stop) => stop.comments) || false; - case TrainFilterType.withComments: - return train.timetableData?.followingStops.every((stop) => stop.comments) || true; + return !train.timetableData?.followingStops.some((stop) => stop.comments); + + case TrainFilterType.noComments: + return train.timetableData?.followingStops.some((stop) => stop.comments); case TrainFilterType.twr: - return !train.timetableData?.TWR || true; + return !train.timetableData?.TWR; case TrainFilterType.skr: - return !train.timetableData?.SKR || true; + return !train.timetableData?.SKR; + + case TrainFilterType.common: + return train.timetableData?.SKR || train.timetableData?.TWR; case TrainFilterType.passenger: return !/^[AMRE]\D{2}$/.test(train.timetableData?.category || ''); diff --git a/src/styles/filters_options.scss b/src/styles/filters_options.scss index 2daba67..22e2060 100644 --- a/src/styles/filters_options.scss +++ b/src/styles/filters_options.scss @@ -67,7 +67,7 @@ h1.option-title { box-shadow: 0 5px 10px 2px #0f0f0f; width: 97%; - max-width: 500px; + max-width: 550px; padding: 1em; z-index: 100; diff --git a/src/styles/global.scss b/src/styles/global.scss index 5d8daa0..3e4efc6 100644 --- a/src/styles/global.scss +++ b/src/styles/global.scss @@ -202,10 +202,6 @@ button { pointer-events: none; opacity: 0.85; } - - &[data-inactive='true'] { - opacity: 0.55; - } } button.btn--filled {