Wire dashboards to the API and add customer portal plus discounts.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Alireza Hassani
2026-08-05 15:15:16 +03:30
co-authored by Cursor
parent af11d96fd0
commit b103e330ef
73 changed files with 8720 additions and 1605 deletions
+20 -3
View File
@@ -118,16 +118,33 @@ export function removeCategory(
}))
}
export type FlatCategoryOption = {
id: string
nameFa: string
nameEn: string
labelFa: string
labelEn: string
depth: number
}
export function flattenCategories(
categories: Category[],
prefix = '',
): { id: string; labelFa: string; labelEn: string }[] {
depth = 0,
): FlatCategoryOption[] {
return categories.flatMap((category) => {
const labelFa = prefix ? `${prefix} / ${category.nameFa}` : category.nameFa
const labelEn = prefix ? `${prefix} / ${category.nameEn}` : category.nameEn
return [
{ id: category.id, labelFa, labelEn },
...flattenCategories(category.children, labelFa),
{
id: category.id,
nameFa: category.nameFa,
nameEn: category.nameEn,
labelFa,
labelEn,
depth,
},
...flattenCategories(category.children, labelFa, depth + 1),
]
})
}