Consolida recepcoes, stock, equipamentos e identidade SGC

This commit is contained in:
2026-10-28 13:54:53 +02:00
parent eb1c8b8074
commit 75ffdb395c
76 changed files with 6933 additions and 152 deletions
+20 -4
View File
@@ -7,20 +7,36 @@ import {
SidebarMenuItem,
} from '@/components/ui/sidebar';
import { useCurrentUrl } from '@/hooks/use-current-url';
import { toUrl } from '@/lib/utils';
import type { NavItem } from '@/types';
export function NavMain({ items }: { items: NavItem[] }) {
const { isCurrentUrl } = useCurrentUrl();
export function NavMain({
items,
title = 'Navegação',
}: {
items: NavItem[];
title?: string;
}) {
const { isCurrentOrParentUrl, currentUrl } = useCurrentUrl();
const receivingOrder = /^\/ordens\/\d+\/recepcoes/.test(currentUrl);
return (
<SidebarGroup className="px-2 py-0">
<SidebarGroupLabel>Platform</SidebarGroupLabel>
<SidebarGroupLabel>{title}</SidebarGroupLabel>
<SidebarMenu>
{items.map((item) => (
<SidebarMenuItem key={item.title}>
<SidebarMenuButton
asChild
isActive={isCurrentUrl(item.href)}
isActive={
(toUrl(item.href) === '/recepcoes' &&
receivingOrder) ||
(isCurrentOrParentUrl(item.href) &&
!(
toUrl(item.href) === '/ordens' &&
receivingOrder
))
}
tooltip={{ children: item.title }}
>
<Link href={item.href} prefetch>