mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-01-02 22:32:27 +08:00
refactor: Simplify Home component layout by integrating DiagramPageLayout functionality directly
This commit is contained in:
43
app/page.tsx
43
app/page.tsx
@@ -4,35 +4,28 @@ import { DrawIoEmbed } from "react-drawio";
|
|||||||
import ChatPanel from "@/components/chat-panel";
|
import ChatPanel from "@/components/chat-panel";
|
||||||
import { DiagramProvider, useDiagram } from "@/contexts/diagram-context";
|
import { DiagramProvider, useDiagram } from "@/contexts/diagram-context";
|
||||||
|
|
||||||
// Internal layout component
|
export default function Home() {
|
||||||
function DiagramPageLayout({ children }: { children: React.ReactNode }) {
|
|
||||||
const { drawioRef, handleDiagramExport } = useDiagram();
|
const { drawioRef, handleDiagramExport } = useDiagram();
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="flex h-screen bg-gray-100">
|
|
||||||
<div className="w-2/3 p-1 h-full relative">
|
|
||||||
<DrawIoEmbed
|
|
||||||
ref={drawioRef}
|
|
||||||
onExport={handleDiagramExport}
|
|
||||||
urlParameters={{
|
|
||||||
spin: true,
|
|
||||||
libraries: false,
|
|
||||||
saveAndExit: false,
|
|
||||||
noExitBtn: true,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className="w-1/3 h-full p-1">{children}</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function Home() {
|
|
||||||
return (
|
return (
|
||||||
<DiagramProvider>
|
<DiagramProvider>
|
||||||
<DiagramPageLayout>
|
<div className="flex h-screen bg-gray-100">
|
||||||
<ChatPanel />
|
<div className="w-2/3 p-1 h-full relative">
|
||||||
</DiagramPageLayout>
|
<DrawIoEmbed
|
||||||
|
ref={drawioRef}
|
||||||
|
onExport={handleDiagramExport}
|
||||||
|
urlParameters={{
|
||||||
|
spin: true,
|
||||||
|
libraries: false,
|
||||||
|
saveAndExit: false,
|
||||||
|
noExitBtn: true,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="w-1/3 h-full p-1">
|
||||||
|
<ChatPanel />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</DiagramProvider>
|
</DiagramProvider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user