Skip to content

Build your personal knowledge base with Trilium Notes

feat(standalone/setup): improve display of sync error

Elian Doran5ba5aee16090
diff --git a/apps/client/src/setup.css b/apps/client/src/setup.css
index 9674803186..b27c6bc9a0 100644
--- a/apps/client/src/setup.css
+++ b/apps/client/src/setup.css
@@ -84,6 +84,7 @@ body.setup {
display: flex;
flex-direction: column;
height: 100%;
+ padding: 2em;
>main {
flex: 1;
@@ -102,6 +103,18 @@ body.setup {
margin-inline: -2em;
padding-inline: 2em;
}
+
+ >.page-error {
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ background: var(--admonition-caution-accent-color);
+ z-index: 10;
+ margin: 0;
+ border-radius: 0;
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
+ }
}
form {
@@ -223,7 +236,6 @@ body.setup {
.slide-page {
position: absolute;
inset: 0;
- padding: 2em;
}
.slide-out-forward,
diff --git a/apps/client/src/setup.tsx b/apps/client/src/setup.tsx
index 277a2bb315..25049a5fd4 100644
--- a/apps/client/src/setup.tsx
+++ b/apps/client/src/setup.tsx
@@ -247,6 +247,7 @@ function SyncFromServer({ setState }: { setState: (state: State) => void }) {
title={t("setup.sync-from-server")}
description={t("setup.sync-from-server-page-description")}
illustration={<SyncIllustration targetDevice="server" />}
+ error={error}
footer={<>
<Button text={t("setup.button-back")} onClick={() => setState("firstOptions")} kind="lowProfile" />
<Button text={t("setup.button-finish-setup")} kind="primary" onClick={handleFinishSetup} disabled={!isValid} />
@@ -270,8 +271,6 @@ function SyncFromServer({ setState }: { setState: (state: State) => void }) {
<FormTextBox placeholder={t("setup.proxy-server-placeholder")} currentValue={syncProxy} onChange={setSyncProxy} />
</FormGroup>
</Collapsible>
-
- {error && <Admonition className="error" type="caution">{replaceHtmlEscapedSlashes(error)}</Admonition>}
</form>
</SetupPage>
);
@@ -345,9 +344,10 @@ function SetupOptionCard({ title, description, icon, onClick, disabled }: { titl
);
}
-function SetupPage({ title, className, illustration, children, footer }: {
+function SetupPage({ title, className, illustration, children, footer, error }: {
title: string;
description?: string;
+ error?: string | null;
className?: string;
illustration?: ComponentChildren;
children: ComponentChildren;
@@ -355,6 +355,8 @@ function SetupPage({ title, className, illustration, children, footer }: {
}) {
return (
<div className={clsx("page", className)}>
+ {error && <Admonition className="page-error" type="caution">{replaceHtmlEscapedSlashes(error)}</Admonition>}
+
{illustration}
<h1>{title}</h1>
<main>