Add roll-call Start/Stop UX to business and customer dashboards.
Owners/admins can run timed work days, manage tasks in a modal, and stop from the FAB or row control. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
ac287e02cc
commit
c4e846564e
@@ -1,6 +1,17 @@
|
||||
import type { BusinessCategory } from '../types/category'
|
||||
import type { MultiSelectOption } from '../components/MultiSelectDropdown'
|
||||
|
||||
/** Match IranBay: "English / فارسی" when both exist. */
|
||||
export function businessCategoryLabel(
|
||||
category: Pick<BusinessCategory, 'name' | 'nameFa'>,
|
||||
) {
|
||||
const nameFa = category.nameFa?.trim()
|
||||
if (nameFa && nameFa !== category.name) {
|
||||
return `${category.name} / ${nameFa}`
|
||||
}
|
||||
return category.name
|
||||
}
|
||||
|
||||
export function flattenBusinessCategories(
|
||||
categories: BusinessCategory[],
|
||||
): MultiSelectOption<number>[] {
|
||||
@@ -12,7 +23,15 @@ export function flattenBusinessCategories(
|
||||
.sort((a, b) => a.sortOrder - b.sortOrder || a.name.localeCompare(b.name))
|
||||
|
||||
for (const child of children) {
|
||||
result.push({ value: child.id, label: child.name, depth })
|
||||
const keywords = [child.name, child.nameFa ?? '', child.slug, ...(child.tags ?? [])]
|
||||
.join(' ')
|
||||
.trim()
|
||||
result.push({
|
||||
value: child.id,
|
||||
label: businessCategoryLabel(child),
|
||||
depth,
|
||||
keywords,
|
||||
})
|
||||
walk(child.id, depth + 1)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user