@xyo-network/react-module 2.75.7 → 2.76.0
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/browser/ModuleRenderProps.d.cts +1 -1
- package/dist/browser/ModuleRenderProps.d.cts.map +1 -1
- package/dist/browser/ModuleRenderProps.d.mts +1 -1
- package/dist/browser/ModuleRenderProps.d.mts.map +1 -1
- package/dist/browser/ModuleRenderProps.d.ts +1 -1
- package/dist/browser/ModuleRenderProps.d.ts.map +1 -1
- package/dist/browser/components/Card/Module/components/DiscoverDialog.d.cts +1 -1
- package/dist/browser/components/Card/Module/components/DiscoverDialog.d.cts.map +1 -1
- package/dist/browser/components/Card/Module/components/DiscoverDialog.d.mts +1 -1
- package/dist/browser/components/Card/Module/components/DiscoverDialog.d.mts.map +1 -1
- package/dist/browser/components/Card/Module/components/DiscoverDialog.d.ts +1 -1
- package/dist/browser/components/Card/Module/components/DiscoverDialog.d.ts.map +1 -1
- package/dist/browser/index.cjs +34 -34
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js +34 -34
- package/dist/browser/index.js.map +1 -1
- package/dist/neutral/ModuleRenderProps.d.cts +7 -0
- package/dist/neutral/ModuleRenderProps.d.cts.map +1 -0
- package/dist/neutral/ModuleRenderProps.d.mts +7 -0
- package/dist/neutral/ModuleRenderProps.d.mts.map +1 -0
- package/dist/neutral/ModuleRenderProps.d.ts +7 -0
- package/dist/neutral/ModuleRenderProps.d.ts.map +1 -0
- package/dist/neutral/components/Card/Diviner/Card.d.cts +6 -0
- package/dist/neutral/components/Card/Diviner/Card.d.cts.map +1 -0
- package/dist/neutral/components/Card/Diviner/Card.d.mts +6 -0
- package/dist/neutral/components/Card/Diviner/Card.d.mts.map +1 -0
- package/dist/neutral/components/Card/Diviner/Card.d.ts +6 -0
- package/dist/neutral/components/Card/Diviner/Card.d.ts.map +1 -0
- package/dist/neutral/components/Card/Diviner/CardActions.d.cts +6 -0
- package/dist/neutral/components/Card/Diviner/CardActions.d.cts.map +1 -0
- package/dist/neutral/components/Card/Diviner/CardActions.d.mts +6 -0
- package/dist/neutral/components/Card/Diviner/CardActions.d.mts.map +1 -0
- package/dist/neutral/components/Card/Diviner/CardActions.d.ts +6 -0
- package/dist/neutral/components/Card/Diviner/CardActions.d.ts.map +1 -0
- package/dist/neutral/components/Card/Diviner/CardContent.d.cts +6 -0
- package/dist/neutral/components/Card/Diviner/CardContent.d.cts.map +1 -0
- package/dist/neutral/components/Card/Diviner/CardContent.d.mts +6 -0
- package/dist/neutral/components/Card/Diviner/CardContent.d.mts.map +1 -0
- package/dist/neutral/components/Card/Diviner/CardContent.d.ts +6 -0
- package/dist/neutral/components/Card/Diviner/CardContent.d.ts.map +1 -0
- package/dist/neutral/components/Card/Diviner/CardHeader.d.cts +6 -0
- package/dist/neutral/components/Card/Diviner/CardHeader.d.cts.map +1 -0
- package/dist/neutral/components/Card/Diviner/CardHeader.d.mts +6 -0
- package/dist/neutral/components/Card/Diviner/CardHeader.d.mts.map +1 -0
- package/dist/neutral/components/Card/Diviner/CardHeader.d.ts +6 -0
- package/dist/neutral/components/Card/Diviner/CardHeader.d.ts.map +1 -0
- package/dist/neutral/components/Card/Diviner/index.d.cts +4 -0
- package/dist/neutral/components/Card/Diviner/index.d.cts.map +1 -0
- package/dist/neutral/components/Card/Diviner/index.d.mts +4 -0
- package/dist/neutral/components/Card/Diviner/index.d.mts.map +1 -0
- package/dist/neutral/components/Card/Diviner/index.d.ts +4 -0
- package/dist/neutral/components/Card/Diviner/index.d.ts.map +1 -0
- package/dist/neutral/components/Card/Module/Card.d.cts +5 -0
- package/dist/neutral/components/Card/Module/Card.d.cts.map +1 -0
- package/dist/neutral/components/Card/Module/Card.d.mts +5 -0
- package/dist/neutral/components/Card/Module/Card.d.mts.map +1 -0
- package/dist/neutral/components/Card/Module/Card.d.ts +5 -0
- package/dist/neutral/components/Card/Module/Card.d.ts.map +1 -0
- package/dist/neutral/components/Card/Module/CardActions.d.cts +5 -0
- package/dist/neutral/components/Card/Module/CardActions.d.cts.map +1 -0
- package/dist/neutral/components/Card/Module/CardActions.d.mts +5 -0
- package/dist/neutral/components/Card/Module/CardActions.d.mts.map +1 -0
- package/dist/neutral/components/Card/Module/CardActions.d.ts +5 -0
- package/dist/neutral/components/Card/Module/CardActions.d.ts.map +1 -0
- package/dist/neutral/components/Card/Module/CardContent.d.cts +5 -0
- package/dist/neutral/components/Card/Module/CardContent.d.cts.map +1 -0
- package/dist/neutral/components/Card/Module/CardContent.d.mts +5 -0
- package/dist/neutral/components/Card/Module/CardContent.d.mts.map +1 -0
- package/dist/neutral/components/Card/Module/CardContent.d.ts +5 -0
- package/dist/neutral/components/Card/Module/CardContent.d.ts.map +1 -0
- package/dist/neutral/components/Card/Module/CardHeader.d.cts +5 -0
- package/dist/neutral/components/Card/Module/CardHeader.d.cts.map +1 -0
- package/dist/neutral/components/Card/Module/CardHeader.d.mts +5 -0
- package/dist/neutral/components/Card/Module/CardHeader.d.mts.map +1 -0
- package/dist/neutral/components/Card/Module/CardHeader.d.ts +5 -0
- package/dist/neutral/components/Card/Module/CardHeader.d.ts.map +1 -0
- package/dist/neutral/components/Card/Module/components/DiscoverDialog.d.cts +9 -0
- package/dist/neutral/components/Card/Module/components/DiscoverDialog.d.cts.map +1 -0
- package/dist/neutral/components/Card/Module/components/DiscoverDialog.d.mts +9 -0
- package/dist/neutral/components/Card/Module/components/DiscoverDialog.d.mts.map +1 -0
- package/dist/neutral/components/Card/Module/components/DiscoverDialog.d.ts +9 -0
- package/dist/neutral/components/Card/Module/components/DiscoverDialog.d.ts.map +1 -0
- package/dist/neutral/components/Card/Module/components/index.d.cts +2 -0
- package/dist/neutral/components/Card/Module/components/index.d.cts.map +1 -0
- package/dist/neutral/components/Card/Module/components/index.d.mts +2 -0
- package/dist/neutral/components/Card/Module/components/index.d.mts.map +1 -0
- package/dist/neutral/components/Card/Module/components/index.d.ts +2 -0
- package/dist/neutral/components/Card/Module/components/index.d.ts.map +1 -0
- package/dist/neutral/components/Card/Module/index.d.cts +5 -0
- package/dist/neutral/components/Card/Module/index.d.cts.map +1 -0
- package/dist/neutral/components/Card/Module/index.d.mts +5 -0
- package/dist/neutral/components/Card/Module/index.d.mts.map +1 -0
- package/dist/neutral/components/Card/Module/index.d.ts +5 -0
- package/dist/neutral/components/Card/Module/index.d.ts.map +1 -0
- package/dist/neutral/components/Card/index.d.cts +3 -0
- package/dist/neutral/components/Card/index.d.cts.map +1 -0
- package/dist/neutral/components/Card/index.d.mts +3 -0
- package/dist/neutral/components/Card/index.d.mts.map +1 -0
- package/dist/neutral/components/Card/index.d.ts +3 -0
- package/dist/neutral/components/Card/index.d.ts.map +1 -0
- package/dist/neutral/components/DetailsBox.d.cts +5 -0
- package/dist/neutral/components/DetailsBox.d.cts.map +1 -0
- package/dist/neutral/components/DetailsBox.d.mts +5 -0
- package/dist/neutral/components/DetailsBox.d.mts.map +1 -0
- package/dist/neutral/components/DetailsBox.d.ts +5 -0
- package/dist/neutral/components/DetailsBox.d.ts.map +1 -0
- package/dist/neutral/components/TableCell.d.cts +5 -0
- package/dist/neutral/components/TableCell.d.cts.map +1 -0
- package/dist/neutral/components/TableCell.d.mts +5 -0
- package/dist/neutral/components/TableCell.d.mts.map +1 -0
- package/dist/neutral/components/TableCell.d.ts +5 -0
- package/dist/neutral/components/TableCell.d.ts.map +1 -0
- package/dist/neutral/components/index.d.cts +4 -0
- package/dist/neutral/components/index.d.cts.map +1 -0
- package/dist/neutral/components/index.d.mts +4 -0
- package/dist/neutral/components/index.d.mts.map +1 -0
- package/dist/neutral/components/index.d.ts +4 -0
- package/dist/neutral/components/index.d.ts.map +1 -0
- package/dist/neutral/hooks/index.d.cts +2 -0
- package/dist/neutral/hooks/index.d.cts.map +1 -0
- package/dist/neutral/hooks/index.d.mts +2 -0
- package/dist/neutral/hooks/index.d.mts.map +1 -0
- package/dist/neutral/hooks/index.d.ts +2 -0
- package/dist/neutral/hooks/index.d.ts.map +1 -0
- package/dist/neutral/hooks/useRefresh.d.cts +4 -0
- package/dist/neutral/hooks/useRefresh.d.cts.map +1 -0
- package/dist/neutral/hooks/useRefresh.d.mts +4 -0
- package/dist/neutral/hooks/useRefresh.d.mts.map +1 -0
- package/dist/neutral/hooks/useRefresh.d.ts +4 -0
- package/dist/neutral/hooks/useRefresh.d.ts.map +1 -0
- package/dist/neutral/index.cjs +202 -0
- package/dist/neutral/index.cjs.map +1 -0
- package/dist/neutral/index.d.cts +4 -0
- package/dist/neutral/index.d.cts.map +1 -0
- package/dist/neutral/index.d.mts +4 -0
- package/dist/neutral/index.d.mts.map +1 -0
- package/dist/neutral/index.d.ts +4 -0
- package/dist/neutral/index.d.ts.map +1 -0
- package/dist/neutral/index.js +179 -0
- package/dist/neutral/index.js.map +1 -0
- package/dist/node/ModuleRenderProps.d.cts +1 -1
- package/dist/node/ModuleRenderProps.d.cts.map +1 -1
- package/dist/node/ModuleRenderProps.d.mts +1 -1
- package/dist/node/ModuleRenderProps.d.mts.map +1 -1
- package/dist/node/ModuleRenderProps.d.ts +1 -1
- package/dist/node/ModuleRenderProps.d.ts.map +1 -1
- package/dist/node/components/Card/Module/components/DiscoverDialog.d.cts +1 -1
- package/dist/node/components/Card/Module/components/DiscoverDialog.d.cts.map +1 -1
- package/dist/node/components/Card/Module/components/DiscoverDialog.d.mts +1 -1
- package/dist/node/components/Card/Module/components/DiscoverDialog.d.mts.map +1 -1
- package/dist/node/components/Card/Module/components/DiscoverDialog.d.ts +1 -1
- package/dist/node/components/Card/Module/components/DiscoverDialog.d.ts.map +1 -1
- package/dist/node/index.cjs +34 -34
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.js +34 -34
- package/dist/node/index.js.map +1 -1
- package/package.json +10 -10
- package/src/ModuleRenderProps.tsx +1 -1
- package/src/components/Card/Diviner/Card.stories.tsx +4 -4
- package/src/components/Card/Diviner/Card.tsx +4 -4
- package/src/components/Card/Diviner/CardHeader.tsx +2 -2
- package/src/components/Card/Module/Card.stories.tsx +4 -4
- package/src/components/Card/Module/Card.tsx +4 -4
- package/src/components/Card/Module/CardActions.tsx +4 -4
- package/src/components/Card/Module/CardHeader.tsx +7 -7
- package/src/components/Card/Module/components/DiscoverDialog.tsx +5 -5
- package/src/components/DetailsBox.stories.tsx +3 -3
- package/src/components/DetailsBox.tsx +7 -7
- package/src/components/TableCell.tsx +2 -2
|
@@ -6,15 +6,15 @@ import { useState } from 'react'
|
|
|
6
6
|
import { ModuleRenderProps } from '../../../ModuleRenderProps'
|
|
7
7
|
import { DiscoverDialog } from './components'
|
|
8
8
|
|
|
9
|
-
export const ModuleCardActions: React.FC<CardActionsProps & ModuleRenderProps> = ({ children,
|
|
9
|
+
export const ModuleCardActions: React.FC<CardActionsProps & ModuleRenderProps> = ({ children, mod, sx, ...props }) => {
|
|
10
10
|
const [discoverDialogOpen, setDiscoverDialogOpen] = useState(false)
|
|
11
11
|
|
|
12
|
-
const config =
|
|
12
|
+
const config = mod?.config
|
|
13
13
|
|
|
14
14
|
return (
|
|
15
15
|
<CardActions sx={{ alignItems: 'stretch', flexDirection: 'column', ml: 1, ...sx }} {...props}>
|
|
16
16
|
<FlexRow justifyContent="space-between" gap={1} alignItems="center">
|
|
17
|
-
{
|
|
17
|
+
{mod ?
|
|
18
18
|
<Chip label={config?.schema} size={'small'} />
|
|
19
19
|
: null}
|
|
20
20
|
{children}
|
|
@@ -22,7 +22,7 @@ export const ModuleCardActions: React.FC<CardActionsProps & ModuleRenderProps> =
|
|
|
22
22
|
Discover
|
|
23
23
|
</ButtonEx>
|
|
24
24
|
</FlexRow>
|
|
25
|
-
<DiscoverDialog fullWidth maxWidth={'md'}
|
|
25
|
+
<DiscoverDialog fullWidth maxWidth={'md'} mod={mod} open={discoverDialogOpen} setOpen={setDiscoverDialogOpen} />
|
|
26
26
|
</CardActions>
|
|
27
27
|
)
|
|
28
28
|
}
|
|
@@ -6,21 +6,21 @@ import { ModuleRenderProps } from '../../../ModuleRenderProps'
|
|
|
6
6
|
|
|
7
7
|
const moduleTypes = ['sentinel', 'bridge', 'archivist', 'diviner', 'node', 'witness']
|
|
8
8
|
|
|
9
|
-
const getModuleIcons = (moduleType: string,
|
|
10
|
-
return
|
|
9
|
+
const getModuleIcons = (moduleType: string, mod: Module) => {
|
|
10
|
+
return mod?.queries.find((query) => query.startsWith(`network.xyo.query.${moduleType}`)) ? findNetworkComponent(moduleType)?.icon : null
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export const ModuleCardHeader: React.FC<ModuleRenderProps & CardHeaderProps> = ({ subheader, avatar, title,
|
|
13
|
+
export const ModuleCardHeader: React.FC<ModuleRenderProps & CardHeaderProps> = ({ subheader, avatar, title, mod, ...props }) => {
|
|
14
14
|
return (
|
|
15
15
|
<CardHeader
|
|
16
|
-
title={title ??
|
|
17
|
-
subheader={subheader ??
|
|
16
|
+
title={title ?? mod?.config.name ?? 'Module'}
|
|
17
|
+
subheader={subheader ?? mod?.address}
|
|
18
18
|
avatar={
|
|
19
19
|
avatar ?? (
|
|
20
20
|
<>
|
|
21
|
-
{
|
|
21
|
+
{mod ?
|
|
22
22
|
moduleTypes.map((moduleType) => {
|
|
23
|
-
const Icon = getModuleIcons(moduleType,
|
|
23
|
+
const Icon = getModuleIcons(moduleType, mod)
|
|
24
24
|
return Icon ? <Icon key={moduleType} fontSize={'large'} color="primary" /> : null
|
|
25
25
|
})
|
|
26
26
|
: null}
|
|
@@ -4,20 +4,20 @@ import { ModuleInstance } from '@xyo-network/module-model'
|
|
|
4
4
|
import { Dispatch, SetStateAction } from 'react'
|
|
5
5
|
|
|
6
6
|
export interface DiscoverDialogProps extends DialogProps {
|
|
7
|
-
|
|
7
|
+
mod?: ModuleInstance
|
|
8
8
|
setOpen?: Dispatch<SetStateAction<boolean>>
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
// Add a dialogue title and quick tip to show description of discover query
|
|
12
12
|
|
|
13
|
-
export const DiscoverDialog: React.FC<DiscoverDialogProps> = ({
|
|
13
|
+
export const DiscoverDialog: React.FC<DiscoverDialogProps> = ({ mod, setOpen, ...props }) => {
|
|
14
14
|
const [discoverPayloads] = usePromise(async () => {
|
|
15
|
-
return await
|
|
16
|
-
}, [
|
|
15
|
+
return await mod?.state()
|
|
16
|
+
}, [mod])
|
|
17
17
|
|
|
18
18
|
return (
|
|
19
19
|
<Dialog {...props}>
|
|
20
|
-
<DialogTitle>Supported Queries for {
|
|
20
|
+
<DialogTitle>Supported Queries for {mod?.config.name || mod?.address}</DialogTitle>
|
|
21
21
|
<Divider />
|
|
22
22
|
<DialogContent>
|
|
23
23
|
<Paper sx={{ p: 1 }}>
|
|
@@ -34,7 +34,7 @@ const NodeTemplate: StoryFn<typeof ModuleDetailsBox> = (args) => {
|
|
|
34
34
|
)
|
|
35
35
|
return (
|
|
36
36
|
<FlexCol minHeight="80vh" alignItems="stretch">
|
|
37
|
-
<ModuleDetailsBox
|
|
37
|
+
<ModuleDetailsBox mod={node} {...args} />
|
|
38
38
|
</FlexCol>
|
|
39
39
|
)
|
|
40
40
|
}
|
|
@@ -56,7 +56,7 @@ const ArchivistTemplate: StoryFn<typeof ModuleDetailsBox> = (args) => {
|
|
|
56
56
|
)
|
|
57
57
|
return (
|
|
58
58
|
<FlexCol minHeight="80vh" alignItems="stretch">
|
|
59
|
-
<ModuleDetailsBox
|
|
59
|
+
<ModuleDetailsBox mod={archivist} {...args} />
|
|
60
60
|
</FlexCol>
|
|
61
61
|
)
|
|
62
62
|
}
|
|
@@ -78,7 +78,7 @@ const DivinerTemplate: StoryFn<typeof ModuleDetailsBox> = (args) => {
|
|
|
78
78
|
)
|
|
79
79
|
return (
|
|
80
80
|
<FlexCol minHeight="80vh" alignItems="stretch">
|
|
81
|
-
<ModuleDetailsBox
|
|
81
|
+
<ModuleDetailsBox mod={diviner} {...args} />
|
|
82
82
|
</FlexCol>
|
|
83
83
|
)
|
|
84
84
|
}
|
|
@@ -8,18 +8,18 @@ import { useState } from 'react'
|
|
|
8
8
|
|
|
9
9
|
import { ModuleRenderProps } from '../ModuleRenderProps'
|
|
10
10
|
|
|
11
|
-
const getModuleIcon = (moduleType: string,
|
|
12
|
-
return
|
|
11
|
+
const getModuleIcon = (moduleType: string, mod: Module) => {
|
|
12
|
+
return mod?.queries.find((query) => query.startsWith(`network.xyo.query.${moduleType}`)) ? findNetworkComponent(moduleType)?.icon() : null
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export const ModuleDetailsBox: React.FC<ModuleRenderProps & FlexBoxProps> = ({ children,
|
|
15
|
+
export const ModuleDetailsBox: React.FC<ModuleRenderProps & FlexBoxProps> = ({ children, mod, ...props }) => {
|
|
16
16
|
const [showQueries, setShowQueries] = useState(false)
|
|
17
17
|
return (
|
|
18
18
|
<FlexCol {...props}>
|
|
19
19
|
<FlexRow>
|
|
20
|
-
{
|
|
20
|
+
{mod ?
|
|
21
21
|
['sentinel', 'bridge', 'archivist', 'diviner', 'node'].map((moduleType) => {
|
|
22
|
-
const icon = getModuleIcon(moduleType,
|
|
22
|
+
const icon = getModuleIcon(moduleType, mod)
|
|
23
23
|
return icon ?
|
|
24
24
|
<ButtonEx onClick={() => setShowQueries(!showQueries)} key={moduleType}>
|
|
25
25
|
{icon}
|
|
@@ -27,11 +27,11 @@ export const ModuleDetailsBox: React.FC<ModuleRenderProps & FlexBoxProps> = ({ c
|
|
|
27
27
|
: null
|
|
28
28
|
})
|
|
29
29
|
: null}
|
|
30
|
-
<EthAccountBox address={EthAddress.fromString(
|
|
30
|
+
<EthAccountBox address={EthAddress.fromString(mod?.address)} />
|
|
31
31
|
</FlexRow>
|
|
32
32
|
|
|
33
33
|
{showQueries ?
|
|
34
|
-
|
|
34
|
+
mod?.queries.map((query) => {
|
|
35
35
|
return <FlexRow key={query}>{query}</FlexRow>
|
|
36
36
|
})
|
|
37
37
|
: null}
|
|
@@ -4,10 +4,10 @@ import { EthAccountBox } from '@xylabs/react-crypto'
|
|
|
4
4
|
|
|
5
5
|
import { ModuleRenderProps } from '../ModuleRenderProps'
|
|
6
6
|
|
|
7
|
-
export const ModuleTableCell: React.FC<ModuleRenderProps & TableCellProps> = ({ children,
|
|
7
|
+
export const ModuleTableCell: React.FC<ModuleRenderProps & TableCellProps> = ({ children, mod, ...props }) => {
|
|
8
8
|
return (
|
|
9
9
|
<TableCell {...props}>
|
|
10
|
-
<EthAccountBox address={EthAddress.fromString(
|
|
10
|
+
<EthAccountBox address={EthAddress.fromString(mod?.address)} />
|
|
11
11
|
{children}
|
|
12
12
|
</TableCell>
|
|
13
13
|
)
|