diff --git a/web/dashboard/src/app/[locale]/(dashboard)/layout.tsx b/web/dashboard/src/app/[locale]/(dashboard)/layout.tsx index c327a3c..c232527 100644 --- a/web/dashboard/src/app/[locale]/(dashboard)/layout.tsx +++ b/web/dashboard/src/app/[locale]/(dashboard)/layout.tsx @@ -37,7 +37,7 @@ export default function DashboardLayout({ const mainColumn = (
-
+
{children}
diff --git a/web/dashboard/src/components/branches/branches-screen.tsx b/web/dashboard/src/components/branches/branches-screen.tsx index 0e4e5ce..ea9f764 100644 --- a/web/dashboard/src/components/branches/branches-screen.tsx +++ b/web/dashboard/src/components/branches/branches-screen.tsx @@ -191,7 +191,7 @@ export function BranchesScreen() {

{b.scheduledPermanentDeleteAt ? (

- {new Date(b.scheduledPermanentDeleteAt).toLocaleString()} + {new Date(b.scheduledPermanentDeleteAt).toLocaleString("fa-IR")}

) : null} diff --git a/web/dashboard/src/components/expenses/expenses-screen.tsx b/web/dashboard/src/components/expenses/expenses-screen.tsx index 871a0ee..8d45e7e 100644 --- a/web/dashboard/src/components/expenses/expenses-screen.tsx +++ b/web/dashboard/src/components/expenses/expenses-screen.tsx @@ -11,6 +11,7 @@ import { isoTodayTehran } from "@/lib/reports/analytics"; import { PageHeader } from "@/components/layout/page-header"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; +import { JalaliDateField } from "@/components/ui/jalali-date-field"; import { LabeledField } from "@/components/ui/labeled-field"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; type Branch = { id: string; name: string }; @@ -172,27 +173,10 @@ export function ExpensesScreen() { - setFrom(e.target.value)} - /> + - setTo(e.target.value)} - /> +

diff --git a/web/dashboard/src/components/layout/header-center-cluster.tsx b/web/dashboard/src/components/layout/header-center-cluster.tsx index ca5b158..cf76757 100644 --- a/web/dashboard/src/components/layout/header-center-cluster.tsx +++ b/web/dashboard/src/components/layout/header-center-cluster.tsx @@ -50,7 +50,7 @@ export function HeaderCenterCluster() { return (

void; +}) { + const Icon = item.icon; + return ( + + + {label} + + ); +} + +export function MobileNav() { + const t = useTranslations("nav"); + const tGroups = useTranslations("nav.groups"); + const tBrand = useTranslations("brand"); + const locale = useLocale(); + const pathname = usePathname(); + const user = useAuthStore((s) => s.user); + const role = user?.role; + const branchId = user?.branchId ?? null; + const permissions = useMemo(() => permissionsOf(user), [user]); + const [open, setOpen] = useState(false); + const [mounted, setMounted] = useState(false); + + useEffect(() => setMounted(true), []); + + // Close on Escape; lock body scroll while open. + useEffect(() => { + if (!open) return; + const onKey = (e: KeyboardEvent) => { + if (e.key === "Escape") setOpen(false); + }; + document.addEventListener("keydown", onKey); + const prevOverflow = document.body.style.overflow; + document.body.style.overflow = "hidden"; + return () => { + document.removeEventListener("keydown", onKey); + document.body.style.overflow = prevOverflow; + }; + }, [open]); + + const close = () => setOpen(false); + const isRtl = locale !== "en"; + + const visible = (items: NavItemDef[]) => + items.filter((item) => canSeeNavItem(item.key, role, branchId, permissions)); + + const isActive = (item: NavItemDef) => + item.href === "/" + ? pathname === "/" + : pathname === item.href || pathname.startsWith(`${item.href}/`); + + return ( + <> + + + {mounted && + open && + createPortal( +
+ {/* Backdrop */} + +
+ + + + {user && ( +
+
+ + {(user.actor ?? user.role).charAt(0).toUpperCase()} + +
+
+

{user.actor ?? user.userId}

+

{user.role}

+
+
+ )} +
+
, + document.body + )} + + ); +} diff --git a/web/dashboard/src/components/layout/sidebar.tsx b/web/dashboard/src/components/layout/sidebar.tsx index ea08798..e2652e3 100644 --- a/web/dashboard/src/components/layout/sidebar.tsx +++ b/web/dashboard/src/components/layout/sidebar.tsx @@ -283,7 +283,8 @@ export function Sidebar({ side }: { side: "left" | "right" }) { return (