feature: skrót posterunku

This commit is contained in:
2023-04-04 21:30:16 +02:00
parent ea48085f6f
commit 4847524b64
5 changed files with 27 additions and 15 deletions
+7 -15
View File
@@ -16,7 +16,7 @@
</thead>
<tbody>
<tr v-for="(station, row) in sortedStationList" tabindex="0">
<tr v-for="(station, row) in store.sortedStationList" tabindex="0">
<td v-for="(value, propName) in headerNameList" @click="changeProperty(station, row, propName as string)">
<span v-if="propName === 'url'" :style="station.url ? 'color: gold' : 'color: gray;'">URL</span>
<span v-else-if="propName === 'projectUrl'" :style="station.projectUrl ? 'color: gold' : 'color: gray;'"
@@ -39,8 +39,8 @@
<select
name="availability"
:id="`select-${row}`"
v-model="sortedStationList[row]['availability']"
@input="(e) => changeAvailability(station, sortedStationList[row]['availability'], e)"
v-model="store.sortedStationList[row]['availability']"
@input="(e) => changeAvailability(station, store.sortedStationList[row]['availability'], e)"
>
<option value="default">dostępna (w paczce)</option>
<option value="nonDefault">dostępna (poza paczką)</option>
@@ -76,6 +76,7 @@ export default defineComponent({
AuthState,
headerNameList: {
name: 'Nazwa',
abbr: 'Skrót posterunku',
hash: 'Hash',
url: 'URL',
lines: 'Linie',
@@ -104,15 +105,6 @@ export default defineComponent({
this.store.fetchSceneriesData();
},
computed: {
sortedStationList() {
return this.store.stationList
.filter((station) => station.name.toLowerCase().startsWith(this.store.searchedSceneryName.toLowerCase()))
.sort((a, b) => (a.name > b.name ? 1 : -1))
.filter((_, i) => i < this.store.maxVisibleResults);
},
},
methods: {
changeProperty(station: SceneryRowItem, row: number, propertyName: string) {
this.store.selectedStationName = station.name;
@@ -128,7 +120,7 @@ export default defineComponent({
}
const stationListRow = this.store.stationList.findIndex(
(station) => station.name == this.sortedStationList[row].name
(station) => station.name == this.store.sortedStationList[row].name
);
if (stationListRow == -1) return;
@@ -150,7 +142,7 @@ export default defineComponent({
changeCheckpoints(row: number) {
const stationListRow = this.store.stationList.findIndex(
(station) => station.name == this.sortedStationList[row].name
(station) => station.name == this.store.sortedStationList[row].name
);
if (stationListRow == -1) return;
@@ -159,7 +151,7 @@ export default defineComponent({
if (newCheckpoints === null) return;
this.store.stationList[stationListRow]['checkpoints'] = newCheckpoints;
this.addChange(this.sortedStationList[row], 'checkpoints', oldCheckpoints, newCheckpoints);
this.addChange(this.store.sortedStationList[row], 'checkpoints', oldCheckpoints, newCheckpoints);
},
changeAvailability(scenery: SceneryRowItem, availability: Availability, e: Event) {