@peers-app/peers-ui 0.23.0 → 0.23.2

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.
@@ -45,6 +45,9 @@ const hooks_1 = require("../../hooks");
45
45
  const layout_picker_1 = require("../../root-layout/layout-picker");
46
46
  const device_pairing_1 = require("../device-pairing");
47
47
  const color_mode_dropdown_1 = require("./color-mode-dropdown");
48
+ const isBrowserPwaHost = typeof window !== "undefined" &&
49
+ !window.electronAPI &&
50
+ !window.ReactNativeWebView;
48
51
  function getAppVersion() {
49
52
  return globalThis.__PEERS_APP_VERSION__ || "unknown";
50
53
  }
@@ -179,11 +182,17 @@ const ResetDeviceSyncInfos = () => {
179
182
  const DeleteLocalDatabase = () => {
180
183
  return ((0, jsx_runtime_1.jsx)("div", { className: "mt-3", children: (0, jsx_runtime_1.jsx)("button", { className: "btn btn-danger btn-sm ms-2", onClick: async () => {
181
184
  const confirmed = confirm("Are you sure you want to delete the local database for the current group? " +
182
- "This will remove all local data. You will need to restart the app and re-sync from other devices.");
185
+ "This removes local data for the current personal or group context only. " +
186
+ "The context will be rebuilt by re-syncing from another of your online devices. " +
187
+ "Account credentials and other contexts are not deleted.");
183
188
  if (!confirmed)
184
189
  return;
185
190
  try {
186
191
  await peers_sdk_1.rpcServerCalls.deleteLocalDatabase();
192
+ if (isBrowserPwaHost) {
193
+ window.location.reload();
194
+ return;
195
+ }
187
196
  alert("Local database has been deleted. Please restart the app.");
188
197
  }
189
198
  catch (err) {
@@ -300,11 +309,8 @@ const DryRunResults = ({ result }) => {
300
309
  const um = result.userMapping;
301
310
  return ((0, jsx_runtime_1.jsxs)("div", { className: "mt-2", children: [(0, jsx_runtime_1.jsxs)("div", { className: "alert alert-info py-2 px-3 small", children: [(0, jsx_runtime_1.jsx)("strong", { children: "Summary:" }), " ", result.totalTasks.toLocaleString(), " tasks and", " ", result.totalLogEntries.toLocaleString(), " log entries across ", result.groups.length, " groups (", result.totalRecords.toLocaleString(), " total records in file)"] }), result.warnings.length > 0 && ((0, jsx_runtime_1.jsxs)("div", { className: "alert alert-warning py-2 px-3 small", children: [(0, jsx_runtime_1.jsx)("strong", { children: "Warnings:" }), (0, jsx_runtime_1.jsx)("ul", { className: "mb-0 ps-3", children: result.warnings.map((w, i) => ((0, jsx_runtime_1.jsx)("li", { children: w }, i))) })] })), (0, jsx_runtime_1.jsxs)("details", { className: "mb-2", children: [(0, jsx_runtime_1.jsx)("summary", { className: "small fw-bold", style: { cursor: "pointer" }, children: "Status Mapping" }), (0, jsx_runtime_1.jsxs)("table", { className: "table table-sm small mt-1", children: [(0, jsx_runtime_1.jsx)("thead", { children: (0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("th", { children: "Mapping" }), (0, jsx_runtime_1.jsx)("th", { className: "text-end", children: "Count" })] }) }), (0, jsx_runtime_1.jsxs)("tbody", { children: [(0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("td", { children: "In-Progress \u2192 Done" }), (0, jsx_runtime_1.jsx)("td", { className: "text-end", children: sm.inProgressToDone.toLocaleString() })] }), (0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("td", { children: "In-Progress \u2192 In-Progress" }), (0, jsx_runtime_1.jsx)("td", { className: "text-end", children: sm.inProgressKeep.toLocaleString() })] }), (0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("td", { children: "Queued \u2192 Done" }), (0, jsx_runtime_1.jsx)("td", { className: "text-end", children: sm.queuedToDone.toLocaleString() })] }), (0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("td", { children: "Queued \u2192 Queued" }), (0, jsx_runtime_1.jsx)("td", { className: "text-end", children: sm.queuedKeep.toLocaleString() })] }), (0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("td", { children: "Backlog \u2192 Done" }), (0, jsx_runtime_1.jsx)("td", { className: "text-end", children: sm.backlogToDone.toLocaleString() })] }), (0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("td", { children: "Backlog \u2192 Backlog" }), (0, jsx_runtime_1.jsx)("td", { className: "text-end", children: sm.backlogKeep.toLocaleString() })] }), (0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("td", { children: "No status \u2192 Done" }), (0, jsx_runtime_1.jsx)("td", { className: "text-end", children: sm.noStatusToDone.toLocaleString() })] }), (0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("td", { children: "No status \u2192 Backlog" }), (0, jsx_runtime_1.jsx)("td", { className: "text-end", children: sm.noStatusToBacklog.toLocaleString() })] })] })] })] }), (0, jsx_runtime_1.jsxs)("details", { className: "mb-2", children: [(0, jsx_runtime_1.jsx)("summary", { className: "small fw-bold", style: { cursor: "pointer" }, children: "User Mapping" }), (0, jsx_runtime_1.jsxs)("table", { className: "table table-sm small mt-1", children: [(0, jsx_runtime_1.jsx)("thead", { children: (0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("th", { children: "User" }), (0, jsx_runtime_1.jsx)("th", { className: "text-end", children: "Tasks" })] }) }), (0, jsx_runtime_1.jsxs)("tbody", { children: [(0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("td", { children: "Mark" }), (0, jsx_runtime_1.jsx)("td", { className: "text-end", children: um.mark.toLocaleString() })] }), (0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("td", { children: "Blair" }), (0, jsx_runtime_1.jsx)("td", { className: "text-end", children: um.blair.toLocaleString() })] }), (0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("td", { children: "Other \u2192 Mark" }), (0, jsx_runtime_1.jsx)("td", { className: "text-end", children: um.other.toLocaleString() })] })] })] })] }), (0, jsx_runtime_1.jsxs)("details", { open: true, className: "mb-2", children: [(0, jsx_runtime_1.jsxs)("summary", { className: "small fw-bold", style: { cursor: "pointer" }, children: ["Groups (", result.groups.length, ")"] }), (0, jsx_runtime_1.jsxs)("table", { className: "table table-sm small mt-1", children: [(0, jsx_runtime_1.jsx)("thead", { children: (0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("th", { children: "Group" }), (0, jsx_runtime_1.jsx)("th", { children: "Route" }), (0, jsx_runtime_1.jsx)("th", { className: "text-end", children: "Tasks" }), (0, jsx_runtime_1.jsx)("th", { className: "text-end", children: "Active" }), (0, jsx_runtime_1.jsx)("th", { className: "text-end", children: "Done" }), (0, jsx_runtime_1.jsx)("th", { className: "text-end", children: "Logs" })] }) }), (0, jsx_runtime_1.jsx)("tbody", { children: result.groups.map((g) => ((0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("td", { children: g.groupName }), (0, jsx_runtime_1.jsx)("td", { children: (0, jsx_runtime_1.jsx)("span", { className: `badge bg-${g.context === "home" ? "success" : "secondary"}`, children: g.context }) }), (0, jsx_runtime_1.jsx)("td", { className: "text-end", children: g.taskCount.toLocaleString() }), (0, jsx_runtime_1.jsx)("td", { className: "text-end", children: g.activeCount.toLocaleString() }), (0, jsx_runtime_1.jsx)("td", { className: "text-end", children: g.doneCount.toLocaleString() }), (0, jsx_runtime_1.jsx)("td", { className: "text-end", children: g.logEntryCount.toLocaleString() })] }, g.groupId))) })] })] })] }));
302
311
  };
303
- const showLogoutInSettings = typeof window !== "undefined" &&
304
- !window.electronAPI &&
305
- !window.ReactNativeWebView;
306
312
  const LogoutSection = () => {
307
- if (!showLogoutInSettings)
313
+ if (!isBrowserPwaHost)
308
314
  return null;
309
315
  return ((0, jsx_runtime_1.jsx)("div", { className: "mt-4 pt-3 border-top", children: (0, jsx_runtime_1.jsx)("button", { className: "btn btn-outline-danger btn-sm", onClick: async () => {
310
316
  const confirmed = confirm("Are you sure you want to logout? This will clear your credentials from this browser. " +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peers-app/peers-ui",
3
- "version": "0.23.0",
3
+ "version": "0.23.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/peers-app/peers-ui.git"
@@ -28,7 +28,7 @@
28
28
  "lint:fix": "biome check --write ."
29
29
  },
30
30
  "peerDependencies": {
31
- "@peers-app/peers-sdk": "^0.23.0",
31
+ "@peers-app/peers-sdk": "^0.23.2",
32
32
  "bootstrap": "^5.3.3",
33
33
  "react": "^18.0.0",
34
34
  "react-dom": "^18.0.0"
@@ -39,7 +39,7 @@
39
39
  "@babel/preset-react": "^7.24.1",
40
40
  "@babel/preset-typescript": "^7.27.1",
41
41
  "@biomejs/biome": "2.3.11",
42
- "@peers-app/peers-sdk": "0.23.0",
42
+ "@peers-app/peers-sdk": "0.23.2",
43
43
  "@testing-library/dom": "^10.4.0",
44
44
  "@testing-library/jest-dom": "^6.6.3",
45
45
  "@testing-library/react": "^16.3.0",
@@ -30,6 +30,11 @@ type PeersHostWindow = Window & {
30
30
  ReactNativeWebView?: unknown;
31
31
  };
32
32
 
33
+ const isBrowserPwaHost =
34
+ typeof window !== "undefined" &&
35
+ !(window as PeersHostWindow).electronAPI &&
36
+ !(window as PeersHostWindow).ReactNativeWebView;
37
+
33
38
  type PeersGlobal = typeof globalThis & {
34
39
  __PEERS_APP_VERSION__?: string;
35
40
  };
@@ -351,11 +356,17 @@ const DeleteLocalDatabase: React.FC = () => {
351
356
  onClick={async () => {
352
357
  const confirmed = confirm(
353
358
  "Are you sure you want to delete the local database for the current group? " +
354
- "This will remove all local data. You will need to restart the app and re-sync from other devices.",
359
+ "This removes local data for the current personal or group context only. " +
360
+ "The context will be rebuilt by re-syncing from another of your online devices. " +
361
+ "Account credentials and other contexts are not deleted.",
355
362
  );
356
363
  if (!confirmed) return;
357
364
  try {
358
365
  await rpcServerCalls.deleteLocalDatabase();
366
+ if (isBrowserPwaHost) {
367
+ window.location.reload();
368
+ return;
369
+ }
359
370
  alert("Local database has been deleted. Please restart the app.");
360
371
  } catch (err) {
361
372
  console.error("Error while deleting local database", err);
@@ -705,13 +716,8 @@ const DryRunResults: React.FC<{ result: IDryRunResult }> = ({ result }) => {
705
716
  );
706
717
  };
707
718
 
708
- const showLogoutInSettings =
709
- typeof window !== "undefined" &&
710
- !(window as PeersHostWindow).electronAPI &&
711
- !(window as PeersHostWindow).ReactNativeWebView;
712
-
713
719
  const LogoutSection: React.FC = () => {
714
- if (!showLogoutInSettings) return null;
720
+ if (!isBrowserPwaHost) return null;
715
721
  return (
716
722
  <div className="mt-4 pt-3 border-top">
717
723
  <button