feat: use main navbar for canvas page
This commit is contained in:
parent
253c2b7e38
commit
485d6c0615
@ -1,4 +1,9 @@
|
||||
import { Metadata } from "next";
|
||||
import { Suspense } from "react";
|
||||
import { cookies } from "next/headers";
|
||||
import { auth } from "@/app/(auth)/auth";
|
||||
import { TopNavbar } from "@/components/top-navbar";
|
||||
import { getSiteSettings, getNavLinks } from "@/lib/db/queries";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "无限画布",
|
||||
@ -10,9 +15,37 @@ export default function CanvasEditorLayout({
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<Suspense fallback={<div className="h-screen w-screen bg-background" />}>
|
||||
<CanvasLayoutWrapper>{children}</CanvasLayoutWrapper>
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
|
||||
async function CanvasLayoutWrapper({ children }: { children: React.ReactNode }) {
|
||||
const [session, siteSettings, navLinks] = await Promise.all([
|
||||
auth(),
|
||||
getSiteSettings(),
|
||||
getNavLinks(),
|
||||
]);
|
||||
|
||||
return (
|
||||
<div className="h-screen w-screen overflow-hidden bg-background">
|
||||
{children}
|
||||
<TopNavbar
|
||||
siteName={siteSettings.siteName}
|
||||
siteLogo={siteSettings.siteLogo || undefined}
|
||||
siteLogoDark={siteSettings.siteLogoDark || undefined}
|
||||
isAdmin={session?.user?.type === "admin"}
|
||||
customLinks={navLinks.map(link => ({
|
||||
id: link.id,
|
||||
name: link.name,
|
||||
url: link.url,
|
||||
order: link.order
|
||||
}))}
|
||||
/>
|
||||
<div className="pt-12 h-full">
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@ -2,9 +2,7 @@
|
||||
|
||||
import { useEffect, useState, useCallback, use } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import Link from "next/link";
|
||||
import {
|
||||
ArrowLeft,
|
||||
Save,
|
||||
Undo2,
|
||||
Redo2,
|
||||
@ -17,15 +15,12 @@ import {
|
||||
Video,
|
||||
Type,
|
||||
Loader2,
|
||||
Settings,
|
||||
Trash2,
|
||||
Scissors,
|
||||
Sparkles,
|
||||
Expand,
|
||||
Maximize2,
|
||||
Move3D,
|
||||
Layers,
|
||||
MoreHorizontal,
|
||||
PanelLeftClose,
|
||||
PanelLeft,
|
||||
Download,
|
||||
@ -363,20 +358,9 @@ export default function CanvasEditorPage({ params }: PageProps) {
|
||||
<TooltipProvider>
|
||||
<div className="h-full flex flex-col bg-background">
|
||||
{/* 顶部工具栏 */}
|
||||
<div className="h-12 border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 flex items-center justify-between px-4 shrink-0">
|
||||
{/* 左侧:返回 + 标题 */}
|
||||
<div className="h-10 border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 flex items-center justify-between px-4 shrink-0">
|
||||
{/* 左侧:标题编辑 */}
|
||||
<div className="flex items-center gap-2">
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Button variant="ghost" size="icon" asChild>
|
||||
<Link href="/canvas">
|
||||
<ArrowLeft className="h-4 w-4" />
|
||||
</Link>
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>返回列表</TooltipContent>
|
||||
</Tooltip>
|
||||
|
||||
{isEditingTitle ? (
|
||||
<Input
|
||||
value={editTitle}
|
||||
@ -386,7 +370,7 @@ export default function CanvasEditorPage({ params }: PageProps) {
|
||||
if (e.key === 'Enter') handleUpdateTitle();
|
||||
if (e.key === 'Escape') setIsEditingTitle(false);
|
||||
}}
|
||||
className="h-8 w-48"
|
||||
className="h-7 w-48 text-sm"
|
||||
autoFocus
|
||||
/>
|
||||
) : (
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user