mirror of
https://git.meshkee.com/BaloutPastry/dashboards.git
synced 2026-08-11 22:30:59 +04:30
Initial commit of Balout Pastry admin dashboards.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
export type Flavor = {
|
||||
id: string
|
||||
nameFa: string
|
||||
nameEn: string
|
||||
}
|
||||
|
||||
export type FlavorAmountEntry = {
|
||||
id: string
|
||||
amount: string
|
||||
price: number
|
||||
}
|
||||
|
||||
/** One selectable flavor instance on a category (select can be duplicated). */
|
||||
export type FlavorBlock = {
|
||||
id: string
|
||||
flavorId: string
|
||||
entries: FlavorAmountEntry[]
|
||||
}
|
||||
|
||||
export type CategoryFlavorOptions = FlavorBlock[]
|
||||
|
||||
export const flavors: Flavor[] = [
|
||||
{ id: 'chocolate', nameFa: 'شکلات', nameEn: 'Chocolate' },
|
||||
{ id: 'banana', nameFa: 'موز', nameEn: 'Banana' },
|
||||
{ id: 'hazelnut', nameFa: 'فندق', nameEn: 'Hazelnut' },
|
||||
{ id: 'vanilla', nameFa: 'وانیل', nameEn: 'Vanilla' },
|
||||
{ id: 'pistachio', nameFa: 'پسته', nameEn: 'Pistachio' },
|
||||
{ id: 'walnut', nameFa: 'گردو', nameEn: 'Walnut' },
|
||||
{ id: 'strawberry', nameFa: 'توتفرنگی', nameEn: 'Strawberry' },
|
||||
{ id: 'caramel', nameFa: 'کارامل', nameEn: 'Caramel' },
|
||||
]
|
||||
|
||||
function uid() {
|
||||
return `${Date.now()}-${Math.random().toString(36).slice(2, 7)}`
|
||||
}
|
||||
|
||||
export function createFlavorEntry(
|
||||
amount: string,
|
||||
price: number,
|
||||
): FlavorAmountEntry {
|
||||
return {
|
||||
id: uid(),
|
||||
amount,
|
||||
price,
|
||||
}
|
||||
}
|
||||
|
||||
export function createFlavorBlock(flavorId = flavors[0]?.id ?? ''): FlavorBlock {
|
||||
return {
|
||||
id: uid(),
|
||||
flavorId,
|
||||
entries: [],
|
||||
}
|
||||
}
|
||||
|
||||
export { formatPrice } from '../utils/price'
|
||||
Reference in New Issue
Block a user