@xyo-network/react-webapp 2.31.5 → 2.32.0-rc.11
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/NotFoundPage/Page.d.ts.map +1 -1
- package/dist/cjs/components/NotFoundPage/Page.js +2 -2
- package/dist/cjs/components/NotFoundPage/Page.js.map +1 -1
- package/dist/cjs/components/NotFoundPage/index.d.ts +0 -1
- package/dist/cjs/components/NotFoundPage/index.d.ts.map +1 -1
- package/dist/cjs/components/NotFoundPage/index.js +0 -1
- package/dist/cjs/components/NotFoundPage/index.js.map +1 -1
- package/dist/cjs/components/index.d.ts +0 -1
- package/dist/cjs/components/index.d.ts.map +1 -1
- package/dist/cjs/components/index.js +0 -1
- package/dist/cjs/components/index.js.map +1 -1
- package/dist/docs.json +494 -772
- package/dist/esm/components/NotFoundPage/Page.d.ts.map +1 -1
- package/dist/esm/components/NotFoundPage/Page.js +1 -1
- package/dist/esm/components/NotFoundPage/Page.js.map +1 -1
- package/dist/esm/components/NotFoundPage/index.d.ts +0 -1
- package/dist/esm/components/NotFoundPage/index.d.ts.map +1 -1
- package/dist/esm/components/NotFoundPage/index.js +0 -1
- package/dist/esm/components/NotFoundPage/index.js.map +1 -1
- package/dist/esm/components/index.d.ts +0 -1
- package/dist/esm/components/index.d.ts.map +1 -1
- package/dist/esm/components/index.js +0 -1
- package/dist/esm/components/index.js.map +1 -1
- package/package.json +19 -18
- package/src/components/NotFoundPage/Page.stories.tsx +1 -2
- package/src/components/NotFoundPage/Page.tsx +2 -1
- package/src/components/NotFoundPage/index.ts +0 -1
- package/src/components/index.ts +0 -1
- package/dist/cjs/components/NotFoundPage/NotFound.d.ts +0 -5
- package/dist/cjs/components/NotFoundPage/NotFound.d.ts.map +0 -1
- package/dist/cjs/components/NotFoundPage/NotFound.js +0 -11
- package/dist/cjs/components/NotFoundPage/NotFound.js.map +0 -1
- package/dist/cjs/components/ResultLoader.d.ts +0 -9
- package/dist/cjs/components/ResultLoader.d.ts.map +0 -1
- package/dist/cjs/components/ResultLoader.js +0 -24
- package/dist/cjs/components/ResultLoader.js.map +0 -1
- package/dist/esm/components/NotFoundPage/NotFound.d.ts +0 -5
- package/dist/esm/components/NotFoundPage/NotFound.d.ts.map +0 -1
- package/dist/esm/components/NotFoundPage/NotFound.js +0 -8
- package/dist/esm/components/NotFoundPage/NotFound.js.map +0 -1
- package/dist/esm/components/ResultLoader.d.ts +0 -9
- package/dist/esm/components/ResultLoader.d.ts.map +0 -1
- package/dist/esm/components/ResultLoader.js +0 -20
- package/dist/esm/components/ResultLoader.js.map +0 -1
- package/src/components/NotFoundPage/NotFound.tsx +0 -15
- package/src/components/ResultLoader.stories.tsx +0 -37
- package/src/components/ResultLoader.tsx +0 -27
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Page.d.ts","sourceRoot":"","sources":["../../../../src/components/NotFoundPage/Page.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Page.d.ts","sourceRoot":"","sources":["../../../../src/components/NotFoundPage/Page.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAc,eAAe,EAAE,MAAM,SAAS,CAAA;AAErD,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAIxD,CAAA;AAED,kDAAkD;AAClD,eAAO,MAAM,YAAY,qCAAqB,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { NotFound } from '@xyo-network/react-shared';
|
|
2
3
|
import { WebAppPage } from '../Page';
|
|
3
|
-
import { NotFound } from './NotFound';
|
|
4
4
|
export const WebAppNotFoundPage = ({ title, ...props }) => (_jsx(WebAppPage, { title: title ?? 'Sorry! Page Not Found', ...props, children: _jsx(NotFound, {}) }));
|
|
5
5
|
/** @deprecated use WebAppNotFoundPage instead */
|
|
6
6
|
export const NotFoundPage = WebAppNotFoundPage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Page.js","sourceRoot":"","sources":["../../../../src/components/NotFoundPage/Page.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Page.js","sourceRoot":"","sources":["../../../../src/components/NotFoundPage/Page.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AAEpD,OAAO,EAAE,UAAU,EAAmB,MAAM,SAAS,CAAA;AAErD,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/NotFoundPage/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/NotFoundPage/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/NotFoundPage/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/NotFoundPage/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,QAAQ,CAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,QAAQ,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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
|
@@ -10,32 +10,32 @@
|
|
|
10
10
|
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/issues"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@emotion/react": "^11.10.4",
|
|
14
|
-
"@emotion/styled": "^11.10.4",
|
|
15
|
-
"@mui/material": "^5.10.3",
|
|
16
13
|
"@xylabs/react-button": "^2.14.16",
|
|
17
14
|
"@xylabs/react-flexbox": "^2.14.16",
|
|
18
|
-
"@xylabs/react-link": "^2.14.16",
|
|
19
15
|
"@xylabs/react-pixel": "^2.14.16",
|
|
20
16
|
"@xylabs/react-shared": "^2.14.16",
|
|
21
|
-
"@xyo-network/
|
|
22
|
-
"@xyo-network/react-
|
|
23
|
-
"@xyo-network/react-
|
|
24
|
-
"@xyo-network/react-
|
|
25
|
-
"@xyo-network/react-shared": "^2.31.5",
|
|
26
|
-
"axios": "^0.27.2",
|
|
27
|
-
"react": "^18.2.0",
|
|
28
|
-
"react-dom": "^18.2.0",
|
|
17
|
+
"@xyo-network/react-app-settings": "^2.32.0-rc.11",
|
|
18
|
+
"@xyo-network/react-appbar": "^2.32.0-rc.11",
|
|
19
|
+
"@xyo-network/react-footer": "^2.32.0-rc.11",
|
|
20
|
+
"@xyo-network/react-shared": "^2.32.0-rc.11",
|
|
29
21
|
"react-helmet": "^6.1.0",
|
|
30
|
-
"react-router-dom": "^6.3.0",
|
|
31
22
|
"tslib": "^2.4.0"
|
|
32
23
|
},
|
|
33
|
-
"
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"@mui/icons-material": "^5.10.3",
|
|
26
|
+
"@mui/material": "^5.10.3",
|
|
27
|
+
"@mui/styles": "^5.10.3",
|
|
28
|
+
"@xyo-network/api": "^2.30.0-rc.3",
|
|
29
|
+
"@xyo-network/payload": "^2.30.0-rc.3",
|
|
30
|
+
"react": "^18.2.0",
|
|
31
|
+
"react-dom": "^18.2.0",
|
|
32
|
+
"react-icons": "^4.4.0",
|
|
33
|
+
"react-router-dom": "^6.3.0"
|
|
34
|
+
},
|
|
34
35
|
"devDependencies": {
|
|
35
|
-
"@
|
|
36
|
-
"@types/react-helmet": "^6.1.5",
|
|
37
|
-
"@xylabs/tsconfig-dom": "^2.5.167"
|
|
36
|
+
"@types/react-helmet": "^6.1.5"
|
|
38
37
|
},
|
|
38
|
+
"description": "Common React library for all XYO projects that use React",
|
|
39
39
|
"browser": "dist/esm/index.js",
|
|
40
40
|
"docs": "dist/docs.json",
|
|
41
41
|
"exports": {
|
|
@@ -78,5 +78,6 @@
|
|
|
78
78
|
},
|
|
79
79
|
"sideEffects": false,
|
|
80
80
|
"types": "dist/esm/index.d.ts",
|
|
81
|
-
"version": "2.
|
|
81
|
+
"version": "2.32.0-rc.11",
|
|
82
|
+
"stableVersion": "2.31.2"
|
|
82
83
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { NotFound } from '@xyo-network/react-shared'
|
|
2
|
+
|
|
1
3
|
import { WebAppPage, WebAppPageProps } from '../Page'
|
|
2
|
-
import { NotFound } from './NotFound'
|
|
3
4
|
|
|
4
5
|
export const WebAppNotFoundPage: React.FC<WebAppPageProps> = ({ title, ...props }) => (
|
|
5
6
|
<WebAppPage title={title ?? 'Sorry! Page Not Found'} {...props}>
|
package/src/components/index.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NotFound.d.ts","sourceRoot":"","sources":["../../../../src/components/NotFoundPage/NotFound.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAe,MAAM,uBAAuB,CAAA;AAEjE,QAAA,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CASpC,CAAA;AAED,OAAO,EAAE,QAAQ,EAAE,CAAA"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NotFound = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const material_1 = require("@mui/material");
|
|
6
|
-
const react_flexbox_1 = require("@xylabs/react-flexbox");
|
|
7
|
-
const NotFound = (props) => {
|
|
8
|
-
return ((0, jsx_runtime_1.jsxs)(react_flexbox_1.FlexGrowCol, Object.assign({}, props, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h2" }, { children: "Sorry!" })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ marginY: 3, variant: "body2" }, { children: "Can't find anything here" }))] })));
|
|
9
|
-
};
|
|
10
|
-
exports.NotFound = NotFound;
|
|
11
|
-
//# sourceMappingURL=NotFound.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NotFound.js","sourceRoot":"","sources":["../../../../src/components/NotFoundPage/NotFound.tsx"],"names":[],"mappings":";;;;AAAA,4CAA0C;AAC1C,yDAAiE;AAEjE,MAAM,QAAQ,GAA2B,CAAC,KAAK,EAAE,EAAE;IACjD,OAAO,CACL,wBAAC,2BAAW,oBAAK,KAAK,eACpB,uBAAC,qBAAU,kBAAC,OAAO,EAAC,IAAI,4BAAoB,EAC5C,uBAAC,qBAAU,kBAAC,OAAO,EAAE,CAAC,EAAE,OAAO,EAAC,OAAO,gBACpC,0BAA0B,IAChB,KACD,CACf,CAAA;AACH,CAAC,CAAA;AAEQ,4BAAQ"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { XyoApiError } from '@xyo-network/api';
|
|
2
|
-
import { PropsWithChildren } from 'react';
|
|
3
|
-
export interface HandleItemDetailLoadingProps<T> {
|
|
4
|
-
apiError: Error | XyoApiError | undefined;
|
|
5
|
-
notFound: boolean;
|
|
6
|
-
searchResult: T | undefined;
|
|
7
|
-
}
|
|
8
|
-
export declare function ResultLoader<T>(props: PropsWithChildren<HandleItemDetailLoadingProps<T>>): JSX.Element;
|
|
9
|
-
//# sourceMappingURL=ResultLoader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ResultLoader.d.ts","sourceRoot":"","sources":["../../../src/components/ResultLoader.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAIzC,MAAM,WAAW,4BAA4B,CAAC,CAAC;IAC7C,QAAQ,EAAE,KAAK,GAAG,WAAW,GAAG,SAAS,CAAA;IACzC,QAAQ,EAAE,OAAO,CAAA;IACjB,YAAY,EAAE,CAAC,GAAG,SAAS,CAAA;CAC5B;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,iBAAiB,CAAC,4BAA4B,CAAC,CAAC,CAAC,CAAC,eAcxF"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ResultLoader = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_flexbox_1 = require("@xylabs/react-flexbox");
|
|
6
|
-
const NotFoundPage_1 = require("./NotFoundPage");
|
|
7
|
-
function ResultLoader(props) {
|
|
8
|
-
const { notFound, apiError, searchResult, children } = props;
|
|
9
|
-
if (notFound) {
|
|
10
|
-
return (0, jsx_runtime_1.jsx)(NotFoundPage_1.NotFound, {});
|
|
11
|
-
}
|
|
12
|
-
// Defer error handling to the children
|
|
13
|
-
if (apiError) {
|
|
14
|
-
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
|
|
15
|
-
}
|
|
16
|
-
if (searchResult === undefined) {
|
|
17
|
-
return (0, jsx_runtime_1.jsx)(react_flexbox_1.FlexGrowRow, { busy: true, minHeight: "50px" });
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
exports.ResultLoader = ResultLoader;
|
|
24
|
-
//# sourceMappingURL=ResultLoader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ResultLoader.js","sourceRoot":"","sources":["../../../src/components/ResultLoader.tsx"],"names":[],"mappings":";;;;AAAA,yDAAmD;AAInD,iDAAyC;AAQzC,SAAgB,YAAY,CAAI,KAAyD;IACvF,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAA;IAC5D,IAAI,QAAQ,EAAE;QACZ,OAAO,uBAAC,uBAAQ,KAAG,CAAA;KACpB;IACD,uCAAuC;IACvC,IAAI,QAAQ,EAAE;QACZ,OAAO,2DAAG,QAAQ,GAAI,CAAA;KACvB;IACD,IAAI,YAAY,KAAK,SAAS,EAAE;QAC9B,OAAO,uBAAC,2BAAW,IAAC,IAAI,QAAC,SAAS,EAAC,MAAM,GAAG,CAAA;KAC7C;SAAM;QACL,OAAO,2DAAG,QAAQ,GAAI,CAAA;KACvB;AACH,CAAC;AAdD,oCAcC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NotFound.d.ts","sourceRoot":"","sources":["../../../../src/components/NotFoundPage/NotFound.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAe,MAAM,uBAAuB,CAAA;AAEjE,QAAA,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CASpC,CAAA;AAED,OAAO,EAAE,QAAQ,EAAE,CAAA"}
|
|
@@ -1,8 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { XyoApiError } from '@xyo-network/api';
|
|
2
|
-
import { PropsWithChildren } from 'react';
|
|
3
|
-
export interface HandleItemDetailLoadingProps<T> {
|
|
4
|
-
apiError: Error | XyoApiError | undefined;
|
|
5
|
-
notFound: boolean;
|
|
6
|
-
searchResult: T | undefined;
|
|
7
|
-
}
|
|
8
|
-
export declare function ResultLoader<T>(props: PropsWithChildren<HandleItemDetailLoadingProps<T>>): JSX.Element;
|
|
9
|
-
//# sourceMappingURL=ResultLoader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ResultLoader.d.ts","sourceRoot":"","sources":["../../../src/components/ResultLoader.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAIzC,MAAM,WAAW,4BAA4B,CAAC,CAAC;IAC7C,QAAQ,EAAE,KAAK,GAAG,WAAW,GAAG,SAAS,CAAA;IACzC,QAAQ,EAAE,OAAO,CAAA;IACjB,YAAY,EAAE,CAAC,GAAG,SAAS,CAAA;CAC5B;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,iBAAiB,CAAC,4BAA4B,CAAC,CAAC,CAAC,CAAC,eAcxF"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { FlexGrowRow } from '@xylabs/react-flexbox';
|
|
3
|
-
import { NotFound } from './NotFoundPage';
|
|
4
|
-
export function ResultLoader(props) {
|
|
5
|
-
const { notFound, apiError, searchResult, children } = props;
|
|
6
|
-
if (notFound) {
|
|
7
|
-
return _jsx(NotFound, {});
|
|
8
|
-
}
|
|
9
|
-
// Defer error handling to the children
|
|
10
|
-
if (apiError) {
|
|
11
|
-
return _jsx(_Fragment, { children: children });
|
|
12
|
-
}
|
|
13
|
-
if (searchResult === undefined) {
|
|
14
|
-
return _jsx(FlexGrowRow, { busy: true, minHeight: "50px" });
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
return _jsx(_Fragment, { children: children });
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=ResultLoader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ResultLoader.js","sourceRoot":"","sources":["../../../src/components/ResultLoader.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAInD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAQzC,MAAM,UAAU,YAAY,CAAI,KAAyD;IACvF,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAA;IAC5D,IAAI,QAAQ,EAAE;QACZ,OAAO,KAAC,QAAQ,KAAG,CAAA;KACpB;IACD,uCAAuC;IACvC,IAAI,QAAQ,EAAE;QACZ,OAAO,4BAAG,QAAQ,GAAI,CAAA;KACvB;IACD,IAAI,YAAY,KAAK,SAAS,EAAE;QAC9B,OAAO,KAAC,WAAW,IAAC,IAAI,QAAC,SAAS,EAAC,MAAM,GAAG,CAAA;KAC7C;SAAM;QACL,OAAO,4BAAG,QAAQ,GAAI,CAAA;KACvB;AACH,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
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 }
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/* eslint-disable import/no-internal-modules */
|
|
2
|
-
import { ComponentStory, Meta } from '@storybook/react'
|
|
3
|
-
import { AxiosError } from 'axios'
|
|
4
|
-
|
|
5
|
-
import { ResultLoader } from './ResultLoader'
|
|
6
|
-
|
|
7
|
-
const StorybookEntry: Meta = {
|
|
8
|
-
argTypes: {},
|
|
9
|
-
component: ResultLoader,
|
|
10
|
-
parameters: {
|
|
11
|
-
docs: {
|
|
12
|
-
page: null,
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
title: 'webapp/ResultLoader',
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const Template: ComponentStory<typeof ResultLoader> = (props) => {
|
|
19
|
-
return <ResultLoader {...props} />
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const Default = Template.bind({})
|
|
23
|
-
Default.args = {}
|
|
24
|
-
|
|
25
|
-
const NotFound = Template.bind({})
|
|
26
|
-
NotFound.args = { notFound: true }
|
|
27
|
-
|
|
28
|
-
const ApiError = Template.bind({})
|
|
29
|
-
ApiError.args = { apiError: new AxiosError(), children: <h1>Shown in case of error</h1> }
|
|
30
|
-
|
|
31
|
-
const SearchResult = Template.bind({})
|
|
32
|
-
SearchResult.args = { children: <h1>Shown when there is a valid result</h1>, searchResult: 'foo' }
|
|
33
|
-
|
|
34
|
-
export { ApiError, Default, NotFound, SearchResult }
|
|
35
|
-
|
|
36
|
-
// eslint-disable-next-line import/no-default-export
|
|
37
|
-
export default StorybookEntry
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { FlexGrowRow } from '@xylabs/react-flexbox'
|
|
2
|
-
import { XyoApiError } from '@xyo-network/api'
|
|
3
|
-
import { PropsWithChildren } from 'react'
|
|
4
|
-
|
|
5
|
-
import { NotFound } from './NotFoundPage'
|
|
6
|
-
|
|
7
|
-
export interface HandleItemDetailLoadingProps<T> {
|
|
8
|
-
apiError: Error | XyoApiError | undefined
|
|
9
|
-
notFound: boolean
|
|
10
|
-
searchResult: T | undefined
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function ResultLoader<T>(props: PropsWithChildren<HandleItemDetailLoadingProps<T>>) {
|
|
14
|
-
const { notFound, apiError, searchResult, children } = props
|
|
15
|
-
if (notFound) {
|
|
16
|
-
return <NotFound />
|
|
17
|
-
}
|
|
18
|
-
// Defer error handling to the children
|
|
19
|
-
if (apiError) {
|
|
20
|
-
return <>{children}</>
|
|
21
|
-
}
|
|
22
|
-
if (searchResult === undefined) {
|
|
23
|
-
return <FlexGrowRow busy minHeight="50px" />
|
|
24
|
-
} else {
|
|
25
|
-
return <>{children}</>
|
|
26
|
-
}
|
|
27
|
-
}
|