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'