scroller sponsorów projektu w modalu

This commit is contained in:
2024-03-03 14:31:04 +01:00
parent 9c2f0ac797
commit e222dc63eb
8 changed files with 183 additions and 104 deletions
+85 -30
View File
@@ -1,19 +1,23 @@
<template> <template>
<div class="donation-modal" @keydown.esc="toggleModal(false)"> <AnimatedModal
<button class="donation-modal"
class="btn-toggle btn--image" :isOpen="isModalOpen"
ref="btn" @toggleModal="toggleModal"
@click="toggleModal(true)" @keydown.esc="toggleModal(false)"
@focus="toggleModal(false)"
> >
<img src="/images/icon-dollar.svg" alt="dollar donation icon" />
<span>{{ $t('donations.button-title') }}</span>
</button>
<AnimatedModal :isOpen="isModalOpen" @toggleModal="toggleModal">
<div class="modal_content"> <div class="modal_content">
<div class="modal_main"> <div class="modal_main">
<h1 v-html="$t('donations.header')"></h1> <h1 v-html="$t('donations.header')"></h1>
<div class="donators-slider" v-if="donatorList.length != 0">
<span v-html="$t('donations.donator-title', { count: donatorList.length })"></span>
<transition mode="out-in" name="slider-anim" class="current-name">
<span :key="displayingName">
<img src="/images/icon-diamond.svg" alt="donator diamond icon" />
{{ displayingName }}
</span>
</transition>
</div>
<br /> <br />
<p v-html="$t('donations.p1')"></p> <p v-html="$t('donations.p1')"></p>
<br /> <br />
@@ -83,47 +87,71 @@
</div> </div>
</div> </div>
</AnimatedModal> </AnimatedModal>
</div>
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent } from 'vue'; import { defineComponent } from 'vue';
import AnimatedModal from './AnimatedModal.vue'; import AnimatedModal from './AnimatedModal.vue';
import { useApiStore } from '../../store/apiStore';
export default defineComponent({ export default defineComponent({
components: { AnimatedModal },
props: { props: {
isModalOpen: Boolean isModalOpen: Boolean
}, },
emits: ['toggleModal'], emits: ['toggleModal'],
watch: {
isModalOpen(b: boolean) {
this.running = b;
this.lastUpdate = Date.now();
}
},
created() {
this.runUpdate();
},
data() {
return {
apiStore: useApiStore(),
displayingIndex: 0,
lastUpdate: 0,
running: false
};
},
computed: {
displayingName() {
return this.donatorList[this.displayingIndex];
},
donatorList() {
return this.apiStore.donatorsData.slice().sort(() => Math.sign(Math.random() * -2 + 1));
}
},
methods: { methods: {
toggleModal(value: boolean) { toggleModal(value: boolean) {
this.$emit('toggleModal', value); this.$emit('toggleModal', value);
}
}, },
components: { AnimatedModal }
runUpdate() {
if (Date.now() >= this.lastUpdate + 2000 && this.running) {
this.displayingIndex = (this.displayingIndex + 1) % this.donatorList.length;
this.lastUpdate = Date.now();
}
window.requestAnimationFrame(this.runUpdate);
}
}
}); });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '../../styles/responsive.scss'; @import '../../styles/responsive.scss';
button.btn-toggle {
$btnColor: #254069;
background-color: $btnColor;
&:hover {
background-color: lighten($btnColor, 5%);
}
@include smallScreen {
span {
display: none;
}
}
}
.modal_content { .modal_content {
display: grid; display: grid;
grid-template-rows: 1fr auto; grid-template-rows: 1fr auto;
@@ -151,6 +179,7 @@ button.btn-toggle {
.modal_main { .modal_main {
overflow: auto; overflow: auto;
overflow-x: hidden;
img { img {
max-height: 20px; max-height: 20px;
@@ -198,4 +227,30 @@ button.btn-toggle {
} }
} }
} }
.donators-slider {
text-align: center;
line-height: 30px;
.current-name {
backface-visibility: hidden;
display: block;
font-weight: bold;
word-wrap: break-word;
color: var(--clr-donator);
}
}
.slider-anim {
&-move,
&-enter-active,
&-leave-active {
transition: all 150ms ease-in-out;
}
&-enter-from,
&-leave-to {
opacity: 0;
}
}
</style> </style>
-2
View File
@@ -59,8 +59,6 @@ export default defineComponent({
'store.region.id': { 'store.region.id': {
handler(regionId) { handler(regionId) {
this.selectedItemIndex = this.regionList.findIndex((reg) => reg.id == regionId); this.selectedItemIndex = this.regionList.findIndex((reg) => reg.id == regionId);
console.log('region id', regionId);
} }
}, },
'$route.query.region': { '$route.query.region': {
-2
View File
@@ -98,8 +98,6 @@ export default defineComponent({
fallbackName += isCarPassenger ? 'passenger' : 'cargo'; fallbackName += isCarPassenger ? 'passenger' : 'cargo';
} }
console.log(stockName, fallbackName);
(event.target as HTMLImageElement).src = `/images/icon-${fallbackName}.png`; (event.target as HTMLImageElement).src = `/images/icon-${fallbackName}.png`;
} }
} }
@@ -256,8 +256,6 @@ export default defineComponent({
}, },
handleAuthorsInput() { handleAuthorsInput() {
console.log(this.authorsInputValue);
this.filterStore.changeFilterValue('authors', this.authorsInputValue); this.filterStore.changeFilterValue('authors', this.authorsInputValue);
if (this.saveOptions) StorageManager.setStringValue('authors', this.authorsInputValue); if (this.saveOptions) StorageManager.setStringValue('authors', this.authorsInputValue);
+1
View File
@@ -2,6 +2,7 @@
"donations": { "donations": {
"button-title": "TOSS A COIN", "button-title": "TOSS A COIN",
"header": "Toss a coin to Stacjownik!", "header": "Toss a coin to Stacjownik!",
"donator-title": "Project is supported by more than <b>{count}</b> people, including:",
"p1": "<b>Hello o7!</b> This is Spythere, the creator of Stacjownik, Pojazdownik and several other applications that enhance the gameplay of Train Driver 2!", "p1": "<b>Hello o7!</b> This is Spythere, the creator of Stacjownik, Pojazdownik and several other applications that enhance the gameplay of Train Driver 2!",
"p2": "{b1} is a completely free tool, created and continuously developed for the Train Driver 2 simulator community since 2020. However, a part of the project is sustained solely through my private financial contribution. Features such as {b2} or {b3} (operating on my {link} - to which you are warmly invited) must function on a dedicated server where they can collect and process data, and then display it on the website.", "p2": "{b1} is a completely free tool, created and continuously developed for the Train Driver 2 simulator community since 2020. However, a part of the project is sustained solely through my private financial contribution. Features such as {b2} or {b3} (operating on my {link} - to which you are warmly invited) must function on a dedicated server where they can collect and process data, and then display it on the website.",
"p2-b1": "Stacjownik", "p2-b1": "Stacjownik",
+1
View File
@@ -2,6 +2,7 @@
"donations": { "donations": {
"button-title": "GROSZA DAJ", "button-title": "GROSZA DAJ",
"header": "Grosza daj Stacjownikowi!", "header": "Grosza daj Stacjownikowi!",
"donator-title": "Projekt wspiera już ponad <b>{count}</b> osób, w tym:",
"p1": "<b>Hej o7!</b> Z tej strony Spythere, twórca Stacjownika, Pojazdownika oraz kilku innych aplikacji wspomagających rozgrywkę symulatora Train Driver 2!", "p1": "<b>Hej o7!</b> Z tej strony Spythere, twórca Stacjownika, Pojazdownika oraz kilku innych aplikacji wspomagających rozgrywkę symulatora Train Driver 2!",
"p2": "{b1} to narzędzie całkowicie darmowe, tworzone i rozwijane dla społeczności symulatora TD2 nieprzerwanie od 2020 roku. Jednakże, część projektu jest podtrzymywana wyłącznie dzięki mojemu prywatnemu wkładowi finansowemu. Funkcje takie jak {b2} czy też {b3} działający na moim {link} (na który serdeczne zapraszam) muszą działać na wydzielonym serwerze, gdzie będą mogły zbierać i przetwarzać dane, aby następnie pokazać je na stronie.", "p2": "{b1} to narzędzie całkowicie darmowe, tworzone i rozwijane dla społeczności symulatora TD2 nieprzerwanie od 2020 roku. Jednakże, część projektu jest podtrzymywana wyłącznie dzięki mojemu prywatnemu wkładowi finansowemu. Funkcje takie jak {b2} czy też {b3} działający na moim {link} (na który serdeczne zapraszam) muszą działać na wydzielonym serwerze, gdzie będą mogły zbierać i przetwarzać dane, aby następnie pokazać je na stronie.",
"p2-b1": "Stacjownik", "p2-b1": "Stacjownik",
+3
View File
@@ -49,6 +49,9 @@ body {
padding: 0; padding: 0;
font-family: 'Quicksand', sans-serif; font-family: 'Quicksand', sans-serif;
font-weight: 500; font-weight: 500;
text-rendering: optimizeLegibility !important;
-webkit-font-smoothing: antialiased !important;
overflow-y: scroll; overflow-y: scroll;
&.no-scroll { &.no-scroll {
+26 -1
View File
@@ -8,9 +8,18 @@
ref="filterCardRef" ref="filterCardRef"
/> />
<Donation :isModalOpen="isDonationModalOpen" @toggleModal="toggleDonationModal" /> <button
class="btn-donation btn--image"
ref="btn"
@click="isDonationModalOpen = true"
@focus="isDonationModalOpen = false"
>
<img src="/images/icon-dollar.svg" alt="dollar donation icon" />
<span>{{ $t('donations.button-title') }}</span>
</button>
</div> </div>
<Donation :isModalOpen="isDonationModalOpen" @toggleModal="toggleDonationModal" />
<StationTable :stations="computedStationList" @toggleDonationModal="toggleDonationModal" /> <StationTable :stations="computedStationList" @toggleDonationModal="toggleDonationModal" />
</div> </div>
</section> </section>
@@ -109,4 +118,20 @@ export default defineComponent({
margin-bottom: 0.5em; margin-bottom: 0.5em;
} }
button.btn-donation {
$btnColor: #254069;
background-color: $btnColor;
&:hover {
background-color: lighten($btnColor, 5%);
}
@include smallScreen {
span {
display: none;
}
}
}
</style> </style>