@xyo-network/react-webapp 2.25.51 → 2.25.52

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.
Files changed (55) hide show
  1. package/dist/cjs/components/{WebAppChrome.d.ts → Chrome.d.ts} +0 -0
  2. package/dist/cjs/components/{WebAppChrome.js → Chrome.js} +4 -2
  3. package/dist/cjs/components/Chrome.js.map +1 -0
  4. package/dist/cjs/components/ErrorPage.d.ts +4 -0
  5. package/dist/cjs/components/ErrorPage.js +11 -0
  6. package/dist/cjs/components/ErrorPage.js.map +1 -0
  7. package/dist/cjs/components/NotFoundPage/NotFound.d.ts +4 -0
  8. package/dist/cjs/components/NotFoundPage/NotFound.js +11 -0
  9. package/dist/cjs/components/NotFoundPage/NotFound.js.map +1 -0
  10. package/dist/cjs/components/NotFoundPage/Page.d.ts +5 -0
  11. package/dist/cjs/components/NotFoundPage/Page.js +15 -0
  12. package/dist/cjs/components/NotFoundPage/Page.js.map +1 -0
  13. package/dist/cjs/components/NotFoundPage/index.d.ts +2 -0
  14. package/dist/cjs/components/NotFoundPage/index.js +6 -0
  15. package/dist/cjs/components/NotFoundPage/index.js.map +1 -0
  16. package/dist/cjs/components/Page.d.ts +10 -0
  17. package/dist/cjs/components/Page.js +27 -0
  18. package/dist/cjs/components/Page.js.map +1 -0
  19. package/dist/cjs/components/index.d.ts +4 -1
  20. package/dist/cjs/components/index.js +4 -1
  21. package/dist/cjs/components/index.js.map +1 -1
  22. package/dist/docs.json +25169 -51
  23. package/dist/esm/components/{WebAppChrome.d.ts → Chrome.d.ts} +0 -0
  24. package/dist/esm/components/{WebAppChrome.js → Chrome.js} +5 -3
  25. package/dist/esm/components/Chrome.js.map +1 -0
  26. package/dist/esm/components/ErrorPage.d.ts +4 -0
  27. package/dist/esm/components/ErrorPage.js +7 -0
  28. package/dist/esm/components/ErrorPage.js.map +1 -0
  29. package/dist/esm/components/NotFoundPage/NotFound.d.ts +4 -0
  30. package/dist/esm/components/NotFoundPage/NotFound.js +8 -0
  31. package/dist/esm/components/NotFoundPage/NotFound.js.map +1 -0
  32. package/dist/esm/components/NotFoundPage/Page.d.ts +5 -0
  33. package/dist/esm/components/NotFoundPage/Page.js +7 -0
  34. package/dist/esm/components/NotFoundPage/Page.js.map +1 -0
  35. package/dist/esm/components/NotFoundPage/index.d.ts +2 -0
  36. package/dist/esm/components/NotFoundPage/index.js +3 -0
  37. package/dist/esm/components/NotFoundPage/index.js.map +1 -0
  38. package/dist/esm/components/Page.d.ts +10 -0
  39. package/dist/esm/components/Page.js +21 -0
  40. package/dist/esm/components/Page.js.map +1 -0
  41. package/dist/esm/components/index.d.ts +4 -1
  42. package/dist/esm/components/index.js +4 -1
  43. package/dist/esm/components/index.js.map +1 -1
  44. package/package.json +9 -16
  45. package/src/components/{WebAppChrome.stories.tsx → Chrome.stories.tsx} +3 -3
  46. package/src/components/{WebAppChrome.tsx → Chrome.tsx} +5 -2
  47. package/src/components/ErrorPage.tsx +15 -0
  48. package/src/components/NotFoundPage/NotFound.tsx +15 -0
  49. package/src/components/NotFoundPage/Page.stories.tsx +26 -0
  50. package/src/components/NotFoundPage/Page.tsx +11 -0
  51. package/src/components/NotFoundPage/index.ts +2 -0
  52. package/src/components/Page.tsx +47 -0
  53. package/src/components/index.ts +4 -1
  54. package/dist/cjs/components/WebAppChrome.js.map +0 -1
  55. package/dist/esm/components/WebAppChrome.js.map +0 -1
@@ -2,9 +2,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Paper } from '@mui/material';
3
3
  import { FlexCol, FlexGrowCol } from '@xylabs/react-flexbox';
4
4
  import { ApplicationAppBar } from '@xyo-network/react-appbar';
5
- import { ErrorBoundary, ErrorPage, Footer } from '@xyo-network/react-shared';
5
+ import { Footer } from '@xyo-network/react-footer';
6
+ import { ErrorBoundary } from '@xyo-network/react-shared';
6
7
  import { Helmet } from 'react-helmet';
8
+ import { WebAppErrorPage } from './ErrorPage';
7
9
  export const WebAppChrome = ({ footerElevation = 4, errorPage, appbar, footer, children, appName, ...props }) => {
8
- return (_jsxs(FlexCol, { alignItems: "stretch", height: "100vh", ...props, children: [_jsx(Helmet, { defaultTitle: appName, titleTemplate: `%s | ${appName}`, children: _jsx("meta", { content: "website", property: "og:type" }) }), appbar ?? _jsx(ApplicationAppBar, {}), _jsx(FlexGrowCol, { overflow: "hidden", justifyContent: "flex-start", alignItems: "stretch", children: _jsx(ErrorBoundary, { fallback: errorPage ?? _jsx(ErrorPage, {}), children: children }) }), _jsx(Paper, { elevation: footerElevation, square: true, children: footer ?? _jsx(Footer, { dynamicHeight: true }) })] }));
10
+ return (_jsxs(FlexCol, { alignItems: "stretch", height: "100vh", ...props, children: [_jsx(Helmet, { defaultTitle: appName, titleTemplate: `%s | ${appName}`, children: _jsx("meta", { content: "website", property: "og:type" }) }), appbar ?? _jsx(ApplicationAppBar, {}), _jsx(FlexGrowCol, { overflow: "hidden", justifyContent: "flex-start", alignItems: "stretch", children: _jsx(ErrorBoundary, { fallback: errorPage ?? _jsx(WebAppErrorPage, {}), children: children }) }), _jsx(Paper, { elevation: footerElevation, square: true, children: footer ?? _jsx(Footer, { dynamicHeight: true }) })] }));
9
11
  };
10
- //# sourceMappingURL=WebAppChrome.js.map
12
+ //# sourceMappingURL=Chrome.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Chrome.js","sourceRoot":"","sources":["../../../src/components/Chrome.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,EAAgB,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAEzD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAErC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAU7C,MAAM,CAAC,MAAM,YAAY,GAAgC,CAAC,EAAE,eAAe,GAAG,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IAC3I,OAAO,CACL,MAAC,OAAO,IAAC,UAAU,EAAC,SAAS,EAAC,MAAM,EAAC,OAAO,KAAK,KAAK,aACpD,KAAC,MAAM,IAAC,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,OAAO,EAAE,YAC7D,eAAM,OAAO,EAAC,SAAS,EAAC,QAAQ,EAAC,SAAS,GAAG,GACtC,EACR,MAAM,IAAI,KAAC,iBAAiB,KAAG,EAChC,KAAC,WAAW,IAAC,QAAQ,EAAC,QAAQ,EAAC,cAAc,EAAC,YAAY,EAAC,UAAU,EAAC,SAAS,YAC7E,KAAC,aAAa,IAAC,QAAQ,EAAE,SAAS,IAAI,KAAC,eAAe,KAAG,YAAG,QAAQ,GAAiB,GACzE,EACd,KAAC,KAAK,IAAC,SAAS,EAAE,eAAe,EAAE,MAAM,kBACtC,MAAM,IAAI,KAAC,MAAM,IAAC,aAAa,SAAG,GAC7B,IACA,CACX,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ export declare const WebAppErrorPage: () => JSX.Element;
3
+ /** @deprecated use WebAppErrorPage instead */
4
+ export declare const ErrorPage: () => JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ButtonEx } from '@xylabs/react-button';
3
+ import { WebAppPage } from './Page';
4
+ export const WebAppErrorPage = () => (_jsxs(WebAppPage, { title: "Oops! Something went wrong", children: [_jsx("h1", { children: "Oops! Something went wrong!" }), _jsx(ButtonEx, { href: "/", variant: "contained", children: "Homepage" })] }));
5
+ /** @deprecated use WebAppErrorPage instead */
6
+ export const ErrorPage = WebAppErrorPage;
7
+ //# 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,sBAAsB,CAAA;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AAEnC,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE,CAAC,CACnC,MAAC,UAAU,IAAC,KAAK,EAAC,4BAA4B,aAC5C,uDAAoC,EACpC,KAAC,QAAQ,IAAC,IAAI,EAAC,GAAG,EAAC,OAAO,EAAC,WAAW,yBAE3B,IACA,CACd,CAAA;AAED,8CAA8C;AAC9C,MAAM,CAAC,MAAM,SAAS,GAAG,eAAe,CAAA"}
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { FlexBoxProps } from '@xylabs/react-flexbox';
3
+ declare const NotFound: React.FC<FlexBoxProps>;
4
+ export { NotFound };
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Typography } from '@mui/material';
3
+ import { FlexGrowCol } from '@xylabs/react-flexbox';
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
+ };
7
+ export { NotFound };
8
+ //# sourceMappingURL=NotFound.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotFound.js","sourceRoot":"","sources":["../../../../src/components/NotFoundPage/NotFound.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAgB,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAEjE,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
+ /// <reference types="react" />
2
+ import { WebAppPageProps } from '../Page';
3
+ export declare const WebAppNotFoundPage: React.FC<WebAppPageProps>;
4
+ /** @deprecated use WebAppNotFoundPage instead */
5
+ export declare const NotFoundPage: import("react").FC<WebAppPageProps>;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { WebAppPage } from '../Page';
3
+ import { NotFound } from './NotFound';
4
+ export const WebAppNotFoundPage = ({ title, ...props }) => (_jsx(WebAppPage, { title: title ?? 'Sorry! Page Not Found', ...props, children: _jsx(NotFound, {}) }));
5
+ /** @deprecated use WebAppNotFoundPage instead */
6
+ export const NotFoundPage = WebAppNotFoundPage;
7
+ //# sourceMappingURL=Page.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Page.js","sourceRoot":"","sources":["../../../../src/components/NotFoundPage/Page.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAmB,MAAM,SAAS,CAAA;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,MAAM,CAAC,MAAM,kBAAkB,GAA8B,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE,CAAC,CACpF,KAAC,UAAU,IAAC,KAAK,EAAE,KAAK,IAAI,uBAAuB,KAAM,KAAK,YAC5D,KAAC,QAAQ,KAAG,GACD,CACd,CAAA;AAED,kDAAkD;AAClD,MAAM,CAAC,MAAM,YAAY,GAAG,kBAAkB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './NotFound';
2
+ export * from './Page';
@@ -0,0 +1,3 @@
1
+ export * from './NotFound';
2
+ export * from './Page';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/NotFoundPage/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,QAAQ,CAAA"}
@@ -0,0 +1,10 @@
1
+ import { ContainerProps } from '@mui/material';
2
+ import { FlexBoxProps } from '@xylabs/react-flexbox';
3
+ import { ReactNode } from 'react';
4
+ export interface WebAppPageProps extends FlexBoxProps {
5
+ container?: ContainerProps['maxWidth'];
6
+ breadcrumbs?: ReactNode;
7
+ }
8
+ export declare const WebAppPage: React.FC<WebAppPageProps>;
9
+ /** @deprecated use WebAppPagePage instead */
10
+ export declare const FlexPage: import("react").FC<WebAppPageProps>;
@@ -0,0 +1,21 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ import { Container } from '@mui/material';
3
+ import { FlexGrowCol } from '@xylabs/react-flexbox';
4
+ import { useUserEvents } from '@xylabs/react-pixel';
5
+ import { useAsyncEffect } from '@xylabs/react-shared';
6
+ import { Helmet } from 'react-helmet';
7
+ import { useLocation } from 'react-router-dom';
8
+ export const WebAppPage = ({ title, container = 'xl', breadcrumbs, children, ...props }) => {
9
+ const userEvents = useUserEvents();
10
+ const { pathname } = useLocation();
11
+ useAsyncEffect(
12
+ // eslint-disable-next-line react-hooks/exhaustive-deps
13
+ async () => {
14
+ await userEvents?.viewContent({ name: title ?? 'NodeBasePage', path: location.pathname });
15
+ }, [pathname, title, userEvents]);
16
+ const Body = (props) => (_jsxs(FlexGrowCol, { gap: 2, paddingY: 2, justifyContent: "flex-start", alignItems: "stretch", ...props, children: [breadcrumbs, children] }));
17
+ 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 }))] }));
18
+ };
19
+ /** @deprecated use WebAppPagePage instead */
20
+ export const FlexPage = WebAppPage;
21
+ //# sourceMappingURL=Page.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Page.js","sourceRoot":"","sources":["../../../src/components/Page.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAkB,MAAM,eAAe,CAAA;AACzD,OAAO,EAAgB,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAErD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAM9C,MAAM,CAAC,MAAM,UAAU,GAA8B,CAAC,EAAE,KAAK,EAAE,SAAS,GAAG,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IACpH,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;AAED,6CAA6C;AAC7C,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAAA"}
@@ -1 +1,4 @@
1
- export * from './WebAppChrome';
1
+ export * from './Chrome';
2
+ export * from './ErrorPage';
3
+ export * from './NotFoundPage';
4
+ export * from './Page';
@@ -1,2 +1,5 @@
1
- export * from './WebAppChrome';
1
+ export * from './Chrome';
2
+ export * from './ErrorPage';
3
+ export * from './NotFoundPage';
4
+ export * from './Page';
2
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,QAAQ,CAAA"}
package/package.json CHANGED
@@ -13,15 +13,18 @@
13
13
  "@emotion/react": "^11.9.0",
14
14
  "@emotion/styled": "^11.8.1",
15
15
  "@mui/material": "^5.8.3",
16
+ "@xylabs/react-button": "^2.12.23",
16
17
  "@xylabs/react-flexbox": "^2.12.23",
17
- "@xyo-network/react-appbar": "^2.25.51",
18
- "@xyo-network/react-shared": "^2.25.51",
18
+ "@xylabs/react-pixel": "^2.12.23",
19
+ "@xylabs/react-shared": "^2.12.23",
20
+ "@xyo-network/react-appbar": "^2.25.52",
21
+ "@xyo-network/react-footer": "^2.25.52",
22
+ "@xyo-network/react-shared": "^2.25.52",
19
23
  "react": "^18.1.0",
20
24
  "react-dom": "^18.1.0",
21
25
  "react-helmet": "^6.1.0",
22
26
  "react-router-dom": "^6.3.0",
23
- "tslib": "^2.4.0",
24
- "typedoc": "^0.22.17"
27
+ "tslib": "^2.4.0"
25
28
  },
26
29
  "description": "Common React library for all XYO projects that use React",
27
30
  "devDependencies": {
@@ -29,8 +32,7 @@
29
32
  "@babel/preset-env": "^7.18.2",
30
33
  "@storybook/react": "^6.5.8",
31
34
  "@types/react-helmet": "^6.1.5",
32
- "@xylabs/tsconfig": "^1.0.13",
33
- "axios": "^0.27.2"
35
+ "@xylabs/tsconfig": "^1.0.13"
34
36
  },
35
37
  "browser": "dist/esm/index.js",
36
38
  "docs": "dist/docs.json",
@@ -61,15 +63,6 @@
61
63
  "react"
62
64
  ],
63
65
  "license": "LGPL-3.0",
64
- "peerDependencies": {
65
- "axios": ">0.26",
66
- "typedoc": "^0.22.13"
67
- },
68
- "peerDependenciesMeta": {
69
- "typedoc": {
70
- "optional": true
71
- }
72
- },
73
66
  "resolutions": {
74
67
  "@storybook/react/webpack": "^5",
75
68
  "bn.js": "^5.2.0",
@@ -90,6 +83,6 @@
90
83
  },
91
84
  "sideEffects": false,
92
85
  "types": "dist/esm/index.d.ts",
93
- "version": "2.25.51",
86
+ "version": "2.25.52",
94
87
  "packageManager": "yarn@3.1.1"
95
88
  }
@@ -3,8 +3,8 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'
3
3
  import { FlexCol } from '@xylabs/react-flexbox'
4
4
  import { BrowserRouter } from 'react-router-dom'
5
5
 
6
- import { FlexPage } from '../../../shared/src'
7
- import { WebAppChrome } from './WebAppChrome'
6
+ import { WebAppChrome } from './Chrome'
7
+ import { WebAppPage } from './Page'
8
8
 
9
9
  const StorybookEntry = {
10
10
  argTypes: {},
@@ -22,7 +22,7 @@ const Template: ComponentStory<typeof WebAppChrome> = (args) => {
22
22
  <FlexCol height="80vh" alignItems="stretch" overflow="hidden">
23
23
  <BrowserRouter>
24
24
  <WebAppChrome {...args}>
25
- <FlexPage />
25
+ <WebAppPage />
26
26
  </WebAppChrome>
27
27
  </BrowserRouter>
28
28
  </FlexCol>
@@ -1,10 +1,13 @@
1
1
  import { Paper } from '@mui/material'
2
2
  import { FlexBoxProps, FlexCol, FlexGrowCol } from '@xylabs/react-flexbox'
3
3
  import { ApplicationAppBar } from '@xyo-network/react-appbar'
4
- import { ErrorBoundary, ErrorPage, Footer } from '@xyo-network/react-shared'
4
+ import { Footer } from '@xyo-network/react-footer'
5
+ import { ErrorBoundary } from '@xyo-network/react-shared'
5
6
  import { ReactNode } from 'react'
6
7
  import { Helmet } from 'react-helmet'
7
8
 
9
+ import { WebAppErrorPage } from './ErrorPage'
10
+
8
11
  export interface WebAppChromeProps extends FlexBoxProps {
9
12
  appName: string
10
13
  footer?: ReactNode
@@ -21,7 +24,7 @@ export const WebAppChrome: React.FC<WebAppChromeProps> = ({ footerElevation = 4,
21
24
  </Helmet>
22
25
  {appbar ?? <ApplicationAppBar />}
23
26
  <FlexGrowCol overflow="hidden" justifyContent="flex-start" alignItems="stretch">
24
- <ErrorBoundary fallback={errorPage ?? <ErrorPage />}>{children}</ErrorBoundary>
27
+ <ErrorBoundary fallback={errorPage ?? <WebAppErrorPage />}>{children}</ErrorBoundary>
25
28
  </FlexGrowCol>
26
29
  <Paper elevation={footerElevation} square>
27
30
  {footer ?? <Footer dynamicHeight />}
@@ -0,0 +1,15 @@
1
+ import { ButtonEx } from '@xylabs/react-button'
2
+
3
+ import { WebAppPage } from './Page'
4
+
5
+ export const WebAppErrorPage = () => (
6
+ <WebAppPage title="Oops! Something went wrong">
7
+ <h1>Oops! Something went wrong!</h1>
8
+ <ButtonEx href="/" variant="contained">
9
+ Homepage
10
+ </ButtonEx>
11
+ </WebAppPage>
12
+ )
13
+
14
+ /** @deprecated use WebAppErrorPage instead */
15
+ export const ErrorPage = WebAppErrorPage
@@ -0,0 +1,15 @@
1
+ import { Typography } from '@mui/material'
2
+ import { FlexBoxProps, FlexGrowCol } from '@xylabs/react-flexbox'
3
+
4
+ const NotFound: React.FC<FlexBoxProps> = (props) => {
5
+ return (
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>
12
+ )
13
+ }
14
+
15
+ export { NotFound }
@@ -0,0 +1,26 @@
1
+ import { ComponentMeta, ComponentStory } from '@storybook/react'
2
+
3
+ import { NotFound } from './NotFound'
4
+
5
+ const StorybookEntry = {
6
+ argTypes: {},
7
+ component: NotFound,
8
+ parameters: {
9
+ docs: {
10
+ page: null,
11
+ },
12
+ },
13
+ title: 'webapp/NotFound',
14
+ } as ComponentMeta<typeof NotFound>
15
+
16
+ const Template: ComponentStory<typeof NotFound> = () => {
17
+ return <NotFound />
18
+ }
19
+
20
+ const Default = Template.bind({})
21
+ Default.args = {}
22
+
23
+ export { Default }
24
+
25
+ // eslint-disable-next-line import/no-default-export
26
+ export default StorybookEntry
@@ -0,0 +1,11 @@
1
+ import { WebAppPage, WebAppPageProps } from '../Page'
2
+ import { NotFound } from './NotFound'
3
+
4
+ export const WebAppNotFoundPage: React.FC<WebAppPageProps> = ({ title, ...props }) => (
5
+ <WebAppPage title={title ?? 'Sorry! Page Not Found'} {...props}>
6
+ <NotFound />
7
+ </WebAppPage>
8
+ )
9
+
10
+ /** @deprecated use WebAppNotFoundPage instead */
11
+ export const NotFoundPage = WebAppNotFoundPage
@@ -0,0 +1,2 @@
1
+ export * from './NotFound'
2
+ export * from './Page'
@@ -0,0 +1,47 @@
1
+ import { Container, ContainerProps } from '@mui/material'
2
+ import { FlexBoxProps, FlexGrowCol } from '@xylabs/react-flexbox'
3
+ import { useUserEvents } from '@xylabs/react-pixel'
4
+ import { useAsyncEffect } from '@xylabs/react-shared'
5
+ import { ReactNode } from 'react'
6
+ import { Helmet } from 'react-helmet'
7
+ import { useLocation } from 'react-router-dom'
8
+ export interface WebAppPageProps extends FlexBoxProps {
9
+ container?: ContainerProps['maxWidth']
10
+ breadcrumbs?: ReactNode
11
+ }
12
+
13
+ export const WebAppPage: React.FC<WebAppPageProps> = ({ title, container = 'xl', breadcrumbs, children, ...props }) => {
14
+ const userEvents = useUserEvents()
15
+ const { pathname } = useLocation()
16
+
17
+ useAsyncEffect(
18
+ // eslint-disable-next-line react-hooks/exhaustive-deps
19
+ async () => {
20
+ await userEvents?.viewContent({ name: title ?? 'NodeBasePage', path: location.pathname })
21
+ },
22
+ [pathname, title, userEvents]
23
+ )
24
+
25
+ const Body: React.FC<FlexBoxProps> = (props) => (
26
+ <FlexGrowCol gap={2} paddingY={2} justifyContent="flex-start" alignItems="stretch" {...props}>
27
+ {breadcrumbs}
28
+ {children}
29
+ </FlexGrowCol>
30
+ )
31
+
32
+ return (
33
+ <FlexGrowCol alignItems="stretch" justifyContent="flex-start" minHeight={0} overflow="visible scroll">
34
+ <Helmet title={title} />
35
+ {container ? (
36
+ <Container style={{ alignItems: 'stretch', display: 'flex', flexDirection: 'column', flexGrow: 1, justifyContent: 'flex-start' }} maxWidth={container}>
37
+ <Body {...props} />
38
+ </Container>
39
+ ) : (
40
+ <Body {...props} />
41
+ )}
42
+ </FlexGrowCol>
43
+ )
44
+ }
45
+
46
+ /** @deprecated use WebAppPagePage instead */
47
+ export const FlexPage = WebAppPage
@@ -1 +1,4 @@
1
- export * from './WebAppChrome'
1
+ export * from './Chrome'
2
+ export * from './ErrorPage'
3
+ export * from './NotFoundPage'
4
+ export * from './Page'
@@ -1 +0,0 @@
1
- {"version":3,"file":"WebAppChrome.js","sourceRoot":"","sources":["../../../src/components/WebAppChrome.tsx"],"names":[],"mappings":";;;;;AAAA,4CAAqC;AACrC,yDAA0E;AAC1E,4DAA6D;AAC7D,4DAA4E;AAE5E,+CAAqC;AAU9B,MAAM,YAAY,GAAgC,CAAC,EAA+E,EAAE,EAAE;QAAnF,EAAE,eAAe,GAAG,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,OAAY,EAAP,KAAK,sBAA7E,2EAA+E,CAAF;IACrI,OAAO,CACL,wBAAC,uBAAO,kBAAC,UAAU,EAAC,SAAS,EAAC,MAAM,EAAC,OAAO,IAAK,KAAK,eACpD,uBAAC,qBAAM,kBAAC,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,OAAO,EAAE,gBAC7D,iCAAM,OAAO,EAAC,SAAS,EAAC,QAAQ,EAAC,SAAS,GAAG,IACtC,EACR,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,uBAAC,gCAAiB,KAAG,EAChC,uBAAC,2BAAW,kBAAC,QAAQ,EAAC,QAAQ,EAAC,cAAc,EAAC,YAAY,EAAC,UAAU,EAAC,SAAS,gBAC7E,uBAAC,4BAAa,kBAAC,QAAQ,EAAE,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,uBAAC,wBAAS,KAAG,gBAAG,QAAQ,IAAiB,IACnE,EACd,uBAAC,gBAAK,kBAAC,SAAS,EAAE,eAAe,EAAE,MAAM,sBACtC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,uBAAC,qBAAM,IAAC,aAAa,SAAG,IAC7B,KACA,CACX,CAAA;AACH,CAAC,CAAA;AAfY,QAAA,YAAY,gBAexB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"WebAppChrome.js","sourceRoot":"","sources":["../../../src/components/WebAppChrome.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,EAAgB,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAE5E,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAUrC,MAAM,CAAC,MAAM,YAAY,GAAgC,CAAC,EAAE,eAAe,GAAG,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IAC3I,OAAO,CACL,MAAC,OAAO,IAAC,UAAU,EAAC,SAAS,EAAC,MAAM,EAAC,OAAO,KAAK,KAAK,aACpD,KAAC,MAAM,IAAC,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,OAAO,EAAE,YAC7D,eAAM,OAAO,EAAC,SAAS,EAAC,QAAQ,EAAC,SAAS,GAAG,GACtC,EACR,MAAM,IAAI,KAAC,iBAAiB,KAAG,EAChC,KAAC,WAAW,IAAC,QAAQ,EAAC,QAAQ,EAAC,cAAc,EAAC,YAAY,EAAC,UAAU,EAAC,SAAS,YAC7E,KAAC,aAAa,IAAC,QAAQ,EAAE,SAAS,IAAI,KAAC,SAAS,KAAG,YAAG,QAAQ,GAAiB,GACnE,EACd,KAAC,KAAK,IAAC,SAAS,EAAE,eAAe,EAAE,MAAM,kBACtC,MAAM,IAAI,KAAC,MAAM,IAAC,aAAa,SAAG,GAC7B,IACA,CACX,CAAA;AACH,CAAC,CAAA"}