mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-04 22:08:12 +00:00
Liczniki aktywnych graczy przy opcjach wyboru serwerów
This commit is contained in:
@@ -213,6 +213,7 @@
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
padding: 0.1em 0.5em;
|
padding: 0.1em 0.5em;
|
||||||
color: paleturquoise;
|
color: paleturquoise;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.options {
|
.options {
|
||||||
|
|||||||
+17
-1
@@ -42,7 +42,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<span class="info_region">
|
<span class="info_region">
|
||||||
<SelectBox :itemList="options.regions" :defaultItemIndex="0" @selected="changeRegion" />
|
<SelectBox :itemList="computedRegions" :defaultItemIndex="0" @selected="changeRegion" />
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
@@ -124,6 +124,20 @@ export default defineComponent({
|
|||||||
trainList() {
|
trainList() {
|
||||||
return this.store.trainList.filter((train) => train.online);
|
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} <div class='text--grayed'>${regionStationCount} / ${regionTrainCount}</div>`,
|
||||||
|
selectedValue: region.value,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
data: () => ({
|
data: () => ({
|
||||||
@@ -141,6 +155,8 @@ export default defineComponent({
|
|||||||
pl: require('@/assets/icon-pl.svg'),
|
pl: require('@/assets/icon-pl.svg'),
|
||||||
error: require('@/assets/icon-error.svg'),
|
error: require('@/assets/icon-error.svg'),
|
||||||
dollar: require('@/assets/icon-dollar.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'),
|
discord: require('@/assets/icon-discord.png'),
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="select-box">
|
<div class="select-box" >
|
||||||
<div class="select-box_content">
|
<div class="select-box_content">
|
||||||
<button class="selected" @click="toggleBox">
|
<button class="selected" @click="toggleBox">
|
||||||
<span class="text--primary">{{ prefix }}</span> {{ computedSelectedItem.value }}
|
<span class="text--primary">{{ prefix }}</span>
|
||||||
|
<span>{{ computedSelectedItem.selectedValue || computedSelectedItem.value }}</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<ul class="options" :ref="(el) => (listRef = el as Element)">
|
<ul class="options" :ref="(el) => (listRef = el as Element)">
|
||||||
@@ -15,9 +16,7 @@
|
|||||||
>
|
>
|
||||||
<label :for="item.id" v-if="listOpen">
|
<label :for="item.id" v-if="listOpen">
|
||||||
<input type="button" :id="item.id" name="select-box" @click="selectOption(item)" />
|
<input type="button" :id="item.id" name="select-box" @click="selectOption(item)" />
|
||||||
<span :style="computedSelectedItem.id == item.id ? 'color: gold;' : ''">
|
<span :style="computedSelectedItem.id == item.id ? 'color: gold;' : ''" v-html="item.value"> </span>
|
||||||
{{ item.value }}
|
|
||||||
</span>
|
|
||||||
</label>
|
</label>
|
||||||
</transition>
|
</transition>
|
||||||
</li>
|
</li>
|
||||||
@@ -36,6 +35,7 @@ import { computed, defineComponent, Ref, ref } from '@vue/runtime-core';
|
|||||||
interface Item {
|
interface Item {
|
||||||
id: string;
|
id: string;
|
||||||
value: string;
|
value: string;
|
||||||
|
selectedValue?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
@@ -193,8 +193,6 @@ ul.options {
|
|||||||
z-index: 10;
|
z-index: 10;
|
||||||
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
margin-top: 0.25em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
li.option {
|
li.option {
|
||||||
@@ -207,10 +205,11 @@ li.option {
|
|||||||
-moz-appearance: none;
|
-moz-appearance: none;
|
||||||
appearance: none;
|
appearance: none;
|
||||||
border: none;
|
border: none;
|
||||||
|
outline: none;
|
||||||
|
|
||||||
&:focus + span {
|
&:focus + span {
|
||||||
color: $accentCol;
|
color: $accentCol;
|
||||||
font-weight: bold;
|
font-weight: 800;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,7 +228,7 @@ li.option {
|
|||||||
background-color: hsla(0, 0%, 20%, 0.95);
|
background-color: hsla(0, 0%, 20%, 0.95);
|
||||||
}
|
}
|
||||||
|
|
||||||
padding: 0.75em 0;
|
padding: 0.5em 0;
|
||||||
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user