suna/frontend/src/app/dashboard/layout.tsx

67 lines
1.8 KiB
TypeScript
Raw Normal View History

2025-04-16 13:41:55 +08:00
"use client"
2025-04-16 02:14:58 +08:00
import { SidebarLeft } from "@/components/dashboard/sidebar/sidebar-left"
import {
SidebarInset,
SidebarProvider,
SidebarTrigger,
} from "@/components/ui/sidebar"
2025-04-16 02:37:56 +08:00
import {
Breadcrumb,
BreadcrumbItem,
BreadcrumbList,
BreadcrumbPage,
} from "@/components/ui/breadcrumb"
import { Separator } from "@/components/ui/separator"
2025-04-16 13:41:55 +08:00
import { Button } from "@/components/ui/button"
import { Copy } from "lucide-react"
import { usePathname } from "next/navigation"
import { toast } from "sonner"
2025-04-16 02:37:56 +08:00
2025-04-16 02:14:58 +08:00
interface DashboardLayoutProps {
children: React.ReactNode
2025-04-13 00:37:45 +08:00
}
2025-04-16 13:41:55 +08:00
export default function DashboardLayout({
2025-04-13 00:37:45 +08:00
children,
2025-04-16 02:14:58 +08:00
}: DashboardLayoutProps) {
2025-04-16 13:41:55 +08:00
const pathname = usePathname()
const copyCurrentUrl = () => {
const url = window.location.origin + pathname
navigator.clipboard.writeText(url)
toast.success("URL copied to clipboard")
}
2025-04-12 02:57:17 +08:00
2025-04-12 08:04:40 +08:00
return (
2025-04-16 02:14:58 +08:00
<SidebarProvider>
2025-04-16 08:04:04 +08:00
<SidebarLeft />
2025-04-16 02:14:58 +08:00
<SidebarInset>
2025-04-16 02:37:56 +08:00
<header className="bg-background sticky top-0 flex h-14 shrink-0 items-center gap-2">
<div className="flex flex-1 items-center gap-2 px-3">
<SidebarTrigger />
2025-04-16 13:41:55 +08:00
</div>
<div className="absolute left-1/2 -translate-x-1/2 text-sm font-medium tracking-wide uppercase text-muted-foreground">
Dynamic Page Title
</div>
<div className="flex items-center pr-4">
<Button
variant="ghost"
size="icon"
onClick={copyCurrentUrl}
className="h-9 w-9"
>
<Copy className="h-4 w-4" />
</Button>
2025-04-16 02:37:56 +08:00
</div>
</header>
2025-04-16 08:04:04 +08:00
<div className="bg-background">
{children}
</div>
2025-04-16 02:14:58 +08:00
</SidebarInset>
{/* <SidebarRight /> */}
</SidebarProvider>
)
2025-04-16 01:20:15 +08:00
}