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,39 @@
|
||||
// The real GET /customers/:id/orders endpoint returns OrderItem rows with
|
||||
// only `productVariantId` (no nested product/variant title) — this joins
|
||||
// against the already-existing GET /catalog/products list client-side rather
|
||||
// than touching apps/api to add an include.
|
||||
import { ref } from 'vue'
|
||||
import { api } from '../api/client'
|
||||
|
||||
export interface VariantLookup {
|
||||
productTitle: string
|
||||
variantTitle: string
|
||||
imageUrl?: string
|
||||
}
|
||||
|
||||
const cache = ref<Map<string, VariantLookup> | null>(null)
|
||||
|
||||
async function ensureLoaded() {
|
||||
if (cache.value) return cache.value
|
||||
const products = await api.listProducts()
|
||||
const map = new Map<string, VariantLookup>()
|
||||
for (const product of products) {
|
||||
for (const variant of product.variants) {
|
||||
map.set(variant.id, {
|
||||
productTitle: product.title,
|
||||
variantTitle: variant.title,
|
||||
imageUrl: product.images[0]?.url,
|
||||
})
|
||||
}
|
||||
}
|
||||
cache.value = map
|
||||
return map
|
||||
}
|
||||
|
||||
export function useOrderItemProduct() {
|
||||
const lookup = async (productVariantId: string): Promise<VariantLookup | undefined> => {
|
||||
const map = await ensureLoaded()
|
||||
return map.get(productVariantId)
|
||||
}
|
||||
return { lookup }
|
||||
}
|
||||
Reference in New Issue
Block a user