dodano wybór z listy autorów w filtrach

This commit is contained in:
2024-01-06 17:40:43 +01:00
parent bc1c1bd3d2
commit 9acf3c740c
3 changed files with 169 additions and 136 deletions
@@ -60,8 +60,9 @@
</div> </div>
</section> </section>
<section class="card_timestamp" style="text-align: center"> <section class="card_timestamp">
<div>{{ $t('filters.minimum-hours-title') }}</div> <h3 class="section-header">{{ $t('filters.minimum-hours-title') }}</h3>
<span class="clock"> <span class="clock">
<button class="btn--action" @click="subHour">-</button> <button class="btn--action" @click="subHour">-</button>
<span>{{ <span>{{
@@ -75,16 +76,27 @@
</span> </span>
</section> </section>
<datalist id="authors">
<option v-for="(author, i) in authors" :key="i" :value="author"></option>
</datalist>
<section class="card_authors-search"> <section class="card_authors-search">
<h3 class="section-header">{{ $t('filters.authors-search') }}</h3>
<form action="javascript:void(0);" @submit="handleAuthorsInput">
<input <input
type="text" type="text"
:placeholder="$t('filters.authors-search')" id="author"
list="authors"
name="authors" name="authors"
:placeholder="$t('filters.authors-placeholder')"
v-model="authorsInputValue" v-model="authorsInputValue"
@input="handleAuthorsInput"
@focus="preventKeyDown = true" @focus="preventKeyDown = true"
@blur="preventKeyDown = false" @blur="preventKeyDown = false"
/> />
<button class="btn--action">{{ $t('filters.authors-button-title') }}</button>
</form>
</section> </section>
<section class="card_sliders"> <section class="card_sliders">
@@ -196,6 +208,19 @@ export default defineComponent({
currentOptionsActive() { currentOptionsActive() {
return true; return true;
},
authors() {
return this.store.stationList
.reduce((acc, station) => {
station.generalInfo?.authors?.forEach((author) => {
if (author.trim() != '' && !acc.includes(author.toLocaleLowerCase()))
acc.push(author.toLocaleLowerCase());
});
return acc;
}, [] as string[])
.sort((a, b) => a.localeCompare(b));
} }
}, },
@@ -230,12 +255,12 @@ export default defineComponent({
if (this.saveOptions) StorageManager.setStringValue(target.name, target.value); if (this.saveOptions) StorageManager.setStringValue(target.name, target.value);
}, },
handleAuthorsInput(e: Event) { handleAuthorsInput() {
clearTimeout(this.delayInputTimer); console.log(this.authorsInputValue);
this.delayInputTimer = window.setTimeout(() => { this.filterStore.changeFilterValue('authors', this.authorsInputValue);
this.handleInput(e);
}, 400); if (this.saveOptions) StorageManager.setStringValue('authors', this.authorsInputValue);
}, },
changeNumericFilterValue(name: string, value: number, saveToStorage = false) { changeNumericFilterValue(name: string, value: number, saveToStorage = false) {
@@ -297,16 +322,22 @@ export default defineComponent({
@import '../../styles/card.scss'; @import '../../styles/card.scss';
@import '../../styles/animations.scss'; @import '../../styles/animations.scss';
h3.section-header {
text-align: center;
margin: 0.5em 0;
}
.card { .card {
display: grid; display: grid;
grid-template-rows: 1fr auto; grid-template-rows: 1fr auto;
}
&_info { .card_info {
background-color: #111; background-color: #111;
padding: 0.5em; padding: 0.5em;
} }
&_controls { .card_controls {
display: flex; display: flex;
gap: 0.5em; gap: 0.5em;
@@ -314,9 +345,9 @@ export default defineComponent({
border-radius: 0.5em 0.5em 0 0; border-radius: 0.5em 0.5em 0 0;
height: 100%; height: 100%;
} }
} }
&_content { .card_content {
padding: 1em 0.5em; padding: 1em 0.5em;
display: flex; display: flex;
@@ -324,17 +355,17 @@ export default defineComponent({
gap: 1em; gap: 1em;
overflow: auto; overflow: auto;
} }
&_title { .card_title {
font-size: 2em; font-size: 2em;
font-weight: 700; font-weight: 700;
color: $accentCol; color: $accentCol;
text-align: center; text-align: center;
} }
&_regions { .card_regions {
display: flex; display: flex;
justify-content: center; justify-content: center;
@@ -354,9 +385,9 @@ export default defineComponent({
background-color: seagreen; background-color: seagreen;
} }
} }
} }
&_timestamp { .card_timestamp {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
@@ -367,7 +398,7 @@ export default defineComponent({
justify-content: center; justify-content: center;
font-size: 1.2em; font-size: 1.2em;
margin-top: 0.5em; text-align: center;
span { span {
min-width: 120px; min-width: 120px;
@@ -379,31 +410,29 @@ export default defineComponent({
padding: 0.2em 0.6em; padding: 0.2em 0.6em;
} }
} }
} }
&_modes { .card_authors-search {
margin: 1em 0;
form {
display: flex; display: flex;
justify-content: center; justify-content: center;
flex-wrap: wrap;
.option { gap: 0.5em;
margin: 0 1em; width: 100%;
margin-top: 1em;
} }
}
&_authors-search {
display: inline-block;
margin: 0 auto;
width: 60%;
min-width: 240px;
input { input {
width: 100%; width: 70%;
max-width: 400px;
padding: 0.5em; padding: 0.5em;
border: 1px solid white; outline: 1px solid white;
}
} }
}
&_actions { .card_actions {
width: 100%; width: 100%;
padding: 0.5em; padding: 0.5em;
@@ -429,7 +458,6 @@ export default defineComponent({
} }
} }
} }
}
} }
.option-section h3 { .option-section h3 {
+4 -1
View File
@@ -227,7 +227,10 @@
"routes-2t-cat": "MIN. CATENARY DOUBLE TRACK ROUTES", "routes-2t-cat": "MIN. CATENARY DOUBLE TRACK ROUTES",
"routes-2t-other": "MIN. OTHER DOUBLE TRACK ROUTES" "routes-2t-other": "MIN. OTHER DOUBLE TRACK ROUTES"
}, },
"authors-search": "Search by author (other filters apply)", "authors-search": "SEARCH BY AUTHOR NAME (other filters apply):",
"authors-placeholder": "Enter the author nickname...",
"authors-button-title": "Search",
"minimum-hours-title": "SHOW ONLY SCENERIES UNTIL:", "minimum-hours-title": "SHOW ONLY SCENERIES UNTIL:",
"now": "NOW", "now": "NOW",
"hour": "h", "hour": "h",
+3 -1
View File
@@ -218,7 +218,9 @@
"routes-2t-other": "SZLAKI DWUTOROWE NIEZELEKTR. (MINIMUM)" "routes-2t-other": "SZLAKI DWUTOROWE NIEZELEKTR. (MINIMUM)"
}, },
"authors-search": "Szukaj autora (uwzględnia inne filtry)", "authors-search": "SZUKAJ AUTORA (uwzględnia inne filtry):",
"authors-placeholder": "Wpisz nick autora...",
"authors-button-title": "Szukaj",
"minimum-hours-title": "POKAŻ TYLKO SCENERIE DOSTĘPNE MINIMUM DO:", "minimum-hours-title": "POKAŻ TYLKO SCENERIE DOSTĘPNE MINIMUM DO:",
"now": "TERAZ", "now": "TERAZ",
"hour": " godz.", "hour": " godz.",