Skip to content

Build your personal knowledge base with Trilium Notes

feat(standalone/setup): basic server sync form

Elian Doran39972a9bd720
diff --git a/apps/client/src/setup.css b/apps/client/src/setup.css
index 338da5407e..4ef0fc26fd 100644
--- a/apps/client/src/setup.css
+++ b/apps/client/src/setup.css
@@ -74,6 +74,8 @@ body.setup {
>main {
flex: 1;
+ display: flex;
+ flex-direction: column;
}
>footer {
@@ -84,5 +86,26 @@ body.setup {
padding-top: 1rem;
}
}
+
+ form {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ flex-grow: 1;
+ gap: 1rem;
+ width: 80%;
+ margin: auto;
+ }
+
+ .form-item-with-icon {
+ display: flex;
+ align-items: center;
+ gap: 0.5rem;
+
+ .tn-icon {
+ font-size: 1.5em;
+ color: var(--muted-text-color);
+ }
+ }
}
}
diff --git a/apps/client/src/setup.tsx b/apps/client/src/setup.tsx
index 0840aea730..da127bcfc9 100644
--- a/apps/client/src/setup.tsx
+++ b/apps/client/src/setup.tsx
@@ -1,11 +1,13 @@
import "./setup.css";
-import { render } from "preact";
+import { ComponentChildren, render } from "preact";
import { useState } from "preact/hooks";
import { initLocale, t } from "./services/i18n";
import Button from "./widgets/react/Button";
import { CardFrame } from "./widgets/react/Card";
+import FormGroup from "./widgets/react/FormGroup";
+import FormTextBox from "./widgets/react/FormTextBox";
import Icon from "./widgets/react/Icon";
async function main() {
@@ -66,7 +68,17 @@ function SyncFromServer({ setState }: { setState: (state: State) => void }) {
<h1>{t("setup.sync-from-server-page-title")}</h1>
<p>{t("setup.sync-from-server-page-description")}</p>
- <main />
+ <main>
+ <form>
+ <FormItemWithIcon icon="bx bx-server">
+ <FormTextBox placeholder="https://example.com" />
+ </FormItemWithIcon>
+
+ <FormItemWithIcon icon="bx bx-lock">
+ <FormTextBox placeholder={t("setup.password-placeholder")} type="password" />
+ </FormItemWithIcon>
+ </form>
+ </main>
<footer>
<Button text={t("setup.button-back")} onClick={() => setState("firstOptions")} kind="lowProfile" />
@@ -76,6 +88,15 @@ function SyncFromServer({ setState }: { setState: (state: State) => void }) {
);
}
+function FormItemWithIcon({ icon, children }: { icon: string; children: ComponentChildren }) {
+ return (
+ <div class="form-item-with-icon">
+ <Icon icon={icon} />
+ {children}
+ </div>
+ );
+}
+
function SetupOptionCard({ title, description, icon, onClick }: { title: string; description: string, icon: string, onClick?: () => void }) {
return (
<CardFrame className="setup-option-card" onClick={onClick}>
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index 838920067b..73529a5867 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -2245,6 +2245,7 @@
"title": "Setup",
"sync-from-server-page-title": "Connect to sync server",
"sync-from-server-page-description": "Enter your server details below to connect your existing workspace.",
+ "password-placeholder": "Password",
"button-back": "Back",
"button-finish-setup": "Finish setup"
}