From d475d67c5537ec4d6bafa9b308159688b67137ca Mon Sep 17 00:00:00 2001 From: pearmini Date: Thu, 9 Oct 2025 18:18:52 -0400 Subject: [PATCH 1/2] Show notebooks in New page --- app/EditorPage.jsx | 133 +++++++++++++++++++++++++++++++++------------ 1 file changed, 97 insertions(+), 36 deletions(-) diff --git a/app/EditorPage.jsx b/app/EditorPage.jsx index f9f39f1..7262b94 100644 --- a/app/EditorPage.jsx +++ b/app/EditorPage.jsx @@ -3,14 +3,16 @@ import {useState, useEffect, useRef, useCallback, useSyncExternalStore} from "re import {notFound} from "next/navigation"; import {Pencil} from "lucide-react"; import {Editor} from "./Editor.jsx"; -import {getNotebookById, createNotebook, addNotebook, saveNotebook} from "./api.js"; +import {getNotebookById, createNotebook, addNotebook, saveNotebook, getNotebooks} from "./api.js"; import {isDirtyStore, countStore} from "./store.js"; import {cn} from "./cn.js"; +import {SafeLink} from "./SafeLink.jsx"; const UNSET = Symbol("UNSET"); export function EditorPage({id: initialId}) { const [notebook, setNotebook] = useState(UNSET); + const [notebookList, setNotebookList] = useState([]); const [showInput, setShowInput] = useState(false); const [autoRun, setAutoRun] = useState(false); const [id, setId] = useState(initialId); @@ -59,6 +61,11 @@ export function EditorPage({id: initialId}) { }, 100); }, [notebook, isAdded]); + useEffect(() => { + const notebooks = getNotebooks(); + setNotebookList(notebooks.slice(0, 4)); + }, [isAdded]); + useEffect(() => { const onBeforeUnload = (e) => { if (isDirty) e.preventDefault(); @@ -137,44 +144,98 @@ export function EditorPage({id: initialId}) { } return ( -
- - {!isAdded && ( - +
+ {!isAdded && notebookList.length > 0 && ( +
+ +
+ + View your notebooks +
- } - /> +
+ )} + {!isAdded && notebookList.length === 0 && ( +
+

+ Explore code and art with instant feedback. +

+
+ )} +
+ + {!isAdded && ( + + )} + {!showInput && isAdded && ( + + )} + {showInput || !isAdded ? ( + + ) : ( + {notebook.title} + )} +
+ } + /> +
); } From e0484e05095c399facb436801b91eb891c244cfb Mon Sep 17 00:00:00 2001 From: pearmini Date: Fri, 10 Oct 2025 06:54:41 -0400 Subject: [PATCH 2/2] Fix ci --- app/EditorPage.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/app/EditorPage.jsx b/app/EditorPage.jsx index 7262b94..6efd533 100644 --- a/app/EditorPage.jsx +++ b/app/EditorPage.jsx @@ -156,7 +156,6 @@ export function EditorPage({id: initialId}) {