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:
@@ -0,0 +1,93 @@
|
||||
// Scoped port of legacy henza_pwa/src/store/store.ts.
|
||||
//
|
||||
// Legacy fetched one curated payload (POST /front + GET /config) that carried
|
||||
// the home banner slider, the category grid, promotions, the ignore-list and
|
||||
// the gold price ticker. The new API exposes none of that as a single config
|
||||
// endpoint, so this store restores the two pieces that drive visible home-page
|
||||
// UI and are actually derivable today:
|
||||
//
|
||||
// - `cats` — REAL data: distinct categories derived from GET /catalog/products
|
||||
// (the response already includes each product's category).
|
||||
// Legacy's per-category `icon.image` was a remote URL from the old
|
||||
// Laravel host and has no equivalent, so a local brand mark stands
|
||||
// in until category artwork exists.
|
||||
// - `config.main_slider` — legacy's banner slides were remote URLs too. These
|
||||
// are placeholder slides built from legacy's own local artwork,
|
||||
// using legacy's exact slide shape ({text, type, src, link}) so
|
||||
// HomeSlider's popup/link/discount click handling works unchanged.
|
||||
//
|
||||
// Not ported (no backend): promotionList, ignoreList, priceList, isLoaded.
|
||||
import { defineStore } from 'pinia'
|
||||
import { api } from '../api/client'
|
||||
import shippingArt from '../assets/img/shipping-and-delivery.png'
|
||||
import competitionArt from '../assets/img/sports-and-competition.png'
|
||||
import brandArt from '../assets/img/montzar-logo.png'
|
||||
|
||||
export interface Slide {
|
||||
text: string | undefined
|
||||
type: string | undefined
|
||||
src: string | undefined
|
||||
link: string | undefined
|
||||
}
|
||||
|
||||
export interface HomeCategory {
|
||||
id: string
|
||||
title: string
|
||||
icon?: { image: string }
|
||||
}
|
||||
|
||||
const PLACEHOLDER_SLIDES: Slide[] = [
|
||||
{
|
||||
type: 'popup',
|
||||
src: shippingArt,
|
||||
text: 'ارسال سریع و مطمئن سفارشهای شما به سراسر کشور.',
|
||||
link: undefined,
|
||||
},
|
||||
{
|
||||
type: 'popup',
|
||||
src: competitionArt,
|
||||
text: 'جدیدترین محصولات منتزر را در بخش محصولات جدید ببینید.',
|
||||
link: undefined,
|
||||
},
|
||||
{
|
||||
type: 'popup',
|
||||
src: brandArt,
|
||||
text: 'منتزر، همراه شما در خرید و فروش طلا.',
|
||||
link: undefined,
|
||||
},
|
||||
]
|
||||
|
||||
export const useConfigStore = defineStore('config', {
|
||||
state: () => ({
|
||||
config: { main_slider: PLACEHOLDER_SLIDES as Slide[] },
|
||||
cats: [] as HomeCategory[],
|
||||
loaded: false,
|
||||
}),
|
||||
actions: {
|
||||
setCats(cats: HomeCategory[]) {
|
||||
this.cats = cats
|
||||
},
|
||||
// Legacy's store.init() fanned out to /config, /promotion, /ignore, /price.
|
||||
// Here the only live source is the product catalogue, from which the real
|
||||
// category list is derived.
|
||||
async init() {
|
||||
try {
|
||||
const products = await api.listProducts()
|
||||
const seen = new Map<string, HomeCategory>()
|
||||
for (const p of products) {
|
||||
if (p.category && !seen.has(p.category.id)) {
|
||||
seen.set(p.category.id, {
|
||||
id: p.category.id,
|
||||
title: p.category.title,
|
||||
icon: { image: brandArt },
|
||||
})
|
||||
}
|
||||
}
|
||||
this.cats = [...seen.values()]
|
||||
this.loaded = true
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user