From 9991b8f1e265d7df39863d3fab979f94f45e2f16 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Tue, 24 Mar 2026 12:05:37 +0200 Subject: [PATCH] feat(standalone/setup): intermediate screen for creating new document --- apps/client/src/setup.tsx | 27 +++++++++++++------ .../src/translations/en/translation.json | 4 ++- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/apps/client/src/setup.tsx b/apps/client/src/setup.tsx index db3fc8c569..7cdaaacb81 100644 --- a/apps/client/src/setup.tsx +++ b/apps/client/src/setup.tsx @@ -19,14 +19,15 @@ async function main() { document.body.replaceChildren(bodyWrapper); } -type State = "firstOptions" | "syncFromDesktop" | "syncFromServer" | "syncInProgress" | "syncFailed"; +type State = "firstOptions" | "createNewDocument" | "syncFromDesktop" | "syncFromServer" | "syncInProgress" | "syncFailed"; function App() { - const [ state, setState ] = useState("syncFromServer"); + const [ state, setState ] = useState("firstOptions"); return (
{state === "firstOptions" && } + {state === "createNewDocument" && } {state === "syncFromServer" && } {state === "syncInProgress" && }
@@ -43,12 +44,7 @@ function SetupOptions({ setState }: { setState: (state: State) => void }) { icon="bx bx-file-blank" title={t("setup.new-document")} description={t("setup.new-document-description")} - onClick={async () => { - await server.post("setup/new-document"); - - // After creating a new document, we can just reload the page to load it. - location.reload(); - }} + onClick={() => setState("createNewDocument")} /> ); } +function CreateNewDocument() { + useEffect(() => { + server.post("setup/new-document").then(() => { + location.reload(); + }); + }, []); + + return (
+

{t("setup.create-new-document-title")}

+

{t("setup.create-new-document-description")}

+ + +
); +} + function SyncFromServer({ setState }: { setState: (state: State) => void }) { const [serverUrl, setServerUrl] = useState(""); const [password, setPassword] = useState(""); diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json index 7d768178cc..ae243ac0bb 100644 --- a/apps/client/src/translations/en/translation.json +++ b/apps/client/src/translations/en/translation.json @@ -2252,6 +2252,8 @@ "button-finish-setup": "Finish setup", "sync-step-connecting": "Connecting to server", "sync-step-syncing": "Syncing data", - "sync-step-finalizing": "Setting up options" + "sync-step-finalizing": "Setting up options", + "create-new-document-title": "Preparing your new document", + "create-new-document-description": "You’ll be redirected automatically in a moment." } }