frontend: add bookmark management and homepage navigation

Admin-only /bookmarks page for managing entries; homepage now renders
public bookmarks as a category-grouped navigation grid (empty state
links admin to the manager). Dashboard gains a recent-bookmarks card,
dock and main layout get a bookmark entry for admins, and the
middleware protects /bookmarks.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-03 01:51:55 +08:00
parent ffecc9451d
commit 37cecaa1ce
8 changed files with 625 additions and 42 deletions

View File

@@ -2,13 +2,15 @@
import { Dock, DockIcon } from "@/components/ui/dock";
import { signOut } from "next-auth/react";
import { Home, User, LogOut, Download, BookOpen, LayoutDashboard } from "lucide-react";
import { Home, User, LogOut, Download, BookOpen, LayoutDashboard, Bookmark } from "lucide-react";
export function HomeDock({
isAuthenticated,
isAdmin,
onLoginClick,
}: {
isAuthenticated: boolean;
isAdmin: boolean;
onLoginClick?: () => void;
}) {
return (
@@ -46,6 +48,13 @@ export function HomeDock({
</a>
</DockIcon>
)}
{isAdmin && (
<DockIcon>
<a href="/bookmarks" aria-label="书签">
<Bookmark className="h-5 w-5 text-slate-700" />
</a>
</DockIcon>
)}
<DockIcon>
{isAuthenticated ? (
<button