Skip to content

Build your personal knowledge base with Trilium Notes

feat(standalone): display a more compact badge

Elian Doran132c72536abd
diff --git a/apps/client/src/layouts/desktop_layout.tsx b/apps/client/src/layouts/desktop_layout.tsx
index 4570e70ef3..b3b07e4a9b 100644
--- a/apps/client/src/layouts/desktop_layout.tsx
+++ b/apps/client/src/layouts/desktop_layout.tsx
@@ -91,6 +91,7 @@ export default class DesktopLayout {
.optChild(launcherPaneIsHorizontal, <LeftPaneToggle isHorizontalLayout={true} />)
.child(<TabHistoryNavigationButtons />)
.child(new TabRowWidget().class("full-width"))
+ .optChild(glob.isStandalone, <StandaloneWarningBar />)
.optChild(isNewLayout, <RightPaneToggle />)
.optChild(customTitleBarButtons, <TitleBarButtons />)
.css("height", "40px")
@@ -118,6 +119,7 @@ export default class DesktopLayout {
.class("tab-row-container")
.child(<TabHistoryNavigationButtons />)
.child(new TabRowWidget())
+ .optChild(glob.isStandalone, <StandaloneWarningBar />)
.optChild(isNewLayout, <RightPaneToggle />)
.optChild(customTitleBarButtons, <TitleBarButtons />)
.css("height", "40px")
@@ -187,7 +189,6 @@ export default class DesktopLayout {
)
)
.optChild(launcherPaneIsHorizontal && isNewLayout, <StatusBar />)
- .optChild(glob.isStandalone, <StandaloneWarningBar />)
.child(<CloseZenModeButton />)
// Desktop-specific dialogs.
diff --git a/apps/client/src/layouts/mobile_layout.tsx b/apps/client/src/layouts/mobile_layout.tsx
index 56a3fe064e..d5bc99a2f6 100644
--- a/apps/client/src/layouts/mobile_layout.tsx
+++ b/apps/client/src/layouts/mobile_layout.tsx
@@ -47,7 +47,7 @@ export default class MobileLayout {
.css("padding-inline-start", "0")
.css("padding-inline-end", "0")
.css("contain", "content")
- .child(new FlexContainer("column").filling().id("mobile-sidebar-wrapper").child(new QuickSearchWidget()).child(new NoteTreeWidget()))
+ .child(new FlexContainer("column").filling().id("mobile-sidebar-wrapper").child(new QuickSearchWidget()).child(new NoteTreeWidget()).optChild(glob.isStandalone, <StandaloneWarningBar />))
)
.child(
new ScreenContainer("detail", "row")
@@ -56,7 +56,6 @@ export default class MobileLayout {
.child(
new SplitNoteContainer(() =>
new NoteWrapperWidget()
- .optChild(glob.isStandalone, <StandaloneWarningBar />)
.child(
new FlexContainer("row")
.class("title-row note-split-title")
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index 8ebdc2470f..5277594cf8 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -1,5 +1,9 @@
{
- "about": {
+ "standalone": {
+ "badge_label": "Standalone",
+ "warning_tooltip": "You are running Trilium in standalone mode. Some features are not available, and you may experience issues or data loss. Use the desktop application or self-hosted server for the best experience."
+ },
+ "about": {
"version_label": "Version:",
"version": "{{appVersion}} (database: {{dbVersion}}, sync protocol: {{syncVersion}})",
"build_info": "Build: {{buildDate}}, revision: <buildRevision />",
diff --git a/apps/client/src/widgets/layout/StandaloneWarningBar.css b/apps/client/src/widgets/layout/StandaloneWarningBar.css
new file mode 100644
index 0000000000..1749601293
--- /dev/null
+++ b/apps/client/src/widgets/layout/StandaloneWarningBar.css
@@ -0,0 +1,20 @@
+.component.standalone-badge {
+ contain: none;
+ display: flex;
+ align-items: center;
+ gap: 4px;
+ padding: 4px 10px;
+ margin-inline: 4px;
+ border-radius: 4px;
+ font-size: 0.75em;
+ font-weight: 600;
+ white-space: nowrap;
+ cursor: default;
+ background-color: color-mix(in srgb, var(--color-warning, #e6a700) 15%, transparent);
+ color: var(--color-warning, #e6a700);
+ border: 1px solid color-mix(in srgb, var(--color-warning, #e6a700) 30%, transparent);
+
+ .bx {
+ font-size: 1.1em;
+ }
+}
diff --git a/apps/client/src/widgets/layout/StandaloneWarningBar.tsx b/apps/client/src/widgets/layout/StandaloneWarningBar.tsx
index 43a2c8af5f..f7f9d5a277 100644
--- a/apps/client/src/widgets/layout/StandaloneWarningBar.tsx
+++ b/apps/client/src/widgets/layout/StandaloneWarningBar.tsx
@@ -1,26 +1,21 @@
-import { isMobile } from "../../services/utils";
-import Admonition from "../react/Admonition";
+import { useRef } from "preact/hooks";
+import { t } from "../../services/i18n";
+import { useTooltip } from "../react/hooks";
+import "./StandaloneWarningBar.css";
export default function StandaloneWarningBar() {
+ const badgeRef = useRef<HTMLDivElement>(null);
+
+ useTooltip(badgeRef, {
+ title: t("standalone.warning_tooltip"),
+ placement: "top",
+ delay: 200
+ });
+
return (
- <div
- className="standalone-warning-bar"
- style={{
- contain: "none"
- }}
- >
- <Admonition
- type="caution"
- style={{
- margin: 0,
- fontSize: "0.8em"
- }}
- >
- {isMobile()
- ? "Running Trilium standalone. Beware of data loss and other issues."
- : "You are running Trilium in standalone mode. Some features are not available, and you may experience issues or data loss. Use the desktop application or self-hosted server for the best experience."
- }
- </Admonition>
+ <div ref={badgeRef} className="standalone-badge">
+ <span className="bx bx-error-circle" />
+ <span className="standalone-badge-text">{t("standalone.badge_label")}</span>
</div>
);
}