mirror of
https://github.com/zadam/trilium.git
synced 2026-01-07 15:14:24 +01:00
chore(save_indicator): prepare icon and title
This commit is contained in:
parent
e161ffce57
commit
a1dda3b578
@ -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",
|
||||
|
||||
@ -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}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user