feat(freight:backoffice): added org structure managemnet

This commit is contained in:
Michael Abebe
2026-05-25 15:50:09 +03:00
parent 2272255bef
commit 516d2c8b45
7 changed files with 1878 additions and 37 deletions

View File

@@ -83,34 +83,38 @@ const Sidebar = ({
item.children?.some((child) =>
activePath.startsWith(child.href.toLowerCase()),
) ?? false;
const isActive =
activePath === itemHref ||
activePath.startsWith(`${itemHref}/`) ||
childActive;
const isCurrentItem = hasChildren
? activePath === itemHref
: activePath === itemHref || activePath.startsWith(`${itemHref}/`);
const isSectionActive = childActive && !isCurrentItem;
return (
<div key={item.href} className="flex flex-col gap-1">
<div
className={clsx(
"group flex items-center gap-2 rounded-md transition",
isActive
isCurrentItem
? "bg-sidebar-primary text-sidebar-primary-foreground shadow-sm"
: "text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
: isSectionActive
? "bg-sidebar-accent/70 text-sidebar-accent-foreground"
: "text-sidebar-foreground hover:bg-sidebar-accent/60 hover:text-sidebar-accent-foreground",
)}
>
<a
href={item.href}
onClick={(event) => navigateTo(event, item.href)}
aria-current={isActive ? "page" : undefined}
aria-current={isCurrentItem ? "page" : undefined}
className="flex min-w-0 flex-1 items-center gap-3 px-3 py-2.5 text-sm font-medium"
>
{item.icon ? (
<span
className={clsx(
"flex h-5 w-5 items-center justify-center [&_svg]:h-5 [&_svg]:w-5",
isActive
isCurrentItem
? "text-white"
: "text-slate-500 group-hover:text-[#10B981] dark:text-slate-400 dark:group-hover:text-white",
: isSectionActive
? "text-[#10B981] dark:text-emerald-300"
: "text-slate-500 group-hover:text-[#10B981] dark:text-slate-400 dark:group-hover:text-white",
)}
>
{item.icon}
@@ -131,9 +135,11 @@ const Sidebar = ({
}
className={clsx(
"mr-2 inline-flex h-8 w-8 items-center justify-center rounded-md transition",
isActive
isCurrentItem
? "text-white/90 hover:bg-white/10"
: "text-slate-500 hover:bg-sidebar-accent dark:text-slate-400",
: isSectionActive
? "text-[#10B981] hover:bg-sidebar-accent/80 dark:text-emerald-300"
: "text-slate-500 hover:bg-sidebar-accent/60 dark:text-slate-400",
)}
>
<ChevronDown
@@ -161,7 +167,7 @@ const Sidebar = ({
"rounded-md px-3 py-2 text-sm transition",
childActiveHref
? "bg-sidebar-primary text-sidebar-primary-foreground shadow-sm"
: "text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
: "text-sidebar-foreground hover:bg-sidebar-accent/60 hover:text-sidebar-accent-foreground",
)}
>
{child.label}