feat: frontend MVP — auth, timeline, upload, albums, admin, image viewer
Backend: - user roles (DB + JWT + first-user-is-admin) - volume-aware file resolver (multi-volume asset serving) - directory scanner uses volume URI directly - date-summary endpoint (capture date from EXIF) - timeline ordered by capture date - list endpoints: volumes, plugins, pipelines, library paths - delete endpoints: volumes, library paths - configurable upload body limit (MAX_UPLOAD_BYTES) Frontend: - auth: login/register, token refresh, role-based admin gate - timeline: date-grouped grid, infinite scroll, date scrubber - image viewer: fullscreen zoom/pan/pinch, metadata sidebar - upload: drag-drop, sequential upload, progress tracking - albums: create, add/remove photos, asset picker dialog - admin: storage (import library), jobs (pagination, error details), plugins (list + toggle), pipelines, sidecars, duplicates - multi-select mode with add-to-album action - TanStack Query for all data fetching
This commit is contained in:
57
k-photos-frontend/components/admin-sidebar.tsx
Normal file
57
k-photos-frontend/components/admin-sidebar.tsx
Normal file
@@ -0,0 +1,57 @@
|
||||
"use client"
|
||||
|
||||
import Link from "next/link"
|
||||
import { usePathname } from "next/navigation"
|
||||
import { useAuth } from "@/hooks/use-auth"
|
||||
import {
|
||||
SidebarGroup,
|
||||
SidebarGroupLabel,
|
||||
SidebarGroupContent,
|
||||
SidebarMenu,
|
||||
SidebarMenuItem,
|
||||
SidebarMenuButton,
|
||||
} from "@/components/ui/sidebar"
|
||||
import {
|
||||
HardDriveIcon,
|
||||
ListIcon,
|
||||
PlugIcon,
|
||||
WorkflowIcon,
|
||||
FileTextIcon,
|
||||
CopyIcon,
|
||||
} from "lucide-react"
|
||||
|
||||
const ADMIN_LINKS = [
|
||||
{ href: "/admin/storage", label: "Storage", icon: HardDriveIcon },
|
||||
{ href: "/admin/jobs", label: "Jobs", icon: ListIcon },
|
||||
{ href: "/admin/plugins", label: "Plugins", icon: PlugIcon },
|
||||
{ href: "/admin/pipelines", label: "Pipelines", icon: WorkflowIcon },
|
||||
{ href: "/admin/sidecars", label: "Sidecars", icon: FileTextIcon },
|
||||
{ href: "/admin/duplicates", label: "Duplicates", icon: CopyIcon },
|
||||
]
|
||||
|
||||
export function AdminSidebar() {
|
||||
const { isAdmin } = useAuth()
|
||||
const pathname = usePathname()
|
||||
|
||||
if (!isAdmin) return null
|
||||
|
||||
return (
|
||||
<SidebarGroup>
|
||||
<SidebarGroupLabel>Admin</SidebarGroupLabel>
|
||||
<SidebarGroupContent>
|
||||
<SidebarMenu>
|
||||
{ADMIN_LINKS.map(({ href, label, icon: Icon }) => (
|
||||
<SidebarMenuItem key={href}>
|
||||
<SidebarMenuButton asChild isActive={pathname === href}>
|
||||
<Link href={href}>
|
||||
<Icon className="h-4 w-4" />
|
||||
<span>{label}</span>
|
||||
</Link>
|
||||
</SidebarMenuButton>
|
||||
</SidebarMenuItem>
|
||||
))}
|
||||
</SidebarMenu>
|
||||
</SidebarGroupContent>
|
||||
</SidebarGroup>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user