frontend: rebuild bookmark page with drag-and-drop, search, and theme system
- bookmark management with dnd-kit reordering, bulk edit, search, category filter/rename, and meta auto-fetch - migrate /bookmarks → /dashboard/bookmarks under (main) layout - homepage redesign with category grid, /-key search, dock tooltips - theme toggle + use-theme, sonner toasts, alert-dialog/skeleton, visual refresh of auth pages Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
File diff suppressed because it is too large
Load Diff
16
frontend/app/(main)/dashboard/bookmarks/page.tsx
Normal file
16
frontend/app/(main)/dashboard/bookmarks/page.tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
import type { Metadata } from "next";
|
||||
import { redirect } from "next/navigation";
|
||||
import { auth } from "@/auth";
|
||||
import { BookmarkManager } from "./bookmark-manager";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "书签管理",
|
||||
};
|
||||
|
||||
export default async function BookmarksPage() {
|
||||
const session = await auth();
|
||||
const role = (session?.user as { role?: string } | undefined)?.role;
|
||||
if (role !== "admin") redirect("/unauthorized");
|
||||
|
||||
return <BookmarkManager />;
|
||||
}
|
||||
@@ -1,8 +1,13 @@
|
||||
import type { Metadata } from "next";
|
||||
import { auth } from "@/auth";
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Globe, ExternalLink } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "仪表盘",
|
||||
};
|
||||
|
||||
const SERVER_API_URL = process.env.SERVER_API_URL || "http://backend:8080";
|
||||
|
||||
interface Bookmark {
|
||||
@@ -65,7 +70,7 @@ export default async function DashboardPage() {
|
||||
<CardTitle>最近书签</CardTitle>
|
||||
{isAdmin && (
|
||||
<Link
|
||||
href="/bookmarks"
|
||||
href="/dashboard/bookmarks"
|
||||
className="text-sm text-primary hover:underline"
|
||||
>
|
||||
管理 →
|
||||
@@ -92,6 +97,9 @@ export default async function DashboardPage() {
|
||||
<img
|
||||
src={bm.icon}
|
||||
alt=""
|
||||
width={16}
|
||||
height={16}
|
||||
loading="lazy"
|
||||
className="size-4 object-contain"
|
||||
/>
|
||||
) : (
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import Link from "next/link";
|
||||
import { auth } from "@/auth";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { signOut } from "@/auth";
|
||||
import { HomeDock } from "../home-dock";
|
||||
|
||||
export default async function MainLayout({
|
||||
children,
|
||||
@@ -9,38 +7,15 @@ export default async function MainLayout({
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const session = await auth();
|
||||
const user = session?.user as any;
|
||||
const user = session?.user as { role?: string } | undefined;
|
||||
const isAdmin = user?.role === "admin";
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-gray-50">
|
||||
<header className="border-b bg-white">
|
||||
<div className="mx-auto flex max-w-6xl items-center justify-between px-4 py-3">
|
||||
<Link href="/" className="text-lg font-bold">
|
||||
EvanPage
|
||||
</Link>
|
||||
<nav className="flex items-center gap-4">
|
||||
<Link href="/dashboard" className="text-sm hover:underline">
|
||||
仪表盘
|
||||
</Link>
|
||||
{user?.role === "admin" && (
|
||||
<Link href="/bookmarks" className="text-sm hover:underline">
|
||||
书签
|
||||
</Link>
|
||||
)}
|
||||
<form
|
||||
action={async () => {
|
||||
"use server";
|
||||
await signOut({ redirectTo: "/login" });
|
||||
}}
|
||||
>
|
||||
<Button variant="ghost" size="sm" type="submit">
|
||||
退出
|
||||
</Button>
|
||||
</form>
|
||||
</nav>
|
||||
</div>
|
||||
</header>
|
||||
<main className="mx-auto max-w-6xl px-4 py-6">{children}</main>
|
||||
<div className="min-h-screen bg-gradient-to-br from-background via-background to-muted/40">
|
||||
<main className="mx-auto max-w-6xl px-4 pt-8 pb-32 sm:px-6 sm:pt-12 lg:px-8">
|
||||
{children}
|
||||
</main>
|
||||
<HomeDock isAuthenticated={!!session?.user} isAdmin={isAdmin} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user