rita-workspace 0.5.43 → 0.5.44
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.js +72 -39
- package/dist/index.mjs +72 -39
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1894,10 +1894,19 @@ var DrawingsDialog = ({
|
|
|
1894
1894
|
minute: "2-digit"
|
|
1895
1895
|
});
|
|
1896
1896
|
};
|
|
1897
|
-
const daysSinceBackup = (0, import_react5.useMemo)(() => {
|
|
1897
|
+
const { daysSinceBackup, lastBackupTimestamp } = (0, import_react5.useMemo)(() => {
|
|
1898
1898
|
const lastBackup = localStorage.getItem("rita-workspace-last-backup");
|
|
1899
|
-
if (!lastBackup)
|
|
1900
|
-
|
|
1899
|
+
if (!lastBackup) {
|
|
1900
|
+
return {
|
|
1901
|
+
daysSinceBackup: drawings.length > 0 ? 999 : null,
|
|
1902
|
+
lastBackupTimestamp: null
|
|
1903
|
+
};
|
|
1904
|
+
}
|
|
1905
|
+
const ts = parseInt(lastBackup, 10);
|
|
1906
|
+
return {
|
|
1907
|
+
daysSinceBackup: Math.floor((Date.now() - ts) / (1e3 * 60 * 60 * 24)),
|
|
1908
|
+
lastBackupTimestamp: ts
|
|
1909
|
+
};
|
|
1901
1910
|
}, [drawings.length, open]);
|
|
1902
1911
|
const { rootDrawings, drawingsByFolder, filteredFolders } = (0, import_react5.useMemo)(() => {
|
|
1903
1912
|
const query = searchQuery.toLowerCase().trim();
|
|
@@ -2572,42 +2581,66 @@ var DrawingsDialog = ({
|
|
|
2572
2581
|
)
|
|
2573
2582
|
] }),
|
|
2574
2583
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: sectionHeaderStyle, children: t.sectionWorkspace }),
|
|
2575
|
-
daysSinceBackup !== null &&
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2584
|
+
daysSinceBackup !== null && (() => {
|
|
2585
|
+
const isNever = daysSinceBackup >= 999;
|
|
2586
|
+
const isCritical = !isNever && daysSinceBackup >= 30;
|
|
2587
|
+
const isWarning = !isNever && !isCritical && daysSinceBackup >= 7;
|
|
2588
|
+
const isInfo = !isNever && !isCritical && !isWarning;
|
|
2589
|
+
const dateStr = lastBackupTimestamp ? new Date(lastBackupTimestamp).toLocaleString(effectiveLang || "sv", {
|
|
2590
|
+
year: "numeric",
|
|
2591
|
+
month: "short",
|
|
2592
|
+
day: "numeric",
|
|
2593
|
+
hour: "2-digit",
|
|
2594
|
+
minute: "2-digit"
|
|
2595
|
+
}) : null;
|
|
2596
|
+
const ageStr = daysSinceBackup === 0 ? "idag" : `f\xF6r ${daysSinceBackup} dagar sedan`;
|
|
2597
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
2598
|
+
"div",
|
|
2599
|
+
{
|
|
2600
|
+
style: {
|
|
2601
|
+
margin: "0 20px 12px",
|
|
2602
|
+
padding: "10px 14px",
|
|
2603
|
+
backgroundColor: isCritical || isNever ? "#f8d7da" : isWarning ? "#fff3cd" : "transparent",
|
|
2604
|
+
color: isCritical || isNever ? "#721c24" : isWarning ? "#856404" : "var(--text-secondary-color, #888)",
|
|
2605
|
+
fontSize: "13px",
|
|
2606
|
+
fontWeight: isInfo ? 400 : 500,
|
|
2607
|
+
border: isInfo ? "1px solid var(--default-border-color, #e0e0e0)" : `1px solid ${isCritical || isNever ? "#dc3545" : "#ffc107"}`,
|
|
2608
|
+
borderRadius: "6px",
|
|
2609
|
+
display: "flex",
|
|
2610
|
+
alignItems: "center",
|
|
2611
|
+
gap: "8px"
|
|
2612
|
+
},
|
|
2613
|
+
children: [
|
|
2614
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { fontSize: "16px" }, children: isNever || isCritical ? "\u{1F6A8}" : isWarning ? "\u26A0\uFE0F" : "\u{1F4BE}" }),
|
|
2615
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: isNever ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
2616
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("strong", { children: "Ingen backup gjord \xE4nnu." }),
|
|
2617
|
+
' Klicka "Spara alla ritningar" nedan f\xF6r att ladda ner en kopia.'
|
|
2618
|
+
] }) : isCritical ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
2619
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("strong", { children: [
|
|
2620
|
+
"Ingen backup p\xE5 ",
|
|
2621
|
+
daysSinceBackup,
|
|
2622
|
+
" dagar."
|
|
2623
|
+
] }),
|
|
2624
|
+
" Senast: ",
|
|
2625
|
+
dateStr,
|
|
2626
|
+
"."
|
|
2627
|
+
] }) : isWarning ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
2628
|
+
"Senaste backup ",
|
|
2629
|
+
ageStr,
|
|
2630
|
+
" (",
|
|
2631
|
+
dateStr,
|
|
2632
|
+
"). \xD6verv\xE4g att spara en ny."
|
|
2633
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
2634
|
+
"Senaste backup ",
|
|
2635
|
+
ageStr,
|
|
2636
|
+
" (",
|
|
2637
|
+
dateStr,
|
|
2638
|
+
")."
|
|
2639
|
+
] }) })
|
|
2640
|
+
]
|
|
2641
|
+
}
|
|
2642
|
+
);
|
|
2643
|
+
})(),
|
|
2611
2644
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { padding: "0 20px 16px", display: "flex", gap: "8px" }, children: [
|
|
2612
2645
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2613
2646
|
ActionButton,
|
package/dist/index.mjs
CHANGED
|
@@ -1822,10 +1822,19 @@ var DrawingsDialog = ({
|
|
|
1822
1822
|
minute: "2-digit"
|
|
1823
1823
|
});
|
|
1824
1824
|
};
|
|
1825
|
-
const daysSinceBackup = useMemo(() => {
|
|
1825
|
+
const { daysSinceBackup, lastBackupTimestamp } = useMemo(() => {
|
|
1826
1826
|
const lastBackup = localStorage.getItem("rita-workspace-last-backup");
|
|
1827
|
-
if (!lastBackup)
|
|
1828
|
-
|
|
1827
|
+
if (!lastBackup) {
|
|
1828
|
+
return {
|
|
1829
|
+
daysSinceBackup: drawings.length > 0 ? 999 : null,
|
|
1830
|
+
lastBackupTimestamp: null
|
|
1831
|
+
};
|
|
1832
|
+
}
|
|
1833
|
+
const ts = parseInt(lastBackup, 10);
|
|
1834
|
+
return {
|
|
1835
|
+
daysSinceBackup: Math.floor((Date.now() - ts) / (1e3 * 60 * 60 * 24)),
|
|
1836
|
+
lastBackupTimestamp: ts
|
|
1837
|
+
};
|
|
1829
1838
|
}, [drawings.length, open]);
|
|
1830
1839
|
const { rootDrawings, drawingsByFolder, filteredFolders } = useMemo(() => {
|
|
1831
1840
|
const query = searchQuery.toLowerCase().trim();
|
|
@@ -2500,42 +2509,66 @@ var DrawingsDialog = ({
|
|
|
2500
2509
|
)
|
|
2501
2510
|
] }),
|
|
2502
2511
|
/* @__PURE__ */ jsx6("div", { style: sectionHeaderStyle, children: t.sectionWorkspace }),
|
|
2503
|
-
daysSinceBackup !== null &&
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
"
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2512
|
+
daysSinceBackup !== null && (() => {
|
|
2513
|
+
const isNever = daysSinceBackup >= 999;
|
|
2514
|
+
const isCritical = !isNever && daysSinceBackup >= 30;
|
|
2515
|
+
const isWarning = !isNever && !isCritical && daysSinceBackup >= 7;
|
|
2516
|
+
const isInfo = !isNever && !isCritical && !isWarning;
|
|
2517
|
+
const dateStr = lastBackupTimestamp ? new Date(lastBackupTimestamp).toLocaleString(effectiveLang || "sv", {
|
|
2518
|
+
year: "numeric",
|
|
2519
|
+
month: "short",
|
|
2520
|
+
day: "numeric",
|
|
2521
|
+
hour: "2-digit",
|
|
2522
|
+
minute: "2-digit"
|
|
2523
|
+
}) : null;
|
|
2524
|
+
const ageStr = daysSinceBackup === 0 ? "idag" : `f\xF6r ${daysSinceBackup} dagar sedan`;
|
|
2525
|
+
return /* @__PURE__ */ jsxs4(
|
|
2526
|
+
"div",
|
|
2527
|
+
{
|
|
2528
|
+
style: {
|
|
2529
|
+
margin: "0 20px 12px",
|
|
2530
|
+
padding: "10px 14px",
|
|
2531
|
+
backgroundColor: isCritical || isNever ? "#f8d7da" : isWarning ? "#fff3cd" : "transparent",
|
|
2532
|
+
color: isCritical || isNever ? "#721c24" : isWarning ? "#856404" : "var(--text-secondary-color, #888)",
|
|
2533
|
+
fontSize: "13px",
|
|
2534
|
+
fontWeight: isInfo ? 400 : 500,
|
|
2535
|
+
border: isInfo ? "1px solid var(--default-border-color, #e0e0e0)" : `1px solid ${isCritical || isNever ? "#dc3545" : "#ffc107"}`,
|
|
2536
|
+
borderRadius: "6px",
|
|
2537
|
+
display: "flex",
|
|
2538
|
+
alignItems: "center",
|
|
2539
|
+
gap: "8px"
|
|
2540
|
+
},
|
|
2541
|
+
children: [
|
|
2542
|
+
/* @__PURE__ */ jsx6("span", { style: { fontSize: "16px" }, children: isNever || isCritical ? "\u{1F6A8}" : isWarning ? "\u26A0\uFE0F" : "\u{1F4BE}" }),
|
|
2543
|
+
/* @__PURE__ */ jsx6("span", { children: isNever ? /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
2544
|
+
/* @__PURE__ */ jsx6("strong", { children: "Ingen backup gjord \xE4nnu." }),
|
|
2545
|
+
' Klicka "Spara alla ritningar" nedan f\xF6r att ladda ner en kopia.'
|
|
2546
|
+
] }) : isCritical ? /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
2547
|
+
/* @__PURE__ */ jsxs4("strong", { children: [
|
|
2548
|
+
"Ingen backup p\xE5 ",
|
|
2549
|
+
daysSinceBackup,
|
|
2550
|
+
" dagar."
|
|
2551
|
+
] }),
|
|
2552
|
+
" Senast: ",
|
|
2553
|
+
dateStr,
|
|
2554
|
+
"."
|
|
2555
|
+
] }) : isWarning ? /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
2556
|
+
"Senaste backup ",
|
|
2557
|
+
ageStr,
|
|
2558
|
+
" (",
|
|
2559
|
+
dateStr,
|
|
2560
|
+
"). \xD6verv\xE4g att spara en ny."
|
|
2561
|
+
] }) : /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
2562
|
+
"Senaste backup ",
|
|
2563
|
+
ageStr,
|
|
2564
|
+
" (",
|
|
2565
|
+
dateStr,
|
|
2566
|
+
")."
|
|
2567
|
+
] }) })
|
|
2568
|
+
]
|
|
2569
|
+
}
|
|
2570
|
+
);
|
|
2571
|
+
})(),
|
|
2539
2572
|
/* @__PURE__ */ jsxs4("div", { style: { padding: "0 20px 16px", display: "flex", gap: "8px" }, children: [
|
|
2540
2573
|
/* @__PURE__ */ jsx6(
|
|
2541
2574
|
ActionButton,
|