Files
meezi/web/dashboard/src/lib/sidebar-nav.ts
T
soroush.asadi cd1af30bbc
CI/CD / CI · API (dotnet build + test) (push) Successful in 5m50s
CI/CD / CI · Admin API (dotnet build) (push) Successful in 32s
CI/CD / CI · Dashboard (tsc) (push) Successful in 1m3s
CI/CD / CI · Admin Web (tsc) (push) Successful in 35s
CI/CD / CI · Website (tsc) (push) Successful in 44s
CI/CD / CI · Koja (tsc) (push) Successful in 48s
CI/CD / Deploy · all services (push) Has been cancelled
fix: sidebar accordion + koja slug + support ticket LINQ crash
Sidebar:
- All groups start collapsed on first load (v4 storage key resets old state)
- Opening one group closes all others (accordion)
- Navigating to a section opens only that section's group

Koja slug:
- SlugHelper: Persian->Latin transliteration, slug validation
- Registration accepts optional custom slug; auto-derives from cafe name
- Slug can be updated from dashboard Settings -> Profile
- Settings PATCH validates uniqueness (SLUG_TAKEN) and format (INVALID_SLUG)
- koja.meezi.ir/{slug} now redirects to /fa/cafe/{slug} (short URL support)

Bug fix:
- SupportTicketService: cafeId/status filters applied before Select() projection
  to fix EF "could not be translated" crash on the support tickets page

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-31 22:28:25 +03:30

135 lines
3.1 KiB
TypeScript

import type { LucideIcon } from "lucide-react";
import {
LayoutGrid,
UtensilsCrossed,
Users,
Ticket,
Package,
BookOpen,
UserCog,
BarChart3,
Calendar,
Star,
MessageSquare,
Receipt,
Settings,
ChefHat,
Bell,
ListOrdered,
Building2,
CreditCard,
Wallet,
Clock,
LifeBuoy,
Compass,
} from "lucide-react";
export type NavGroupId = "operations" | "menuSales" | "customers" | "finance" | "management";
export type NavItemKey =
| "pos"
| "tables"
| "queue"
| "kds"
| "notifications"
| "reservations"
| "menu"
| "inventory"
| "coupons"
| "crm"
| "sms"
| "reviews"
| "discover"
| "reports"
| "expenses"
| "shifts"
| "taxes"
| "hr"
| "branches"
| "subscription"
| "support"
| "settings";
export type NavItemDef = {
key: NavItemKey;
href: string;
icon: LucideIcon;
};
export type NavGroupDef = {
id: NavGroupId;
defaultOpen: boolean;
items: NavItemDef[];
};
export const NAV_GROUPS: NavGroupDef[] = [
{
id: "operations",
defaultOpen: true,
items: [
{ key: "pos", href: "/pos", icon: LayoutGrid },
{ key: "tables", href: "/tables", icon: UtensilsCrossed },
{ key: "queue", href: "/queue", icon: ListOrdered },
{ key: "kds", href: "/kds", icon: ChefHat },
{ key: "notifications", href: "/notifications", icon: Bell },
{ key: "reservations", href: "/reservations", icon: Calendar },
],
},
{
id: "menuSales",
defaultOpen: true,
items: [
{ key: "menu", href: "/menu", icon: BookOpen },
{ key: "inventory", href: "/inventory", icon: Package },
{ key: "coupons", href: "/coupons", icon: Ticket },
],
},
{
id: "customers",
defaultOpen: true,
items: [
{ key: "crm", href: "/crm", icon: Users },
{ key: "sms", href: "/sms", icon: MessageSquare },
{ key: "reviews", href: "/reviews", icon: Star },
{ key: "discover", href: "/discover", icon: Compass },
],
},
{
id: "finance",
defaultOpen: true,
items: [
{ key: "reports", href: "/reports", icon: BarChart3 },
{ key: "expenses", href: "/expenses", icon: Wallet },
{ key: "shifts", href: "/shifts", icon: Clock },
{ key: "taxes", href: "/taxes", icon: Receipt },
],
},
{
id: "management",
defaultOpen: true,
items: [
{ key: "hr", href: "/hr", icon: UserCog },
{ key: "branches", href: "/branches", icon: Building2 },
{ key: "subscription", href: "/subscription", icon: CreditCard },
{ key: "settings", href: "/settings", icon: Settings },
{ key: "support", href: "/support", icon: LifeBuoy },
],
},
];
export const NAV_GROUPS_STORAGE_KEY = "meezi:nav-groups:v4";
/** Branch-scoped staff only see daily operations. */
export const BRANCH_ONLY_NAV_GROUP: NavGroupId = "operations";
export function findNavGroupForPath(pathname: string): NavGroupId | null {
for (const group of NAV_GROUPS) {
for (const item of group.items) {
if (pathname === item.href || pathname.startsWith(`${item.href}/`)) {
return group.id;
}
}
}
return null;
}