refactor(AisleViewer): update page title logic and imports

Improved the logic for displaying the page title based on search criteria.
This commit is contained in:
Jérémy Munsch 2026-10-28 15:08:46 +01:00
parent 889cc66c07
commit f882b431b7
No known key found for this signature in database
GPG key ID: 2AAECDA6B7330F91

View file

@ -1,7 +1,7 @@
<template>
<div>
<div class="h1 sticky-md-top sticky-top-offset bg-body py-2 z-3 text-uppercase">
{{ __('All aisles') }}
{{ pageTitle }}
</div>
<div
@ -53,7 +53,7 @@
<script lang="ts" setup>
import { storeToRefs } from "pinia";
import { onMounted, onUnmounted, ref } from "vue";
import { computed, onMounted, onUnmounted, ref } from "vue";
import { useProductViewerStore } from "@fo/stores";
import { __, trans_choice } from "@modules/trans";
@ -62,14 +62,22 @@ import ProductCard from "./ProductCard.vue";
defineOptions({ name: "AilesViewer" });
const store = useProductViewerStore();
const { loading, filteredProductList } = storeToRefs(store);
const {
loading, filteredProductList, activeBrands, activeRanges, activeTags, isDiscounted, currentSearchValue
} = storeToRefs(store);
const scrollSentinel = ref<HTMLElement | null>(null);
let observer: IntersectionObserver | null = null;
const anyBrandChecked = computed<boolean>(() => activeBrands.value.length > 0);
const anyRangeChecked = computed<boolean>(() => activeRanges.value.length > 0);
const anyTagChecked = computed<boolean>(() => activeTags.value.length > 0);
const hascheckedAnOption = computed<boolean>(() => currentSearchValue.value.length > 0 || anyBrandChecked.value
|| anyRangeChecked.value || anyTagChecked.value|| anyBrandChecked.value || isDiscounted.value
);
const pageTitle = computed<string>(() => hascheckedAnOption.value ? __("Your search") : __("All aisles"));
onMounted(() => {
observer = new IntersectionObserver((entries) => {
const firstEntry = entries[0];