rita-workspace 0.5.15 → 0.5.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -116,6 +116,8 @@ interface Translations {
116
116
  moveToFolder: string;
117
117
  moveToRoot: string;
118
118
  newFolderName: string;
119
+ backupReminder: string;
120
+ days: string;
119
121
  shortcutNewDrawing: string;
120
122
  }
121
123
  declare function getTranslations(langCode?: string): Translations;
package/dist/index.d.ts CHANGED
@@ -116,6 +116,8 @@ interface Translations {
116
116
  moveToFolder: string;
117
117
  moveToRoot: string;
118
118
  newFolderName: string;
119
+ backupReminder: string;
120
+ days: string;
119
121
  shortcutNewDrawing: string;
120
122
  }
121
123
  declare function getTranslations(langCode?: string): Translations;
package/dist/index.js CHANGED
@@ -318,6 +318,9 @@ var sv = {
318
318
  moveToFolder: "Flytta till mapp",
319
319
  moveToRoot: "Ingen mapp",
320
320
  newFolderName: "Ny mapp",
321
+ // Backup reminder
322
+ backupReminder: "Senaste backup:",
323
+ days: "dagar sedan",
321
324
  // Shortcuts
322
325
  shortcutNewDrawing: "Ctrl+Alt+N"
323
326
  };
@@ -365,6 +368,9 @@ var en = {
365
368
  moveToFolder: "Move to folder",
366
369
  moveToRoot: "No folder",
367
370
  newFolderName: "New folder",
371
+ // Backup reminder
372
+ backupReminder: "Last backup:",
373
+ days: "days ago",
368
374
  // Shortcuts
369
375
  shortcutNewDrawing: "Ctrl+Alt+N"
370
376
  };
@@ -1553,6 +1559,11 @@ var DrawingsDialog = ({
1553
1559
  minute: "2-digit"
1554
1560
  });
1555
1561
  };
1562
+ const daysSinceBackup = (0, import_react5.useMemo)(() => {
1563
+ const lastBackup = localStorage.getItem("rita-workspace-last-backup");
1564
+ if (!lastBackup) return drawings.length > 0 ? 999 : null;
1565
+ return Math.floor((Date.now() - parseInt(lastBackup, 10)) / (1e3 * 60 * 60 * 24));
1566
+ }, [drawings.length, open]);
1556
1567
  const { rootDrawings, drawingsByFolder, filteredFolders } = (0, import_react5.useMemo)(() => {
1557
1568
  const query = searchQuery.toLowerCase().trim();
1558
1569
  const filtered = query ? drawings.filter((d) => d.name.toLowerCase().includes(query)) : drawings;
@@ -2190,6 +2201,7 @@ var DrawingsDialog = ({
2190
2201
  )
2191
2202
  ] }),
2192
2203
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: sectionHeaderStyle, children: t.sectionWorkspace }),
2204
+ daysSinceBackup !== null && daysSinceBackup >= 7 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { padding: "0 20px 8px", fontSize: "12px", color: "var(--text-secondary-color, #888)" }, children: daysSinceBackup >= 30 ? `\u26A0\uFE0F ${t.backupReminder || "Ingen backup p\xE5"} ${daysSinceBackup} ${t.days || "dagar"}` : `${t.backupReminder || "Senaste backup:"} ${daysSinceBackup} ${t.days || "dagar sedan"}` }),
2193
2205
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { padding: "0 20px 16px", display: "flex", gap: "8px" }, children: [
2194
2206
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2195
2207
  ActionButton,
@@ -2197,7 +2209,10 @@ var DrawingsDialog = ({
2197
2209
  icon: "\u{1F4BE}",
2198
2210
  label: t.saveAllBackup,
2199
2211
  description: t.saveAllBackupDesc,
2200
- onClick: exportWorkspace
2212
+ onClick: () => {
2213
+ localStorage.setItem("rita-workspace-last-backup", Date.now().toString());
2214
+ exportWorkspace();
2215
+ }
2201
2216
  }
2202
2217
  ),
2203
2218
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
package/dist/index.mjs CHANGED
@@ -250,6 +250,9 @@ var sv = {
250
250
  moveToFolder: "Flytta till mapp",
251
251
  moveToRoot: "Ingen mapp",
252
252
  newFolderName: "Ny mapp",
253
+ // Backup reminder
254
+ backupReminder: "Senaste backup:",
255
+ days: "dagar sedan",
253
256
  // Shortcuts
254
257
  shortcutNewDrawing: "Ctrl+Alt+N"
255
258
  };
@@ -297,6 +300,9 @@ var en = {
297
300
  moveToFolder: "Move to folder",
298
301
  moveToRoot: "No folder",
299
302
  newFolderName: "New folder",
303
+ // Backup reminder
304
+ backupReminder: "Last backup:",
305
+ days: "days ago",
300
306
  // Shortcuts
301
307
  shortcutNewDrawing: "Ctrl+Alt+N"
302
308
  };
@@ -1485,6 +1491,11 @@ var DrawingsDialog = ({
1485
1491
  minute: "2-digit"
1486
1492
  });
1487
1493
  };
1494
+ const daysSinceBackup = useMemo(() => {
1495
+ const lastBackup = localStorage.getItem("rita-workspace-last-backup");
1496
+ if (!lastBackup) return drawings.length > 0 ? 999 : null;
1497
+ return Math.floor((Date.now() - parseInt(lastBackup, 10)) / (1e3 * 60 * 60 * 24));
1498
+ }, [drawings.length, open]);
1488
1499
  const { rootDrawings, drawingsByFolder, filteredFolders } = useMemo(() => {
1489
1500
  const query = searchQuery.toLowerCase().trim();
1490
1501
  const filtered = query ? drawings.filter((d) => d.name.toLowerCase().includes(query)) : drawings;
@@ -2122,6 +2133,7 @@ var DrawingsDialog = ({
2122
2133
  )
2123
2134
  ] }),
2124
2135
  /* @__PURE__ */ jsx6("div", { style: sectionHeaderStyle, children: t.sectionWorkspace }),
2136
+ daysSinceBackup !== null && daysSinceBackup >= 7 && /* @__PURE__ */ jsx6("div", { style: { padding: "0 20px 8px", fontSize: "12px", color: "var(--text-secondary-color, #888)" }, children: daysSinceBackup >= 30 ? `\u26A0\uFE0F ${t.backupReminder || "Ingen backup p\xE5"} ${daysSinceBackup} ${t.days || "dagar"}` : `${t.backupReminder || "Senaste backup:"} ${daysSinceBackup} ${t.days || "dagar sedan"}` }),
2125
2137
  /* @__PURE__ */ jsxs4("div", { style: { padding: "0 20px 16px", display: "flex", gap: "8px" }, children: [
2126
2138
  /* @__PURE__ */ jsx6(
2127
2139
  ActionButton,
@@ -2129,7 +2141,10 @@ var DrawingsDialog = ({
2129
2141
  icon: "\u{1F4BE}",
2130
2142
  label: t.saveAllBackup,
2131
2143
  description: t.saveAllBackupDesc,
2132
- onClick: exportWorkspace
2144
+ onClick: () => {
2145
+ localStorage.setItem("rita-workspace-last-backup", Date.now().toString());
2146
+ exportWorkspace();
2147
+ }
2133
2148
  }
2134
2149
  ),
2135
2150
  /* @__PURE__ */ jsx6(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rita-workspace",
3
- "version": "0.5.15",
3
+ "version": "0.5.16",
4
4
  "description": "Multi-drawing workspace feature for Rita (Excalidraw fork)",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",