Merge pull request #458 from danditomaso/feat/add-error-boundary
feat: add error boundary
This commit is contained in:
21 files changed
+263
-79
No files matched your search
@@ -37,6 +37,7 @@
|
|||||||
"maplibre-gl": "5.1.1",
|
"maplibre-gl": "5.1.1",
|
||||||
"react": "^19.0.0",
|
"react": "^19.0.0",
|
||||||
"react-dom": "^19.0.0",
|
"react-dom": "^19.0.0",
|
||||||
|
"react-error-boundary": "^5.0.0",
|
||||||
"react-hook-form": "^7.54.2",
|
"react-hook-form": "^7.54.2",
|
||||||
"react-map-gl": "8.0.1",
|
"react-map-gl": "8.0.1",
|
||||||
"react-qrcode-logo": "^3.0.0",
|
"react-qrcode-logo": "^3.0.0",
|
||||||
@@ -1523,6 +1524,8 @@
|
|||||||
|
|
||||||
"react-dom": ["react-dom@19.0.0", "", { "dependencies": { "scheduler": "^0.25.0" }, "peerDependencies": { "react": "^19.0.0" } }, "sha512-4GV5sHFG0e/0AD4X+ySy6UJd3jVl1iNsNHdpad0qhABJ11twS3TTBnseqsKurKcsNqCEFeGL3uLpVChpIO3QfQ=="],
|
"react-dom": ["react-dom@19.0.0", "", { "dependencies": { "scheduler": "^0.25.0" }, "peerDependencies": { "react": "^19.0.0" } }, "sha512-4GV5sHFG0e/0AD4X+ySy6UJd3jVl1iNsNHdpad0qhABJ11twS3TTBnseqsKurKcsNqCEFeGL3uLpVChpIO3QfQ=="],
|
||||||
|
|
||||||
|
"react-error-boundary": ["react-error-boundary@5.0.0", "", { "dependencies": { "@babel/runtime": "^7.12.5" }, "peerDependencies": { "react": ">=16.13.1" } }, "sha512-tnjAxG+IkpLephNcePNA7v6F/QpWLH8He65+DmedchDwg162JZqx4NmbXj0mlAYVVEd81OW7aFhmbsScYfiAFQ=="],
|
||||||
|
|
||||||
"react-hook-form": ["react-hook-form@7.54.2", "", { "peerDependencies": { "react": "^16.8.0 || ^17 || ^18 || ^19" } }, "sha512-eHpAUgUjWbZocoQYUHposymRb4ZP6d0uwUnooL2uOybA9/3tPUvoAKqEWK1WaSiTxxOfTpffNZP7QwlnM3/gEg=="],
|
"react-hook-form": ["react-hook-form@7.54.2", "", { "peerDependencies": { "react": "^16.8.0 || ^17 || ^18 || ^19" } }, "sha512-eHpAUgUjWbZocoQYUHposymRb4ZP6d0uwUnooL2uOybA9/3tPUvoAKqEWK1WaSiTxxOfTpffNZP7QwlnM3/gEg=="],
|
||||||
|
|
||||||
"react-is": ["react-is@17.0.2", "", {}, "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w=="],
|
"react-is": ["react-is@17.0.2", "", {}, "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w=="],
|
||||||
@@ -1543,6 +1546,8 @@
|
|||||||
|
|
||||||
"readable-stream": ["readable-stream@3.6.2", "", { "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", "util-deprecate": "^1.0.1" } }, "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA=="],
|
"readable-stream": ["readable-stream@3.6.2", "", { "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", "util-deprecate": "^1.0.1" } }, "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA=="],
|
||||||
|
|
||||||
|
"regenerator-runtime": ["regenerator-runtime@0.14.1", "", {}, "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw=="],
|
||||||
|
|
||||||
"reflect.getprototypeof": ["reflect.getprototypeof@1.0.10", "", { "dependencies": { "call-bind": "^1.0.8", "define-properties": "^1.2.1", "es-abstract": "^1.23.9", "es-errors": "^1.3.0", "es-object-atoms": "^1.0.0", "get-intrinsic": "^1.2.7", "get-proto": "^1.0.1", "which-builtin-type": "^1.2.1" } }, "sha512-00o4I+DVrefhv+nX0ulyi3biSHCPDe+yLv5o/p6d/UVlirijB8E16FtfwSAi4g3tcqrQ4lRAqQSoFEZJehYEcw=="],
|
"reflect.getprototypeof": ["reflect.getprototypeof@1.0.10", "", { "dependencies": { "call-bind": "^1.0.8", "define-properties": "^1.2.1", "es-abstract": "^1.23.9", "es-errors": "^1.3.0", "es-object-atoms": "^1.0.0", "get-intrinsic": "^1.2.7", "get-proto": "^1.0.1", "which-builtin-type": "^1.2.1" } }, "sha512-00o4I+DVrefhv+nX0ulyi3biSHCPDe+yLv5o/p6d/UVlirijB8E16FtfwSAi4g3tcqrQ4lRAqQSoFEZJehYEcw=="],
|
||||||
|
|
||||||
"regenerate": ["regenerate@1.4.2", "", {}, "sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A=="],
|
"regenerate": ["regenerate@1.4.2", "", {}, "sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A=="],
|
||||||
|
|||||||
@@ -70,6 +70,7 @@
|
|||||||
"maplibre-gl": "5.1.1",
|
"maplibre-gl": "5.1.1",
|
||||||
"react": "^19.0.0",
|
"react": "^19.0.0",
|
||||||
"react-dom": "^19.0.0",
|
"react-dom": "^19.0.0",
|
||||||
|
"react-error-boundary": "^5.0.0",
|
||||||
"react-hook-form": "^7.54.2",
|
"react-hook-form": "^7.54.2",
|
||||||
"react-map-gl": "8.0.1",
|
"react-map-gl": "8.0.1",
|
||||||
"react-qrcode-logo": "^3.0.0",
|
"react-qrcode-logo": "^3.0.0",
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" id="Layer_1" data-name="Layer 1" viewBox="0 0 1871.69 2607.94"><defs><style>.cls-1,.cls-4{fill:#2c2d3c;stroke-width:0}.cls-4{fill:#fff}</style></defs><path id="Body_background" fill="#67ea94" stroke-width="0" d="M1349.07 573.19h-855.5c-11.05 0-20.01 8.96-20.01 20.01v1219.19c0 10.12 8.21 18.33 18.33 18.33h854.27c8.7 0 15.75-7.05 15.75-15.75V586.04c0-7.1-5.75-12.85-12.85-12.85Zm-220.55 569.8h-411V787h411v355.99Z" data-name="Body background"/><path id="Body" d="M1166.62 5.54c-21.2 13.2-31.7 24.3-34.1 36-2.2 10.6-1.8 11.4 13.6 26.9 7.7 7.6 15.3 15.7 17.1 18l3.2 4.1-13.7 5.8c-26.6 11.4-109.5 54-125.2 64.4-4.6 3-5.5 4.1-5.5 6.5 0 3.5 2.7 5.6 5.1 4.1 1.3-.8 2.9-.5 6.4 1.2 9.4 4.5 34.3 10.5 59 14.3 6.9 1.1 27.6 3.3 46 5 49.1 4.5 71 8 71 11.5 0 2.2-21.1 23.5-37.5 38-8.2 7.2-24.4 20.9-36 30.5-29 24-42.2 35.9-62 56.1-27.2 27.7-54.4 60.8-60.9 74.1-2.5 5-2.7 6.1-1.7 9.1.7 1.9 8.9 12.6 18.4 23.9 9.5 11.2 24.2 29.2 32.8 39.9 30.8 38.2 48.3 56.9 75.2 80.4l13.7 12-118.2.6c-65.1.3-203.8.7-308.4.8-182.2.3-221.1.8-237.2 3.1-11.6 1.6-16.2 4.8-18.1 12.7-.9 3.3-1.3 130.7-1.6 479.6-.3 261.4-.7 530.3-.9 597.7-.5 142.7-.1 152.6 6.6 163.8 2.6 4.2 6.9 6.4 13.7 6.8 3.1.2 55 .6 115.4 1 99.7.6 109.7.8 109.7 2.3.2 11.7-9.3 741.7-9.6 742-.2.3-75.5-1.9-167.2-4.8-158.1-4.9-167.1-5.1-171-3.5-11.6 4.6-12.2 20.8-1 26.3 4.1 1.9 10.2 2.2 165.3 7.1 88.6 2.8 168.2 5.1 177 5.1h16l4.7-5.3c2.6-2.9 5.2-6.2 5.7-7.3.7-1.5 10.4-722.4 10.1-757.4v-4.4l159.2.7c87.6.4 159.3.8 159.4.9 0 .1 2.7 169.2 5.9 375.7l5.7 375.5 3 6c1.6 3.3 4.2 7.6 5.8 9.5l2.9 3.5 167.8-.3c158.5-.4 168-.5 171.9-2.2 11.2-4.9 12.1-19.9 1.5-25.8l-3.9-2.2h-318.7l-.3-7.7c-.3-10.8-11.2-710.5-11.2-722.6v-9.7h121.8c85.3.1 123.8-.2 128.7-1 12.4-2 18.1-6.1 21.9-15.8 1.5-4 1.6-46.7 1.6-608.5 0-332.3-.3-610.5-.6-618.2-.7-15.7-1.6-20-4.7-21.8-1.7-.9-24.6-1.3-101.2-1.5l-99-.2-3-3.4c-1.6-1.9-9.1-8.8-16.5-15.4-24.3-21.5-43.4-42.2-71.5-77.2-8.2-10.2-21.9-26.8-30.5-37-8.5-10.2-16.8-20-18.3-21.9-3.4-4.1-3.2-5.1 3.8-15.6 11.1-16.9 35.8-45.8 59-69 16.8-16.9 30.6-29.2 57-51 36-29.7 54.9-46.8 67.7-60.9 8.5-9.4 8.9-10.1 8.6-14-.3-3.8-.7-4.3-5-6.4-8-4-29.7-7.2-76.3-11.2-36.5-3.1-62.7-7.4-84.3-13.6-8.9-2.6-17.8-6.1-17.1-6.8 1.4-1.3 31.8-17.6 56.9-30.4 31.9-16.3 56.3-27.9 73.3-34.8l10.7-4.5 6.3 5.2c11.6 9.7 23.7 13.6 38.1 12.1 8.3-.8 10-2.6 11.7-11.7 2.1-11.2-.9-22.9-12-47.4-9.8-21.7-19.8-36.9-31.4-47.9-7.3-6.8-8.8-6.8-20.6.5Zm190.1 570.1c1.1 1.1 1.3 114 1.6 619.5l.2 618.3-2.2 4.4c-3.2 6.3-8.1 8.7-19.8 10-9.2.9-48.7.8-618.5-.9-254.3-.8-236.4-.3-239.4-6.6-3.2-6.6-4.2-16-4.7-44-.2-15.4 0-283.4.4-595.5.5-312.1.5-569.2 0-571.3-.9-4.2.5-18.4 2.5-24.5 1-3.2 1.9-3.9 6.3-5.4 10.9-3.6 32.3-3.9 396.9-4.7 448.7-1 475-1 476.7.7Z" class="cls-1"/><path d="M717.52 787h411v355.99h-411z" class="cls-4"/><path id="Dot" fill="#454656" stroke="#2c2d3c" stroke-miterlimit="10" stroke-width="7" d="M1246.61 622.56c-10.79 3.78-18.53 10.79-23.69 21.39-2.77 5.62-2.95 6.45-2.95 16.59s.18 10.97 2.95 16.87c7.56 15.86 22.03 24.34 40.29 23.51 7.38-.28 9.31-.74 15.58-3.69 8.67-4.15 15.4-10.6 18.99-18.25 9.96-21.02 1.94-43.79-19.18-54.21-6.55-3.23-7.47-3.41-17.06-3.69-8.02-.18-11.25.18-14.94 1.48Z"/><path id="Eyes" d="M651.62 705.94c-8 1.6-10.3 5.2-12 19.4-1.4 12-1.8 452.5-.4 459.2 1.4 6.4 2.7 8.9 5.7 10.8 2.1 1.4 31.7 1.6 275.1 1.5 150 0 275.3-.3 278.4-.6 6.8-.7 9.6-1.9 10.7-4.8.5-1.1.7-106.1.4-235.6-.6-263.8.3-239.2-8.5-243.1-5.2-2.3-17.1-5-23-5.1-8-.3-489.4-2.8-505.5-2.7-9.1.1-18.5.5-20.9 1Zm186.5 82c6.5 1.2 8.4 2.3 8.4 4.9s-2.3 3.1-11.3 1.8c-12.3-1.6-35.6-.4-50.4 2.7-14.5 3-33.7 9.1-43.7 13.9-7.3 3.5-16.6 10-16.6 11.6 0 .5 1.7 1 3.8 1.2 3.2.3 3.7.6 3.7 2.8s-.4 2.5-5.8 2.8c-7 .4-8.7-.8-8.7-5.6 0-10.9 30.8-26.7 65.5-33.7 6.6-1.3 13.6-2.6 15.5-2.8 7.9-.9 34-.6 39.6.4Zm224.9 3.3c35.7 7.5 65.5 22.9 65.5 33.8 0 4.8-1.7 6-8.7 5.6-5.4-.3-5.8-.5-5.8-2.8s.5-2.5 3.8-2.8c2-.2 3.7-.7 3.7-1.2 0-1.6-9.3-8.1-16.6-11.6-10-4.8-29.2-10.9-43.7-13.9-14.8-3.1-38.1-4.3-50.4-2.7-9 1.3-11.3.9-11.3-1.8 0-4.7 7.5-6 32-5.5 16.1.3 21.6.8 31.5 2.9Zm-238.5 58.4c4.6 2.3 5.9 3.6 8.4 8.4 3.2 6.3 3.7 10.2 5.6 42.3.6 9.9 1.5 26.3 2.1 36.5 1.2 20.5.5 96.3-1.1 122.6-3.3 53.9-5 74.5-6.1 76.6-.5 1-1.6 1.8-2.5 1.8-.8 0-4.1.9-7.3 2-17.1 5.7-43.2-.5-50.3-12-6-9.7-7.6-27-8.8-97-.5-27.2-1.4-56.5-2.2-65-.7-8.5-1.3-29-1.3-45.5 0-40.5 1.5-46.7 14.4-59.6 5.3-5.2 8.2-7.2 14.6-9.9 10.4-4.3 13.6-5 22-4.4 4.9.3 8.6 1.3 12.5 3.2Zm230.7 1.9c7.3 3 10 4.8 15.4 10.2 12.9 12.9 14.4 19.1 14.4 59.6 0 16.5-.6 37-1.3 45.5-.8 8.5-1.7 37.8-2.2 65-1.2 70-2.8 87.3-8.8 97-7.1 11.5-33.2 17.7-50.3 12-3.2-1.1-6.5-2-7.3-2-.9 0-2-.8-2.5-1.8-1.1-2.1-2.8-22.7-6.1-76.6-1.6-26.3-2.3-102.1-1.1-122.6 4.3-73.4 4.1-71.4 7.5-78.5 6.2-12.6 23.2-15.8 42.3-7.8Z" class="cls-1"/><path id="Meshtastic_M" fill="#2c2d3c" fill-rule="evenodd" stroke-width="0" d="m1034.49 1359.63-215.84 316.53-45.53-31.04 238.56-349.85c5.12-7.52 13.64-12.02 22.74-12.03 9.1 0 17.62 4.48 22.76 11.99l239.11 349.3-45.47 31.13-216.33-316.02Zm-452.9 316.2 252.13-369.74-45.53-31.05-252.13 369.73 45.53 31.05Z" data-nameLine truncated
|
||||||
|
After Width: | Height: | Size: 14 KiB |
+8
-5
@@ -12,8 +12,11 @@ import { useAppStore } from "@core/stores/appStore.ts";
|
|||||||
import { useDeviceStore } from "@core/stores/deviceStore.ts";
|
import { useDeviceStore } from "@core/stores/deviceStore.ts";
|
||||||
import { Dashboard } from "@pages/Dashboard/index.tsx";
|
import { Dashboard } from "@pages/Dashboard/index.tsx";
|
||||||
import type { JSX } from "react";
|
import type { JSX } from "react";
|
||||||
|
import { ErrorBoundary } from "react-error-boundary";
|
||||||
|
import { ErrorPage } from "./components/UI/ErrorPage";
|
||||||
import { MapProvider } from "react-map-gl/maplibre";
|
import { MapProvider } from "react-map-gl/maplibre";
|
||||||
|
|
||||||
|
|
||||||
export const App = (): JSX.Element => {
|
export const App = (): JSX.Element => {
|
||||||
const { getDevice } = useDeviceStore();
|
const { getDevice } = useDeviceStore();
|
||||||
const { selectedDevice, setConnectDialogOpen, connectDialogOpen } =
|
const { selectedDevice, setConnectDialogOpen, connectDialogOpen } =
|
||||||
@@ -22,7 +25,7 @@ export const App = (): JSX.Element => {
|
|||||||
const device = getDevice(selectedDevice);
|
const device = getDevice(selectedDevice);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<ErrorBoundary FallbackComponent={ErrorPage}>
|
||||||
<NewDeviceDialog
|
<NewDeviceDialog
|
||||||
open={connectDialogOpen}
|
open={connectDialogOpen}
|
||||||
onOpenChange={(open) => {
|
onOpenChange={(open) => {
|
||||||
@@ -30,18 +33,19 @@ export const App = (): JSX.Element => {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Toaster />
|
<Toaster />
|
||||||
<MapProvider>
|
|
||||||
<DeviceWrapper device={device}>
|
<DeviceWrapper device={device}>
|
||||||
<div className="flex h-screen flex-col overflow-hidden bg-background-primary text-text-primary">
|
<div className="flex h-screen flex-col overflow-hidden bg-background-primary text-text-primary">
|
||||||
<div className="flex grow">
|
<div className="flex grow">
|
||||||
<DeviceSelector />
|
<DeviceSelector />
|
||||||
<div className="flex grow flex-col">
|
<div className="flex grow flex-col">
|
||||||
{device ? (
|
{device ? (
|
||||||
<div className="flex h-screen">
|
<div className="flex h-screen w-full">
|
||||||
<DialogManager />
|
<DialogManager />
|
||||||
<KeyBackupReminder />
|
<KeyBackupReminder />
|
||||||
<CommandPalette />
|
<CommandPalette />
|
||||||
|
<MapProvider>
|
||||||
<PageRouter />
|
<PageRouter />
|
||||||
|
</MapProvider>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
@@ -53,7 +57,6 @@ export const App = (): JSX.Element => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</DeviceWrapper>
|
</DeviceWrapper>
|
||||||
</MapProvider>
|
</ErrorBoundary>
|
||||||
</>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
+10
-2
@@ -4,16 +4,24 @@ import ChannelsPage from "@pages/Channels.tsx";
|
|||||||
import ConfigPage from "@pages/Config/index.tsx";
|
import ConfigPage from "@pages/Config/index.tsx";
|
||||||
import MessagesPage from "@pages/Messages.tsx";
|
import MessagesPage from "@pages/Messages.tsx";
|
||||||
import NodesPage from "@pages/Nodes.tsx";
|
import NodesPage from "@pages/Nodes.tsx";
|
||||||
|
import { ErrorBoundary } from "react-error-boundary";
|
||||||
|
import { ErrorPage } from "./components/UI/ErrorPage";
|
||||||
|
|
||||||
|
export const ErrorBoundaryWrapper = ({
|
||||||
|
children,
|
||||||
|
}: { children: React.ReactNode }) => (
|
||||||
|
<ErrorBoundary FallbackComponent={ErrorPage}>{children}</ErrorBoundary>
|
||||||
|
);
|
||||||
|
|
||||||
export const PageRouter = () => {
|
export const PageRouter = () => {
|
||||||
const { activePage } = useDevice();
|
const { activePage } = useDevice();
|
||||||
return (
|
return (
|
||||||
<>
|
<ErrorBoundary FallbackComponent={ErrorPage}>
|
||||||
{activePage === "messages" && <MessagesPage />}
|
{activePage === "messages" && <MessagesPage />}
|
||||||
{activePage === "map" && <MapPage />}
|
{activePage === "map" && <MapPage />}
|
||||||
{activePage === "config" && <ConfigPage />}
|
{activePage === "config" && <ConfigPage />}
|
||||||
{activePage === "channels" && <ChannelsPage />}
|
{activePage === "channels" && <ChannelsPage />}
|
||||||
{activePage === "nodes" && <NodesPage />}
|
{activePage === "nodes" && <NodesPage />}
|
||||||
</>
|
</ErrorBoundary>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -4,7 +4,6 @@ import {
|
|||||||
} from "@components/Form/DynamicFormField.tsx";
|
} from "@components/Form/DynamicFormField.tsx";
|
||||||
import { FieldWrapper } from "@components/Form/FormWrapper.tsx";
|
import { FieldWrapper } from "@components/Form/FormWrapper.tsx";
|
||||||
import { Button } from "@components/UI/Button.tsx";
|
import { Button } from "@components/UI/Button.tsx";
|
||||||
import { H4 } from "@components/UI/Typography/H4.tsx";
|
|
||||||
import { Subtle } from "@components/UI/Typography/Subtle.tsx";
|
import { Subtle } from "@components/UI/Typography/Subtle.tsx";
|
||||||
import {
|
import {
|
||||||
type Control,
|
type Control,
|
||||||
@@ -14,6 +13,7 @@ import {
|
|||||||
type SubmitHandler,
|
type SubmitHandler,
|
||||||
useForm,
|
useForm,
|
||||||
} from "react-hook-form";
|
} from "react-hook-form";
|
||||||
|
import { Heading } from "../UI/Typography/Heading";
|
||||||
|
|
||||||
interface DisabledBy<T> {
|
interface DisabledBy<T> {
|
||||||
fieldName: Path<T>;
|
fieldName: Path<T>;
|
||||||
@@ -96,7 +96,9 @@ export function DynamicForm<T extends FieldValues>({
|
|||||||
{fieldGroups.map((fieldGroup) => (
|
{fieldGroups.map((fieldGroup) => (
|
||||||
<div key={fieldGroup.label} className="space-y-8 sm:space-y-5">
|
<div key={fieldGroup.label} className="space-y-8 sm:space-y-5">
|
||||||
<div>
|
<div>
|
||||||
<H4 className="font-medium">{fieldGroup.label}</H4>
|
<Heading as="h4" className="font-medium">
|
||||||
|
{fieldGroup.label}
|
||||||
|
</Heading>
|
||||||
<Subtle>{fieldGroup.description}</Subtle>
|
<Subtle>{fieldGroup.description}</Subtle>
|
||||||
<Subtle className="font-semibold">{fieldGroup?.notes}</Subtle>
|
<Subtle className="font-semibold">{fieldGroup?.notes}</Subtle>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Separator } from "@app/components/UI/Seperator";
|
import { Separator } from "@app/components/UI/Seperator";
|
||||||
import { H5 } from "@app/components/UI/Typography/H5.tsx";
|
import { Heading } from "@app/components/UI/Typography/Heading";
|
||||||
import { Subtle } from "@app/components/UI/Typography/Subtle.tsx";
|
import { Subtle } from "@app/components/UI/Typography/Subtle.tsx";
|
||||||
import { formatQuantity } from "@app/core/utils/string";
|
import { formatQuantity } from "@app/core/utils/string";
|
||||||
import { Avatar } from "@components/UI/Avatar";
|
import { Avatar } from "@components/UI/Avatar";
|
||||||
@@ -62,7 +62,7 @@ export const NodeDetail = ({ node }: NodeDetailProps) => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<H5>{name}</H5>
|
<Heading as="h5">{name}</Heading>
|
||||||
|
|
||||||
{hardwareType !== "UNSET" && <Subtle>{hardwareType}</Subtle>}
|
{hardwareType !== "UNSET" && <Subtle>{hardwareType}</Subtle>}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import {
|
|||||||
TooltipProvider,
|
TooltipProvider,
|
||||||
TooltipTrigger,
|
TooltipTrigger,
|
||||||
} from "@app/components/UI/Tooltip";
|
} from "@app/components/UI/Tooltip";
|
||||||
import { useAppStore } from "@app/core/stores/appStore";
|
|
||||||
import {
|
import {
|
||||||
type MessageWithState,
|
type MessageWithState,
|
||||||
useDeviceStore,
|
useDeviceStore,
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import { cn } from "@app/core/utils/cn.ts";
|
import { cn } from "@app/core/utils/cn.ts";
|
||||||
import { AlignLeftIcon, type LucideIcon } from "lucide-react";
|
import { AlignLeftIcon, type LucideIcon } from "lucide-react";
|
||||||
|
import { ErrorBoundary } from "react-error-boundary";
|
||||||
|
import { ErrorPage } from "./UI/ErrorPage";
|
||||||
import Footer from "./UI/Footer";
|
import Footer from "./UI/Footer";
|
||||||
import { Spinner } from "./UI/Spinner";
|
import { Spinner } from "./UI/Spinner";
|
||||||
|
|
||||||
@@ -23,7 +25,7 @@ export const PageLayout = ({
|
|||||||
children,
|
children,
|
||||||
}: PageLayoutProps) => {
|
}: PageLayoutProps) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<ErrorBoundary FallbackComponent={ErrorPage}>
|
||||||
<div className="relative flex h-full w-full flex-col">
|
<div className="relative flex h-full w-full flex-col">
|
||||||
<div className="flex h-14 shrink-0 border-b-[0.5px] border-slate-300 dark:border-slate-700 md:h-16 md:px-4">
|
<div className="flex h-14 shrink-0 border-b-[0.5px] border-slate-300 dark:border-slate-700 md:h-16 md:px-4">
|
||||||
<button
|
<button
|
||||||
@@ -68,6 +70,6 @@ export const PageLayout = ({
|
|||||||
<Footer />
|
<Footer />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</ErrorBoundary>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
import newGithubIssueUrl from "@app/core/utils/github";
|
||||||
|
import { ExternalLink } from "lucide-react";
|
||||||
|
import { Heading } from "./Typography/Heading";
|
||||||
|
import { Link } from "./Typography/Link";
|
||||||
|
import { P } from "./Typography/P";
|
||||||
|
|
||||||
|
export function ErrorPage({ error }: { error: Error }) {
|
||||||
|
if (!error) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<article className="w-full overflow-y-auto">
|
||||||
|
<section className="flex shrink md:flex-row gap-16 mt-20 px-4 md:px-8 text-lg md:text-xl space-y-2 place-items-center">
|
||||||
|
<div>
|
||||||
|
<Heading as="h2" className="text-text-primary">
|
||||||
|
This is a little embarrassing...
|
||||||
|
</Heading>
|
||||||
|
<P>
|
||||||
|
We are really sorry but an error occurred in the web client that
|
||||||
|
caused it to crash. <br />
|
||||||
|
This is not supposed to happen, and we are working hard to fix it.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
The best way to prevent this from happening again to you or anyone
|
||||||
|
else is to report the issue to us.
|
||||||
|
</P>
|
||||||
|
<P>Please include the following information in your report:</P>
|
||||||
|
<ul className="list-disc list-inside text-sm">
|
||||||
|
<li>What you were doing when the error occurred</li>
|
||||||
|
<li>What you expected to happen</li>
|
||||||
|
<li>What actually happened</li>
|
||||||
|
<li>Any other relevant information</li>
|
||||||
|
</ul>
|
||||||
|
<P>
|
||||||
|
You can report the issue to our{" "}
|
||||||
|
<Link
|
||||||
|
href={newGithubIssueUrl({
|
||||||
|
repoUrl: "https://github.com/meshtastic/web",
|
||||||
|
template: "bug.yml",
|
||||||
|
title: "[Bug]: An unhandled error occurred. <Add details here>",
|
||||||
|
logs: error?.stack,
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
Github
|
||||||
|
</Link>
|
||||||
|
<ExternalLink size={24} className="inline-block ml-2" />
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Return to the <Link href="/">dashboard</Link>
|
||||||
|
</P>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="hidden md:block md:max-w-64 lg:max-w-80 w-full aspect-suqare">
|
||||||
|
<img
|
||||||
|
src="/images/chirpy.svg"
|
||||||
|
alt="Chirpy the Meshtastic error"
|
||||||
|
className="max-w-full h-auto"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<details className="mt-8 px-4 md:px-8 text-lg md:text-xl space-y-2 text-md whitespace-pre-wrap break-all">
|
||||||
|
<summary className="cursor-pointer">Error Details</summary>
|
||||||
|
<span className="text-sm mt-4">
|
||||||
|
{error?.message && (
|
||||||
|
<>
|
||||||
|
<label htmlFor="message">Error message:</label>
|
||||||
|
<p
|
||||||
|
id="message"
|
||||||
|
className="text-slate-400 break-words overflow-wrap"
|
||||||
|
>
|
||||||
|
{error.message}
|
||||||
|
</p>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
{error?.stack && (
|
||||||
|
<>
|
||||||
|
<label htmlFor="stack">Stack trace:</label>
|
||||||
|
<p
|
||||||
|
id="stack"
|
||||||
|
className="text-slate-400 break-words overflow-wrap"
|
||||||
|
>
|
||||||
|
{error.stack}
|
||||||
|
</p>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
{!error?.message && !error?.stack && (
|
||||||
|
<p className="text-slate-400">{error.toString()}</p>
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
</details>
|
||||||
|
</article>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { H4 } from "@components/UI/Typography/H4.tsx";
|
import { Heading } from "../Typography/Heading";
|
||||||
|
|
||||||
export interface SidebarSectionProps {
|
export interface SidebarSectionProps {
|
||||||
label: string;
|
label: string;
|
||||||
@@ -11,7 +11,9 @@ export const SidebarSection = ({
|
|||||||
children,
|
children,
|
||||||
}: SidebarSectionProps) => (
|
}: SidebarSectionProps) => (
|
||||||
<div className="px-4 py-2">
|
<div className="px-4 py-2">
|
||||||
<H4 className="mb-3 ml-2">{title}</H4>
|
<Heading as="h4" className="mb-3 ml-2">
|
||||||
|
{title}
|
||||||
|
</Heading>
|
||||||
<div className="space-y-1">{children}</div>
|
<div className="space-y-1">{children}</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
export interface H1Props {
|
|
||||||
children: React.ReactNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const H1 = ({ children }: H1Props): JSX.Element => (
|
|
||||||
<h1 className="scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl">
|
|
||||||
{children}
|
|
||||||
</h1>
|
|
||||||
);
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
export interface H2Props {
|
|
||||||
children: React.ReactNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const H2 = ({ children }: H2Props): JSX.Element => (
|
|
||||||
<h2 className="scroll-m-20 border-b border-b-slate-200 pb-2 text-3xl font-semibold tracking-tight transition-colors first:mt-0 dark:border-b-slate-700">
|
|
||||||
{children}
|
|
||||||
</h2>
|
|
||||||
);
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
export interface H3Props {
|
|
||||||
children: React.ReactNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const H3 = ({ children }: H3Props): JSX.Element => (
|
|
||||||
<h3 className="scroll-m-20 text-2xl font-semibold tracking-tight">
|
|
||||||
{children}
|
|
||||||
</h3>
|
|
||||||
);
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
import { cn } from "@app/core/utils/cn.ts";
|
|
||||||
|
|
||||||
export interface H4Props {
|
|
||||||
className?: string;
|
|
||||||
children: React.ReactNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const H4 = ({ className, children }: H4Props): JSX.Element => (
|
|
||||||
<h4
|
|
||||||
className={cn(
|
|
||||||
"scroll-m-20 text-xl font-semibold tracking-tight",
|
|
||||||
className,
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
{children}
|
|
||||||
</h4>
|
|
||||||
);
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
import { cn } from "@app/core/utils/cn.ts";
|
|
||||||
|
|
||||||
export interface H5Props {
|
|
||||||
className?: string;
|
|
||||||
children: React.ReactNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const H5 = ({ className, children }: H5Props): JSX.Element => (
|
|
||||||
<h5
|
|
||||||
className={cn("scroll-m-20 text-lg font-medium tracking-tight", className)}
|
|
||||||
>
|
|
||||||
{children}
|
|
||||||
</h5>
|
|
||||||
);
|
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
import type React from "react";
|
||||||
|
|
||||||
|
const headingStyles = {
|
||||||
|
h1: "scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl",
|
||||||
|
h2: "scroll-m-20 border-b border-b-slate-200 pb-2 text-3xl font-semibold tracking-tight transition-colors first:mt-0 dark:border-b-slate-700",
|
||||||
|
h3: "scroll-m-20 text-2xl font-semibold tracking-tight",
|
||||||
|
h4: "scroll-m-20 text-xl font-semibold tracking-tight",
|
||||||
|
h5: "scroll-m-20 text-lg font-medium tracking-tight",
|
||||||
|
};
|
||||||
|
|
||||||
|
interface HeadingProps {
|
||||||
|
as?: "h1" | "h2" | "h3" | "h4" | "h5";
|
||||||
|
children: React.ReactNode;
|
||||||
|
className?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const Heading = ({
|
||||||
|
as: Component = "h1",
|
||||||
|
children,
|
||||||
|
className = "",
|
||||||
|
...props
|
||||||
|
}: HeadingProps) => {
|
||||||
|
const baseStyles = headingStyles[Component] || headingStyles.h1;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Component className={`${baseStyles} ${className}`} {...props}>
|
||||||
|
{children}
|
||||||
|
</Component>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -1,7 +1,10 @@
|
|||||||
|
import { cn } from "@app/core/utils/cn";
|
||||||
|
|
||||||
export interface PProps {
|
export interface PProps {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
|
className?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const P = ({ children }: PProps): JSX.Element => (
|
export const P = ({ children, className }: PProps) => (
|
||||||
<p className="leading-7 not-first:mt-6">{children}</p>
|
<p className={cn("leading-7 not-first:mt-6", className)}>{children}</p>
|
||||||
);
|
);
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
interface RepoIdentifier {
|
||||||
|
user: string;
|
||||||
|
repo: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface GithubIssueUrlOptions extends Partial<RepoIdentifier> {
|
||||||
|
repoUrl?: string;
|
||||||
|
body?: string;
|
||||||
|
title?: string;
|
||||||
|
labels?: string[];
|
||||||
|
template?: string;
|
||||||
|
assignee?: string;
|
||||||
|
projects?: string[];
|
||||||
|
logs?: string;
|
||||||
|
version?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
type ValidatedOptions = {
|
||||||
|
repoUrl: string;
|
||||||
|
} & Omit<GithubIssueUrlOptions, "repoUrl" | "user" | "repo">;
|
||||||
|
|
||||||
|
const VALID_PARAMS = [
|
||||||
|
"body",
|
||||||
|
"title",
|
||||||
|
"labels",
|
||||||
|
"template",
|
||||||
|
"assignee",
|
||||||
|
"projects",
|
||||||
|
"version",
|
||||||
|
"logs",
|
||||||
|
] as const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a URL for creating a new GitHub issue
|
||||||
|
* @param options Configuration options for the GitHub issue URL
|
||||||
|
* @returns A formatted URL string for creating a new GitHub issue
|
||||||
|
* @throws {Error} If repository information is missing or invalid
|
||||||
|
* @throws {TypeError} If labels or projects are not arrays when provided
|
||||||
|
*/
|
||||||
|
export default function newGithubIssueUrl(
|
||||||
|
options: GithubIssueUrlOptions = {},
|
||||||
|
): string {
|
||||||
|
const validatedOptions = validateOptions(options);
|
||||||
|
const url = new URL(`${validatedOptions.repoUrl}/issues/new`);
|
||||||
|
|
||||||
|
for (const key of VALID_PARAMS) {
|
||||||
|
const value = validatedOptions[key];
|
||||||
|
|
||||||
|
if (value === undefined) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((key === "labels" || key === "projects") && Array.isArray(value)) {
|
||||||
|
url.searchParams.set(key, value.join(","));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
url.searchParams.set(key, String(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
return url.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
function validateOptions(options: GithubIssueUrlOptions): ValidatedOptions {
|
||||||
|
const repoUrl =
|
||||||
|
options.repoUrl ??
|
||||||
|
(options.user && options.repo
|
||||||
|
? `https://github.com/${options.user}/${options.repo}`
|
||||||
|
: undefined);
|
||||||
|
|
||||||
|
if (!repoUrl) {
|
||||||
|
throw new Error(
|
||||||
|
"You need to specify either the `repoUrl` option or both the `user` and `repo` options",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const key of ["labels", "projects"] as const) {
|
||||||
|
const value = options[key];
|
||||||
|
if (value !== undefined && !Array.isArray(value)) {
|
||||||
|
throw new TypeError(`The \`${key}\` option should be an array`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
...options,
|
||||||
|
repoUrl,
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -76,6 +76,10 @@
|
|||||||
::file-selector-button {
|
::file-selector-button {
|
||||||
border-color: var(--color-slate-200, currentColor);
|
border-color: var(--color-slate-200, currentColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: var(--font-sans);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@layer components {
|
@layer components {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
import { Heading } from "@app/components/UI/Typography/Heading";
|
||||||
import { useAppStore } from "@app/core/stores/appStore.ts";
|
import { useAppStore } from "@app/core/stores/appStore.ts";
|
||||||
import { useDeviceStore } from "@app/core/stores/deviceStore.ts";
|
import { useDeviceStore } from "@app/core/stores/deviceStore.ts";
|
||||||
import { Button } from "@components/UI/Button.tsx";
|
import { Button } from "@components/UI/Button.tsx";
|
||||||
import { Separator } from "@components/UI/Seperator.tsx";
|
import { Separator } from "@components/UI/Seperator.tsx";
|
||||||
import { H3 } from "@components/UI/Typography/H3.tsx";
|
|
||||||
import { Subtle } from "@components/UI/Typography/Subtle.tsx";
|
import { Subtle } from "@components/UI/Typography/Subtle.tsx";
|
||||||
import {
|
import {
|
||||||
BluetoothIcon,
|
BluetoothIcon,
|
||||||
@@ -25,7 +25,7 @@ export const Dashboard = () => {
|
|||||||
<div className="flex flex-col gap-3 p-3">
|
<div className="flex flex-col gap-3 p-3">
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<div className="space-y-1">
|
<div className="space-y-1">
|
||||||
<H3>Connected Devices</H3>
|
<Heading as="h3">Connected Devices</Heading>
|
||||||
<Subtle>Manage, connect and disconnect devices</Subtle>
|
<Subtle>Manage, connect and disconnect devices</Subtle>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -89,7 +89,7 @@ export const Dashboard = () => {
|
|||||||
) : (
|
) : (
|
||||||
<div className="m-auto flex flex-col gap-3 text-center">
|
<div className="m-auto flex flex-col gap-3 text-center">
|
||||||
<ListPlusIcon size={48} className="mx-auto text-text-secondary" />
|
<ListPlusIcon size={48} className="mx-auto text-text-secondary" />
|
||||||
<H3>No Devices</H3>
|
<Heading as="h3">No Devices</Heading>
|
||||||
<Subtle>Connect at least one device to get started</Subtle>
|
<Subtle>Connect at least one device to get started</Subtle>
|
||||||
<Button
|
<Button
|
||||||
className="gap-2 dark:bg-white dark:text-slate-900 dark:hover:text-slate-100"
|
className="gap-2 dark:bg-white dark:text-slate-900 dark:hover:text-slate-100"
|
||||||
|
|||||||
Reference in new issue
Block a user