Spaces:
Runtime error
Runtime error
Download src/app/dashboard/layout.tsx from damndeepesh-dev/RippleWorkers: direct link, hf CLI and curl.
- Browser
- Download file 6.83 kB
-
https://huggingface.co/spaces/damndeepesh-dev/RippleWorkers/resolve/main/src/app/dashboard/layout.tsx
- Command line
-
hf download hf://spaces/damndeepesh-dev/RippleWorkers/src/app/dashboard/layout.tsx
-
curl -L -o layout.tsx https://huggingface.co/spaces/damndeepesh-dev/RippleWorkers/resolve/main/src/app/dashboard/layout.tsx
6.83 kB
| import { createClient } from "@/lib/supabase/server"; | |
| import { redirect } from "next/navigation"; | |
| import Link from "next/link"; | |
| import { LayoutDashboard, PenSquare, Calendar, Settings, LogOut, PlusCircle, Layers, FileEdit, History as HistoryIcon, Clock, Users, MessageSquare } from "lucide-react"; | |
| import { ThemeToggle } from "@/components/ThemeToggle"; | |
| import LogoutButton from "@/components/dashboard/LogoutButton"; | |
| export default async function DashboardLayout({ | |
| children, | |
| }: { | |
| children: React.ReactNode; | |
| }) { | |
| const supabase = await createClient(); | |
| const { data: { user } } = await supabase.auth.getUser(); | |
| if (!user) { | |
| redirect("/"); | |
| } | |
| return ( | |
| <div className="flex h-screen bg-background text-foreground font-sans"> | |
| <div className="md:hidden fixed top-0 left-0 right-0 z-50 bg-background border-b border-border-subtle p-3 flex justify-between items-center"> | |
| <span className="font-semibold text-sm">Ripple</span> | |
| <div className="flex items-center gap-4"> | |
| <Link href="/dashboard"><LayoutDashboard size={18} /></Link> | |
| <Link href="/dashboard/create"><PlusCircle size={18} /></Link> | |
| <ThemeToggle /> | |
| <LogoutButton /> | |
| </div> | |
| </div> | |
| {/* Sidebar (Desktop) */} | |
| <aside className="w-60 bg-sidebar border-r border-border-subtle flex flex-col hidden md:flex transition-all duration-300"> | |
| {/* Brand & Workspace */} | |
| {/* Brand & Workspace */} | |
| <div className="h-12 flex items-center px-4 border-b border-transparent mb-2"> | |
| <Link href="/dashboard" className="flex items-center gap-2 hover:bg-black/5 dark:hover:bg-white/5 p-1 rounded-md transition-colors -ml-1"> | |
| <div className="w-5 h-5 rounded bg-primary-green flex items-center justify-center text-white text-[10px] font-bold">R</div> | |
| <span className="font-medium text-sm truncate">Ripple</span> | |
| </Link> | |
| <div className="ml-auto z-10"> | |
| <ThemeToggle /> | |
| </div> | |
| </div> | |
| <nav className="flex-1 px-2 py-2 space-y-6 overflow-y-auto scrollbar-none"> | |
| {/* Create Section */} | |
| <div> | |
| <p className="px-3 text-[11px] font-medium text-gray-400 mb-1">Actions</p> | |
| <div className="space-y-0.5"> | |
| <Link href="/dashboard/create" className="flex items-center gap-2.5 px-3 py-1.5 text-sm text-foreground/80 hover:bg-black/5 dark:hover:bg-white/5 rounded-md transition-colors"> | |
| <PlusCircle size={16} className="text-gray-400" /> | |
| New post | |
| </Link> | |
| <Link href="/dashboard/automations" className="flex items-center gap-2.5 px-3 py-1.5 text-sm text-foreground/80 hover:bg-black/5 dark:hover:bg-white/5 rounded-md transition-colors"> | |
| <MessageSquare size={16} className="text-gray-400" /> | |
| Automations | |
| </Link> | |
| </div> | |
| </div> | |
| {/* Posts Section */} | |
| <div> | |
| <p className="px-3 text-[11px] font-medium text-gray-400 mb-1">Content</p> | |
| <div className="space-y-0.5"> | |
| <Link href="/dashboard/calendar" className="flex items-center gap-2.5 px-3 py-1.5 text-sm text-foreground/80 hover:bg-black/5 dark:hover:bg-white/5 rounded-md transition-colors"> | |
| <Calendar size={16} className="text-gray-400" /> | |
| Calendar | |
| </Link> | |
| <Link href="/dashboard/posts" className="flex items-center gap-2.5 px-3 py-1.5 text-sm text-foreground/80 hover:bg-black/5 dark:hover:bg-white/5 rounded-md transition-colors"> | |
| <Layers size={16} className="text-gray-400" /> | |
| All Posts | |
| </Link> | |
| <Link href="/dashboard/drafts" className="flex items-center gap-2.5 px-3 py-1.5 text-sm text-foreground/80 hover:bg-black/5 dark:hover:bg-white/5 rounded-md transition-colors"> | |
| <FileEdit size={16} className="text-gray-400" /> | |
| Drafts | |
| </Link> | |
| </div> | |
| </div> | |
| {/* Configuration Section */} | |
| <div> | |
| <p className="px-3 text-[11px] font-medium text-gray-400 mb-1">Settings</p> | |
| <div className="space-y-0.5"> | |
| <Link href="/dashboard/connections" className="flex items-center gap-2.5 px-3 py-1.5 text-sm text-foreground/80 hover:bg-black/5 dark:hover:bg-white/5 rounded-md transition-colors"> | |
| <Users size={16} className="text-gray-400" /> | |
| Connections | |
| </Link> | |
| <Link href="/dashboard/settings" className="flex items-center gap-2.5 px-3 py-1.5 text-sm text-foreground/80 hover:bg-black/5 dark:hover:bg-white/5 rounded-md transition-colors"> | |
| <Settings size={16} className="text-gray-400" /> | |
| Preferences | |
| </Link> | |
| </div> | |
| </div> | |
| </nav> | |
| <div className="p-2 border-t border-border-subtle space-y-1"> | |
| <Link href="/dashboard/settings" className="flex items-center gap-3 px-2 py-2 hover:bg-black/5 dark:hover:bg-white/5 rounded-md transition-colors"> | |
| <div className="w-6 h-6 rounded bg-gray-200 dark:bg-gray-700 flex items-center justify-center text-[10px] overflow-hidden"> | |
| {user.user_metadata?.avatar_url || user.user_metadata?.picture ? <img src={user.user_metadata?.avatar_url || user.user_metadata?.picture} className="w-full h-full object-cover" /> : "U"} | |
| </div> | |
| <span className="text-sm font-medium truncate flex-1">{user.user_metadata?.full_name || user.email}</span> | |
| </Link> | |
| <LogoutButton /> | |
| </div> | |
| </aside> | |
| {/* Main Content */} | |
| <main className="flex-1 overflow-y-auto pt-14 md:pt-0"> | |
| {children} | |
| </main> | |
| </div > | |
| ); | |
| } | |