"use client"; import { signOut } from "@/app/login/actions"; import { Card, CardContent, Typography, } from "poyraz-ui/atoms"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "poyraz-ui/molecules"; import { SidebarBranding, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupLabel, SidebarHeader, SidebarMenu, SidebarMenuItem, SidebarPanel, SidebarProvider, SidebarRail, SidebarTrigger, SidebarUserProfile, useSidebar, } from "poyraz-ui/organisms"; import { ChevronUp, LogOut, Settings } from "lucide-react"; import type { LucideIcon } from "lucide-react"; import Image from "next/image"; import Link from "next/link"; import { usePathname } from "next/navigation"; export type AppShellNavItem = { title: string; href?: string; icon?: LucideIcon; }; export type AppShellNavGroup = { title: string; items: AppShellNavItem[]; }; export type AppShellBranding = { applicationName: string; organizationName: string | null; lightLogoUrl: string | null; darkLogoUrl: string | null; }; type ShellUser = { email: string; displayName: string; shortName: string; avatarUrl: string | null; }; type AppShellProps = { branding: AppShellBranding; children: React.ReactNode; homeHref: string; navGroups: AppShellNavGroup[]; settingsHref: string; user: ShellUser; progress?: number; }; export function AppShell({ branding, children, homeHref, navGroups, settingsHref, user, progress, }: AppShellProps) { const pathname = usePathname(); const sidebarProps = { branding, homeHref, navGroups, pathname, progress, settingsHref, user }; return (
Ana içeriğe geç
{children}
); } type SidebarCompositionProps = { branding: AppShellBranding; homeHref: string; navGroups: AppShellNavGroup[]; pathname: string; progress?: number; settingsHref: string; user: ShellUser; }; function DesktopSidebar(props: SidebarCompositionProps) { return ( ); } function MobileSidebar(props: SidebarCompositionProps) { return (
Menü
); } function SidebarComposition({ branding, homeHref, navGroups, pathname, progress, settingsHref, user, }: SidebarCompositionProps) { return ( <> } title={branding.applicationName} subtitle={branding.organizationName ?? "Freelancer portalı"} /> Kenar çubuğunu daralt {typeof progress === "number" ? : null} ); } function SidebarNavigation({ homeHref, navGroups, pathname, }: Pick) { const { setMobileOpen, variant } = useSidebar(); return navGroups.map((group) => ( {group.title} {group.items.map((item) => { const active = item.href === homeHref ? pathname === homeHref : item.href ? pathname === item.href || pathname.startsWith(`${item.href}/`) : false; const Icon = item.icon; return ( ); })} )); } function BrandMark({ branding }: { branding: AppShellBranding }) { const logoUrl = branding.lightLogoUrl ?? branding.darkLogoUrl; if (!logoUrl) { return ( {branding.applicationName.slice(0, 1).toLocaleUpperCase("tr-TR")} ); } return ( {branding.darkLogoUrl ? ( ) : null} ); } function MobileBrand({ branding }: { branding: AppShellBranding }) { return (
{branding.applicationName}
); } function ProgressSummary({ progress }: { progress: number }) { const normalizedProgress = Math.max(0, Math.min(100, progress)); return ( Proje ilerlemesi
%{normalizedProgress} tamamlandı
); } function AccountMenu({ user, settingsHref }: { user: ShellUser; settingsHref: string }) { return (
); }