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:
@@ -30,32 +30,16 @@ async function fetchPublicBookmarks(): Promise<Bookmark[]> {
|
||||
export default async function HomePage() {
|
||||
const session = await auth();
|
||||
const isAuthenticated = !!session?.user;
|
||||
const isAdmin = (session?.user as any)?.role === "admin";
|
||||
const role = (session?.user as { role?: string } | undefined)?.role;
|
||||
const isAdmin = role === "admin";
|
||||
|
||||
let healthText = "无法连接到后端服务";
|
||||
let bookmarks: Bookmark[] = [];
|
||||
|
||||
try {
|
||||
const res = await fetch(`${SERVER_API_URL}/api/health`, {
|
||||
cache: "no-store",
|
||||
});
|
||||
if (res.ok) {
|
||||
healthText = await res.text();
|
||||
} else {
|
||||
healthText = `后端异常: ${res.status}`;
|
||||
}
|
||||
} catch {
|
||||
healthText = "后端连接失败";
|
||||
}
|
||||
|
||||
bookmarks = await fetchPublicBookmarks();
|
||||
const bookmarks = await fetchPublicBookmarks();
|
||||
|
||||
return (
|
||||
<Suspense>
|
||||
<HomePageClient
|
||||
isAuthenticated={isAuthenticated}
|
||||
isAdmin={isAdmin}
|
||||
healthText={healthText}
|
||||
hasKeycloak={hasKeycloak}
|
||||
bookmarks={bookmarks}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user