2024-12-07 14:06:25 +00:00
|
|
|
"use client";
|
|
|
|
|
|
|
|
import {
|
|
|
|
Folder,
|
|
|
|
MoreHorizontal,
|
|
|
|
Share,
|
|
|
|
Trash2,
|
|
|
|
type LucideIcon,
|
|
|
|
} from "lucide-react";
|
|
|
|
import {
|
|
|
|
SidebarGroup,
|
|
|
|
SidebarGroupLabel,
|
|
|
|
SidebarMenu,
|
|
|
|
SidebarMenuAction,
|
|
|
|
SidebarMenuButton,
|
|
|
|
SidebarMenuItem,
|
|
|
|
useSidebar,
|
|
|
|
} from "@/components/ui/sidebar";
|
|
|
|
import {
|
|
|
|
DropdownMenu,
|
|
|
|
DropdownMenuContent,
|
|
|
|
DropdownMenuItem,
|
|
|
|
DropdownMenuSeparator,
|
|
|
|
DropdownMenuTrigger,
|
|
|
|
} from "@/components/ui/dropdown-menu";
|
2024-12-12 12:59:15 +00:00
|
|
|
import { useTranslations } from "next-intl";
|
2024-12-07 14:06:25 +00:00
|
|
|
|
|
|
|
export function NavProjects({
|
|
|
|
projects,
|
|
|
|
}: {
|
|
|
|
projects: {
|
|
|
|
name: string;
|
|
|
|
url: string;
|
|
|
|
icon: LucideIcon;
|
|
|
|
}[];
|
|
|
|
}) {
|
|
|
|
const { isMobile } = useSidebar();
|
2024-12-12 12:59:15 +00:00
|
|
|
const t = useTranslations("Components.NavProjects");
|
2024-12-07 14:06:25 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<SidebarGroup className="group-data-[collapsible=icon]:hidden">
|
2024-12-12 12:59:15 +00:00
|
|
|
<SidebarGroupLabel>{t("projects")}</SidebarGroupLabel>
|
2024-12-07 14:06:25 +00:00
|
|
|
<SidebarMenu>
|
|
|
|
{projects.map((item) => (
|
|
|
|
<SidebarMenuItem key={item.name}>
|
|
|
|
<SidebarMenuButton asChild>
|
|
|
|
<a href={item.url}>
|
|
|
|
<item.icon />
|
|
|
|
<span>{item.name}</span>
|
|
|
|
</a>
|
|
|
|
</SidebarMenuButton>
|
|
|
|
<DropdownMenu>
|
|
|
|
<DropdownMenuTrigger asChild>
|
|
|
|
<SidebarMenuAction showOnHover>
|
|
|
|
<MoreHorizontal />
|
2024-12-12 12:59:15 +00:00
|
|
|
<span className="sr-only">{t("more")}</span>
|
2024-12-07 14:06:25 +00:00
|
|
|
</SidebarMenuAction>
|
|
|
|
</DropdownMenuTrigger>
|
|
|
|
<DropdownMenuContent
|
|
|
|
className="w-48"
|
|
|
|
side={isMobile ? "bottom" : "right"}
|
|
|
|
align={isMobile ? "end" : "start"}
|
|
|
|
>
|
|
|
|
<DropdownMenuItem>
|
|
|
|
<Folder className="text-muted-foreground" />
|
2024-12-12 12:59:15 +00:00
|
|
|
<span>{t("viewProject")}</span>
|
2024-12-07 14:06:25 +00:00
|
|
|
</DropdownMenuItem>
|
|
|
|
<DropdownMenuItem>
|
|
|
|
<Share className="text-muted-foreground" />
|
2024-12-12 12:59:15 +00:00
|
|
|
<span>{t("shareProject")}</span>
|
2024-12-07 14:06:25 +00:00
|
|
|
</DropdownMenuItem>
|
|
|
|
<DropdownMenuSeparator />
|
|
|
|
<DropdownMenuItem>
|
|
|
|
<Trash2 className="text-muted-foreground" />
|
2024-12-12 12:59:15 +00:00
|
|
|
<span>{t("deleteProject")}</span>
|
2024-12-07 14:06:25 +00:00
|
|
|
</DropdownMenuItem>
|
|
|
|
</DropdownMenuContent>
|
|
|
|
</DropdownMenu>
|
|
|
|
</SidebarMenuItem>
|
|
|
|
))}
|
|
|
|
<SidebarMenuItem>
|
|
|
|
<SidebarMenuButton>
|
|
|
|
<MoreHorizontal />
|
2024-12-12 12:59:15 +00:00
|
|
|
<span>{t("more")}</span>
|
2024-12-07 14:06:25 +00:00
|
|
|
</SidebarMenuButton>
|
|
|
|
</SidebarMenuItem>
|
|
|
|
</SidebarMenu>
|
|
|
|
</SidebarGroup>
|
|
|
|
);
|
|
|
|
}
|