Applies to both user-app and user-app-v2. Logic and structure are shared; each app keeps its own look. Appearance settings - New "تنظیمات ظاهری" page (/settings/appearance), opened from the dashboard and available without login. It offers a light/dark/system theme and a "fast & light" motion switch. - appearanceStore saves the choice to localStorage. A small inline boot script in index.html applies it before first paint so there is no white flash. The "system" option follows OS changes live. - New ToggleSwitch component. Dark mode - Theme LESS tokens now compile to CSS custom properties. Light/dark values come from a generated virtual:palette.css (themeConfig/ appearance.ts, with colors.json + new colors.dark.json). - New LESS alpha() plugin replaces fade() on theme tokens. - New semantic tokens: page, onInk, heroSurface, hairlineStrong, photoMat, photoStage. - The dark palette is layered (page < card < panel < border) so surfaces separate without shadows. - Hard-coded colors were replaced by tokens according to their role. - antd inputs/text get dark overrides; vant uses its own .van-theme-dark. - Light mode looks the same as before. Reduced motion - With html.motion-reduced, transitions are capped at 120ms, keyframe loops stop, and backdrop blurs and permanent will-change are dropped. - Spinners and the toast progress bar (which closes the toast) are exempt via .keep-motion. - Carousel autoplay, the v1 Lottie and the product morph honor the setting. Product detail - Opening a product is now a container-transform morph from the tapped card (ProductMorph). It replaces the bottom Drawer and uses composited transform/opacity only. - The detail view is seeded with the card's data, so it no longer opens blank and jumps. Filters and sheets - Filters are now a full-width bottom sheet. Selections stay a draft until applied, so the result list no longer re-renders while dragging the slider. - DropDown collapse animates grid-template-rows instead of a capped max-height. - v2 IslandSheet is restyled to the v2 design language (API unchanged). Fixes - filtersStore.reset() shallow-copied shared arrays, so clearing the filters never cleared the selected brands.
138 lines
3.7 KiB
Vue
138 lines
3.7 KiB
Vue
<!--
|
|
Ported from legacy henza_pwa/src/App.vue — layout switching, RTL shell, and
|
|
the app-version-check / service-worker update dialog.
|
|
|
|
Not ported (deliberate): Firebase push init and WebOTP autofill. Both were
|
|
already commented out in legacy's own App.vue, so neither ran there either.
|
|
-->
|
|
<template>
|
|
<div>
|
|
<component :is="getLayout" class="relative">
|
|
<router-view v-slot="{ Component, route }">
|
|
<keep-alive>
|
|
<suspense>
|
|
<template #default>
|
|
<component :is="Component" :key="route.name" />
|
|
</template>
|
|
</suspense>
|
|
</keep-alive>
|
|
</router-view>
|
|
</component>
|
|
|
|
<DialogVantOneButton :timeOut="-1" v-model:show="versionDialog" :closeOnClickOverlay="true">
|
|
<template v-slot:img>
|
|
<!-- Still (first frame) in reduced-motion mode. -->
|
|
<DotLottieVue
|
|
class="w-full aspect-square"
|
|
:autoplay="!appearance.isReducedMotion"
|
|
:loop="!appearance.isReducedMotion"
|
|
src="https://lottie.host/cb620e8e-c64a-42e8-a6b5-8844146e5999/nmft7oBO8q.json"
|
|
/>
|
|
</template>
|
|
|
|
<template v-slot:title>
|
|
<div class="p-8 text-justify">نسخه جدید منتزر منتشر شد!</div>
|
|
</template>
|
|
|
|
<template v-slot:button>
|
|
<div class="text-center text-[color:var(--c-primary)]" @click="update()">به روز رسانی</div>
|
|
</template>
|
|
</DialogVantOneButton>
|
|
|
|
<ProductMorph />
|
|
<ToastHost />
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { computed, onMounted, ref } from 'vue'
|
|
import { useRouter } from 'vue-router'
|
|
import { DotLottieVue } from '@lottiefiles/dotlottie-vue'
|
|
import { useRegisterSW } from 'virtual:pwa-register/vue'
|
|
import MasterLayout from './layout/MasterLayout.vue'
|
|
import FullPageLayout from './layout/FullPageLayout.vue'
|
|
import DialogVantOneButton from './components/DialogVantOneButton.vue'
|
|
import ToastHost from './components/ui/ToastHost.vue'
|
|
import ProductMorph from './components/product/ProductMorph.vue'
|
|
import { useRefresh } from './composables/useRefresh'
|
|
import { useAppearanceStore } from './stores/appearanceStore'
|
|
import pkg from '../package.json'
|
|
|
|
const router = useRouter()
|
|
const appearance = useAppearanceStore()
|
|
const { updateServiceWorker } = useRegisterSW()
|
|
|
|
const getLayout = computed(() => {
|
|
if (router.currentRoute.value.meta && router.currentRoute.value.meta.layout === 'FullPage') {
|
|
return FullPageLayout
|
|
}
|
|
return MasterLayout
|
|
})
|
|
|
|
// Ported from legacy App.vue:52-74 — compare the stored version against the
|
|
// bundled package version and offer a one-tap service-worker update.
|
|
const versionDialog = ref(false)
|
|
|
|
function checkVersion() {
|
|
const version = localStorage.getItem('version')
|
|
if (version) {
|
|
if (version !== pkg.version) versionDialog.value = true
|
|
} else {
|
|
localStorage.setItem('version', pkg.version)
|
|
}
|
|
}
|
|
|
|
function update() {
|
|
localStorage.setItem('version', pkg.version)
|
|
updateServiceWorker()
|
|
window.location.reload()
|
|
}
|
|
|
|
onMounted(() => {
|
|
useRefresh()
|
|
checkVersion()
|
|
})
|
|
</script>
|
|
|
|
<style lang="less">
|
|
body::-webkit-scrollbar {
|
|
display: none;
|
|
}
|
|
|
|
#app {
|
|
overflow: hidden;
|
|
direction: rtl !important;
|
|
-webkit-font-smoothing: antialiased;
|
|
-moz-osx-font-smoothing: grayscale;
|
|
text-align: start;
|
|
color: @primary;
|
|
-webkit-user-select: none;
|
|
-ms-user-select: none;
|
|
user-select: none;
|
|
}
|
|
|
|
.slideDown-enter-active,
|
|
.slideDown-leave-active {
|
|
transition: all @transition-duration ease;
|
|
}
|
|
.slideDown-enter-from {
|
|
transform: translateY(-100vh);
|
|
}
|
|
|
|
.slideDown-leave-to {
|
|
transform: translateY(100vh);
|
|
}
|
|
|
|
.slideDown-leave-from {
|
|
transform: translateY(0);
|
|
}
|
|
.slideDown-enter-to {
|
|
transform: translateY(0);
|
|
}
|
|
|
|
.fade-down-enter-active,
|
|
.fade-down-leave-active {
|
|
transition: all @transition-duration ease;
|
|
}
|
|
</style>
|