SearchView: Removed the dynamic collection-tile grid (e.g. "پرفروش‌های این هفته") and the "نتایج / N محصول" section header from the UI. Underlying data/filtering logic untouched.

DashboardView ("میز کار"): Rebuilt from scratch with a new structure, distinct from the old card+grid layout but visually aligned with HomeView (same blurred bar, @ink/@wine palette, staged reveal animation on mount):

Single hero card (ink→wine gradient) showing balance, gold/fiat debt, and identity — no quick-action icons inside it anymore.

Live gold rate folded into a slim inline row at the bottom instead of a titled section.
Iterated shadow/spacing on the hero card per feedback (softer, less clipped).
DialogVant / DialogVantOneButton (shared modal components, used in 7+ call sites: Dashboard, Cart, SingleProduct, Register, App): Replaced Vant's default dialog chrome with the app's own rounded-card language — circular icon badge for the illustration, pill-shaped primary/secondary buttons. No call-site markup changed.

LoginView: Rebuilt from scratch — full-bleed dark hero (brand + step copy) overlapped by a floating white form sheet, animated crossfade transition between the mobile-number and OTP steps, same staged entrance animation as Home/Dashboard. All auth logic (API check, OTP stub, session login) unchanged.
This commit is contained in:
s.esmaeili
2026-09-18 12:54:45 +03:30
parent 05fe780c89
commit 53a304b5d5
355 changed files with 22865 additions and 14 deletions
+95
View File
@@ -0,0 +1,95 @@
import { createRouter, createWebHistory } from 'vue-router';
import { useSessionStore } from '../stores/session';
import { useNavStore } from '../stores/navStore';
import { useTransitionStore } from '../stores/transitionStore';
// Legacy lazy-loaded every route component (`component: () => import(...)`) so
// the initial bundle only carries the entry route. Matched here.
export const router = createRouter({
history: createWebHistory(),
// Ported from legacy router/index.ts:225-237 — restore saved scroll on
// back/forward, otherwise jump to top on every navigation.
scrollBehavior(_to, _from, savedPosition) {
if (savedPosition) return savedPosition;
return { top: 0 };
},
routes: [
// legacy's actual home route is /home (name: 'home'), not '/' — matched here.
{ path: '/home', name: 'home', component: () => import('../views/HomeView.vue') },
{
path: '/product/:id',
name: 'singleProduct',
component: () => import('../components/product/SingleProduct.vue'),
props: true,
meta: { layout: 'FullPage' },
},
{ path: '/newest', name: 'newestProduct', component: () => import('../views/NewestView.vue'), meta: { layout: 'FullPage' } },
{ path: '/cart', name: 'cart', component: () => import('../views/CartView.vue') },
{ path: '/login', name: 'login', component: () => import('../views/user/LoginRegisterView.vue'), meta: { layout: 'FullPage' } },
{ path: '/user', name: 'userPage::hasSubRoute', component: () => import('../views/user/DashboardView.vue') },
{ path: '/orders', name: 'ordersList', component: () => import('../views/user/OrdersView.vue'), meta: { requiresAuth: true } },
{
path: '/transactions',
name: 'transactionsList',
component: () => import('../views/user/TransactionsView.vue'),
meta: { requiresAuth: true },
},
{ path: '/profile', name: 'profileData', component: () => import('../views/user/ProfileView.vue'), meta: { requiresAuth: true } },
{ path: '/favorites', name: 'favoritesList', component: () => import('../views/user/FavoritesView.vue'), meta: { requiresAuth: true } },
{ path: '/notifications', name: 'notifications', component: () => import('../views/user/NotificationsView.vue') },
{ path: '/search', name: 'search', component: () => import('../views/search/SearchView.vue') },
{ path: '/collection/:id?', name: 'collection', component: () => import('../views/search/CollectionView.vue') },
// legacy redirects any unmatched path (including '/') to the home route by name.
{ path: '/', redirect: { name: 'home' } },
{ path: '/:pathMatch(.*)*', redirect: { name: 'home' } },
],
});
// Ported from legacy's main router guard: redirects an already-logged-in
// user away from /login, and blocks unauthenticated access to routes that
// require a session (legacy blocked ordersList/transactionsList/profileData/
// favoritesList/completeProfile the same way).
router.beforeEach((to) => {
const session = useSessionStore();
const nav = useNavStore();
if (to.name === 'login' && session.customerId) {
return { name: 'home' };
}
if (to.meta.requiresAuth && !session.customerId) {
return { name: 'login', query: { redirect: to.fullPath } };
}
// legacy router/index.ts:268-270 — the product page slides down into view.
if (to.name === 'singleProduct') nav.setPgaTransition('slideDown');
else nav.setPgaTransition(undefined);
});
// Ported from legacy router/index.ts:273-286.
//
// setActiveLink moves the bottom-nav GSAP notch + bubble to the current tab,
// and this hook is its ONLY caller in the whole app — that part is live.
//
// The transitionFlag cycling below used to replay AppHeader's "shutter" enter
// animation. AppHeader was deleted when every screen moved to the redesigned
// components/ui/PageBar.vue, and nothing reads transitionFlag any more, so
// that half is currently inert. It is left in place rather than ripped out
// because transitionStore is still the shared home for this kind of
// page-transition state; flagged here so the next reader doesn't assume it
// still drives a visible animation.
router.afterEach((to) => {
const nav = useNavStore();
const transition = useTransitionStore();
transition.setTransitionFlag(false);
transition.setTransitionEnded(false);
setTimeout(() => {
transition.setTransitionFlag(true);
}, 100);
const route = nav.navBarRoutes.find((x) => to.name === x.name);
if (route) {
nav.setActiveLink(route.index);
if (!nav.showNav) nav.setNavVisibility(true);
} else nav.setNavVisibility(false);
});