feat: paginate customer orders and polish the dashboard hero

Add paged orders API and infinite scroll, short order numbers, and align the guest invite card with the logged-in hero shell.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
s.esmaeili
2026-10-17 13:11:42 +03:30
co-authored by Cursor
parent f550172567
commit afb068c643
89 changed files with 4518 additions and 1325 deletions
+18 -2
View File
@@ -32,12 +32,28 @@ export const useCatalogStore = defineStore('catalog', () => {
// reason to keep loading the full catalogue.
async function load(force = false): Promise<ProductSummary[]> {
const list = await cache.fetch(KEYS.catalog, api.listProducts, { force })
// Prefer a bounded page when a caller still uses the unpaged helper — the
// real catalogue reaches ~16k rows (STUB-03). Screens that need filters or
// infinite scroll should call api.listProductsPaged directly.
const list = await cache.fetch(
KEYS.catalog,
async () => {
const page = await api.listProductsPaged({ page: 1, limit: 100, sort: 'newest' })
return page.rows
},
{ force },
)
products.value = list
loaded.value = true
return list
}
/** Replace the in-memory slice (home rails, after a paged fetch). */
function replace(list: ProductSummary[]) {
products.value = list
loaded.value = true
}
function byId(id: string): ProductSummary | null {
return products.value.find((p) => p.id === id) ?? null
}
@@ -47,5 +63,5 @@ export const useCatalogStore = defineStore('catalog', () => {
cache.invalidate(KEYS.catalog)
}
return { products, loaded, categories, load, byId, invalidate }
return { products, loaded, categories, load, replace, byId, invalidate }
})