remove homepage board
This commit is contained in:
parent
9777084ca8
commit
299f3eff87
40
src/App.tsx
40
src/App.tsx
|
|
@ -1,19 +1,13 @@
|
|||
import { inject } from '@vercel/analytics';
|
||||
import "tldraw/tldraw.css";
|
||||
import "@/css/style.css"
|
||||
import { useEffect, useState } from "react";
|
||||
import ReactDOM from "react-dom/client";
|
||||
import { Default } from "@/components/Default";
|
||||
import { Canvas } from "@/components/Canvas";
|
||||
import { Toggle } from "@/components/Toggle";
|
||||
import { useCanvas } from "@/hooks/useCanvas"
|
||||
import { createShapes } from "@/utils/utils";
|
||||
import { BrowserRouter, Route, Routes } from 'react-router-dom';
|
||||
import { Contact } from "@/components/Contact";
|
||||
import { Post } from '@/components/Post';
|
||||
import { Board } from './components/Board';
|
||||
import { Inbox } from './components/Inbox';
|
||||
import { Books } from './components/Books';
|
||||
import {
|
||||
Editor,
|
||||
Tldraw,
|
||||
|
|
@ -32,7 +26,6 @@ inject();
|
|||
const customShapeUtils = [ChatBoxShape, VideoChatShape, EmbedShape];
|
||||
const customTools = [ChatBoxTool, VideoChatTool, EmbedTool];
|
||||
|
||||
// [2]
|
||||
export default function InteractiveShapeExample() {
|
||||
return (
|
||||
<div className="tldraw__editor">
|
||||
|
|
@ -50,7 +43,6 @@ export default function InteractiveShapeExample() {
|
|||
);
|
||||
}
|
||||
|
||||
// Add this function before or after InteractiveShapeExample
|
||||
const handleInitialShapeLoad = (editor: Editor) => {
|
||||
const url = new URL(window.location.href);
|
||||
const shapeId = url.searchParams.get('shapeId') || url.searchParams.get('frameId');
|
||||
|
|
@ -75,7 +67,6 @@ const handleInitialShapeLoad = (editor: Editor) => {
|
|||
console.log('Zooming to shape bounds');
|
||||
editor.zoomToBounds(editor.getShapeGeometry(shape).bounds, {
|
||||
targetZoom: 1,
|
||||
//padding: 32
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
|
@ -94,42 +85,13 @@ function App() {
|
|||
// <React.StrictMode>
|
||||
<BrowserRouter>
|
||||
<Routes>
|
||||
<Route path="/" element={<Home />} />
|
||||
<Route path="/" element={<Default />} />
|
||||
<Route path="/card/contact" element={<Contact />} />
|
||||
<Route path="/posts/:slug" element={<Post />} />
|
||||
<Route path="/board/:slug" element={<Board />} />
|
||||
<Route path="/inbox" element={<Inbox />} />
|
||||
<Route path="/books" element={<Books />} />
|
||||
</Routes>
|
||||
</BrowserRouter>
|
||||
// </React.StrictMode>
|
||||
);
|
||||
};
|
||||
|
||||
function Home() {
|
||||
const { isCanvasEnabled, elementsInfo } = useCanvas();
|
||||
const shapes = createShapes(elementsInfo)
|
||||
const [isEditorMounted, setIsEditorMounted] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
const handleEditorDidMount = () => {
|
||||
setIsEditorMounted(true);
|
||||
};
|
||||
|
||||
window.addEventListener('editorDidMountEvent', handleEditorDidMount);
|
||||
|
||||
return () => {
|
||||
window.removeEventListener('editorDidMountEvent', handleEditorDidMount);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Toggle />
|
||||
<div style={{ zIndex: 999999 }} className={`${isCanvasEnabled && isEditorMounted ? 'transparent' : ''}`}>
|
||||
{<Default />}
|
||||
</div>
|
||||
{isCanvasEnabled && elementsInfo.length > 0 ? <Canvas shapes={shapes} /> : null}
|
||||
</>
|
||||
)
|
||||
}
|
||||
49322
src/canvas01.ts
49322
src/canvas01.ts
File diff suppressed because it is too large
Load Diff
|
|
@ -1,15 +0,0 @@
|
|||
|
||||
import { Editor, Tldraw } from "tldraw";
|
||||
import { canvas } from "@/canvas01";
|
||||
|
||||
export function Books() {
|
||||
return (
|
||||
<div className="tldraw__editor">
|
||||
<Tldraw
|
||||
onMount={(editor: Editor) => {
|
||||
editor.putContentOntoCurrentPage(canvas as any)
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
import { Editor, Tldraw, TLShape, TLUiComponents } from "tldraw";
|
||||
import { SimController } from "@/physics/PhysicsControls";
|
||||
import { HTMLShapeUtil } from "@/utils/HTMLShapeUtil";
|
||||
|
||||
const components: TLUiComponents = {
|
||||
HelpMenu: null,
|
||||
StylePanel: null,
|
||||
PageMenu: null,
|
||||
NavigationPanel: null,
|
||||
DebugMenu: null,
|
||||
//ContextMenu: null,
|
||||
ActionsMenu: null,
|
||||
QuickActions: null,
|
||||
MainMenu: null,
|
||||
MenuPanel: null,
|
||||
}
|
||||
|
||||
export function Canvas({ shapes }: { shapes: TLShape[]; }) {
|
||||
|
||||
return (
|
||||
<div className="tldraw__editor">
|
||||
<Tldraw
|
||||
components={components}
|
||||
shapeUtils={[HTMLShapeUtil]}
|
||||
onMount={(_: Editor) => {
|
||||
window.dispatchEvent(new CustomEvent('editorDidMountEvent'));
|
||||
}}
|
||||
>
|
||||
<SimController shapes={shapes} />
|
||||
</Tldraw>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue