mirror of
https://git.meshkee.com/BaloutPastry/dashboards.git
synced 2026-08-11 22:30:59 +04:30
Wire dashboards to the API and add customer portal plus discounts.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
af11d96fd0
commit
b103e330ef
+39
-99
@@ -1,17 +1,29 @@
|
||||
import img1010 from '../images/products/IMG_1010.jpeg'
|
||||
import img1031 from '../images/products/IMG_1031.jpeg'
|
||||
import img1035 from '../images/products/IMG_1035.jpeg'
|
||||
import img1039 from '../images/products/IMG_1039.jpeg'
|
||||
import img1040 from '../images/products/IMG_1040.jpeg'
|
||||
import img1043 from '../images/products/IMG_1043.jpeg'
|
||||
|
||||
export type SellUnit = 'unit' | 'kilo'
|
||||
|
||||
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 = {
|
||||
@@ -20,18 +32,25 @@ export type Product = {
|
||||
nameEn: string
|
||||
price: number
|
||||
sellUnit: SellUnit
|
||||
category: string
|
||||
image: string
|
||||
categoryId: string
|
||||
category: ProductCategoryRef
|
||||
intro?: string
|
||||
description?: string
|
||||
tags?: string[]
|
||||
mainImageUrl: string | null
|
||||
mainImageKey?: string | null
|
||||
gallery?: ProductGalleryImage[]
|
||||
options: ProductOptionValue[]
|
||||
}
|
||||
|
||||
export const productCategories = [
|
||||
'شیرینی',
|
||||
'کیک',
|
||||
'باقلوا',
|
||||
'نان',
|
||||
'ماکارون',
|
||||
] as const
|
||||
export const productImagePlaceholder =
|
||||
'data:image/svg+xml,' +
|
||||
encodeURIComponent(
|
||||
`<svg xmlns="http://www.w3.org/2000/svg" width="400" height="400" viewBox="0 0 400 400">
|
||||
<rect width="400" height="400" fill="#f3ebe3"/>
|
||||
<text x="200" y="210" text-anchor="middle" fill="#b08a6a" font-family="sans-serif" font-size="28">محصول</text>
|
||||
</svg>`,
|
||||
)
|
||||
|
||||
function optionId() {
|
||||
return `${Date.now()}-${Math.random().toString(36).slice(2, 7)}`
|
||||
@@ -50,89 +69,6 @@ export function createProductOptionValue(
|
||||
}
|
||||
}
|
||||
|
||||
export const products: Product[] = [
|
||||
{
|
||||
id: '1',
|
||||
nameFa: 'شیرینی پسته',
|
||||
nameEn: 'Pistachio Cookie',
|
||||
price: 185000,
|
||||
sellUnit: 'unit',
|
||||
category: 'شیرینی',
|
||||
image: img1010,
|
||||
options: [],
|
||||
},
|
||||
{
|
||||
id: '2',
|
||||
nameFa: 'کیک شکلاتی',
|
||||
nameEn: 'Chocolate Cake',
|
||||
price: 420000,
|
||||
sellUnit: 'kilo',
|
||||
category: 'کیک',
|
||||
image: img1031,
|
||||
options: [],
|
||||
},
|
||||
{
|
||||
id: '3',
|
||||
nameFa: 'باقلوا گردو',
|
||||
nameEn: 'Walnut Baklava',
|
||||
price: 265000,
|
||||
sellUnit: 'kilo',
|
||||
category: 'باقلوا',
|
||||
image: img1035,
|
||||
options: [],
|
||||
},
|
||||
{
|
||||
id: '4',
|
||||
nameFa: 'نان خامهای',
|
||||
nameEn: 'Cream Puff',
|
||||
price: 95000,
|
||||
sellUnit: 'unit',
|
||||
category: 'نان',
|
||||
image: img1039,
|
||||
options: [],
|
||||
},
|
||||
{
|
||||
id: '5',
|
||||
nameFa: 'تارت میوه',
|
||||
nameEn: 'Fruit Tart',
|
||||
price: 310000,
|
||||
sellUnit: 'unit',
|
||||
category: 'کیک',
|
||||
image: img1040,
|
||||
options: [],
|
||||
},
|
||||
{
|
||||
id: '6',
|
||||
nameFa: 'ماکارون بلوط',
|
||||
nameEn: 'Balout Macaron',
|
||||
price: 150000,
|
||||
sellUnit: 'unit',
|
||||
category: 'ماکارون',
|
||||
image: img1043,
|
||||
options: [],
|
||||
},
|
||||
{
|
||||
id: '7',
|
||||
nameFa: 'کروسان کرهای',
|
||||
nameEn: 'Butter Croissant',
|
||||
price: 120000,
|
||||
sellUnit: 'unit',
|
||||
category: 'نان',
|
||||
image: img1010,
|
||||
options: [],
|
||||
},
|
||||
{
|
||||
id: '8',
|
||||
nameFa: 'چیزکیک وانیل',
|
||||
nameEn: 'Vanilla Cheesecake',
|
||||
price: 380000,
|
||||
sellUnit: 'kilo',
|
||||
category: 'کیک',
|
||||
image: img1040,
|
||||
options: [],
|
||||
},
|
||||
]
|
||||
|
||||
const sellUnitLabel: Record<SellUnit, string> = {
|
||||
unit: 'واحد',
|
||||
kilo: 'کیلو',
|
||||
@@ -147,3 +83,7 @@ export function formatPriceParts(product: Product): {
|
||||
label: `تومان - ${sellUnitLabel[product.sellUnit]}`,
|
||||
}
|
||||
}
|
||||
|
||||
export function productImageSrc(product: Product) {
|
||||
return product.mainImageUrl || productImagePlaceholder
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user