From 2b9b65b443a555a60fb403d51721b9d8606906da Mon Sep 17 00:00:00 2001
From: 1ilit <1ilit@proton.me>
Date: Thu, 24 Jul 2025 21:58:54 +0400
Subject: [PATCH] add restore warning modal
---
src/components/Workspace.jsx | 21 ++++++++++++++++++---
src/i18n/locales/en.js | 4 ++++
2 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/src/components/Workspace.jsx b/src/components/Workspace.jsx
index 1cb7d08..873b83c 100644
--- a/src/components/Workspace.jsx
+++ b/src/components/Workspace.jsx
@@ -20,6 +20,7 @@ import {
} from "../hooks";
import FloatingControls from "./FloatingControls";
import { Button, Modal, Tag } from "@douyinfe/semi-ui";
+import { IconAlertTriangle } from "@douyinfe/semi-icons";
import { useTranslation } from "react-i18next";
import { databases } from "../data/databases";
import { isRtl } from "../i18n/utils/rtl";
@@ -47,7 +48,7 @@ export default function WorkSpace() {
const [showSelectDbModal, setShowSelectDbModal] = useState(false);
const [showRestoreModal, setShowRestoreModal] = useState(false);
const [selectedDb, setSelectedDb] = useState("");
- const { layout } = useLayout();
+ const { layout, setLayout } = useLayout();
const { settings } = useSettings();
const { types, setTypes } = useTypes();
const { areas, setAreas } = useAreas();
@@ -453,7 +454,7 @@ export default function WorkSpace() {
)}
@@ -518,7 +519,21 @@ export default function WorkSpace() {
centered
closable
onCancel={() => setShowRestoreModal(false)}
- >
+ title={
+
+ {t("restore_version")}
+
+ }
+ okText={t("continue")}
+ cancelText={t("cancel")}
+ onOk={() => {
+ setLayout((prev) => ({ ...prev, readOnly: false }));
+ setShowRestoreModal(false);
+ setVersion(null);
+ }}
+ >
+ {t("restore_warning")}
+
);
}
diff --git a/src/i18n/locales/en.js b/src/i18n/locales/en.js
index 872e3f1..62f4584 100644
--- a/src/i18n/locales/en.js
+++ b/src/i18n/locales/en.js
@@ -264,6 +264,10 @@ const en = {
version: "Version",
record_version: "Record version",
commited_at: "Commited at",
+ read_only: "Read only",
+ continue: "Continue",
+ restore_version: "Restore version",
+ restore_warning: "Loading another version will overwrite the current changes."
},
};