Files
myeasycms-v2/apps/dev-tool/components/app-sidebar.tsx
Giancarlo Buomprisco 7ebff31475 Next.js Supabase V3 (#463)
Version 3 of the kit:
- Radix UI replaced with Base UI (using the Shadcn UI patterns)
- next-intl replaces react-i18next
- enhanceAction deprecated; usage moved to next-safe-action
- main layout now wrapped with [locale] path segment
- Teams only mode
- Layout updates
- Zod v4
- Next.js 16.2
- Typescript 6
- All other dependencies updated
- Removed deprecated Edge CSRF
- Dynamic Github Action runner
2026-03-24 13:40:38 +08:00

125 lines
3.0 KiB
TypeScript

'use client';
import Link from 'next/link';
import { usePathname } from 'next/navigation';
import {
BoltIcon,
ComponentIcon,
DatabaseIcon,
FileTextIcon,
LanguagesIcon,
LayoutDashboardIcon,
MailIcon,
} from 'lucide-react';
import {
Sidebar,
SidebarGroup,
SidebarGroupLabel,
SidebarHeader,
SidebarMenu,
SidebarMenuButton,
SidebarMenuItem,
SidebarMenuSub,
SidebarMenuSubButton,
SidebarMenuSubItem,
} from '@kit/ui/sidebar';
import { isRouteActive } from '@kit/ui/utils';
const routes = [
{
label: 'Dashboard',
path: '/',
Icon: LayoutDashboardIcon,
},
{
label: 'Environment Variables',
path: '/variables',
Icon: BoltIcon,
},
{
label: 'Components',
path: '/components',
Icon: ComponentIcon,
},
{
label: 'Emails',
path: '/emails',
Icon: MailIcon,
},
{
label: 'Translations',
path: '/translations',
Icon: LanguagesIcon,
},
{
label: 'Database',
path: '/database',
Icon: DatabaseIcon,
},
{
label: 'PRD Manager',
path: '/prds',
Icon: FileTextIcon,
},
];
export function DevToolSidebar({
...props
}: React.ComponentProps<typeof Sidebar>) {
const pathname = usePathname();
return (
<Sidebar collapsible="icon" {...props}>
<SidebarHeader>
<b className="p-1 font-mono text-xs font-semibold">Makerkit Dev Tool</b>
</SidebarHeader>
<SidebarGroup className="group-data-[collapsible=icon]:hidden">
<SidebarGroupLabel>Dev Tools</SidebarGroupLabel>
<SidebarMenu>
{routes.map((route) => (
<SidebarMenuItem key={route.path || route.label}>
{'children' in route ? (
<>
<SidebarMenuButton>
<route.Icon className="h-4 w-4" />
<span>{route.label}</span>
</SidebarMenuButton>
<SidebarMenuSub>
{route.children.map((child) => (
<SidebarMenuSubItem key={child.path}>
<SidebarMenuSubButton
render={
<Link href={child.path}>
<child.Icon className="h-4 w-4" />
<span>{child.label}</span>
</Link>
}
isActive={isRouteActive(child.path, pathname, false)}
/>
</SidebarMenuSubItem>
))}
</SidebarMenuSub>
</>
) : (
<SidebarMenuButton
isActive={isRouteActive(route.path, pathname, false)}
render={
<Link href={route.path}>
<route.Icon className="h-4 w-4" />
<span>{route.label}</span>
</Link>
}
/>
)}
</SidebarMenuItem>
))}
</SidebarMenu>
</SidebarGroup>
</Sidebar>
);
}