Skip to content

Build your personal knowledge base with Trilium Notes

chore(save_indicator): prepare icon and title

Elian Dorana1dda3b5788b
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index c9eb25ee36..eb8d63d0fb 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -2209,7 +2209,11 @@
"execute_script": "Run script",
"execute_script_description": "This note is a script note. Click to execute the script.",
"execute_sql": "Run SQL",
- "execute_sql_description": "This note is a SQL note. Click to execute the SQL query."
+ "execute_sql_description": "This note is a SQL note. Click to execute the SQL query.",
+ "save_status_saved": "Saved",
+ "save_status_saving": "Saving...",
+ "save_status_unsaved": "Unsaved",
+ "save_status_error": "Save failed"
},
"status_bar": {
"language_title": "Change content language",
diff --git a/apps/client/src/widgets/layout/NoteBadges.tsx b/apps/client/src/widgets/layout/NoteBadges.tsx
index 245f231999..5e47005137 100644
--- a/apps/client/src/widgets/layout/NoteBadges.tsx
+++ b/apps/client/src/widgets/layout/NoteBadges.tsx
@@ -12,6 +12,7 @@ import { useShareInfo } from "../shared_info";
export default function NoteBadges() {
return (
<div className="note-badges">
+ <SaveStatusBadge />
<ReadOnlyBadge />
<ShareBadge />
<ClippedNoteBadge />
@@ -105,3 +106,36 @@ function ExecuteBadge() {
/>
);
}
+
+function SaveStatusBadge() {
+ const state: "saved" | "saving" | "unsaved" | "error" = "saved"; // TODO: implement save state tracking
+
+ let icon: string;
+ let title: string;
+ switch (state) {
+ case "saved":
+ icon = "bx bx-check";
+ title = t("breadcrumb_badges.save_status_saved");
+ break;
+ case "saving":
+ icon = "bx bx-loader bx-spin";
+ title = t("breadcrumb_badges.save_status_saving");
+ break;
+ case "unsaved":
+ icon = "bx bx-cloud-upload";
+ title = t("breadcrumb_badges.save_status_unsaved");
+ break;
+ case "error":
+ icon = "bx bx-error-circle";
+ title = t("breadcrumb_badges.save_status_error");
+ break;
+ }
+
+ return (
+ <Badge
+ className="save-status-badge"
+ icon={icon}
+ text={title}
+ />
+ );
+}