Initial commit of Balout Pastry public website.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Alireza Hassani
2026-08-05 15:15:01 +03:30
co-authored by Cursor
commit 35939e6ee4
80 changed files with 8796 additions and 0 deletions
+85
View File
@@ -0,0 +1,85 @@
export type SellUnit = 'unit' | 'kilo'
export type UserRole = 'customer' | 'admin' | 'superAdmin'
export type ProductCategoryRef = {
id: string
nameFa: string
nameEn: string
parentId?: string | null
}
export type ProductOptionValue = {
id: string
flavorId: string
amount: string
price: number
flavor?: {
id: string
nameFa: string
nameEn: string
}
}
export type ProductGalleryImage = {
id?: string
url: string
storageKey?: string
sortOrder?: number
}
export type Product = {
id: string
nameFa: string
nameEn: string
price: number
sellUnit: SellUnit
categoryId: string
category: ProductCategoryRef
intro?: string | null
description?: string | null
tags?: string[]
mainImageUrl: string | null
mainImageKey?: string | null
gallery?: ProductGalleryImage[]
options?: ProductOptionValue[]
}
export type CategoryNode = {
id: string
nameFa: string
nameEn: string
slug: string
parentId: string | null
sortOrder: number
children?: CategoryNode[]
}
export type ProductListResponse = {
items: Product[]
total: number
page: number
pageSize: number
}
const sellUnitLabel: Record<SellUnit, string> = {
unit: 'واحد',
kilo: 'کیلو',
}
export function formatPriceFa(price: number) {
return price.toLocaleString('fa-IR')
}
export function formatProductPrice(product: Product) {
const unit = sellUnitLabel[product.sellUnit] ?? ''
return {
amount: formatPriceFa(product.price),
unitLabel: unit,
full: `${formatPriceFa(product.price)} تومان /${unit}`,
}
}
export function productImageSrc(product: Product, fallback: string) {
return product.mainImageUrl || fallback
}