@xyo-network/react-chain-boundwitness 1.2.5 → 1.2.7
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/index.mjs +3 -1239
- package/dist/browser/index.mjs.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -33
- package/src/index.ts +1 -2
- package/dist/types/Plugin.d.ts +0 -3
- package/dist/types/Plugin.d.ts.map +0 -1
- package/dist/types/components/Card/Card.d.ts +0 -9
- package/dist/types/components/Card/Card.d.ts.map +0 -1
- package/dist/types/components/Card/CardContent/AddressAvatarGroup.d.ts +0 -8
- package/dist/types/components/Card/CardContent/AddressAvatarGroup.d.ts.map +0 -1
- package/dist/types/components/Card/CardContent/CardContent.d.ts +0 -14
- package/dist/types/components/Card/CardContent/CardContent.d.ts.map +0 -1
- package/dist/types/components/Card/CardContent/SchemaAvatarGroup.d.ts +0 -9
- package/dist/types/components/Card/CardContent/SchemaAvatarGroup.d.ts.map +0 -1
- package/dist/types/components/Card/CardContent/index.d.ts +0 -3
- package/dist/types/components/Card/CardContent/index.d.ts.map +0 -1
- package/dist/types/components/Card/CardContent/layout/CardColumnTitle.d.ts +0 -5
- package/dist/types/components/Card/CardContent/layout/CardColumnTitle.d.ts.map +0 -1
- package/dist/types/components/Card/CardContent/layout/CardColumnsFlex.d.ts +0 -2
- package/dist/types/components/Card/CardContent/layout/CardColumnsFlex.d.ts.map +0 -1
- package/dist/types/components/Card/CardContent/layout/CardContentFlex.d.ts +0 -5
- package/dist/types/components/Card/CardContent/layout/CardContentFlex.d.ts.map +0 -1
- package/dist/types/components/Card/CardContent/layout/index.d.ts +0 -4
- package/dist/types/components/Card/CardContent/layout/index.d.ts.map +0 -1
- package/dist/types/components/Card/CardHeader/CardHeader.d.ts +0 -20
- package/dist/types/components/Card/CardHeader/CardHeader.d.ts.map +0 -1
- package/dist/types/components/Card/CardHeader/index.d.ts +0 -2
- package/dist/types/components/Card/CardHeader/index.d.ts.map +0 -1
- package/dist/types/components/Card/index.d.ts +0 -4
- package/dist/types/components/Card/index.d.ts.map +0 -1
- package/dist/types/components/Details/BoundWitnessLinksDetails.d.ts +0 -8
- package/dist/types/components/Details/BoundWitnessLinksDetails.d.ts.map +0 -1
- package/dist/types/components/Details/Box/DetailsBox.d.ts +0 -6
- package/dist/types/components/Details/Box/DetailsBox.d.ts.map +0 -1
- package/dist/types/components/Details/Box/index.d.ts +0 -2
- package/dist/types/components/Details/Box/index.d.ts.map +0 -1
- package/dist/types/components/Details/Card/DetailsCard.d.ts +0 -11
- package/dist/types/components/Details/Card/DetailsCard.d.ts.map +0 -1
- package/dist/types/components/Details/Card/DetailsCardContent.d.ts +0 -16
- package/dist/types/components/Details/Card/DetailsCardContent.d.ts.map +0 -1
- package/dist/types/components/Details/Card/DetailsCardInner.d.ts +0 -11
- package/dist/types/components/Details/Card/DetailsCardInner.d.ts.map +0 -1
- package/dist/types/components/Details/Card/Navigation/BottomNavigation.d.ts +0 -17
- package/dist/types/components/Details/Card/Navigation/BottomNavigation.d.ts.map +0 -1
- package/dist/types/components/Details/Card/Navigation/NavigationTabs.d.ts +0 -11
- package/dist/types/components/Details/Card/Navigation/NavigationTabs.d.ts.map +0 -1
- package/dist/types/components/Details/Card/Navigation/index.d.ts +0 -3
- package/dist/types/components/Details/Card/Navigation/index.d.ts.map +0 -1
- package/dist/types/components/Details/Card/index.d.ts +0 -2
- package/dist/types/components/Details/Card/index.d.ts.map +0 -1
- package/dist/types/components/Details/Details.d.ts +0 -16
- package/dist/types/components/Details/Details.d.ts.map +0 -1
- package/dist/types/components/Details/ValidationDetails.d.ts +0 -8
- package/dist/types/components/Details/ValidationDetails.d.ts.map +0 -1
- package/dist/types/components/Details/index.d.ts +0 -5
- package/dist/types/components/Details/index.d.ts.map +0 -1
- package/dist/types/components/_shared/Actions/BWActions.d.ts +0 -15
- package/dist/types/components/_shared/Actions/BWActions.d.ts.map +0 -1
- package/dist/types/components/_shared/Actions/Verification.d.ts +0 -9
- package/dist/types/components/_shared/Actions/Verification.d.ts.map +0 -1
- package/dist/types/components/_shared/Actions/_shared/ActionMenuItemProps.d.ts +0 -7
- package/dist/types/components/_shared/Actions/_shared/ActionMenuItemProps.d.ts.map +0 -1
- package/dist/types/components/_shared/Actions/_shared/MenuItemDialog.d.ts +0 -7
- package/dist/types/components/_shared/Actions/_shared/MenuItemDialog.d.ts.map +0 -1
- package/dist/types/components/_shared/Actions/_shared/index.d.ts +0 -3
- package/dist/types/components/_shared/Actions/_shared/index.d.ts.map +0 -1
- package/dist/types/components/_shared/Actions/index.d.ts +0 -5
- package/dist/types/components/_shared/Actions/index.d.ts.map +0 -1
- package/dist/types/components/_shared/Actions/json/MenuItem.d.ts +0 -6
- package/dist/types/components/_shared/Actions/json/MenuItem.d.ts.map +0 -1
- package/dist/types/components/_shared/Actions/json/index.d.ts +0 -2
- package/dist/types/components/_shared/Actions/json/index.d.ts.map +0 -1
- package/dist/types/components/_shared/Actions/previous-hash/DialogContent.d.ts +0 -8
- package/dist/types/components/_shared/Actions/previous-hash/DialogContent.d.ts.map +0 -1
- package/dist/types/components/_shared/Actions/previous-hash/MenuItem.d.ts +0 -6
- package/dist/types/components/_shared/Actions/previous-hash/MenuItem.d.ts.map +0 -1
- package/dist/types/components/_shared/Actions/previous-hash/QuickTipButton.d.ts +0 -8
- package/dist/types/components/_shared/Actions/previous-hash/QuickTipButton.d.ts.map +0 -1
- package/dist/types/components/_shared/Actions/previous-hash/index.d.ts +0 -4
- package/dist/types/components/_shared/Actions/previous-hash/index.d.ts.map +0 -1
- package/dist/types/components/_shared/Heading/HashHeadingPaper/Adornment/BackPaperAdornment.d.ts +0 -6
- package/dist/types/components/_shared/Heading/HashHeadingPaper/Adornment/BackPaperAdornment.d.ts.map +0 -1
- package/dist/types/components/_shared/Heading/HashHeadingPaper/Adornment/PaperAdornment.d.ts +0 -6
- package/dist/types/components/_shared/Heading/HashHeadingPaper/Adornment/PaperAdornment.d.ts.map +0 -1
- package/dist/types/components/_shared/Heading/HashHeadingPaper/Adornment/PaperAdornmentIconButton.d.ts +0 -6
- package/dist/types/components/_shared/Heading/HashHeadingPaper/Adornment/PaperAdornmentIconButton.d.ts.map +0 -1
- package/dist/types/components/_shared/Heading/HashHeadingPaper/Adornment/index.d.ts +0 -4
- package/dist/types/components/_shared/Heading/HashHeadingPaper/Adornment/index.d.ts.map +0 -1
- package/dist/types/components/_shared/Heading/HashHeadingPaper/HashHeadingPaper.d.ts +0 -15
- package/dist/types/components/_shared/Heading/HashHeadingPaper/HashHeadingPaper.d.ts.map +0 -1
- package/dist/types/components/_shared/Heading/HashHeadingPaper/index.d.ts +0 -2
- package/dist/types/components/_shared/Heading/HashHeadingPaper/index.d.ts.map +0 -1
- package/dist/types/components/_shared/Heading/Heading.d.ts +0 -4
- package/dist/types/components/_shared/Heading/Heading.d.ts.map +0 -1
- package/dist/types/components/_shared/Heading/HeadingPaper/HeadingPaper.d.ts +0 -14
- package/dist/types/components/_shared/Heading/HeadingPaper/HeadingPaper.d.ts.map +0 -1
- package/dist/types/components/_shared/Heading/HeadingPaper/index.d.ts +0 -2
- package/dist/types/components/_shared/Heading/HeadingPaper/index.d.ts.map +0 -1
- package/dist/types/components/_shared/Heading/HeadingProps.d.ts +0 -14
- package/dist/types/components/_shared/Heading/HeadingProps.d.ts.map +0 -1
- package/dist/types/components/_shared/Heading/index.d.ts +0 -5
- package/dist/types/components/_shared/Heading/index.d.ts.map +0 -1
- package/dist/types/components/_shared/Payloads/PayloadsPropertyGroup.d.ts +0 -10
- package/dist/types/components/_shared/Payloads/PayloadsPropertyGroup.d.ts.map +0 -1
- package/dist/types/components/_shared/Payloads/PayloadsTable.d.ts +0 -11
- package/dist/types/components/_shared/Payloads/PayloadsTable.d.ts.map +0 -1
- package/dist/types/components/_shared/Payloads/index.d.ts +0 -3
- package/dist/types/components/_shared/Payloads/index.d.ts.map +0 -1
- package/dist/types/components/_shared/Payloads/payloads-table/TableBody.d.ts +0 -11
- package/dist/types/components/_shared/Payloads/payloads-table/TableBody.d.ts.map +0 -1
- package/dist/types/components/_shared/Payloads/payloads-table/TableBodyFiltered.d.ts +0 -8
- package/dist/types/components/_shared/Payloads/payloads-table/TableBodyFiltered.d.ts.map +0 -1
- package/dist/types/components/_shared/Payloads/payloads-table/TableHead.d.ts +0 -4
- package/dist/types/components/_shared/Payloads/payloads-table/TableHead.d.ts.map +0 -1
- package/dist/types/components/_shared/Payloads/payloads-table/index.d.ts +0 -4
- package/dist/types/components/_shared/Payloads/payloads-table/index.d.ts.map +0 -1
- package/dist/types/components/_shared/Signatures/SignatureDetails.d.ts +0 -8
- package/dist/types/components/_shared/Signatures/SignatureDetails.d.ts.map +0 -1
- package/dist/types/components/_shared/Signatures/SignatureTable.d.ts +0 -8
- package/dist/types/components/_shared/Signatures/SignatureTable.d.ts.map +0 -1
- package/dist/types/components/_shared/Signatures/SignatureTableRow.d.ts +0 -14
- package/dist/types/components/_shared/Signatures/SignatureTableRow.d.ts.map +0 -1
- package/dist/types/components/_shared/Signatures/index.d.ts +0 -3
- package/dist/types/components/_shared/Signatures/index.d.ts.map +0 -1
- package/dist/types/components/_shared/index.d.ts +0 -5
- package/dist/types/components/_shared/index.d.ts.map +0 -1
- package/dist/types/components/index.d.ts +0 -4
- package/dist/types/components/index.d.ts.map +0 -1
- package/src/Plugin.ts +0 -21
- package/src/components/Card/Card.stories.tsx +0 -22
- package/src/components/Card/Card.tsx +0 -25
- package/src/components/Card/CardContent/AddressAvatarGroup.tsx +0 -27
- package/src/components/Card/CardContent/CardContent.tsx +0 -36
- package/src/components/Card/CardContent/SchemaAvatarGroup.tsx +0 -43
- package/src/components/Card/CardContent/index.ts +0 -2
- package/src/components/Card/CardContent/layout/CardColumnTitle.tsx +0 -10
- package/src/components/Card/CardContent/layout/CardColumnsFlex.tsx +0 -8
- package/src/components/Card/CardContent/layout/CardContentFlex.tsx +0 -19
- package/src/components/Card/CardContent/layout/index.ts +0 -3
- package/src/components/Card/CardHeader/CardHeader.tsx +0 -89
- package/src/components/Card/CardHeader/index.ts +0 -1
- package/src/components/Card/index.ts +0 -3
- package/src/components/Details/BoundWitnessLinksDetails.tsx +0 -38
- package/src/components/Details/Box/DetailsBox.stories.tsx +0 -65
- package/src/components/Details/Box/DetailsBox.tsx +0 -70
- package/src/components/Details/Box/index.ts +0 -1
- package/src/components/Details/Card/DetailsCard.stories.tsx +0 -37
- package/src/components/Details/Card/DetailsCard.tsx +0 -20
- package/src/components/Details/Card/DetailsCardContent.tsx +0 -63
- package/src/components/Details/Card/DetailsCardInner.tsx +0 -53
- package/src/components/Details/Card/Navigation/BottomNavigation.stories.tsx +0 -24
- package/src/components/Details/Card/Navigation/BottomNavigation.tsx +0 -47
- package/src/components/Details/Card/Navigation/NavigationTabs.stories.tsx +0 -26
- package/src/components/Details/Card/Navigation/NavigationTabs.tsx +0 -53
- package/src/components/Details/Card/Navigation/index.ts +0 -2
- package/src/components/Details/Card/index.ts +0 -1
- package/src/components/Details/Details.stories.tsx +0 -77
- package/src/components/Details/Details.tsx +0 -35
- package/src/components/Details/ValidationDetails.tsx +0 -43
- package/src/components/Details/index.ts +0 -4
- package/src/components/_shared/Actions/BWActions.tsx +0 -55
- package/src/components/_shared/Actions/Verification.tsx +0 -46
- package/src/components/_shared/Actions/_shared/ActionMenuItemProps.ts +0 -7
- package/src/components/_shared/Actions/_shared/MenuItemDialog.tsx +0 -28
- package/src/components/_shared/Actions/_shared/index.ts +0 -2
- package/src/components/_shared/Actions/index.ts +0 -4
- package/src/components/_shared/Actions/json/MenuItem.tsx +0 -43
- package/src/components/_shared/Actions/json/index.ts +0 -1
- package/src/components/_shared/Actions/previous-hash/DialogContent.tsx +0 -44
- package/src/components/_shared/Actions/previous-hash/MenuItem.tsx +0 -37
- package/src/components/_shared/Actions/previous-hash/QuickTipButton.tsx +0 -32
- package/src/components/_shared/Actions/previous-hash/index.ts +0 -3
- package/src/components/_shared/Heading/HashHeadingPaper/Adornment/BackPaperAdornment.tsx +0 -13
- package/src/components/_shared/Heading/HashHeadingPaper/Adornment/PaperAdornment.tsx +0 -15
- package/src/components/_shared/Heading/HashHeadingPaper/Adornment/PaperAdornmentIconButton.tsx +0 -13
- package/src/components/_shared/Heading/HashHeadingPaper/Adornment/index.ts +0 -3
- package/src/components/_shared/Heading/HashHeadingPaper/HashHeadingPaper.stories.tsx +0 -33
- package/src/components/_shared/Heading/HashHeadingPaper/HashHeadingPaper.tsx +0 -45
- package/src/components/_shared/Heading/HashHeadingPaper/index.ts +0 -1
- package/src/components/_shared/Heading/Heading.tsx +0 -49
- package/src/components/_shared/Heading/HeadingPaper/HeadingPaper.tsx +0 -50
- package/src/components/_shared/Heading/HeadingPaper/index.ts +0 -1
- package/src/components/_shared/Heading/HeadingProps.tsx +0 -15
- package/src/components/_shared/Heading/index.ts +0 -4
- package/src/components/_shared/Payloads/PayloadsPropertyGroup.tsx +0 -26
- package/src/components/_shared/Payloads/PayloadsTable.tsx +0 -53
- package/src/components/_shared/Payloads/index.ts +0 -2
- package/src/components/_shared/Payloads/payloads-table/TableBody.tsx +0 -66
- package/src/components/_shared/Payloads/payloads-table/TableBodyFiltered.tsx +0 -52
- package/src/components/_shared/Payloads/payloads-table/TableHead.tsx +0 -24
- package/src/components/_shared/Payloads/payloads-table/index.ts +0 -3
- package/src/components/_shared/Signatures/SignatureDetails.tsx +0 -22
- package/src/components/_shared/Signatures/SignatureTable.stories.tsx +0 -29
- package/src/components/_shared/Signatures/SignatureTable.tsx +0 -92
- package/src/components/_shared/Signatures/SignatureTableRow.tsx +0 -88
- package/src/components/_shared/Signatures/index.ts +0 -2
- package/src/components/_shared/index.ts +0 -4
- package/src/components/index.ts +0 -3
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { Collapse } from '@mui/material'
|
|
2
|
-
import { FlexGrowCol, FlexRow } from '@xylabs/react-flexbox'
|
|
3
|
-
import type { BoundWitness } from '@xyo-network/boundwitness-model'
|
|
4
|
-
import type { CardContentExProps } from '@xyo-network/react-card'
|
|
5
|
-
import { CardContentEx } from '@xyo-network/react-card'
|
|
6
|
-
import { useTableHeight } from '@xyo-network/react-table'
|
|
7
|
-
import type { Dispatch, SetStateAction } from 'react'
|
|
8
|
-
import React, { useState } from 'react'
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
BoundWitnessPayloadsTable, BoundWitnessPayloadsTableForBWs, BoundWitnessSignatureTable,
|
|
12
|
-
} from '../../_shared/index.ts'
|
|
13
|
-
import { BoundWitnessBottomNavigation, BWNavigationTabs } from './Navigation/index.ts'
|
|
14
|
-
|
|
15
|
-
export interface DetailsCardContentProps extends CardContentExProps {
|
|
16
|
-
boundwitness?: BoundWitness
|
|
17
|
-
collapsed?: boolean
|
|
18
|
-
setCollapsed?: Dispatch<SetStateAction<boolean>>
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const DetailsCardContent = ({
|
|
22
|
-
ref, collapsed, boundwitness, setCollapsed, ...props
|
|
23
|
-
}: DetailsCardContentProps & { ref?: React.Ref<HTMLDivElement | null> }) => {
|
|
24
|
-
const { height } = useTableHeight()
|
|
25
|
-
const [activeTab, setActiveTab] = useState(0)
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<CardContentEx removePadding>
|
|
29
|
-
<FlexGrowCol alignItems="stretch" height={height !== undefined && collapsed ? height : 'auto'} justifyContent="start" ref={ref}>
|
|
30
|
-
<Collapse in={collapsed}>
|
|
31
|
-
<FlexRow alignItems="stretch" height={height !== undefined && collapsed ? height : 'auto'} {...props}>
|
|
32
|
-
<BWNavigationTabs value={activeTab} setValue={setActiveTab} boundWitness={boundwitness} />
|
|
33
|
-
<FlexGrowCol
|
|
34
|
-
justifyContent="start"
|
|
35
|
-
overflow="scroll"
|
|
36
|
-
sx={{ borderLeft: '1px solid', borderLeftColor: 'divider' }}
|
|
37
|
-
>
|
|
38
|
-
{activeTab === 0
|
|
39
|
-
? <BoundWitnessPayloadsTable boundwitness={boundwitness} variant="scrollable" />
|
|
40
|
-
: null}
|
|
41
|
-
{activeTab === 1
|
|
42
|
-
? <BoundWitnessPayloadsTableForBWs boundwitness={boundwitness} variant="scrollable" />
|
|
43
|
-
: null}
|
|
44
|
-
{activeTab === 2
|
|
45
|
-
? <BoundWitnessSignatureTable block={boundwitness} variant="scrollable" />
|
|
46
|
-
: null}
|
|
47
|
-
</FlexGrowCol>
|
|
48
|
-
</FlexRow>
|
|
49
|
-
</Collapse>
|
|
50
|
-
</FlexGrowCol>
|
|
51
|
-
<Collapse in={!collapsed} unmountOnExit>
|
|
52
|
-
<BoundWitnessBottomNavigation
|
|
53
|
-
onClick={() => setCollapsed?.(true)}
|
|
54
|
-
activeTab={activeTab}
|
|
55
|
-
setActiveTab={setActiveTab}
|
|
56
|
-
boundWitness={boundwitness}
|
|
57
|
-
/>
|
|
58
|
-
</Collapse>
|
|
59
|
-
</CardContentEx>
|
|
60
|
-
)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
DetailsCardContent.displayName = 'DetailsCardContent'
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { ExpandLessRounded as ExpandLessRoundedIcon, ExpandMoreRounded as ExpandMoreRoundedIcon } from '@mui/icons-material'
|
|
2
|
-
import type { CardProps } from '@mui/material'
|
|
3
|
-
import {
|
|
4
|
-
Card,
|
|
5
|
-
Divider, IconButton,
|
|
6
|
-
} from '@mui/material'
|
|
7
|
-
import { useResetState } from '@xylabs/react-hooks'
|
|
8
|
-
import type { BoundWitness } from '@xyo-network/boundwitness-model'
|
|
9
|
-
import type { PayloadDetailsRenderProps } from '@xyo-network/react-payload-plugin'
|
|
10
|
-
import React from 'react'
|
|
11
|
-
|
|
12
|
-
import { BoundWitnessCardHeader } from '../../Card/index.ts'
|
|
13
|
-
import { DetailsCardContent } from './DetailsCardContent.tsx'
|
|
14
|
-
|
|
15
|
-
const BoundWitnessDetailsCardInner = ({
|
|
16
|
-
ref, payload, active, ...props
|
|
17
|
-
}: PayloadDetailsRenderProps & CardProps & { ref?: React.Ref<HTMLDivElement | null> }) => {
|
|
18
|
-
const boundwitness = payload as BoundWitness
|
|
19
|
-
const [collapsed, setCollapsed] = useResetState<boolean>(!active)
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<Card ref={ref} {...props}>
|
|
23
|
-
<BoundWitnessCardHeader
|
|
24
|
-
payload={payload}
|
|
25
|
-
active={active}
|
|
26
|
-
activeBgColor={false}
|
|
27
|
-
hideJSONButton={false}
|
|
28
|
-
hideValidation={false}
|
|
29
|
-
hidePreviousHash={false}
|
|
30
|
-
additionalActions={(
|
|
31
|
-
<>
|
|
32
|
-
<Divider
|
|
33
|
-
flexItem
|
|
34
|
-
orientation="vertical"
|
|
35
|
-
sx={{ ml: 2, mr: 1 }}
|
|
36
|
-
/>
|
|
37
|
-
<IconButton onClick={() => setCollapsed(!collapsed)}>
|
|
38
|
-
{collapsed
|
|
39
|
-
? <ExpandMoreRoundedIcon />
|
|
40
|
-
: <ExpandLessRoundedIcon />}
|
|
41
|
-
</IconButton>
|
|
42
|
-
</>
|
|
43
|
-
)}
|
|
44
|
-
sx={{ columnGap: 2 }}
|
|
45
|
-
/>
|
|
46
|
-
<DetailsCardContent boundwitness={boundwitness} collapsed={collapsed} setCollapsed={setCollapsed} ref={ref} />
|
|
47
|
-
</Card>
|
|
48
|
-
)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
BoundWitnessDetailsCardInner.displayName = 'BoundWitnessDetailsCardInner'
|
|
52
|
-
|
|
53
|
-
export { BoundWitnessDetailsCardInner }
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryFn } from '@storybook/react'
|
|
2
|
-
import { FlexGrowRow } from '@xylabs/react-flexbox'
|
|
3
|
-
import { sampleBlock } from '@xyo-network/react-storybook'
|
|
4
|
-
import React from 'react'
|
|
5
|
-
|
|
6
|
-
import { BoundWitnessBottomNavigation } from './BottomNavigation.tsx'
|
|
7
|
-
|
|
8
|
-
export default {
|
|
9
|
-
component: BoundWitnessBottomNavigation,
|
|
10
|
-
title: 'plugin/boundwitness/BottomNavigation',
|
|
11
|
-
} as Meta
|
|
12
|
-
|
|
13
|
-
const Template: StoryFn<typeof BoundWitnessBottomNavigation> = (props) => {
|
|
14
|
-
return (
|
|
15
|
-
<FlexGrowRow height="calc(100vh - 20px)">
|
|
16
|
-
<BoundWitnessBottomNavigation {...props} />
|
|
17
|
-
</FlexGrowRow>
|
|
18
|
-
)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const Default = Template.bind({})
|
|
22
|
-
Default.args = { boundWitness: sampleBlock }
|
|
23
|
-
|
|
24
|
-
export { Default }
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type { BottomNavigationProps } from '@mui/material'
|
|
2
|
-
import {
|
|
3
|
-
BottomNavigation, BottomNavigationAction,
|
|
4
|
-
styled,
|
|
5
|
-
} from '@mui/material'
|
|
6
|
-
import type { BoundWitness } from '@xyo-network/boundwitness-model'
|
|
7
|
-
import { BoundWitnessSchema } from '@xyo-network/boundwitness-model'
|
|
8
|
-
import type { Dispatch, SetStateAction } from 'react'
|
|
9
|
-
import React from 'react'
|
|
10
|
-
import { FaSignature } from 'react-icons/fa'
|
|
11
|
-
import { VscSymbolMethod, VscSymbolNamespace } from 'react-icons/vsc'
|
|
12
|
-
|
|
13
|
-
export interface BoundWitnessBottomNavigationProps extends BottomNavigationProps {
|
|
14
|
-
activeTab?: number
|
|
15
|
-
boundWitness?: BoundWitness
|
|
16
|
-
setActiveTab?: Dispatch<SetStateAction<number>>
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const BoundWitnessBottomNavigation = ({
|
|
20
|
-
ref, activeTab = 0, setActiveTab, boundWitness, ...props
|
|
21
|
-
}: BoundWitnessBottomNavigationProps & { ref?: React.Ref<HTMLDivElement | null> }) => {
|
|
22
|
-
const payloadCount = boundWitness?.payload_schemas.filter(schema => schema !== BoundWitnessSchema).length ?? 0
|
|
23
|
-
const boundWitnessCount = boundWitness?.payload_schemas.filter(schema => schema === BoundWitnessSchema).length ?? 0
|
|
24
|
-
const signers = boundWitness?.addresses.length ?? 0
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<StyledBottomNavigation
|
|
28
|
-
showLabels
|
|
29
|
-
value={activeTab}
|
|
30
|
-
|
|
31
|
-
onChange={(_event, newValue) => {
|
|
32
|
-
setActiveTab?.(newValue)
|
|
33
|
-
}}
|
|
34
|
-
ref={ref}
|
|
35
|
-
{...props}
|
|
36
|
-
>
|
|
37
|
-
<BottomNavigationAction label={`Payloads - ${payloadCount}`} icon={<VscSymbolNamespace />} />
|
|
38
|
-
<BottomNavigationAction label={`Bound Witnesses - ${boundWitnessCount}`} icon={<VscSymbolMethod />} />
|
|
39
|
-
<BottomNavigationAction label={`Signatures - ${signers}`} icon={<FaSignature />} />
|
|
40
|
-
</StyledBottomNavigation>
|
|
41
|
-
)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
BoundWitnessBottomNavigation.displayName = 'BoundWitnessBottomNavigation'
|
|
45
|
-
export { BoundWitnessBottomNavigation }
|
|
46
|
-
|
|
47
|
-
const StyledBottomNavigation = styled(BottomNavigation, { name: 'StyledBottomNavigation' })(() => ({ background: 'inherit' }))
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryFn } from '@storybook/react'
|
|
2
|
-
import { FlexCol } from '@xylabs/react-flexbox'
|
|
3
|
-
import React, { useState } from 'react'
|
|
4
|
-
|
|
5
|
-
import { BWNavigationTabs } from './NavigationTabs.tsx'
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
component: BWNavigationTabs,
|
|
9
|
-
parameters: { actions: { argTypesRegex: '(?!^onChange)^on[A-Z].*' } },
|
|
10
|
-
title: 'plugin/boundwitness/BWNavigationTabs',
|
|
11
|
-
} as Meta
|
|
12
|
-
|
|
13
|
-
const Template: StoryFn<typeof BWNavigationTabs> = (props) => {
|
|
14
|
-
const [value, setValue] = useState(0)
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<FlexCol alignItems="start">
|
|
18
|
-
<BWNavigationTabs value={value} setValue={setValue} {...props} />
|
|
19
|
-
</FlexCol>
|
|
20
|
-
)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const Default = Template.bind({})
|
|
24
|
-
Default.args = {}
|
|
25
|
-
|
|
26
|
-
export { Default }
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import type { TabProps, TabsProps } from '@mui/material'
|
|
2
|
-
import {
|
|
3
|
-
Paper, Tab, Tabs,
|
|
4
|
-
useTheme,
|
|
5
|
-
} from '@mui/material'
|
|
6
|
-
import type { BoundWitness } from '@xyo-network/boundwitness-model'
|
|
7
|
-
import { BoundWitnessSchema } from '@xyo-network/boundwitness-model'
|
|
8
|
-
import type {
|
|
9
|
-
Dispatch, SetStateAction, SyntheticEvent,
|
|
10
|
-
} from 'react'
|
|
11
|
-
import React from 'react'
|
|
12
|
-
import { FaSignature } from 'react-icons/fa'
|
|
13
|
-
import { VscSymbolMethod, VscSymbolNamespace } from 'react-icons/vsc'
|
|
14
|
-
|
|
15
|
-
export interface BWNavigationTabs extends TabsProps {
|
|
16
|
-
boundWitness?: BoundWitness
|
|
17
|
-
setValue?: Dispatch<SetStateAction<number>>
|
|
18
|
-
value?: number
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const BWNavigationTabs: React.FC<BWNavigationTabs> = ({
|
|
22
|
-
setValue, value, boundWitness, ...props
|
|
23
|
-
}) => {
|
|
24
|
-
const payloadCount = boundWitness?.payload_schemas.filter(schema => schema !== BoundWitnessSchema).length ?? 0
|
|
25
|
-
const boundWitnessCount = boundWitness?.payload_schemas.filter(schema => schema === BoundWitnessSchema).length ?? 0
|
|
26
|
-
const signers = boundWitness?.addresses.length ?? 0
|
|
27
|
-
const theme = useTheme()
|
|
28
|
-
|
|
29
|
-
const handleChange = (_event: SyntheticEvent, newValue: number) => {
|
|
30
|
-
setValue?.(newValue)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const tabProps: TabProps = {
|
|
34
|
-
iconPosition: 'start',
|
|
35
|
-
sx: {
|
|
36
|
-
boxShadow: 'none', fontSize: theme.spacing(1.75), justifyContent: 'start', lineHeight: 3, minHeight: 0, overflow: 'hidden',
|
|
37
|
-
},
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<Tabs orientation="vertical" value={value} onChange={handleChange} aria-label="BW Vertical tabs" {...props}>
|
|
42
|
-
<Tab component={Paper} elevation={value === 0 ? 3 : 0} {...tabProps} label={`Payloads - ${payloadCount}`} icon={<VscSymbolNamespace />} />
|
|
43
|
-
<Tab
|
|
44
|
-
component={Paper}
|
|
45
|
-
elevation={value === 1 ? 3 : 0}
|
|
46
|
-
{...tabProps}
|
|
47
|
-
label={`Bound Witnesses - ${boundWitnessCount}`}
|
|
48
|
-
icon={<VscSymbolMethod />}
|
|
49
|
-
/>
|
|
50
|
-
<Tab component={Paper} elevation={value === 2 ? 3 : 0} {...tabProps} label={`Signatures - ${signers}`} icon={<FaSignature />} />
|
|
51
|
-
</Tabs>
|
|
52
|
-
)
|
|
53
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './DetailsCard.tsx'
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryFn } from '@storybook/react'
|
|
2
|
-
import type { Hash } from '@xylabs/hex'
|
|
3
|
-
import type { Payload } from '@xyo-network/payload-model'
|
|
4
|
-
import { useEvent } from '@xyo-network/react-event'
|
|
5
|
-
import { sampleBlock } from '@xyo-network/react-storybook'
|
|
6
|
-
import React, { useRef } from 'react'
|
|
7
|
-
import {
|
|
8
|
-
BrowserRouter, Route, Routes,
|
|
9
|
-
} from 'react-router-dom'
|
|
10
|
-
|
|
11
|
-
import { BoundWitnessLinksDetails } from './BoundWitnessLinksDetails.tsx'
|
|
12
|
-
import { BoundWitnessDetails } from './Details.tsx'
|
|
13
|
-
|
|
14
|
-
const StorybookEntry = {
|
|
15
|
-
argTypes: {},
|
|
16
|
-
component: BoundWitnessDetails,
|
|
17
|
-
parameters: { docs: { page: null } },
|
|
18
|
-
title: 'plugin/boundwitness/Details',
|
|
19
|
-
} as Meta<typeof BoundWitnessDetails>
|
|
20
|
-
|
|
21
|
-
const Template: StoryFn<typeof BoundWitnessDetails> = (args) => {
|
|
22
|
-
const sharedRef = useRef<HTMLDivElement>(null)
|
|
23
|
-
useEvent<HTMLDivElement>((noun, verb, data) => console.log(`[${noun}|${verb}|${data}]`), sharedRef)
|
|
24
|
-
useEvent<HTMLDivElement>(() => console.log('2nd Listener'), sharedRef)
|
|
25
|
-
useEvent<HTMLDivElement>(() => console.log('3rd Listener'), sharedRef)
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<BrowserRouter>
|
|
29
|
-
<Routes>
|
|
30
|
-
<Route path="temp" element={<h1>Successfully navigated to archivePath</h1>} />
|
|
31
|
-
<Route path="*" element={<BoundWitnessDetails ref={sharedRef} {...args} />} />
|
|
32
|
-
</Routes>
|
|
33
|
-
</BrowserRouter>
|
|
34
|
-
)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const Default = Template.bind({})
|
|
38
|
-
Default.args = {}
|
|
39
|
-
|
|
40
|
-
const WithNoData = Template.bind({})
|
|
41
|
-
WithNoData.args = {
|
|
42
|
-
payload: {
|
|
43
|
-
_signatures: [],
|
|
44
|
-
addresses: [],
|
|
45
|
-
payload_hashes: [],
|
|
46
|
-
payload_schemas: [],
|
|
47
|
-
previous_hashes: [],
|
|
48
|
-
schema: 'network.xyo.boundwitness',
|
|
49
|
-
} as Payload,
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const WithData = Template.bind({})
|
|
53
|
-
WithData.args = { payload: sampleBlock }
|
|
54
|
-
|
|
55
|
-
const WithArchiveLink = Template.bind({})
|
|
56
|
-
WithArchiveLink.args = { payload: sampleBlock }
|
|
57
|
-
|
|
58
|
-
const WithPreviousHash = Template.bind({})
|
|
59
|
-
const payload = { ...sampleBlock, previous_hashes: ['ebeb156c9aa0db6e5bf9fe3bfcab5e7f2765235587667adc34c1e8966f899349'] as Hash[] }
|
|
60
|
-
WithPreviousHash.args = {
|
|
61
|
-
children: (
|
|
62
|
-
<>
|
|
63
|
-
<h2>For Testing events only</h2>
|
|
64
|
-
<BoundWitnessLinksDetails value={payload} />
|
|
65
|
-
</>
|
|
66
|
-
),
|
|
67
|
-
payload,
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const WithArchiveLinkPaper = Template.bind({})
|
|
71
|
-
WithArchiveLinkPaper.args = { paper: true, payload: sampleBlock }
|
|
72
|
-
|
|
73
|
-
export {
|
|
74
|
-
Default, WithArchiveLink, WithArchiveLinkPaper, WithData, WithNoData, WithPreviousHash,
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export default StorybookEntry
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { FlexBoxProps } from '@xylabs/react-flexbox'
|
|
2
|
-
import { FlexCol } from '@xylabs/react-flexbox'
|
|
3
|
-
import type { BoundWitness } from '@xyo-network/boundwitness-model'
|
|
4
|
-
import type { Payload } from '@xyo-network/payload-model'
|
|
5
|
-
import { PayloadDataDetails, PayloadJsonDetails } from '@xyo-network/react-payload-details'
|
|
6
|
-
import React from 'react'
|
|
7
|
-
|
|
8
|
-
import { BoundWitnessPayloads, BoundWitnessSignatureDetails } from '../_shared/index.ts'
|
|
9
|
-
import { BoundWitnessValidationDetails } from './ValidationDetails.tsx'
|
|
10
|
-
|
|
11
|
-
export interface BoundWitnessDetailsProps extends FlexBoxProps {
|
|
12
|
-
payload?: Payload
|
|
13
|
-
/** @field Fetched Payloads for the Bound Witness */
|
|
14
|
-
payloads?: Payload[]
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const BoundWitnessDetails = ({
|
|
18
|
-
ref, paper, payload, children, ...props
|
|
19
|
-
}: BoundWitnessDetailsProps & { ref?: React.Ref<unknown | null> }) => {
|
|
20
|
-
const boundwitness = payload as BoundWitness | undefined
|
|
21
|
-
return (
|
|
22
|
-
<FlexCol justifyContent="flex-start" alignItems="stretch" gap={1} ref={ref} {...props}>
|
|
23
|
-
<PayloadDataDetails paper={paper} payload={boundwitness} size="large" badge />
|
|
24
|
-
<BoundWitnessPayloads paper={paper} payload={boundwitness} />
|
|
25
|
-
<BoundWitnessSignatureDetails paper={paper} block={boundwitness} />
|
|
26
|
-
<BoundWitnessValidationDetails paper={paper} value={boundwitness} />
|
|
27
|
-
<PayloadJsonDetails paper={paper} payload={boundwitness} />
|
|
28
|
-
{children}
|
|
29
|
-
</FlexCol>
|
|
30
|
-
)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
BoundWitnessDetails.displayName = 'BoundWitnessDetails [XYO]'
|
|
34
|
-
|
|
35
|
-
export { BoundWitnessDetails }
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { Typography } from '@mui/material'
|
|
2
|
-
import { FlexCol } from '@xylabs/react-flexbox'
|
|
3
|
-
import { usePromise } from '@xylabs/react-promise'
|
|
4
|
-
import type { BoundWitness } from '@xyo-network/boundwitness-model'
|
|
5
|
-
import { BoundWitnessValidator } from '@xyo-network/boundwitness-validator'
|
|
6
|
-
import type { PropertyGroupProps } from '@xyo-network/react-property'
|
|
7
|
-
import { Property, PropertyGroup } from '@xyo-network/react-property'
|
|
8
|
-
import React from 'react'
|
|
9
|
-
|
|
10
|
-
export type BoundWitnessValidationDetailsProps = PropertyGroupProps & {
|
|
11
|
-
value?: BoundWitness
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const BoundWitnessValidationDetails: React.FC<BoundWitnessValidationDetailsProps> = ({ value, ...props }) => {
|
|
15
|
-
const [errors = []] = usePromise(async () => await (value ? new BoundWitnessValidator(value).validate() : undefined), [value])
|
|
16
|
-
|
|
17
|
-
let elevation = 2
|
|
18
|
-
if (props.paper) {
|
|
19
|
-
elevation += props.elevation ?? 0
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<PropertyGroup titleProps={{ elevation }} title="Validation" tip="The results from validating the block" {...props}>
|
|
24
|
-
<Property
|
|
25
|
-
titleProps={{ elevation }}
|
|
26
|
-
flexGrow={1}
|
|
27
|
-
title="Valid"
|
|
28
|
-
value={errors.length === 0 ? 'True' : 'False'}
|
|
29
|
-
tip={
|
|
30
|
-
errors.length > 0
|
|
31
|
-
? (
|
|
32
|
-
<FlexCol flexWrap="wrap">
|
|
33
|
-
{errors.map((error) => {
|
|
34
|
-
return <Typography key={error.name}>{error.toString()}</Typography>
|
|
35
|
-
})}
|
|
36
|
-
</FlexCol>
|
|
37
|
-
)
|
|
38
|
-
: <Typography>No Errors</Typography>
|
|
39
|
-
}
|
|
40
|
-
/>
|
|
41
|
-
</PropertyGroup>
|
|
42
|
-
)
|
|
43
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { DataObject as DataObjectIcon } from '@mui/icons-material'
|
|
2
|
-
import { ellipsize } from '@xylabs/eth-address'
|
|
3
|
-
import type { FlexBoxProps } from '@xylabs/react-flexbox'
|
|
4
|
-
import { FlexRow } from '@xylabs/react-flexbox'
|
|
5
|
-
import { QuickTipButton } from '@xylabs/react-quick-tip-button'
|
|
6
|
-
import type { BoundWitness } from '@xyo-network/boundwitness-model'
|
|
7
|
-
import { usePayloadHash } from '@xyo-network/react-shared'
|
|
8
|
-
import type { ReactNode } from 'react'
|
|
9
|
-
import React from 'react'
|
|
10
|
-
|
|
11
|
-
import { BWPreviousHashQuickTipButton } from './previous-hash/index.ts'
|
|
12
|
-
import { BWVerification } from './Verification.tsx'
|
|
13
|
-
|
|
14
|
-
export interface BWActionsProps extends FlexBoxProps {
|
|
15
|
-
additionalActions?: ReactNode
|
|
16
|
-
boundwitness?: BoundWitness
|
|
17
|
-
hideJSONButton?: boolean
|
|
18
|
-
hidePreviousHash?: boolean
|
|
19
|
-
hideValidation?: boolean
|
|
20
|
-
priorActions?: ReactNode
|
|
21
|
-
validationIconColors?: boolean
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export const BWActions: React.FC<BWActionsProps> = ({
|
|
25
|
-
additionalActions,
|
|
26
|
-
boundwitness,
|
|
27
|
-
hideJSONButton,
|
|
28
|
-
hideValidation,
|
|
29
|
-
hidePreviousHash,
|
|
30
|
-
priorActions,
|
|
31
|
-
validationIconColors,
|
|
32
|
-
...props
|
|
33
|
-
}) => {
|
|
34
|
-
const hash = usePayloadHash(boundwitness)
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<FlexRow {...props}>
|
|
38
|
-
{priorActions}
|
|
39
|
-
{hidePreviousHash || boundwitness?.previous_hashes.length === 0 ? null : <BWPreviousHashQuickTipButton boundwitness={boundwitness} />}
|
|
40
|
-
{hideValidation ? null : <BWVerification iconColors={validationIconColors} boundwitness={boundwitness} />}
|
|
41
|
-
{hideJSONButton
|
|
42
|
-
? null
|
|
43
|
-
: (
|
|
44
|
-
<QuickTipButton
|
|
45
|
-
Icon={DataObjectIcon}
|
|
46
|
-
title={`JSON for ${ellipsize(hash ?? '', 8)}`}
|
|
47
|
-
dialogProps={{ fullWidth: true, maxWidth: 'md' }}
|
|
48
|
-
>
|
|
49
|
-
<pre style={{ wordBreak: 'break-all' }}>{boundwitness ? JSON.stringify(boundwitness, null, 2) : null}</pre>
|
|
50
|
-
</QuickTipButton>
|
|
51
|
-
)}
|
|
52
|
-
{additionalActions}
|
|
53
|
-
</FlexRow>
|
|
54
|
-
)
|
|
55
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { CancelRounded as CancelRoundedIcon, CheckCircleOutlineRounded as CheckCircleOutlineRoundedIcon } from '@mui/icons-material'
|
|
2
|
-
import type { SvgIconProps } from '@mui/material'
|
|
3
|
-
import { Typography } from '@mui/material'
|
|
4
|
-
import { FlexCol } from '@xylabs/react-flexbox'
|
|
5
|
-
import { usePromise } from '@xylabs/react-promise'
|
|
6
|
-
import type { QuickTipButtonProps } from '@xylabs/react-quick-tip-button'
|
|
7
|
-
import { QuickTipButton } from '@xylabs/react-quick-tip-button'
|
|
8
|
-
import type { BoundWitness } from '@xyo-network/boundwitness-model'
|
|
9
|
-
import { BoundWitnessValidator } from '@xyo-network/boundwitness-validator'
|
|
10
|
-
import React from 'react'
|
|
11
|
-
|
|
12
|
-
const InvalidIcon = ({ ref, ...props }: SvgIconProps &
|
|
13
|
-
{ ref?: React.Ref<SVGSVGElement | null> }) => <CancelRoundedIcon color="error" ref={ref} {...props} />
|
|
14
|
-
InvalidIcon.displayName = 'InvalidIcon'
|
|
15
|
-
|
|
16
|
-
export interface BWVerification extends QuickTipButtonProps {
|
|
17
|
-
boundwitness?: BoundWitness
|
|
18
|
-
iconColors?: boolean
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const BWVerification: React.FC<BWVerification> = ({ boundwitness, iconColors }) => {
|
|
22
|
-
const [errors = []] = usePromise(async () => await (boundwitness ? new BoundWitnessValidator(boundwitness) : undefined)?.validate(), [boundwitness])
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<QuickTipButton
|
|
26
|
-
Icon={errors.length > 0
|
|
27
|
-
? ({ ref, ...props }) => {
|
|
28
|
-
return <InvalidIcon color={iconColors ? 'error' : undefined} ref={ref} {...props} />
|
|
29
|
-
}
|
|
30
|
-
: ({ ref, ...props }) => {
|
|
31
|
-
return <CheckCircleOutlineRoundedIcon color={iconColors ? 'success' : undefined} ref={ref} {...props} />
|
|
32
|
-
}}
|
|
33
|
-
hoverText={errors.length > 0 ? 'Invalid Bound Witness' : 'Valid'}
|
|
34
|
-
>
|
|
35
|
-
{errors.length > 0
|
|
36
|
-
? (
|
|
37
|
-
<FlexCol flexWrap="wrap" alignItems="start">
|
|
38
|
-
{errors.map((error) => {
|
|
39
|
-
return <Typography key={error.name}>{error.toString()}</Typography>
|
|
40
|
-
})}
|
|
41
|
-
</FlexCol>
|
|
42
|
-
)
|
|
43
|
-
: <Typography>No Errors</Typography>}
|
|
44
|
-
</QuickTipButton>
|
|
45
|
-
)
|
|
46
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { DialogProps } from '@mui/material'
|
|
2
|
-
import {
|
|
3
|
-
Button, Dialog, DialogActions, DialogContent, DialogTitle,
|
|
4
|
-
} from '@mui/material'
|
|
5
|
-
import React from 'react'
|
|
6
|
-
|
|
7
|
-
export interface MenuItemDialogProps extends DialogProps {
|
|
8
|
-
dialogTitle?: string
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const MenuItemDialog: React.FC<MenuItemDialogProps> = ({
|
|
12
|
-
children, dialogTitle, open, onClose, ...props
|
|
13
|
-
}) => {
|
|
14
|
-
return (
|
|
15
|
-
<Dialog open={open} onClose={onClose} sx={{ '& .MuiPaper-root': { minWidth: '75%' } }} {...props}>
|
|
16
|
-
<DialogTitle>{dialogTitle}</DialogTitle>
|
|
17
|
-
<DialogContent>
|
|
18
|
-
{children}
|
|
19
|
-
</DialogContent>
|
|
20
|
-
<DialogActions sx={{
|
|
21
|
-
display: 'flex', flexDirection: 'row', justifyContent: 'end',
|
|
22
|
-
}}
|
|
23
|
-
>
|
|
24
|
-
<Button variant="contained" onClick={e => onClose?.(e, 'escapeKeyDown')}>Close</Button>
|
|
25
|
-
</DialogActions>
|
|
26
|
-
</Dialog>
|
|
27
|
-
)
|
|
28
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { Code } from '@mui/icons-material'
|
|
2
|
-
import { ListItemIcon, MenuItem } from '@mui/material'
|
|
3
|
-
import { ellipsize } from '@xylabs/eth-address'
|
|
4
|
-
import { JsonViewerEx } from '@xyo-network/react-payload-raw-info'
|
|
5
|
-
import { usePayloadHash } from '@xyo-network/react-shared'
|
|
6
|
-
import type { MouseEventHandler } from 'react'
|
|
7
|
-
import React, { useState } from 'react'
|
|
8
|
-
|
|
9
|
-
import type { ActionMenuItemProps } from '../_shared/index.ts'
|
|
10
|
-
import { MenuItemDialog } from '../_shared/index.ts'
|
|
11
|
-
|
|
12
|
-
export interface BWJsonMenuItemProps extends ActionMenuItemProps {}
|
|
13
|
-
|
|
14
|
-
export const BWJsonMenuItem: React.FC<BWJsonMenuItemProps> = ({
|
|
15
|
-
boundwitness, onClick, onDialogClose, ...props
|
|
16
|
-
}) => {
|
|
17
|
-
const hash = usePayloadHash(boundwitness)
|
|
18
|
-
|
|
19
|
-
const [open, setOpen] = useState(false)
|
|
20
|
-
const onClose = () => {
|
|
21
|
-
onDialogClose?.()
|
|
22
|
-
setOpen(false)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const handleMenuClick: MouseEventHandler<HTMLLIElement> = (e) => {
|
|
26
|
-
onClick?.(e)
|
|
27
|
-
setOpen(true)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const title = hash ? `JSON for ${ellipsize(hash, 5)}` : 'JSON'
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<>
|
|
34
|
-
<MenuItem onClick={handleMenuClick} {...props}>
|
|
35
|
-
<ListItemIcon><Code /></ListItemIcon>
|
|
36
|
-
JSON
|
|
37
|
-
</MenuItem>
|
|
38
|
-
<MenuItemDialog open={open} onClose={onClose} dialogTitle={title}>
|
|
39
|
-
<JsonViewerEx value={boundwitness} />
|
|
40
|
-
</MenuItemDialog>
|
|
41
|
-
</>
|
|
42
|
-
)
|
|
43
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './MenuItem.tsx'
|