@xyo-network/react-module 2.49.7 → 2.49.8
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/Card/Module/CardActions.js +1 -11
- package/dist/cjs/components/Card/Module/CardActions.js.map +1 -1
- package/dist/cjs/components/Card/Module/CardHeader.js +11 -2
- package/dist/cjs/components/Card/Module/CardHeader.js.map +1 -1
- package/dist/cjs/components/Card/Module/components/DiscoverDialog.js +3 -2
- package/dist/cjs/components/Card/Module/components/DiscoverDialog.js.map +1 -1
- package/dist/docs.json +1572 -88
- package/dist/esm/components/Card/Module/CardActions.js +2 -11
- package/dist/esm/components/Card/Module/CardActions.js.map +1 -1
- package/dist/esm/components/Card/Module/CardHeader.js +11 -3
- package/dist/esm/components/Card/Module/CardHeader.js.map +1 -1
- package/dist/esm/components/Card/Module/components/DiscoverDialog.js +5 -4
- package/dist/esm/components/Card/Module/components/DiscoverDialog.js.map +1 -1
- package/dist/types/components/Card/Module/CardActions.d.ts.map +1 -1
- package/dist/types/components/Card/Module/CardHeader.d.ts.map +1 -1
- package/dist/types/components/Card/Module/components/DiscoverDialog.d.ts +2 -1
- package/dist/types/components/Card/Module/components/DiscoverDialog.d.ts.map +1 -1
- package/package.json +6 -7
- package/src/components/Card/Module/CardActions.tsx +3 -21
- package/src/components/Card/Module/CardHeader.tsx +18 -2
- package/src/components/Card/Module/components/DiscoverDialog.tsx +12 -4
|
@@ -1,23 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { CardActions,
|
|
2
|
+
import { CardActions, Chip } from '@mui/material';
|
|
3
3
|
import { ButtonEx } from '@xylabs/react-button';
|
|
4
4
|
import { FlexGrowRow } from '@xylabs/react-flexbox';
|
|
5
5
|
import { ModuleWrapper } from '@xyo-network/module';
|
|
6
|
-
import { findNetworkComponent } from '@xyo-network/react-shared';
|
|
7
6
|
import { useState } from 'react';
|
|
8
7
|
import { DiscoverDialog } from './components';
|
|
9
|
-
const getModuleIcons = (moduleType, wrapper) => {
|
|
10
|
-
return wrapper?.queries.find((query) => query.startsWith(`network.xyo.query.${moduleType}`)) ? findNetworkComponent(moduleType)?.icon() : null;
|
|
11
|
-
};
|
|
12
8
|
export const ModuleCardActions = ({ children, module, sx, ...props }) => {
|
|
13
9
|
const [discoverDialogOpen, setDiscoverDialogOpen] = useState(false);
|
|
14
10
|
const wrapper = module ? ModuleWrapper.wrap(module) : undefined;
|
|
15
11
|
const config = wrapper?.config;
|
|
16
|
-
return (_jsxs(CardActions, { sx: { alignItems: 'stretch', flexDirection: 'column', ml: 1, ...sx }, ...props, children: [
|
|
17
|
-
? ['sentinel', 'bridge', 'archivist', 'diviner', 'node', 'witness'].map((moduleType) => {
|
|
18
|
-
const icon = getModuleIcons(moduleType, wrapper);
|
|
19
|
-
return icon ? (_jsx(Icon, { color: 'primary', title: moduleType.toLocaleUpperCase(), children: icon }, moduleType)) : null;
|
|
20
|
-
})
|
|
21
|
-
: null, _jsx(ButtonEx, { onClick: () => setDiscoverDialogOpen(true), size: 'small', variant: 'outlined', children: "Discover" }), _jsx(DiscoverDialog, { fullWidth: true, maxWidth: 'md', open: discoverDialogOpen, setOpen: setDiscoverDialogOpen, wrapper: wrapper })] }), children] }));
|
|
12
|
+
return (_jsxs(CardActions, { sx: { alignItems: 'stretch', flexDirection: 'column', ml: 1, ...sx }, ...props, children: [_jsxs(FlexGrowRow, { justifyContent: "space-between", alignItems: "center", children: [wrapper ? _jsx(Chip, { label: config?.schema, size: 'small' }) : null, _jsx(ButtonEx, { onClick: () => setDiscoverDialogOpen(true), size: 'small', variant: 'outlined', children: "Discover" }), _jsx(DiscoverDialog, { fullWidth: true, maxWidth: 'md', module: module, open: discoverDialogOpen, setOpen: setDiscoverDialogOpen, wrapper: wrapper })] }), children] }));
|
|
22
13
|
};
|
|
23
14
|
//# sourceMappingURL=CardActions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardActions.js","sourceRoot":"","sources":["../../../../../src/components/Card/Module/CardActions.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAoB,
|
|
1
|
+
{"version":3,"file":"CardActions.js","sourceRoot":"","sources":["../../../../../src/components/Card/Module/CardActions.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAoB,IAAI,EAAE,MAAM,eAAe,CAAA;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAGhC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAE7C,MAAM,CAAC,MAAM,iBAAiB,GAAmD,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IACtH,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IACnE,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAC/D,MAAM,MAAM,GAAG,OAAO,EAAE,MAAM,CAAA;IAE9B,OAAO,CACL,MAAC,WAAW,IAAC,EAAE,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,KAAM,KAAK,aAC1F,MAAC,WAAW,IAAC,cAAc,EAAC,eAAe,EAAC,UAAU,EAAC,QAAQ,aAC5D,OAAO,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAI,CAAC,CAAC,CAAC,IAAI,EAChE,KAAC,QAAQ,IAAC,OAAO,EAAE,GAAG,EAAE,CAAC,qBAAqB,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,yBAE7E,EACX,KAAC,cAAc,IAAC,SAAS,QAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,EAAE,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,OAAO,GAAI,IAC5H,EACb,QAAQ,IACG,CACf,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { CardHeader } from '@mui/material';
|
|
3
|
-
import { Identicon } from '@xylabs/react-identicon';
|
|
4
3
|
import { ModuleWrapper } from '@xyo-network/module';
|
|
4
|
+
import { findNetworkComponent } from '@xyo-network/react-shared';
|
|
5
|
+
const getModuleIcons = (moduleType, wrapper) => {
|
|
6
|
+
return wrapper?.queries.find((query) => query.startsWith(`network.xyo.query.${moduleType}`)) ? findNetworkComponent(moduleType)?.icon : null;
|
|
7
|
+
};
|
|
5
8
|
export const ModuleCardHeader = ({ subheader, avatar, title, module, ...props }) => {
|
|
6
9
|
const wrapper = module ? ModuleWrapper.wrap(module) : undefined;
|
|
7
|
-
return (_jsx(CardHeader, { title: title ?? module?.config.name ?? 'Module', subheader: subheader ?? wrapper?.address, avatar: avatar ?? _jsx(
|
|
10
|
+
return (_jsx(CardHeader, { title: title ?? module?.config.name ?? 'Module', subheader: subheader ?? wrapper?.address, avatar: avatar ?? (_jsx(_Fragment, { children: wrapper
|
|
11
|
+
? ['sentinel', 'bridge', 'archivist', 'diviner', 'node', 'witness'].map((moduleType) => {
|
|
12
|
+
const Icon = getModuleIcons(moduleType, wrapper);
|
|
13
|
+
return Icon ? _jsx(Icon, { fontSize: 'large', color: "primary" }) : null;
|
|
14
|
+
})
|
|
15
|
+
: null })), ...props }));
|
|
8
16
|
};
|
|
9
17
|
//# sourceMappingURL=CardHeader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardHeader.js","sourceRoot":"","sources":["../../../../../src/components/Card/Module/CardHeader.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAmB,MAAM,eAAe,CAAA;AAC3D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"CardHeader.js","sourceRoot":"","sources":["../../../../../src/components/Card/Module/CardHeader.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAmB,MAAM,eAAe,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAIhE,MAAM,cAAc,GAAG,CAAC,UAAkB,EAAE,OAAsB,EAAE,EAAE;IACpE,OAAO,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,qBAAqB,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAA;AAC9I,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAkD,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IAChI,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAE/D,OAAO,CACL,KAAC,UAAU,IACT,KAAK,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,CAAC,IAAI,IAAI,QAAQ,EAC/C,SAAS,EAAE,SAAS,IAAI,OAAO,EAAE,OAAO,EACxC,MAAM,EACJ,MAAM,IAAI,CACR,4BACG,OAAO;gBACN,CAAC,CAAC,CAAC,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE;oBACnF,MAAM,IAAI,GAAG,cAAc,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;oBAChD,OAAO,IAAI,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAC,SAAS,GAAG,CAAC,CAAC,CAAC,IAAI,CAAA;gBAClE,CAAC,CAAC;gBACJ,CAAC,CAAC,IAAI,GACP,CACJ,KAEC,KAAK,GACT,CACH,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Button, Dialog, DialogActions, DialogContent } from '@mui/material';
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Button, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle, Divider, Paper } from '@mui/material';
|
|
3
3
|
import { useAsyncEffect } from '@xylabs/react-async-effect';
|
|
4
4
|
import { useState } from 'react';
|
|
5
|
-
|
|
5
|
+
// Add a dialogue title and quick tip to show description of discover query
|
|
6
|
+
export const DiscoverDialog = ({ module, setOpen, wrapper, ...props }) => {
|
|
6
7
|
const [discoverPayloads, setDiscoverPayloads] = useState([]);
|
|
7
8
|
useAsyncEffect(
|
|
8
9
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -13,6 +14,6 @@ export const DiscoverDialog = ({ setOpen, wrapper, ...props }) => {
|
|
|
13
14
|
setDiscoverPayloads(payloads);
|
|
14
15
|
}
|
|
15
16
|
}, [wrapper]);
|
|
16
|
-
return (_jsxs(Dialog, { ...props, children: [_jsx(DialogContent, { children: _jsx("pre", { children: JSON.stringify(discoverPayloads, null, 2) }) }), _jsx(DialogActions, { children: _jsx(Button, { onClick: () => setOpen?.(false), variant: 'outlined', children: "Close" }) })] }));
|
|
17
|
+
return (_jsxs(Dialog, { ...props, children: [_jsxs(DialogTitle, { children: ["Supported Queries for ", module?.config.name || module?.address] }), _jsx(Divider, {}), _jsx(DialogContent, { children: _jsxs(Paper, { sx: { p: 1 }, children: [_jsx(DialogContentText, { children: "All modules share a set of base queries along with ones specific to the module." }), _jsx("pre", { children: JSON.stringify(discoverPayloads, null, 2) })] }) }), _jsx(DialogActions, { children: _jsx(Button, { onClick: () => setOpen?.(false), variant: 'outlined', children: "Close" }) })] }));
|
|
17
18
|
};
|
|
18
19
|
//# sourceMappingURL=DiscoverDialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DiscoverDialog.js","sourceRoot":"","sources":["../../../../../../src/components/Card/Module/components/DiscoverDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAe,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"DiscoverDialog.js","sourceRoot":"","sources":["../../../../../../src/components/Card/Module/components/DiscoverDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,iBAAiB,EAAe,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACzI,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAG3D,OAAO,EAA4B,QAAQ,EAAE,MAAM,OAAO,CAAA;AAQ1D,2EAA2E;AAE3E,MAAM,CAAC,MAAM,cAAc,GAAkC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IACtG,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAY,EAAE,CAAC,CAAA;IAEvE,cAAc;IACZ,uDAAuD;IACvD,KAAK,EAAE,OAAO,EAAE,EAAE;QAChB,IAAI,OAAO,EAAE;YACX,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,QAAQ,EAAE,CAAA;YACzC,IAAI,OAAO,EAAE;gBAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAA;SAC7C;IACH,CAAC,EACD,CAAC,OAAO,CAAC,CACV,CAAA;IAED,OAAO,CACL,MAAC,MAAM,OAAK,KAAK,aACf,MAAC,WAAW,yCAAwB,MAAM,EAAE,MAAM,CAAC,IAAI,IAAI,MAAM,EAAE,OAAO,IAAe,EACzF,KAAC,OAAO,KAAG,EACX,KAAC,aAAa,cACZ,MAAC,KAAK,IAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,aACjB,KAAC,iBAAiB,kGAAoG,EACtH,wBAAM,IAAI,CAAC,SAAS,CAAC,gBAAgB,EAAE,IAAI,EAAE,CAAC,CAAC,GAAO,IAChD,GACM,EAChB,KAAC,aAAa,cACZ,KAAC,MAAM,IAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,UAAU,sBAEnD,GACK,IACT,CACV,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardActions.d.ts","sourceRoot":"","sources":["../../../../../src/components/Card/Module/CardActions.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAe,gBAAgB,
|
|
1
|
+
{"version":3,"file":"CardActions.d.ts","sourceRoot":"","sources":["../../../../../src/components/Card/Module/CardActions.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAe,gBAAgB,EAAQ,MAAM,eAAe,CAAA;AAMnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAG9D,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,GAAG,iBAAiB,CAiB5E,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardHeader.d.ts","sourceRoot":"","sources":["../../../../../src/components/Card/Module/CardHeader.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAc,eAAe,EAAE,MAAM,eAAe,CAAA;AAI3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;
|
|
1
|
+
{"version":3,"file":"CardHeader.d.ts","sourceRoot":"","sources":["../../../../../src/components/Card/Module/CardHeader.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAc,eAAe,EAAE,MAAM,eAAe,CAAA;AAI3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAM9D,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,GAAG,eAAe,CAsB1E,CAAA"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { DialogProps } from '@mui/material';
|
|
2
|
-
import { ModuleWrapper } from '@xyo-network/module';
|
|
2
|
+
import { Module, ModuleWrapper } from '@xyo-network/module';
|
|
3
3
|
import { Dispatch, SetStateAction } from 'react';
|
|
4
4
|
export interface DiscoverDialogProps extends DialogProps {
|
|
5
|
+
module?: Module;
|
|
5
6
|
setOpen?: Dispatch<SetStateAction<boolean>>;
|
|
6
7
|
wrapper?: ModuleWrapper;
|
|
7
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DiscoverDialog.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Card/Module/components/DiscoverDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"DiscoverDialog.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Card/Module/components/DiscoverDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAmE,WAAW,EAA+B,MAAM,eAAe,CAAA;AAEzI,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAE3D,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAY,MAAM,OAAO,CAAA;AAE1D,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACtD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAA;IAC3C,OAAO,CAAC,EAAE,aAAa,CAAA;CACxB;AAID,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA+BxD,CAAA"}
|
package/package.json
CHANGED
|
@@ -15,12 +15,10 @@
|
|
|
15
15
|
"@xylabs/react-button": "^2.17.2",
|
|
16
16
|
"@xylabs/react-crypto": "^2.17.2",
|
|
17
17
|
"@xylabs/react-flexbox": "^2.17.2",
|
|
18
|
-
"@xylabs/react-identicon": "^2.17.2",
|
|
19
|
-
"@xyo-network/archivist": "^2.56.2",
|
|
20
18
|
"@xyo-network/diviner": "^2.56.2",
|
|
21
19
|
"@xyo-network/module": "^2.56.2",
|
|
22
20
|
"@xyo-network/payload-model": "^2.56.2",
|
|
23
|
-
"@xyo-network/react-shared": "^2.49.
|
|
21
|
+
"@xyo-network/react-shared": "^2.49.8"
|
|
24
22
|
},
|
|
25
23
|
"devDependencies": {
|
|
26
24
|
"@ethersproject/address": "^5.7.0",
|
|
@@ -28,12 +26,13 @@
|
|
|
28
26
|
"@ethersproject/networks": "^5.7.1",
|
|
29
27
|
"@ethersproject/providers": "^5.7.2",
|
|
30
28
|
"@ethersproject/solidity": "^5.7.0",
|
|
31
|
-
"@storybook/react": "^7.0.
|
|
29
|
+
"@storybook/react": "^7.0.9",
|
|
32
30
|
"@uniswap/sdk": "^3.0.3",
|
|
33
31
|
"@uniswap/sdk-core": "^3.2.2",
|
|
34
32
|
"@uniswap/v3-sdk": "^3.9.0",
|
|
35
|
-
"@xylabs/ts-scripts-yarn3": "^2.17.
|
|
36
|
-
"@xylabs/tsconfig-react": "^2.17.
|
|
33
|
+
"@xylabs/ts-scripts-yarn3": "^2.17.11",
|
|
34
|
+
"@xylabs/tsconfig-react": "^2.17.11",
|
|
35
|
+
"@xyo-network/archivist": "^2.56.2",
|
|
37
36
|
"@xyo-network/crypto-asset-plugin": "^2.56.2",
|
|
38
37
|
"@xyo-network/diviner-address-history": "^2.56.2",
|
|
39
38
|
"@xyo-network/node": "^2.56.2",
|
|
@@ -91,5 +90,5 @@
|
|
|
91
90
|
},
|
|
92
91
|
"sideEffects": false,
|
|
93
92
|
"types": "dist/types/index.d.ts",
|
|
94
|
-
"version": "2.49.
|
|
93
|
+
"version": "2.49.8"
|
|
95
94
|
}
|
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
import { CardActions, CardActionsProps,
|
|
1
|
+
import { CardActions, CardActionsProps, Chip } from '@mui/material'
|
|
2
2
|
import { ButtonEx } from '@xylabs/react-button'
|
|
3
3
|
import { FlexGrowRow } from '@xylabs/react-flexbox'
|
|
4
4
|
import { ModuleWrapper } from '@xyo-network/module'
|
|
5
|
-
import { findNetworkComponent } from '@xyo-network/react-shared'
|
|
6
5
|
import { useState } from 'react'
|
|
7
6
|
|
|
8
7
|
import { ModuleRenderProps } from '../../../ModuleRenderProps'
|
|
9
8
|
import { DiscoverDialog } from './components'
|
|
10
9
|
|
|
11
|
-
const getModuleIcons = (moduleType: string, wrapper: ModuleWrapper) => {
|
|
12
|
-
return wrapper?.queries.find((query) => query.startsWith(`network.xyo.query.${moduleType}`)) ? findNetworkComponent(moduleType)?.icon() : null
|
|
13
|
-
}
|
|
14
|
-
|
|
15
10
|
export const ModuleCardActions: React.FC<CardActionsProps & ModuleRenderProps> = ({ children, module, sx, ...props }) => {
|
|
16
11
|
const [discoverDialogOpen, setDiscoverDialogOpen] = useState(false)
|
|
17
12
|
const wrapper = module ? ModuleWrapper.wrap(module) : undefined
|
|
@@ -19,25 +14,12 @@ export const ModuleCardActions: React.FC<CardActionsProps & ModuleRenderProps> =
|
|
|
19
14
|
|
|
20
15
|
return (
|
|
21
16
|
<CardActions sx={{ alignItems: 'stretch', flexDirection: 'column', ml: 1, ...sx }} {...props}>
|
|
22
|
-
<Typography variant="caption" fontFamily="inherit" fontWeight="500">
|
|
23
|
-
{config?.schema}
|
|
24
|
-
</Typography>
|
|
25
|
-
<Divider flexItem sx={{ my: 1 }} />
|
|
26
17
|
<FlexGrowRow justifyContent="space-between" alignItems="center">
|
|
27
|
-
{wrapper
|
|
28
|
-
? ['sentinel', 'bridge', 'archivist', 'diviner', 'node', 'witness'].map((moduleType) => {
|
|
29
|
-
const icon = getModuleIcons(moduleType, wrapper)
|
|
30
|
-
return icon ? (
|
|
31
|
-
<Icon color={'primary'} key={moduleType} title={moduleType.toLocaleUpperCase()}>
|
|
32
|
-
{icon}
|
|
33
|
-
</Icon>
|
|
34
|
-
) : null
|
|
35
|
-
})
|
|
36
|
-
: null}
|
|
18
|
+
{wrapper ? <Chip label={config?.schema} size={'small'} /> : null}
|
|
37
19
|
<ButtonEx onClick={() => setDiscoverDialogOpen(true)} size={'small'} variant={'outlined'}>
|
|
38
20
|
Discover
|
|
39
21
|
</ButtonEx>
|
|
40
|
-
<DiscoverDialog fullWidth maxWidth={'md'} open={discoverDialogOpen} setOpen={setDiscoverDialogOpen} wrapper={wrapper} />
|
|
22
|
+
<DiscoverDialog fullWidth maxWidth={'md'} module={module} open={discoverDialogOpen} setOpen={setDiscoverDialogOpen} wrapper={wrapper} />
|
|
41
23
|
</FlexGrowRow>
|
|
42
24
|
{children}
|
|
43
25
|
</CardActions>
|
|
@@ -1,16 +1,32 @@
|
|
|
1
1
|
import { CardHeader, CardHeaderProps } from '@mui/material'
|
|
2
|
-
import { Identicon } from '@xylabs/react-identicon'
|
|
3
2
|
import { ModuleWrapper } from '@xyo-network/module'
|
|
3
|
+
import { findNetworkComponent } from '@xyo-network/react-shared'
|
|
4
4
|
|
|
5
5
|
import { ModuleRenderProps } from '../../../ModuleRenderProps'
|
|
6
6
|
|
|
7
|
+
const getModuleIcons = (moduleType: string, wrapper: ModuleWrapper) => {
|
|
8
|
+
return wrapper?.queries.find((query) => query.startsWith(`network.xyo.query.${moduleType}`)) ? findNetworkComponent(moduleType)?.icon : null
|
|
9
|
+
}
|
|
10
|
+
|
|
7
11
|
export const ModuleCardHeader: React.FC<ModuleRenderProps & CardHeaderProps> = ({ subheader, avatar, title, module, ...props }) => {
|
|
8
12
|
const wrapper = module ? ModuleWrapper.wrap(module) : undefined
|
|
13
|
+
|
|
9
14
|
return (
|
|
10
15
|
<CardHeader
|
|
11
16
|
title={title ?? module?.config.name ?? 'Module'}
|
|
12
17
|
subheader={subheader ?? wrapper?.address}
|
|
13
|
-
avatar={
|
|
18
|
+
avatar={
|
|
19
|
+
avatar ?? (
|
|
20
|
+
<>
|
|
21
|
+
{wrapper
|
|
22
|
+
? ['sentinel', 'bridge', 'archivist', 'diviner', 'node', 'witness'].map((moduleType) => {
|
|
23
|
+
const Icon = getModuleIcons(moduleType, wrapper)
|
|
24
|
+
return Icon ? <Icon fontSize={'large'} color="primary" /> : null
|
|
25
|
+
})
|
|
26
|
+
: null}
|
|
27
|
+
</>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
14
30
|
{...props}
|
|
15
31
|
/>
|
|
16
32
|
)
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import { Button, Dialog, DialogActions, DialogContent, DialogProps } from '@mui/material'
|
|
1
|
+
import { Button, Dialog, DialogActions, DialogContent, DialogContentText, DialogProps, DialogTitle, Divider, Paper } from '@mui/material'
|
|
2
2
|
import { useAsyncEffect } from '@xylabs/react-async-effect'
|
|
3
|
-
import { ModuleWrapper } from '@xyo-network/module'
|
|
3
|
+
import { Module, ModuleWrapper } from '@xyo-network/module'
|
|
4
4
|
import { Payload } from '@xyo-network/payload-model'
|
|
5
5
|
import { Dispatch, SetStateAction, useState } from 'react'
|
|
6
6
|
|
|
7
7
|
export interface DiscoverDialogProps extends DialogProps {
|
|
8
|
+
module?: Module
|
|
8
9
|
setOpen?: Dispatch<SetStateAction<boolean>>
|
|
9
10
|
wrapper?: ModuleWrapper
|
|
10
11
|
}
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
// Add a dialogue title and quick tip to show description of discover query
|
|
14
|
+
|
|
15
|
+
export const DiscoverDialog: React.FC<DiscoverDialogProps> = ({ module, setOpen, wrapper, ...props }) => {
|
|
13
16
|
const [discoverPayloads, setDiscoverPayloads] = useState<Payload[]>([])
|
|
14
17
|
|
|
15
18
|
useAsyncEffect(
|
|
@@ -25,8 +28,13 @@ export const DiscoverDialog: React.FC<DiscoverDialogProps> = ({ setOpen, wrapper
|
|
|
25
28
|
|
|
26
29
|
return (
|
|
27
30
|
<Dialog {...props}>
|
|
31
|
+
<DialogTitle>Supported Queries for {module?.config.name || module?.address}</DialogTitle>
|
|
32
|
+
<Divider />
|
|
28
33
|
<DialogContent>
|
|
29
|
-
<
|
|
34
|
+
<Paper sx={{ p: 1 }}>
|
|
35
|
+
<DialogContentText>All modules share a set of base queries along with ones specific to the module.</DialogContentText>
|
|
36
|
+
<pre>{JSON.stringify(discoverPayloads, null, 2)}</pre>
|
|
37
|
+
</Paper>
|
|
30
38
|
</DialogContent>
|
|
31
39
|
<DialogActions>
|
|
32
40
|
<Button onClick={() => setOpen?.(false)} variant={'outlined'}>
|