Add special orders admin UI and product specials tools.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Alireza Hassani
2026-10-12 23:09:31 +03:30
co-authored by Cursor
parent b103e330ef
commit d63e3a83d5
33 changed files with 2731 additions and 73 deletions
+2
View File
@@ -36,6 +36,8 @@ export type Product = {
category: ProductCategoryRef
intro?: string
description?: string
/** null / undefined = ready immediately */
preparationHours?: number | null
tags?: string[]
mainImageUrl: string | null
mainImageKey?: string | null
+14 -1
View File
@@ -9,6 +9,7 @@ export type UserTitle =
| 'خانم دکتر'
| 'جناب آقای مهندس'
| 'سرکار خانم مهندس'
| ''
export type User = {
id: string
@@ -25,7 +26,7 @@ export type User = {
export const userCategories: UserCategory[] = ['پزشک', 'کسبه', 'مهندس']
export const userTitles: UserTitle[] = [
export const userTitles: Exclude<UserTitle, ''>[] = [
'سرکار خانم',
'جناب آقای',
'جناب دکتر',
@@ -34,6 +35,18 @@ export const userTitles: UserTitle[] = [
'سرکار خانم مهندس',
]
/** Full display name; omits title when none is saved. */
export function formatUserName(user: {
title?: string | null
firstName: string
lastName: string
}) {
return [user.title, user.firstName, user.lastName]
.map((part) => part?.trim())
.filter(Boolean)
.join(' ')
}
/** Strip honorific title prefix from a full display name. */
export function stripUserTitle(fullName: string) {
const sorted = [...userTitles].sort((a, b) => b.length - a.length)