ldc-showroom/components/layout/AppFooter.vue
2024-01-12 18:06:16 +01:00

125 lines
3.5 KiB
Vue

<template>
<footer
id="footer"
ref="footer"
class="container-fluid flex-grow-0"
:style="`background-color: ${activeBrand?.color} !important`"
>
<div v-if="route.name !== 'index'" class="row">
<div class="col-12 col-md-4 d-flex justify-content-center align-items-center">
<span class="fw-bold d-block px-5">Découvrez nos autres marques</span>
</div>
<div class="col col-md-8">
<Swiper
class="z-0"
:scrollbar="{
hide: true,
}"
:modules="modules"
:space-between="30"
:breakpoints="{
'300': {
slidesPerView: 2,
spaceBetween: 20,
},
'560': {
slidesPerView: 4,
spaceBetween: 40,
},
}"
>
<SwiperSlide v-for="(brand,brandIndex) of brands" :key="brandIndex">
<NuxtLink
class="swiper-slide"
:to="`/brands/${brand.slug}`"
data-bs-toggle="tooltip"
:title="`Voir les gammes de la marque ${brand.name}`"
@click.prevent="gotoBrand(brand)"
>
<img
class="img-fluid"
:src="`/data/${brand.picture}`"
:alt="`Marque ${brand.name}`"
:title="`Le logo de la marque ${brand.name}`"
data-bs-toggle="tooltip"
>
</NuxtLink>
</SwiperSlide>
</Swiper>
</div>
</div>
<div v-if="versions.isDebug" class="row">
<div class="col text-center">
<span>{{ appInfo.licence }}</span>&nbsp;-&nbsp;
<span>{{ appInfo.name }}</span>&nbsp;-&nbsp;
<span>{{ appInfo.version }}</span>&nbsp;-&nbsp;
<span class="fw-bold">UWIL</span>
© {{ (new Date()).getFullYear() }}
</div>
</div>
</footer>
</template>
<script lang="ts">
import { Scrollbar } from "swiper/modules";
import { Swiper, SwiperSlide } from "swiper/vue";
import { defineComponent } from "vue";
import { useRoute, type RouteLocationNormalizedLoaded } from "vue-router";
import type { appInfo } from "~/electron/main";
import { useAppStore } from "~/stores/useAppStore";
import bsTooltips from "~/vueModules/bsTooltips";
export default defineComponent({
name: "AppFooter",
components: {Swiper, SwiperSlide},
data(): {
versions: typeof window.versions;
appInfo: typeof appInfo;
route: RouteLocationNormalizedLoaded;
brands: Array<TypeBrand>;
activeBrand: TypeBrand|null;
modules: Array<{
name: string;
}>;
} {
return {
route: useRoute(),
versions: window.versions,
appInfo: {
version: "",
name: "",
licence: ""
},
brands: [],
activeBrand: null,
modules: [Scrollbar],
};
},
watch: {
$route(to: RouteLocationNormalizedLoaded) {
if(to.name === "index") {
// * Reset active Brand on main page
useAppStore().setActiveBrand(null);
}
this.activeBrand = useAppStore().activeBrand;
},
},
mounted() {
bsTooltips.methods.initTooltips();
window.ipcRendererObject.getAppInfo().then((appInfo) => {this.appInfo = appInfo;});
this.brands = useAppStore().data.brands();
this.activeBrand = useAppStore().activeBrand;
},
methods: {
gotoBrand(brand: TypeBrand) {
useAppStore().setActiveBrand(brand);
navigateTo(`/brands/${brand.slug}`);
}
}
});
</script>
<style lang="scss">
@import "swiper/scss";
@import "swiper/scss/scrollbar";
</style>