feat: implement manual save via Ctrl+S with toast and increase autosave interval
- Increased autosave interval to 30s. - Captured Ctrl+S / Meta+S to trigger manual save. - Added a minimalistic, translucent toast in the top right to display saving status.
This commit is contained in:
+2
-2
@@ -143,7 +143,7 @@ export function App() {
|
|||||||
.then((body) => {
|
.then((body) => {
|
||||||
setDrawings((current) => replaceMeta(current, body.drawing));
|
setDrawings((current) => replaceMeta(current, body.drawing));
|
||||||
if (isManual) {
|
if (isManual) {
|
||||||
setToastMessage("Saved.");
|
setToastMessage("Saved");
|
||||||
if (toastTimeoutRef.current !== null) {
|
if (toastTimeoutRef.current !== null) {
|
||||||
clearTimeout(toastTimeoutRef.current);
|
clearTimeout(toastTimeoutRef.current);
|
||||||
}
|
}
|
||||||
@@ -153,7 +153,7 @@ export function App() {
|
|||||||
.catch((saveError: unknown) => {
|
.catch((saveError: unknown) => {
|
||||||
setError(saveError instanceof Error ? saveError.message : "Save failed");
|
setError(saveError instanceof Error ? saveError.message : "Save failed");
|
||||||
if (isManual) {
|
if (isManual) {
|
||||||
setToastMessage("Save failed.");
|
setToastMessage("Save failed");
|
||||||
if (toastTimeoutRef.current !== null) {
|
if (toastTimeoutRef.current !== null) {
|
||||||
clearTimeout(toastTimeoutRef.current);
|
clearTimeout(toastTimeoutRef.current);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user