Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(standalone/setup): page to select whether to import demo or not
Elian Doran51ed4dece23d
diff --git a/apps/client/src/setup.css b/apps/client/src/setup.cssindex 07ee3c57e7..8096d1fba3 100644--- a/apps/client/src/setup.css+++ b/apps/client/src/setup.css@@ -219,6 +219,15 @@ body.setup {}}+ .illustration-icon {+ font-size: 4em;+ text-align: center;+ color: var(--muted-text-color);+ opacity: 0.6;+ margin-top: 2rem;+ margin-bottom: 1rem;+ }+h1 {font-size: 1.4em;text-align: center;diff --git a/apps/client/src/setup.tsx b/apps/client/src/setup.tsxindex b03fc66ffa..f924505aac 100644--- a/apps/client/src/setup.tsx+++ b/apps/client/src/setup.tsx@@ -27,14 +27,15 @@ async function main() {document.body.replaceChildren(bodyWrapper);}-type State = "firstOptions" | "createNewDocument" | "syncFromDesktop" | "syncFromServer" | "syncInProgress" | "syncFailed";+type State = "firstOptions" | "createNewDocumentOptions" | "createNewDocument" | "syncFromDesktop" | "syncFromServer" | "syncInProgress" | "syncFailed";-const STATE_ORDER: State[] = ["firstOptions", "createNewDocument", "syncFromDesktop", "syncFromServer", "syncInProgress", "syncFailed"];+const STATE_ORDER: State[] = ["firstOptions", "createNewDocumentOptions", "createNewDocument", "syncFromDesktop", "syncFromServer", "syncInProgress", "syncFailed"];function renderState(state: State, setState: (state: State) => void) {switch (state) {case "firstOptions": return <SetupOptions setState={setState} />;- case "createNewDocument": return <CreateNewDocument />;+ case "createNewDocumentOptions": return <CreateNewDocumentOptions setState={setState} />;+ case "createNewDocument": return <CreateNewDocumentInProgress />;case "syncFromServer": return <SyncFromServer setState={setState} />;case "syncFromDesktop": return <SyncFromDesktop setState={setState} />;case "syncInProgress": return <SyncInProgress device="server" />;@@ -87,7 +88,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={() => setState("createNewDocument")}+ onClick={() => setState("createNewDocumentOptions")}/><SetupOptionCard@@ -204,7 +205,22 @@ function Spinner() {</div>);}-function CreateNewDocument() {+function CreateNewDocumentOptions({ setState }: { setState: (state: State) => void }) {+ return (+ <SetupPage+ className="create-new-document-options"+ title={t("setup.create-new-document-options-title")}+ illustration={<Icon icon="bx bx-star" className="illustration-icon" />}+ >+ <div class="setup-options">+ <SetupOptionCard icon="bx bx-book-open" title={t("setup.create-new-document-options-with-demo")} description={t("setup.create-new-document-options-with-demo-description")} onClick={() => setState("createNewDocumentWithDemo")} />+ <SetupOptionCard icon="bx bx-file-blank" title={t("setup.create-new-document-options-empty")} description={t("setup.create-new-document-options-empty-description")} onClick={() => setState("createNewDocumentEmpty")} />+ </div>+ </SetupPage>+ );+}++function CreateNewDocumentInProgress() {useEffect(() => {server.post("setup/new-document").then(() => {location.reload();diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.jsonindex 60cdbc0132..b36e42080b 100644--- a/apps/client/src/translations/en/translation.json+++ b/apps/client/src/translations/en/translation.json@@ -2232,9 +2232,9 @@"sample_ishikawa": "Ishikawa"},"setup": {- "heading": "Trilium Notes setup",- "new-document": "New document",- "new-document-description": "Start with a clean workspace and begin immediately.",+ "heading": "Get started with Trilium",+ "new-document": "New knowledge base",+ "new-document-description": "Start with a clean knowledge base and begin right away.","sync-from-desktop": "Connect a desktop app","sync-from-desktop-description": "You only have a Trilium desktop app running on another device. This device will sync its data from that desktop app.","sync-from-server": "Connect to an existing server",@@ -2251,6 +2251,11 @@"sync-step-connecting": "Connecting to server","sync-step-syncing": "Syncing data","sync-step-finalizing": "Setting up options",+ "create-new-document-options-title": "How would you like to start?",+ "create-new-document-options-with-demo": "With demo content",+ "create-new-document-options-with-demo-description": "Explore Trilium with example content.",+ "create-new-document-options-empty": "Empty",+ "create-new-document-options-empty-description": "Start with a blank knowledge base. You can import demo notes later.","create-new-document-title": "Preparing your new document","create-new-document-description": "You’ll be redirected automatically in a moment.","sync-illustration-this-device": "This device",