@xyo-network/react-shared 2.25.26 → 2.25.27
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/cjs/components/ErrorBoundry.d.ts +16 -0
- package/dist/cjs/components/ErrorBoundry.js +28 -0
- package/dist/cjs/components/ErrorBoundry.js.map +1 -0
- package/dist/cjs/components/ErrorPage.d.ts +2 -0
- package/dist/cjs/components/ErrorPage.js +9 -0
- package/dist/cjs/components/ErrorPage.js.map +1 -0
- package/dist/cjs/components/FlexPage.d.ts +8 -0
- package/dist/cjs/components/FlexPage.js +23 -0
- package/dist/cjs/components/FlexPage.js.map +1 -0
- package/dist/cjs/components/NotFound/NotFound.d.ts +2 -1
- package/dist/cjs/components/NotFound/NotFound.js +2 -2
- package/dist/cjs/components/NotFound/NotFound.js.map +1 -1
- package/dist/cjs/components/NotFound/NotFoundPage.d.ts +3 -0
- package/dist/cjs/components/NotFound/NotFoundPage.js +13 -0
- package/dist/cjs/components/NotFound/NotFoundPage.js.map +1 -0
- package/dist/cjs/components/NotFound/index.d.ts +1 -0
- package/dist/cjs/components/NotFound/index.js +1 -0
- package/dist/cjs/components/NotFound/index.js.map +1 -1
- package/dist/cjs/components/index.d.ts +3 -0
- package/dist/cjs/components/index.js +3 -0
- package/dist/cjs/components/index.js.map +1 -1
- package/dist/cjs/contexts/AppSettings/Storage.js +1 -1
- package/dist/cjs/contexts/AppSettings/Storage.js.map +1 -1
- package/dist/docs.json +44225 -17437
- package/dist/esm/components/ErrorBoundry.d.ts +16 -0
- package/dist/esm/components/ErrorBoundry.js +23 -0
- package/dist/esm/components/ErrorBoundry.js.map +1 -0
- package/dist/esm/components/ErrorPage.d.ts +2 -0
- package/dist/esm/components/ErrorPage.js +5 -0
- package/dist/esm/components/ErrorPage.js.map +1 -0
- package/dist/esm/components/FlexPage.d.ts +8 -0
- package/dist/esm/components/FlexPage.js +17 -0
- package/dist/esm/components/FlexPage.js.map +1 -0
- package/dist/esm/components/NotFound/NotFound.d.ts +2 -1
- package/dist/esm/components/NotFound/NotFound.js +3 -3
- package/dist/esm/components/NotFound/NotFound.js.map +1 -1
- package/dist/esm/components/NotFound/NotFoundPage.d.ts +3 -0
- package/dist/esm/components/NotFound/NotFoundPage.js +5 -0
- package/dist/esm/components/NotFound/NotFoundPage.js.map +1 -0
- package/dist/esm/components/NotFound/index.d.ts +1 -0
- package/dist/esm/components/NotFound/index.js +1 -0
- package/dist/esm/components/NotFound/index.js.map +1 -1
- package/dist/esm/components/index.d.ts +3 -0
- package/dist/esm/components/index.js +3 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/contexts/AppSettings/Storage.js +1 -1
- package/dist/esm/contexts/AppSettings/Storage.js.map +1 -1
- package/package.json +4 -2
- package/src/components/ErrorBoundry.tsx +42 -0
- package/src/components/ErrorPage.tsx +12 -0
- package/src/components/FlexPage.tsx +42 -0
- package/src/components/NotFound/NotFound.tsx +8 -10
- package/src/components/NotFound/NotFoundPage.tsx +8 -0
- package/src/components/NotFound/index.ts +1 -0
- package/src/components/index.ts +3 -0
- package/src/contexts/AppSettings/Storage.ts +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Component, ErrorInfo, ReactNode } from 'react';
|
|
2
|
+
export interface ErrorBoundaryProps {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
fallback?: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
export interface ErrorBoundaryState {
|
|
7
|
+
error?: Error;
|
|
8
|
+
}
|
|
9
|
+
export declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
10
|
+
constructor(props: ErrorBoundaryProps);
|
|
11
|
+
static getDerivedStateFromError(error: Error): {
|
|
12
|
+
error: Error;
|
|
13
|
+
};
|
|
14
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
15
|
+
render(): string | number | boolean | import("react").ReactFragment | JSX.Element | null | undefined;
|
|
16
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Typography } from '@mui/material';
|
|
3
|
+
import { FlexCol } from '@xylabs/sdk-react';
|
|
4
|
+
import { Component } from 'react';
|
|
5
|
+
export class ErrorBoundary extends Component {
|
|
6
|
+
constructor(props) {
|
|
7
|
+
super(props);
|
|
8
|
+
this.state = { error: undefined };
|
|
9
|
+
}
|
|
10
|
+
static getDerivedStateFromError(error) {
|
|
11
|
+
return { error };
|
|
12
|
+
}
|
|
13
|
+
componentDidCatch(error, errorInfo) {
|
|
14
|
+
console.error(`${error}: ${errorInfo}`);
|
|
15
|
+
}
|
|
16
|
+
render() {
|
|
17
|
+
if (this.state.error) {
|
|
18
|
+
return (this.props.fallback ?? (_jsxs(FlexCol, { children: [_jsx(Typography, { variant: "h1", children: "Something went wrong." }), _jsxs(Typography, { variant: "body1", children: ["[", this.state.error?.message, "]"] })] })));
|
|
19
|
+
}
|
|
20
|
+
return this.props.children;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=ErrorBoundry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorBoundry.js","sourceRoot":"","sources":["../../../src/components/ErrorBoundry.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAwB,MAAM,OAAO,CAAA;AAWvD,MAAM,OAAO,aAAc,SAAQ,SAAiD;IAClF,YAAY,KAAyB;QACnC,KAAK,CAAC,KAAK,CAAC,CAAA;QACZ,IAAI,CAAC,KAAK,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,CAAA;IACnC,CAAC;IAED,MAAM,CAAC,wBAAwB,CAAC,KAAY;QAC1C,OAAO,EAAE,KAAK,EAAE,CAAA;IAClB,CAAC;IAED,iBAAiB,CAAC,KAAY,EAAE,SAAoB;QAClD,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,KAAK,SAAS,EAAE,CAAC,CAAA;IACzC,CAAC;IAED,MAAM;QACJ,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE;YACpB,OAAO,CACL,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,CACrB,MAAC,OAAO,eACN,KAAC,UAAU,IAAC,OAAO,EAAC,IAAI,sCAAmC,EAC3D,MAAC,UAAU,IAAC,OAAO,EAAC,OAAO,kBAAG,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,OAAO,SAAe,IAC9D,CACX,CACF,CAAA;SACF;QAED,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAA;IAC5B,CAAC;CACF"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ButtonEx } from '@xylabs/sdk-react';
|
|
3
|
+
import { FlexPage } from './FlexPage';
|
|
4
|
+
export const ErrorPage = () => (_jsxs(FlexPage, { title: "Oops! Something went wrong", children: [_jsx("h1", { children: "Oops! Something went wrong!" }), _jsx(ButtonEx, { href: "/", variant: "contained", children: "Homepage" })] }));
|
|
5
|
+
//# sourceMappingURL=ErrorPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorPage.js","sourceRoot":"","sources":["../../../src/components/ErrorPage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,CAC7B,MAAC,QAAQ,IAAC,KAAK,EAAC,4BAA4B,aAC1C,uDAAoC,EACpC,KAAC,QAAQ,IAAC,IAAI,EAAC,GAAG,EAAC,OAAO,EAAC,WAAW,yBAE3B,IACF,CACZ,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ContainerProps } from '@mui/material';
|
|
2
|
+
import { FlexBoxProps } from '@xylabs/sdk-react';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
export interface FlexPageProps extends FlexBoxProps {
|
|
5
|
+
container?: ContainerProps['maxWidth'];
|
|
6
|
+
breadcrumbs?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare const FlexPage: React.FC<FlexPageProps>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Container } from '@mui/material';
|
|
3
|
+
import { FlexGrowCol, useAsyncEffect, useUserEvents } from '@xylabs/sdk-react';
|
|
4
|
+
import { Helmet } from 'react-helmet';
|
|
5
|
+
import { useLocation } from 'react-router-dom';
|
|
6
|
+
export const FlexPage = ({ title, container = 'xl', breadcrumbs, children, ...props }) => {
|
|
7
|
+
const userEvents = useUserEvents();
|
|
8
|
+
const { pathname } = useLocation();
|
|
9
|
+
useAsyncEffect(
|
|
10
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
11
|
+
async () => {
|
|
12
|
+
await userEvents?.viewContent({ name: title ?? 'NodeBasePage', path: location.pathname });
|
|
13
|
+
}, [pathname, title, userEvents]);
|
|
14
|
+
const Body = (props) => (_jsxs(FlexGrowCol, { gap: 2, paddingY: 2, justifyContent: "flex-start", alignItems: "stretch", ...props, children: [breadcrumbs, children] }));
|
|
15
|
+
return (_jsxs(FlexGrowCol, { alignItems: "stretch", justifyContent: "flex-start", minHeight: 0, overflow: "visible scroll", children: [_jsx(Helmet, { title: title }), container ? (_jsx(Container, { style: { alignItems: 'stretch', display: 'flex', flexDirection: 'column', flexGrow: 1, justifyContent: 'flex-start' }, maxWidth: container, children: _jsx(Body, { ...props }) })) : (_jsx(Body, { ...props }))] }));
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=FlexPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlexPage.js","sourceRoot":"","sources":["../../../src/components/FlexPage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAkB,MAAM,eAAe,CAAA;AACzD,OAAO,EAAgB,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAE5F,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAM9C,MAAM,CAAC,MAAM,QAAQ,GAA4B,CAAC,EAAE,KAAK,EAAE,SAAS,GAAG,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IAChH,MAAM,UAAU,GAAG,aAAa,EAAE,CAAA;IAClC,MAAM,EAAE,QAAQ,EAAE,GAAG,WAAW,EAAE,CAAA;IAElC,cAAc;IACZ,uDAAuD;IACvD,KAAK,IAAI,EAAE;QACT,MAAM,UAAU,EAAE,WAAW,CAAC,EAAE,IAAI,EAAE,KAAK,IAAI,cAAc,EAAE,IAAI,EAAE,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAA;IAC3F,CAAC,EACD,CAAC,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,CAC9B,CAAA;IAED,MAAM,IAAI,GAA2B,CAAC,KAAK,EAAE,EAAE,CAAC,CAC9C,MAAC,WAAW,IAAC,GAAG,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,cAAc,EAAC,YAAY,EAAC,UAAU,EAAC,SAAS,KAAK,KAAK,aACzF,WAAW,EACX,QAAQ,IACG,CACf,CAAA;IAED,OAAO,CACL,MAAC,WAAW,IAAC,UAAU,EAAC,SAAS,EAAC,cAAc,EAAC,YAAY,EAAC,SAAS,EAAE,CAAC,EAAE,QAAQ,EAAC,gBAAgB,aACnG,KAAC,MAAM,IAAC,KAAK,EAAE,KAAK,GAAI,EACvB,SAAS,CAAC,CAAC,CAAC,CACX,KAAC,SAAS,IAAC,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,EAAE,cAAc,EAAE,YAAY,EAAE,EAAE,QAAQ,EAAE,SAAS,YACnJ,KAAC,IAAI,OAAK,KAAK,GAAI,GACT,CACb,CAAC,CAAC,CAAC,CACF,KAAC,IAAI,OAAK,KAAK,GAAI,CACpB,IACW,CACf,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Typography } from '@mui/material';
|
|
3
3
|
import { FlexGrowCol } from '@xylabs/sdk-react';
|
|
4
|
-
const NotFound = () => {
|
|
5
|
-
return (
|
|
4
|
+
const NotFound = (props) => {
|
|
5
|
+
return (_jsxs(FlexGrowCol, { ...props, children: [_jsx(Typography, { variant: "h2", children: "Sorry!" }), _jsx(Typography, { marginY: 3, variant: "body2", children: "Can't find anything here" })] }));
|
|
6
6
|
};
|
|
7
7
|
export { NotFound };
|
|
8
8
|
//# sourceMappingURL=NotFound.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotFound.js","sourceRoot":"","sources":["../../../../src/components/NotFound/NotFound.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,
|
|
1
|
+
{"version":3,"file":"NotFound.js","sourceRoot":"","sources":["../../../../src/components/NotFound/NotFound.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAgB,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAE7D,MAAM,QAAQ,GAA2B,CAAC,KAAK,EAAE,EAAE;IACjD,OAAO,CACL,MAAC,WAAW,OAAK,KAAK,aACpB,KAAC,UAAU,IAAC,OAAO,EAAC,IAAI,uBAAoB,EAC5C,KAAC,UAAU,IAAC,OAAO,EAAE,CAAC,EAAE,OAAO,EAAC,OAAO,YACpC,0BAA0B,GAChB,IACD,CACf,CAAA;AACH,CAAC,CAAA;AAED,OAAO,EAAE,QAAQ,EAAE,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { FlexPage } from '../FlexPage';
|
|
3
|
+
import { NotFound } from './NotFound';
|
|
4
|
+
export const NotFoundPage = ({ title, ...props }) => (_jsx(FlexPage, { title: title ?? 'Sorry! Page Not Found', ...props, children: _jsx(NotFound, {}) }));
|
|
5
|
+
//# sourceMappingURL=NotFoundPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotFoundPage.js","sourceRoot":"","sources":["../../../../src/components/NotFound/NotFoundPage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAiB,MAAM,aAAa,CAAA;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,MAAM,CAAC,MAAM,YAAY,GAA4B,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE,CAAC,CAC5E,KAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,IAAI,uBAAuB,KAAM,KAAK,YAC1D,KAAC,QAAQ,KAAG,GACH,CACZ,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/NotFound/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/NotFound/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export * from './Ampersand';
|
|
2
2
|
export * from './BasicHero';
|
|
3
3
|
export * from './DarkModeIconButton';
|
|
4
|
+
export * from './ErrorBoundry';
|
|
5
|
+
export * from './ErrorPage';
|
|
6
|
+
export * from './FlexPage';
|
|
4
7
|
export * from './Footer';
|
|
5
8
|
export * from './FullWidthCard';
|
|
6
9
|
export * from './GradientText';
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export * from './Ampersand';
|
|
2
2
|
export * from './BasicHero';
|
|
3
3
|
export * from './DarkModeIconButton';
|
|
4
|
+
export * from './ErrorBoundry';
|
|
5
|
+
export * from './ErrorPage';
|
|
6
|
+
export * from './FlexPage';
|
|
4
7
|
export * from './Footer';
|
|
5
8
|
export * from './FullWidthCard';
|
|
6
9
|
export * from './GradientText';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,sBAAsB,CAAA;AACpC,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA;AAClC,cAAc,YAAY,CAAA;AAC1B,cAAc,QAAQ,CAAA;AACtB,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,sBAAsB,CAAA;AACpC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA;AAClC,cAAc,YAAY,CAAA;AAC1B,cAAc,QAAQ,CAAA;AACtB,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA"}
|
|
@@ -2,7 +2,7 @@ import { appSettingDefault } from './appSettingDefault';
|
|
|
2
2
|
import { AppSettingSlug } from './Slug';
|
|
3
3
|
import { AppSettingsStorageBase } from './StorageBase';
|
|
4
4
|
export class AppSettingsStorage extends AppSettingsStorageBase {
|
|
5
|
-
constructor(prefix = '
|
|
5
|
+
constructor(prefix = 'AppSettings', defaults) {
|
|
6
6
|
super(prefix, { ...appSettingDefault(), ...defaults });
|
|
7
7
|
}
|
|
8
8
|
get darkMode() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Storage.js","sourceRoot":"","sources":["../../../../src/contexts/AppSettings/Storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAEtD,MAAM,OAAO,kBAAmB,SAAQ,sBAAsB;IAC5D,YAAY,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"Storage.js","sourceRoot":"","sources":["../../../../src/contexts/AppSettings/Storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAEtD,MAAM,OAAO,kBAAmB,SAAQ,sBAAsB;IAC5D,YAAY,MAAM,GAAG,aAAa,EAAE,QAAkC;QACpE,KAAK,CAAC,MAAM,EAAE,EAAE,GAAG,iBAAiB,EAAE,EAAE,GAAG,QAAQ,EAAE,CAAC,CAAA;IACxD,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAA;IACjD,CAAC;IAED,IAAI,QAAQ,CAAC,KAAc;QACzB,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;IACjD,CAAC;IAED,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,SAAS,CAAC,CAAA;IAClD,CAAC;IAED,IAAI,aAAa,CAAC,KAAc;QAC9B,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,SAAS,EAAE,KAAK,CAAC,CAAA;IAClD,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -22,11 +22,12 @@
|
|
|
22
22
|
"@xyo-network/api": "^2.20.38",
|
|
23
23
|
"@xyo-network/core": "^2.20.38",
|
|
24
24
|
"@xyo-network/network": "^2.20.38",
|
|
25
|
-
"@xyo-network/react-theme": "^2.25.
|
|
25
|
+
"@xyo-network/react-theme": "^2.25.27",
|
|
26
26
|
"lodash": "^4.17.21",
|
|
27
27
|
"luxon": "^2.4.0",
|
|
28
28
|
"react": "^18.1.0",
|
|
29
29
|
"react-dom": "^18.1.0",
|
|
30
|
+
"react-helmet": "^6.1.0",
|
|
30
31
|
"react-icons": "^4.3.1",
|
|
31
32
|
"react-json-view": "^1.21.3",
|
|
32
33
|
"react-router-dom": "^6.3.0",
|
|
@@ -44,6 +45,7 @@
|
|
|
44
45
|
"@storybook/react": "^6.5.6",
|
|
45
46
|
"@storybook/theming": "^6.5.6",
|
|
46
47
|
"@types/lodash": "^4.14.182",
|
|
48
|
+
"@types/react-helmet": "^6.1.5",
|
|
47
49
|
"@xylabs/pixel": "^1.3.7",
|
|
48
50
|
"@xylabs/sdk-js": "^2.5.5",
|
|
49
51
|
"@xylabs/sdk-react": "^2.12.10",
|
|
@@ -111,6 +113,6 @@
|
|
|
111
113
|
},
|
|
112
114
|
"sideEffects": false,
|
|
113
115
|
"types": "dist/esm/index.d.ts",
|
|
114
|
-
"version": "2.25.
|
|
116
|
+
"version": "2.25.27",
|
|
115
117
|
"packageManager": "yarn@3.1.1"
|
|
116
118
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Typography } from '@mui/material'
|
|
2
|
+
import { FlexCol } from '@xylabs/sdk-react'
|
|
3
|
+
import { Component, ErrorInfo, ReactNode } from 'react'
|
|
4
|
+
|
|
5
|
+
export interface ErrorBoundaryProps {
|
|
6
|
+
children: ReactNode
|
|
7
|
+
fallback?: ReactNode
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface ErrorBoundaryState {
|
|
11
|
+
error?: Error
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
15
|
+
constructor(props: ErrorBoundaryProps) {
|
|
16
|
+
super(props)
|
|
17
|
+
this.state = { error: undefined }
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static getDerivedStateFromError(error: Error) {
|
|
21
|
+
return { error }
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo) {
|
|
25
|
+
console.error(`${error}: ${errorInfo}`)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
render() {
|
|
29
|
+
if (this.state.error) {
|
|
30
|
+
return (
|
|
31
|
+
this.props.fallback ?? (
|
|
32
|
+
<FlexCol>
|
|
33
|
+
<Typography variant="h1">Something went wrong.</Typography>
|
|
34
|
+
<Typography variant="body1">[{this.state.error?.message}]</Typography>
|
|
35
|
+
</FlexCol>
|
|
36
|
+
)
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return this.props.children
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ButtonEx } from '@xylabs/sdk-react'
|
|
2
|
+
|
|
3
|
+
import { FlexPage } from './FlexPage'
|
|
4
|
+
|
|
5
|
+
export const ErrorPage = () => (
|
|
6
|
+
<FlexPage title="Oops! Something went wrong">
|
|
7
|
+
<h1>Oops! Something went wrong!</h1>
|
|
8
|
+
<ButtonEx href="/" variant="contained">
|
|
9
|
+
Homepage
|
|
10
|
+
</ButtonEx>
|
|
11
|
+
</FlexPage>
|
|
12
|
+
)
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Container, ContainerProps } from '@mui/material'
|
|
2
|
+
import { FlexBoxProps, FlexGrowCol, useAsyncEffect, useUserEvents } from '@xylabs/sdk-react'
|
|
3
|
+
import { ReactNode } from 'react'
|
|
4
|
+
import { Helmet } from 'react-helmet'
|
|
5
|
+
import { useLocation } from 'react-router-dom'
|
|
6
|
+
export interface FlexPageProps extends FlexBoxProps {
|
|
7
|
+
container?: ContainerProps['maxWidth']
|
|
8
|
+
breadcrumbs?: ReactNode
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const FlexPage: React.FC<FlexPageProps> = ({ title, container = 'xl', breadcrumbs, children, ...props }) => {
|
|
12
|
+
const userEvents = useUserEvents()
|
|
13
|
+
const { pathname } = useLocation()
|
|
14
|
+
|
|
15
|
+
useAsyncEffect(
|
|
16
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
17
|
+
async () => {
|
|
18
|
+
await userEvents?.viewContent({ name: title ?? 'NodeBasePage', path: location.pathname })
|
|
19
|
+
},
|
|
20
|
+
[pathname, title, userEvents]
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
const Body: React.FC<FlexBoxProps> = (props) => (
|
|
24
|
+
<FlexGrowCol gap={2} paddingY={2} justifyContent="flex-start" alignItems="stretch" {...props}>
|
|
25
|
+
{breadcrumbs}
|
|
26
|
+
{children}
|
|
27
|
+
</FlexGrowCol>
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<FlexGrowCol alignItems="stretch" justifyContent="flex-start" minHeight={0} overflow="visible scroll">
|
|
32
|
+
<Helmet title={title} />
|
|
33
|
+
{container ? (
|
|
34
|
+
<Container style={{ alignItems: 'stretch', display: 'flex', flexDirection: 'column', flexGrow: 1, justifyContent: 'flex-start' }} maxWidth={container}>
|
|
35
|
+
<Body {...props} />
|
|
36
|
+
</Container>
|
|
37
|
+
) : (
|
|
38
|
+
<Body {...props} />
|
|
39
|
+
)}
|
|
40
|
+
</FlexGrowCol>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { Typography } from '@mui/material'
|
|
2
|
-
import { FlexGrowCol } from '@xylabs/sdk-react'
|
|
2
|
+
import { FlexBoxProps, FlexGrowCol } from '@xylabs/sdk-react'
|
|
3
3
|
|
|
4
|
-
const NotFound = () => {
|
|
4
|
+
const NotFound: React.FC<FlexBoxProps> = (props) => {
|
|
5
5
|
return (
|
|
6
|
-
|
|
7
|
-
<
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
</FlexGrowCol>
|
|
13
|
-
</>
|
|
6
|
+
<FlexGrowCol {...props}>
|
|
7
|
+
<Typography variant="h2">Sorry!</Typography>
|
|
8
|
+
<Typography marginY={3} variant="body2">
|
|
9
|
+
{"Can't find anything here"}
|
|
10
|
+
</Typography>
|
|
11
|
+
</FlexGrowCol>
|
|
14
12
|
)
|
|
15
13
|
}
|
|
16
14
|
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FlexPage, FlexPageProps } from '../FlexPage'
|
|
2
|
+
import { NotFound } from './NotFound'
|
|
3
|
+
|
|
4
|
+
export const NotFoundPage: React.FC<FlexPageProps> = ({ title, ...props }) => (
|
|
5
|
+
<FlexPage title={title ?? 'Sorry! Page Not Found'} {...props}>
|
|
6
|
+
<NotFound />
|
|
7
|
+
</FlexPage>
|
|
8
|
+
)
|
package/src/components/index.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export * from './Ampersand'
|
|
2
2
|
export * from './BasicHero'
|
|
3
3
|
export * from './DarkModeIconButton'
|
|
4
|
+
export * from './ErrorBoundry'
|
|
5
|
+
export * from './ErrorPage'
|
|
6
|
+
export * from './FlexPage'
|
|
4
7
|
export * from './Footer'
|
|
5
8
|
export * from './FullWidthCard'
|
|
6
9
|
export * from './GradientText'
|
|
@@ -3,7 +3,7 @@ import { AppSettingSlug } from './Slug'
|
|
|
3
3
|
import { AppSettingsStorageBase } from './StorageBase'
|
|
4
4
|
|
|
5
5
|
export class AppSettingsStorage extends AppSettingsStorageBase {
|
|
6
|
-
constructor(prefix = '
|
|
6
|
+
constructor(prefix = 'AppSettings', defaults?: Record<string, unknown>) {
|
|
7
7
|
super(prefix, { ...appSettingDefault(), ...defaults })
|
|
8
8
|
}
|
|
9
9
|
|