"use client"; import { usePathname } from "next/navigation"; import { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarMenu, SidebarMenuButton, SidebarMenuItem, } from "@/components/ui/sidebar"; import { ArrowLeft, ClipboardList, Eye, FilePenLine, LayoutDashboard, Settings, } from "lucide-react"; import { ThemeToggle } from "@/components/theme-toggle"; import { DropdownMenuAvatar, type DiscordMemberProfile, } from "@/components/dropdown-menu-avatar"; import { GuardedLink } from "@/components/guarded-link"; import { Badge } from "@/components/ui/badge"; export function FormAdminSidebar({ formId, formTitle, isOpen, userName, userImage, profile, }: { formId: string; formTitle: string; isOpen: boolean; userName?: string; userImage?: string; profile?: DiscordMemberProfile | null; }) { const pathname = usePathname(); const currentSection = pathname.startsWith(`/admin/form/${formId}/result`) ? "Responses" : pathname.startsWith(`/admin/form/${formId}/extra`) ? "Settings" : pathname.startsWith(`/admin/form/${formId}/preview`) ? "Preview" : "Editor"; const items = [ { href: `/admin/form/${formId}`, label: "Editor", icon: LayoutDashboard, active: pathname === `/admin/form/${formId}`, }, { href: `/admin/form/${formId}/result`, label: "Responses", icon: ClipboardList, active: pathname.startsWith(`/admin/form/${formId}/result`), }, { href: `/admin/form/${formId}/extra`, label: "Settings", icon: Settings, active: pathname.startsWith(`/admin/form/${formId}/extra`), }, { href: `/admin/form/${formId}/preview`, label: "Preview", icon: Eye, active: pathname.startsWith(`/admin/form/${formId}/preview`), }, ]; return (
{formTitle} {isOpen ? "Open" : "Closed"}
{currentSection}
All forms
Workspace {items.map(({ href, label, icon: Icon, active }) => ( {label} ))}
{(userName || profile) && ( )}
); }