mirror of
https://github.com/Spythere/station-manager-2.0.git
synced 2026-05-02 21:18:13 +00:00
feature: skrót posterunku
This commit is contained in:
@@ -24,3 +24,4 @@ dist-ssr
|
|||||||
*.sw?
|
*.sw?
|
||||||
|
|
||||||
.vscode
|
.vscode
|
||||||
|
.env
|
||||||
@@ -59,6 +59,12 @@
|
|||||||
wyników
|
wyników
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="pane">
|
||||||
|
Obecnie pokazane scenerie:
|
||||||
|
{{ Math.min(store.maxVisibleResults, store.stationList.length, store.sortedStationList.length) }} /
|
||||||
|
{{ store.stationList.length }}
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="pane">
|
<div class="pane">
|
||||||
<button @click="changelogVisible = !changelogVisible">
|
<button @click="changelogVisible = !changelogVisible">
|
||||||
{{ changelogVisible ? 'Ukryj' : 'Pokaż' }} changelog
|
{{ changelogVisible ? 'Ukryj' : 'Pokaż' }} changelog
|
||||||
@@ -198,6 +204,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
const newSt: SceneryRowItem = {
|
const newSt: SceneryRowItem = {
|
||||||
name,
|
name,
|
||||||
|
abbr: name.slice(0, 2),
|
||||||
url: '',
|
url: '',
|
||||||
hash: '',
|
hash: '',
|
||||||
lines: '',
|
lines: '',
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ export const useStore = defineStore('store', {
|
|||||||
|
|
||||||
changesResponse: [],
|
changesResponse: [],
|
||||||
} as IStore),
|
} as IStore),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
fetchSceneriesData() {
|
fetchSceneriesData() {
|
||||||
this.dataState = 'LOADING';
|
this.dataState = 'LOADING';
|
||||||
@@ -95,4 +96,13 @@ export const useStore = defineStore('store', {
|
|||||||
return axios.post<{ user: IUser }>('auth/token', { token: this.token }, { baseURL });
|
return axios.post<{ user: IUser }>('auth/token', { token: this.token }, { baseURL });
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getters: {
|
||||||
|
sortedStationList(state) {
|
||||||
|
return state.stationList
|
||||||
|
.filter((station) => station.name.toLowerCase().startsWith(state.searchedSceneryName.toLowerCase()))
|
||||||
|
.sort((a, b) => (a.name > b.name ? 1 : -1))
|
||||||
|
.filter((_, i) => i < state.maxVisibleResults);
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ export type ChangeProp =
|
|||||||
|
|
||||||
export enum HeaderTypes {
|
export enum HeaderTypes {
|
||||||
name = 'Nazwa',
|
name = 'Nazwa',
|
||||||
|
abbr = "Skrót posterunku",
|
||||||
url = 'URL',
|
url = 'URL',
|
||||||
hash = 'Hash',
|
hash = 'Hash',
|
||||||
lines = 'Linie',
|
lines = 'Linie',
|
||||||
@@ -45,6 +46,7 @@ export interface SceneryRowItem {
|
|||||||
id: string;
|
id: string;
|
||||||
hash: string;
|
hash: string;
|
||||||
name: string;
|
name: string;
|
||||||
|
abbr: string;
|
||||||
url: string;
|
url: string;
|
||||||
lines: string;
|
lines: string;
|
||||||
project: string | null;
|
project: string | null;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<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)">
|
<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-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;'"
|
<span v-else-if="propName === 'projectUrl'" :style="station.projectUrl ? 'color: gold' : 'color: gray;'"
|
||||||
@@ -39,8 +39,8 @@
|
|||||||
<select
|
<select
|
||||||
name="availability"
|
name="availability"
|
||||||
:id="`select-${row}`"
|
:id="`select-${row}`"
|
||||||
v-model="sortedStationList[row]['availability']"
|
v-model="store.sortedStationList[row]['availability']"
|
||||||
@input="(e) => changeAvailability(station, sortedStationList[row]['availability'], e)"
|
@input="(e) => changeAvailability(station, store.sortedStationList[row]['availability'], e)"
|
||||||
>
|
>
|
||||||
<option value="default">dostępna (w paczce)</option>
|
<option value="default">dostępna (w paczce)</option>
|
||||||
<option value="nonDefault">dostępna (poza paczką)</option>
|
<option value="nonDefault">dostępna (poza paczką)</option>
|
||||||
@@ -76,6 +76,7 @@ export default defineComponent({
|
|||||||
AuthState,
|
AuthState,
|
||||||
headerNameList: {
|
headerNameList: {
|
||||||
name: 'Nazwa',
|
name: 'Nazwa',
|
||||||
|
abbr: 'Skrót posterunku',
|
||||||
hash: 'Hash',
|
hash: 'Hash',
|
||||||
url: 'URL',
|
url: 'URL',
|
||||||
lines: 'Linie',
|
lines: 'Linie',
|
||||||
@@ -104,15 +105,6 @@ export default defineComponent({
|
|||||||
this.store.fetchSceneriesData();
|
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: {
|
methods: {
|
||||||
changeProperty(station: SceneryRowItem, row: number, propertyName: string) {
|
changeProperty(station: SceneryRowItem, row: number, propertyName: string) {
|
||||||
this.store.selectedStationName = station.name;
|
this.store.selectedStationName = station.name;
|
||||||
@@ -128,7 +120,7 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const stationListRow = this.store.stationList.findIndex(
|
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;
|
if (stationListRow == -1) return;
|
||||||
@@ -150,7 +142,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
changeCheckpoints(row: number) {
|
changeCheckpoints(row: number) {
|
||||||
const stationListRow = this.store.stationList.findIndex(
|
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;
|
if (stationListRow == -1) return;
|
||||||
@@ -159,7 +151,7 @@ export default defineComponent({
|
|||||||
if (newCheckpoints === null) return;
|
if (newCheckpoints === null) return;
|
||||||
|
|
||||||
this.store.stationList[stationListRow]['checkpoints'] = newCheckpoints;
|
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) {
|
changeAvailability(scenery: SceneryRowItem, availability: Availability, e: Event) {
|
||||||
|
|||||||
Reference in New Issue
Block a user