refactor(scenery): moved thumbnails toggler to header

This commit is contained in:
2026-03-14 22:32:50 +01:00
parent 7dda21e2a2
commit 4f42c0d878
4 changed files with 42 additions and 33 deletions
@@ -4,12 +4,15 @@
:station="station" :station="station"
:onlineScenery="onlineScenery" :onlineScenery="onlineScenery"
:chosenCheckpoint="chosenCheckpoint" :chosenCheckpoint="chosenCheckpoint"
:showStockThumbnails="showStockThumbnails"
@toggleThumbnails="toggleThumbnails"
/> />
<SceneryTimetableList <SceneryTimetableList
:station="station" :station="station"
:onlineScenery="onlineScenery" :onlineScenery="onlineScenery"
:chosenCheckpoint="chosenCheckpoint" :chosenCheckpoint="chosenCheckpoint"
:showStockThumbnails="showStockThumbnails"
/> />
</section> </section>
</template> </template>
@@ -45,7 +48,8 @@ export default defineComponent({
}, },
data: () => ({ data: () => ({
listOpen: false listOpen: false,
showStockThumbnails: false
}), }),
activated() { activated() {
@@ -82,6 +86,10 @@ export default defineComponent({
}, },
methods: { methods: {
toggleThumbnails() {
this.showStockThumbnails = !this.showStockThumbnails;
},
loadSelectedOption() { loadSelectedOption() {
const queryCheckpoint = this.$route.query['checkpoint']?.toString(); const queryCheckpoint = this.$route.query['checkpoint']?.toString();
@@ -39,6 +39,15 @@
> >
<img src="/images/icon-tablice.ico" alt="icon-tablice" /> <img src="/images/icon-tablice.ico" alt="icon-tablice" />
</a> </a>
<button
class="thumbnails-btn"
data-tooltip-type="HtmlTooltip"
:data-tooltip-content="`<b>${$t(`scenery.btn-${showStockThumbnails ? 'show' : 'hide'}-timetable-thumbnails`)}</b>`"
@click="toggleThumbnails"
>
<i class="fa-solid" :class="`${showStockThumbnails ? 'fa-eye' : 'fa-eye-slash'}`"></i>
</button>
</span> </span>
</h3> </h3>
</div> </div>
@@ -61,9 +70,16 @@ const props = defineProps({
chosenCheckpoint: { chosenCheckpoint: {
type: String, type: String,
required: true required: true
},
showStockThumbnails: {
type: Boolean,
required: true
} }
}); });
const emits = defineEmits(['toggleThumbnails']);
const mainStore = useMainStore(); const mainStore = useMainStore();
const tabliceZbiorczeHref = computed(() => { const tabliceZbiorczeHref = computed(() => {
@@ -83,6 +99,10 @@ const pragotronHref = computed(() => {
const generatorHref = computed(() => { const generatorHref = computed(() => {
return `https://generator-td2.spythere.eu/?sceneryId=${props.onlineScenery!.name}|${props.onlineScenery!.region}`; return `https://generator-td2.spythere.eu/?sceneryId=${props.onlineScenery!.name}|${props.onlineScenery!.region}`;
}); });
function toggleThumbnails() {
emits('toggleThumbnails');
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@@ -111,4 +131,9 @@ img {
gap: 0.25em; gap: 0.25em;
margin-left: 0.5em; margin-left: 0.5em;
} }
.thumbnails-btn {
padding: 0.25em;
width: 2em;
}
</style> </style>
@@ -35,15 +35,6 @@
</template> </template>
</div> </div>
<div class="timetable-options">
<div class="thumbnails-checkbox">
<label>
<input type="checkbox" v-model="showStockThumbnails" />
<span>POKAZUJ PODGLĄDY SKŁADÓW</span>
</label>
</div>
</div>
<div class="list-container"> <div class="list-container">
<transition-group name="list-anim"> <transition-group name="list-anim">
<div <div
@@ -250,6 +241,11 @@ const props = defineProps({
chosenCheckpoint: { chosenCheckpoint: {
type: String, type: String,
required: true required: true
},
showStockThumbnails: {
type: Boolean,
required: true
} }
}); });
@@ -257,8 +253,6 @@ const route = useRoute();
const mainStore = useMainStore(); const mainStore = useMainStore();
const apiStore = useApiStore(); const apiStore = useApiStore();
const showStockThumbnails = ref(false);
const sceneryTimetables: ComputedRef<SceneryTimetableRow[]> = computed(() => { const sceneryTimetables: ComputedRef<SceneryTimetableRow[]> = computed(() => {
if (!props.onlineScenery) return []; if (!props.onlineScenery) return [];
@@ -310,7 +304,7 @@ const sceneryTimetables: ComputedRef<SceneryTimetableRow[]> = computed(() => {
.scenery-timetable-list { .scenery-timetable-list {
display: grid; display: grid;
grid-template-rows: auto auto 1fr; grid-template-rows: auto 1fr;
overflow: hidden; overflow: hidden;
} }
@@ -358,26 +352,6 @@ const sceneryTimetables: ComputedRef<SceneryTimetableRow[]> = computed(() => {
} }
} }
.thumbnails-checkbox {
label {
cursor: pointer;
color: #aaa;
}
input {
width: 0;
outline: none;
}
input:checked + span {
color: var(--clr-success);
}
input:focus-visible + span {
outline: 1px solid white;
}
}
.list-container { .list-container {
position: relative; position: relative;
overflow-y: auto; overflow-y: auto;
+2
View File
@@ -558,6 +558,8 @@
"option-active-timetables": "Aktywne rozkłady jazdy", "option-active-timetables": "Aktywne rozkłady jazdy",
"option-timetables-history": "Historia rozkładów PL1", "option-timetables-history": "Historia rozkładów PL1",
"option-dispatchers-history": "Historia dyżurów PL1", "option-dispatchers-history": "Historia dyżurów PL1",
"btn-show-timetable-thumbnails": "Pokazuj podglądy składów",
"btn-hide-timetable-thumbnails": "Ukrywaj podglądy składów",
"timetable-includesScenery": "WSZYSTKIE RJ", "timetable-includesScenery": "WSZYSTKIE RJ",
"timetable-via": "PRZEJEŻDŻA", "timetable-via": "PRZEJEŻDŻA",
"timetable-issuedFrom": "ROZPOCZYNA BIEG", "timetable-issuedFrom": "ROZPOCZYNA BIEG",