Skip to content

Commit 0486b36

Browse files
committed
Add sample mind map option on new project creation and adjust editor initialization
1 parent 053714f commit 0486b36

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

src/app/(projects)/editor/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default function EditorRootPage() {
2222
// Not logged in - create new project
2323
const newMindMapId = nanoid(10);
2424

25-
router.replace(`/editor/${newMindMapId}`);
25+
router.replace(`/editor/${newMindMapId}?showSample=true`);
2626

2727
return;
2828
}
@@ -36,7 +36,7 @@ export default function EditorRootPage() {
3636
// No existing projects - create new one
3737
const newMindMapId = nanoid(10);
3838

39-
router.replace(`/editor/${newMindMapId}`);
39+
router.replace(`/editor/${newMindMapId}?showSample=true`);
4040
} else {
4141
// Show dialog to choose project
4242
setShouldShowDialog(true);

src/components/editor/editor.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
NodeChange, // Add this import
1414
} from "@xyflow/react";
1515
import { toast } from "sonner";
16-
import { useParams } from "next/navigation";
16+
import { useParams, useSearchParams } from "next/navigation";
1717
import { useSession } from "next-auth/react";
1818
import { nanoid } from "nanoid";
1919

@@ -181,6 +181,8 @@ const findFreePosition = (
181181
};
182182

183183
export default function Editor() {
184+
const searchParams = useSearchParams();
185+
const showSample = searchParams?.get("showSample") === "true";
184186
const { isFullScreen, setIsFullScreen } = useEditor();
185187
const {
186188
getIntersectingNodes,
@@ -193,8 +195,12 @@ export default function Editor() {
193195

194196
const [isPropertiesPanelVisible, setIsPropertiesPanelVisible] =
195197
useState(false);
196-
const [nodes, setNodes, onNodesChange] = useNodesState(initialNodes);
197-
const [edges, setEdges, onEdgesChange] = useEdgesState(initialEdges);
198+
const [nodes, setNodes, onNodesChange] = useNodesState(
199+
showSample ? initialNodes : [],
200+
);
201+
const [edges, setEdges, onEdgesChange] = useEdgesState(
202+
showSample ? initialEdges : [],
203+
);
198204
const [selectedNodeIds, setSelectedNodeIds] = useState<string[]>([]);
199205
const [selectedNodeId, setSelectedNodeId] = useState<string | null>(null);
200206
const [selectedEdgeId, setSelectedEdgeId] = useState<string | null>(null);

src/components/editor/menubar.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ export const Menubar = ({
164164
position="sticky"
165165
>
166166
<MUIToolbar
167-
className="bg-menuBar-background border-b border-b-panels-border text-menuBar-text"
167+
className="bg-menuBar-background border-b border-b-panels-border text-menuBar-text pl-3"
168168
variant="dense"
169169
>
170170
<Box
@@ -182,12 +182,12 @@ export const Menubar = ({
182182
>
183183
<Image
184184
alt="Logo"
185-
className="w-8 h-8 object-contain"
186-
height={28}
185+
className="w-6 h-6 object-contain"
186+
height={22}
187187
src="/app_icon.svg"
188-
width={28}
188+
width={26}
189189
/>
190-
<Box width={1} />
190+
<Box width={2} />
191191
<Typography className="hidden sm:block font-extrabold text-menuBar-text">
192192
AivoMind
193193
</Typography>

0 commit comments

Comments
 (0)