From cf3911e69589886cca1e7651ebf07deb5f943268 Mon Sep 17 00:00:00 2001 From: Spythere Date: Wed, 6 Jul 2022 14:42:16 +0200 Subject: [PATCH] =?UTF-8?q?Liczniki=20aktywnych=20graczy=20przy=20opcjach?= =?UTF-8?q?=20wyboru=20serwer=C3=B3w?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.scss | 1 + src/App.vue | 18 +++++++++++++++++- src/components/Global/SelectBox.vue | 17 ++++++++--------- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/App.scss b/src/App.scss index 5c1ee6c..89e94db 100644 --- a/src/App.scss +++ b/src/App.scss @@ -213,6 +213,7 @@ font-weight: bold; padding: 0.1em 0.5em; color: paleturquoise; + } .options { diff --git a/src/App.vue b/src/App.vue index e03c2d7..3b8ee71 100644 --- a/src/App.vue +++ b/src/App.vue @@ -42,7 +42,7 @@ - + @@ -124,6 +124,20 @@ export default defineComponent({ trainList() { return this.store.trainList.filter((train) => train.online); }, + + computedRegions() { + return this.options.regions.map((region) => { + const regionStationCount = + this.store.apiData.stations?.filter((station) => station.region == region.id && station.isOnline).length || 0; + const regionTrainCount = this.store.apiData.trains?.filter((train) => train.region == region.id && train.online).length || 0; + + return { + id: region.id, + value: `${region.value}
${regionStationCount} / ${regionTrainCount}
`, + selectedValue: region.value, + }; + }); + }, }, data: () => ({ @@ -141,6 +155,8 @@ export default defineComponent({ pl: require('@/assets/icon-pl.svg'), error: require('@/assets/icon-error.svg'), dollar: require('@/assets/icon-dollar.svg'), + dispatcher: require('@/assets/icon-dispatcher.svg'), + train: require('@/assets/icon-train.svg'), discord: require('@/assets/icon-discord.png'), }, }), diff --git a/src/components/Global/SelectBox.vue b/src/components/Global/SelectBox.vue index fc22aa0..3c44b0e 100644 --- a/src/components/Global/SelectBox.vue +++ b/src/components/Global/SelectBox.vue @@ -1,8 +1,9 @@