@xyo-network/react-chain-boundwitness 1.0.1
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/LICENSE +165 -0
- package/README.md +13 -0
- package/dist/browser/index.mjs +1246 -0
- package/dist/browser/index.mjs.map +1 -0
- package/dist/types/Plugin.d.ts +3 -0
- package/dist/types/Plugin.d.ts.map +1 -0
- package/dist/types/components/Card/Card.d.ts +9 -0
- package/dist/types/components/Card/Card.d.ts.map +1 -0
- package/dist/types/components/Card/CardContent/AddressAvatarGroup.d.ts +8 -0
- package/dist/types/components/Card/CardContent/AddressAvatarGroup.d.ts.map +1 -0
- package/dist/types/components/Card/CardContent/CardContent.d.ts +9 -0
- package/dist/types/components/Card/CardContent/CardContent.d.ts.map +1 -0
- package/dist/types/components/Card/CardContent/SchemaAvatarGroup.d.ts +9 -0
- package/dist/types/components/Card/CardContent/SchemaAvatarGroup.d.ts.map +1 -0
- package/dist/types/components/Card/CardContent/index.d.ts +3 -0
- package/dist/types/components/Card/CardContent/index.d.ts.map +1 -0
- package/dist/types/components/Card/CardContent/layout/CardColumnTitle.d.ts +5 -0
- package/dist/types/components/Card/CardContent/layout/CardColumnTitle.d.ts.map +1 -0
- package/dist/types/components/Card/CardContent/layout/CardColumnsFlex.d.ts +2 -0
- package/dist/types/components/Card/CardContent/layout/CardColumnsFlex.d.ts.map +1 -0
- package/dist/types/components/Card/CardContent/layout/CardContentFlex.d.ts +5 -0
- package/dist/types/components/Card/CardContent/layout/CardContentFlex.d.ts.map +1 -0
- package/dist/types/components/Card/CardContent/layout/index.d.ts +4 -0
- package/dist/types/components/Card/CardContent/layout/index.d.ts.map +1 -0
- package/dist/types/components/Card/CardHeader/CardHeader.d.ts +14 -0
- package/dist/types/components/Card/CardHeader/CardHeader.d.ts.map +1 -0
- package/dist/types/components/Card/CardHeader/index.d.ts +2 -0
- package/dist/types/components/Card/CardHeader/index.d.ts.map +1 -0
- package/dist/types/components/Card/index.d.ts +4 -0
- package/dist/types/components/Card/index.d.ts.map +1 -0
- package/dist/types/components/Details/BoundWitnessLinksDetails.d.ts +8 -0
- package/dist/types/components/Details/BoundWitnessLinksDetails.d.ts.map +1 -0
- package/dist/types/components/Details/Box/DetailsBox.d.ts +6 -0
- package/dist/types/components/Details/Box/DetailsBox.d.ts.map +1 -0
- package/dist/types/components/Details/Box/index.d.ts +2 -0
- package/dist/types/components/Details/Box/index.d.ts.map +1 -0
- package/dist/types/components/Details/Card/DetailsCard.d.ts +7 -0
- package/dist/types/components/Details/Card/DetailsCard.d.ts.map +1 -0
- package/dist/types/components/Details/Card/DetailsCardContent.d.ts +10 -0
- package/dist/types/components/Details/Card/DetailsCardContent.d.ts.map +1 -0
- package/dist/types/components/Details/Card/DetailsCardInner.d.ts +7 -0
- package/dist/types/components/Details/Card/DetailsCardInner.d.ts.map +1 -0
- package/dist/types/components/Details/Card/Navigation/BottomNavigation.d.ts +11 -0
- package/dist/types/components/Details/Card/Navigation/BottomNavigation.d.ts.map +1 -0
- package/dist/types/components/Details/Card/Navigation/NavigationTabs.d.ts +10 -0
- package/dist/types/components/Details/Card/Navigation/NavigationTabs.d.ts.map +1 -0
- package/dist/types/components/Details/Card/Navigation/index.d.ts +3 -0
- package/dist/types/components/Details/Card/Navigation/index.d.ts.map +1 -0
- package/dist/types/components/Details/Card/index.d.ts +2 -0
- package/dist/types/components/Details/Card/index.d.ts.map +1 -0
- package/dist/types/components/Details/Details.d.ts +11 -0
- package/dist/types/components/Details/Details.d.ts.map +1 -0
- package/dist/types/components/Details/ValidationDetails.d.ts +8 -0
- package/dist/types/components/Details/ValidationDetails.d.ts.map +1 -0
- package/dist/types/components/Details/index.d.ts +5 -0
- package/dist/types/components/Details/index.d.ts.map +1 -0
- package/dist/types/components/_shared/Actions/BWActions.d.ts +14 -0
- package/dist/types/components/_shared/Actions/BWActions.d.ts.map +1 -0
- package/dist/types/components/_shared/Actions/Verification.d.ts +9 -0
- package/dist/types/components/_shared/Actions/Verification.d.ts.map +1 -0
- package/dist/types/components/_shared/Actions/_shared/ActionMenuItemProps.d.ts +7 -0
- package/dist/types/components/_shared/Actions/_shared/ActionMenuItemProps.d.ts.map +1 -0
- package/dist/types/components/_shared/Actions/_shared/MenuItemDialog.d.ts +7 -0
- package/dist/types/components/_shared/Actions/_shared/MenuItemDialog.d.ts.map +1 -0
- package/dist/types/components/_shared/Actions/_shared/index.d.ts +3 -0
- package/dist/types/components/_shared/Actions/_shared/index.d.ts.map +1 -0
- package/dist/types/components/_shared/Actions/index.d.ts +5 -0
- package/dist/types/components/_shared/Actions/index.d.ts.map +1 -0
- package/dist/types/components/_shared/Actions/json/MenuItem.d.ts +6 -0
- package/dist/types/components/_shared/Actions/json/MenuItem.d.ts.map +1 -0
- package/dist/types/components/_shared/Actions/json/index.d.ts +2 -0
- package/dist/types/components/_shared/Actions/json/index.d.ts.map +1 -0
- package/dist/types/components/_shared/Actions/previous-hash/DialogContent.d.ts +8 -0
- package/dist/types/components/_shared/Actions/previous-hash/DialogContent.d.ts.map +1 -0
- package/dist/types/components/_shared/Actions/previous-hash/MenuItem.d.ts +6 -0
- package/dist/types/components/_shared/Actions/previous-hash/MenuItem.d.ts.map +1 -0
- package/dist/types/components/_shared/Actions/previous-hash/QuickTipButton.d.ts +8 -0
- package/dist/types/components/_shared/Actions/previous-hash/QuickTipButton.d.ts.map +1 -0
- package/dist/types/components/_shared/Actions/previous-hash/index.d.ts +4 -0
- package/dist/types/components/_shared/Actions/previous-hash/index.d.ts.map +1 -0
- package/dist/types/components/_shared/Heading/HashHeadingPaper/Adornment/BackPaperAdornment.d.ts +6 -0
- package/dist/types/components/_shared/Heading/HashHeadingPaper/Adornment/BackPaperAdornment.d.ts.map +1 -0
- package/dist/types/components/_shared/Heading/HashHeadingPaper/Adornment/PaperAdornment.d.ts +6 -0
- package/dist/types/components/_shared/Heading/HashHeadingPaper/Adornment/PaperAdornment.d.ts.map +1 -0
- package/dist/types/components/_shared/Heading/HashHeadingPaper/Adornment/PaperAdornmentIconButton.d.ts +6 -0
- package/dist/types/components/_shared/Heading/HashHeadingPaper/Adornment/PaperAdornmentIconButton.d.ts.map +1 -0
- package/dist/types/components/_shared/Heading/HashHeadingPaper/Adornment/index.d.ts +4 -0
- package/dist/types/components/_shared/Heading/HashHeadingPaper/Adornment/index.d.ts.map +1 -0
- package/dist/types/components/_shared/Heading/HashHeadingPaper/HashHeadingPaper.d.ts +10 -0
- package/dist/types/components/_shared/Heading/HashHeadingPaper/HashHeadingPaper.d.ts.map +1 -0
- package/dist/types/components/_shared/Heading/HashHeadingPaper/index.d.ts +2 -0
- package/dist/types/components/_shared/Heading/HashHeadingPaper/index.d.ts.map +1 -0
- package/dist/types/components/_shared/Heading/Heading.d.ts +4 -0
- package/dist/types/components/_shared/Heading/Heading.d.ts.map +1 -0
- package/dist/types/components/_shared/Heading/HeadingPaper/HeadingPaper.d.ts +9 -0
- package/dist/types/components/_shared/Heading/HeadingPaper/HeadingPaper.d.ts.map +1 -0
- package/dist/types/components/_shared/Heading/HeadingPaper/index.d.ts +2 -0
- package/dist/types/components/_shared/Heading/HeadingPaper/index.d.ts.map +1 -0
- package/dist/types/components/_shared/Heading/HeadingProps.d.ts +14 -0
- package/dist/types/components/_shared/Heading/HeadingProps.d.ts.map +1 -0
- package/dist/types/components/_shared/Heading/index.d.ts +5 -0
- package/dist/types/components/_shared/Heading/index.d.ts.map +1 -0
- package/dist/types/components/_shared/Payloads/PayloadsPropertyGroup.d.ts +10 -0
- package/dist/types/components/_shared/Payloads/PayloadsPropertyGroup.d.ts.map +1 -0
- package/dist/types/components/_shared/Payloads/PayloadsTable.d.ts +10 -0
- package/dist/types/components/_shared/Payloads/PayloadsTable.d.ts.map +1 -0
- package/dist/types/components/_shared/Payloads/index.d.ts +3 -0
- package/dist/types/components/_shared/Payloads/index.d.ts.map +1 -0
- package/dist/types/components/_shared/Payloads/payloads-table/TableBody.d.ts +11 -0
- package/dist/types/components/_shared/Payloads/payloads-table/TableBody.d.ts.map +1 -0
- package/dist/types/components/_shared/Payloads/payloads-table/TableBodyFiltered.d.ts +8 -0
- package/dist/types/components/_shared/Payloads/payloads-table/TableBodyFiltered.d.ts.map +1 -0
- package/dist/types/components/_shared/Payloads/payloads-table/TableHead.d.ts +4 -0
- package/dist/types/components/_shared/Payloads/payloads-table/TableHead.d.ts.map +1 -0
- package/dist/types/components/_shared/Payloads/payloads-table/index.d.ts +4 -0
- package/dist/types/components/_shared/Payloads/payloads-table/index.d.ts.map +1 -0
- package/dist/types/components/_shared/Signatures/SignatureDetails.d.ts +8 -0
- package/dist/types/components/_shared/Signatures/SignatureDetails.d.ts.map +1 -0
- package/dist/types/components/_shared/Signatures/SignatureTable.d.ts +8 -0
- package/dist/types/components/_shared/Signatures/SignatureTable.d.ts.map +1 -0
- package/dist/types/components/_shared/Signatures/SignatureTableRow.d.ts +14 -0
- package/dist/types/components/_shared/Signatures/SignatureTableRow.d.ts.map +1 -0
- package/dist/types/components/_shared/Signatures/index.d.ts +3 -0
- package/dist/types/components/_shared/Signatures/index.d.ts.map +1 -0
- package/dist/types/components/_shared/index.d.ts +5 -0
- package/dist/types/components/_shared/index.d.ts.map +1 -0
- package/dist/types/components/index.d.ts +4 -0
- package/dist/types/components/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -0
- package/package.json +92 -0
- package/src/Plugin.ts +20 -0
- package/src/components/Card/Card.stories.tsx +22 -0
- package/src/components/Card/Card.tsx +24 -0
- package/src/components/Card/CardContent/AddressAvatarGroup.tsx +28 -0
- package/src/components/Card/CardContent/CardContent.tsx +36 -0
- package/src/components/Card/CardContent/SchemaAvatarGroup.tsx +45 -0
- package/src/components/Card/CardContent/index.ts +2 -0
- package/src/components/Card/CardContent/layout/CardColumnTitle.tsx +11 -0
- package/src/components/Card/CardContent/layout/CardColumnsFlex.tsx +8 -0
- package/src/components/Card/CardContent/layout/CardContentFlex.tsx +19 -0
- package/src/components/Card/CardContent/layout/index.ts +3 -0
- package/src/components/Card/CardHeader/CardHeader.tsx +97 -0
- package/src/components/Card/CardHeader/index.ts +1 -0
- package/src/components/Card/index.ts +3 -0
- package/src/components/Details/BoundWitnessLinksDetails.tsx +39 -0
- package/src/components/Details/Box/DetailsBox.stories.tsx +65 -0
- package/src/components/Details/Box/DetailsBox.tsx +70 -0
- package/src/components/Details/Box/index.ts +1 -0
- package/src/components/Details/Card/DetailsCard.stories.tsx +37 -0
- package/src/components/Details/Card/DetailsCard.tsx +18 -0
- package/src/components/Details/Card/DetailsCardContent.tsx +63 -0
- package/src/components/Details/Card/DetailsCardInner.tsx +55 -0
- package/src/components/Details/Card/Navigation/BottomNavigation.stories.tsx +24 -0
- package/src/components/Details/Card/Navigation/BottomNavigation.tsx +50 -0
- package/src/components/Details/Card/Navigation/NavigationTabs.stories.tsx +26 -0
- package/src/components/Details/Card/Navigation/NavigationTabs.tsx +52 -0
- package/src/components/Details/Card/Navigation/index.ts +2 -0
- package/src/components/Details/Card/index.ts +1 -0
- package/src/components/Details/Details.stories.tsx +77 -0
- package/src/components/Details/Details.tsx +34 -0
- package/src/components/Details/ValidationDetails.tsx +44 -0
- package/src/components/Details/index.ts +4 -0
- package/src/components/_shared/Actions/BWActions.tsx +53 -0
- package/src/components/_shared/Actions/Verification.tsx +43 -0
- package/src/components/_shared/Actions/_shared/ActionMenuItemProps.ts +7 -0
- package/src/components/_shared/Actions/_shared/MenuItemDialog.tsx +27 -0
- package/src/components/_shared/Actions/_shared/index.ts +2 -0
- package/src/components/_shared/Actions/index.ts +4 -0
- package/src/components/_shared/Actions/json/MenuItem.tsx +41 -0
- package/src/components/_shared/Actions/json/index.ts +1 -0
- package/src/components/_shared/Actions/previous-hash/DialogContent.tsx +43 -0
- package/src/components/_shared/Actions/previous-hash/MenuItem.tsx +35 -0
- package/src/components/_shared/Actions/previous-hash/QuickTipButton.tsx +31 -0
- package/src/components/_shared/Actions/previous-hash/index.ts +3 -0
- package/src/components/_shared/Heading/HashHeadingPaper/Adornment/BackPaperAdornment.tsx +13 -0
- package/src/components/_shared/Heading/HashHeadingPaper/Adornment/PaperAdornment.tsx +14 -0
- package/src/components/_shared/Heading/HashHeadingPaper/Adornment/PaperAdornmentIconButton.tsx +14 -0
- package/src/components/_shared/Heading/HashHeadingPaper/Adornment/index.ts +3 -0
- package/src/components/_shared/Heading/HashHeadingPaper/HashHeadingPaper.stories.tsx +33 -0
- package/src/components/_shared/Heading/HashHeadingPaper/HashHeadingPaper.tsx +43 -0
- package/src/components/_shared/Heading/HashHeadingPaper/index.ts +1 -0
- package/src/components/_shared/Heading/Heading.tsx +49 -0
- package/src/components/_shared/Heading/HeadingPaper/HeadingPaper.tsx +52 -0
- package/src/components/_shared/Heading/HeadingPaper/index.ts +1 -0
- package/src/components/_shared/Heading/HeadingProps.tsx +15 -0
- package/src/components/_shared/Heading/index.ts +4 -0
- package/src/components/_shared/Payloads/PayloadsPropertyGroup.tsx +25 -0
- package/src/components/_shared/Payloads/PayloadsTable.tsx +51 -0
- package/src/components/_shared/Payloads/index.ts +2 -0
- package/src/components/_shared/Payloads/payloads-table/TableBody.tsx +67 -0
- package/src/components/_shared/Payloads/payloads-table/TableBodyFiltered.tsx +51 -0
- package/src/components/_shared/Payloads/payloads-table/TableHead.tsx +27 -0
- package/src/components/_shared/Payloads/payloads-table/index.ts +3 -0
- package/src/components/_shared/Signatures/SignatureDetails.tsx +21 -0
- package/src/components/_shared/Signatures/SignatureTable.stories.tsx +29 -0
- package/src/components/_shared/Signatures/SignatureTable.tsx +93 -0
- package/src/components/_shared/Signatures/SignatureTableRow.tsx +88 -0
- package/src/components/_shared/Signatures/index.ts +2 -0
- package/src/components/_shared/index.ts +4 -0
- package/src/components/index.ts +3 -0
- package/src/index.ts +2 -0
- package/typedoc.json +5 -0
- package/xy.config.ts +10 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ContentCopy } from '@mui/icons-material'
|
|
2
|
+
import {
|
|
3
|
+
Alert, AlertTitle, Collapse,
|
|
4
|
+
DialogContent, DialogContentProps,
|
|
5
|
+
} from '@mui/material'
|
|
6
|
+
import { FlexGrowRow, FlexRow } from '@xylabs/react-flexbox'
|
|
7
|
+
import { BoundWitness } from '@xyo-network/boundwitness-model'
|
|
8
|
+
import { EllipsizeBox } from '@xyo-network/react-shared'
|
|
9
|
+
import React, { useState } from 'react'
|
|
10
|
+
|
|
11
|
+
export interface PreviousHashDialogProps extends DialogContentProps {
|
|
12
|
+
boundwitness?: BoundWitness
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const PreviousHashDialogContent: React.FC<PreviousHashDialogProps> = ({ boundwitness, ...props }) => {
|
|
16
|
+
const [copied, setCopied] = useState(false)
|
|
17
|
+
|
|
18
|
+
const onCopy = async () => {
|
|
19
|
+
await navigator.clipboard.writeText(boundwitness?.previous_hashes[0] ?? '')
|
|
20
|
+
setCopied(true)
|
|
21
|
+
setTimeout(() => {
|
|
22
|
+
setCopied(false)
|
|
23
|
+
}, 5000)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<DialogContent {...props}>
|
|
28
|
+
<FlexGrowRow columnGap={2}>
|
|
29
|
+
<ContentCopy sx={{ cursor: 'pointer' }} onClick={() => void onCopy()} />
|
|
30
|
+
<EllipsizeBox flexGrow="1" typographyProps={{ variant: 'body1' }}>
|
|
31
|
+
{boundwitness?.previous_hashes.join(',')}
|
|
32
|
+
</EllipsizeBox>
|
|
33
|
+
</FlexGrowRow>
|
|
34
|
+
<FlexRow>
|
|
35
|
+
<Collapse in={copied} unmountOnExit>
|
|
36
|
+
<Alert>
|
|
37
|
+
<AlertTitle>Previous hash copied to clipboard</AlertTitle>
|
|
38
|
+
</Alert>
|
|
39
|
+
</Collapse>
|
|
40
|
+
</FlexRow>
|
|
41
|
+
</DialogContent>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Link } from '@mui/icons-material'
|
|
2
|
+
import { ListItemIcon, MenuItem } from '@mui/material'
|
|
3
|
+
import React, { MouseEventHandler, useState } from 'react'
|
|
4
|
+
|
|
5
|
+
import { ActionMenuItemProps, MenuItemDialog } from '../_shared/index.ts'
|
|
6
|
+
import { PreviousHashDialogContent } from './DialogContent.tsx'
|
|
7
|
+
|
|
8
|
+
export interface BWPreviousHashMenuItemProps extends ActionMenuItemProps {}
|
|
9
|
+
|
|
10
|
+
export const BWPreviousHashMenuItem: React.FC<BWPreviousHashMenuItemProps> = ({
|
|
11
|
+
boundwitness, onClick, onDialogClose, ...props
|
|
12
|
+
}) => {
|
|
13
|
+
const [open, setOpen] = useState(false)
|
|
14
|
+
const onClose = () => {
|
|
15
|
+
onDialogClose?.()
|
|
16
|
+
setOpen(false)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const handleMenuClick: MouseEventHandler<HTMLLIElement> = (e) => {
|
|
20
|
+
onClick?.(e)
|
|
21
|
+
setOpen(true)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<>
|
|
26
|
+
<MenuItem onClick={handleMenuClick} {...props}>
|
|
27
|
+
<ListItemIcon><Link /></ListItemIcon>
|
|
28
|
+
Previous Hash
|
|
29
|
+
</MenuItem>
|
|
30
|
+
<MenuItemDialog open={open} onClose={onClose} dialogTitle="Previous Hash">
|
|
31
|
+
<PreviousHashDialogContent boundwitness={boundwitness} />
|
|
32
|
+
</MenuItemDialog>
|
|
33
|
+
</>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { LinkRounded as LinkRoundedIcon } from '@mui/icons-material'
|
|
2
|
+
import { ellipsize } from '@xylabs/eth-address'
|
|
3
|
+
import { QuickTipButton, QuickTipButtonProps } from '@xylabs/react-quick-tip-button'
|
|
4
|
+
import { BoundWitness } from '@xyo-network/boundwitness-model'
|
|
5
|
+
import React from 'react'
|
|
6
|
+
|
|
7
|
+
import { PreviousHashDialogContent } from './DialogContent.tsx'
|
|
8
|
+
|
|
9
|
+
export interface BWPreviousHashQuickTipButtonProps extends QuickTipButtonProps {
|
|
10
|
+
boundwitness?: BoundWitness
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const BWPreviousHashQuickTipButton: React.FC<BWPreviousHashQuickTipButtonProps> = ({ boundwitness, ...props }) => {
|
|
14
|
+
const previousHash = boundwitness?.previous_hashes[0] ?? null
|
|
15
|
+
const formattedPreviousHash = previousHash === null ? 'No Previous Hash' : `Previous Hash - ${ellipsize(previousHash, 8)}`
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<QuickTipButton
|
|
19
|
+
Icon={LinkRoundedIcon}
|
|
20
|
+
disabled={previousHash === null}
|
|
21
|
+
hoverText={formattedPreviousHash}
|
|
22
|
+
disableDialog={previousHash === null}
|
|
23
|
+
dialogProps={{ fullWidth: true, maxWidth: 'md' }}
|
|
24
|
+
{...props}
|
|
25
|
+
>
|
|
26
|
+
{previousHash === null
|
|
27
|
+
? null
|
|
28
|
+
: <PreviousHashDialogContent boundwitness={boundwitness} />}
|
|
29
|
+
</QuickTipButton>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ArrowBackRounded } from '@mui/icons-material'
|
|
2
|
+
import { IconButtonProps } from '@mui/material'
|
|
3
|
+
import React from 'react'
|
|
4
|
+
|
|
5
|
+
import { PaperAdornmentIconButton } from './PaperAdornmentIconButton.tsx'
|
|
6
|
+
|
|
7
|
+
type BackPaperAdornmentProps = IconButtonProps
|
|
8
|
+
|
|
9
|
+
export const BackPaperAdornment: React.FC<BackPaperAdornmentProps> = props => (
|
|
10
|
+
<PaperAdornmentIconButton {...props}>
|
|
11
|
+
<ArrowBackRounded />
|
|
12
|
+
</PaperAdornmentIconButton>
|
|
13
|
+
)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { styled } from '@mui/material'
|
|
2
|
+
import { FlexBoxProps, FlexCol } from '@xylabs/react-flexbox'
|
|
3
|
+
|
|
4
|
+
export interface PaperAdornmentProps extends FlexBoxProps {
|
|
5
|
+
clickable?: boolean
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const PaperAdornment = styled(FlexCol, {
|
|
9
|
+
name: 'PaperAdornment',
|
|
10
|
+
shouldForwardProp: (prop: string) => !['clickable'].includes(prop),
|
|
11
|
+
})<PaperAdornmentProps>(({ theme, clickable }) => ({
|
|
12
|
+
backgroundColor: theme.palette.secondary.dark,
|
|
13
|
+
cursor: clickable ? 'pointer' : 'auto',
|
|
14
|
+
}))
|
package/src/components/_shared/Heading/HashHeadingPaper/Adornment/PaperAdornmentIconButton.tsx
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IconButton, IconButtonProps, styled,
|
|
3
|
+
} from '@mui/material'
|
|
4
|
+
|
|
5
|
+
export interface PaperAdornmentIconButton extends IconButtonProps {
|
|
6
|
+
themePadding?: number
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const PaperAdornmentIconButton = styled(IconButton, { name: 'PaperAdornmentIconButton' })<PaperAdornmentIconButton>(
|
|
10
|
+
({ theme, themePadding = 1 }) => ({
|
|
11
|
+
borderRadius: 0,
|
|
12
|
+
padding: theme.spacing(themePadding),
|
|
13
|
+
}),
|
|
14
|
+
)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Meta, StoryFn } from '@storybook/react'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
import { BackPaperAdornment } from './Adornment/index.ts'
|
|
5
|
+
import { HashHeadingPaper } from './HashHeadingPaper.tsx'
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
component: HashHeadingPaper,
|
|
9
|
+
title: 'plugin/boundwitness/HashHeadingPaper',
|
|
10
|
+
} as Meta
|
|
11
|
+
|
|
12
|
+
const Template: StoryFn<typeof HashHeadingPaper> = props => <HashHeadingPaper {...props} />
|
|
13
|
+
|
|
14
|
+
const Default = Template.bind({})
|
|
15
|
+
Default.args = {}
|
|
16
|
+
|
|
17
|
+
const WithHash = Template.bind({})
|
|
18
|
+
WithHash.args = { hash: '7982da0e0da76819700079ee21511333d73395805cbeb3e44f25e2d584c8586e' }
|
|
19
|
+
|
|
20
|
+
const WithSizes = Template.bind({})
|
|
21
|
+
WithSizes.args = { hash: '7982da0e0da76819700079ee21511333d73395805cbeb3e44f25e2d584c8586e', size: 'large' }
|
|
22
|
+
|
|
23
|
+
const WithAdornment = Template.bind({})
|
|
24
|
+
WithAdornment.args = {
|
|
25
|
+
AdornmentStart: <BackPaperAdornment sx={{ padding: '24px' }} />,
|
|
26
|
+
hash: '7982da0e0da76819700079ee21511333d73395805cbeb3e44f25e2d584c8586e',
|
|
27
|
+
size: 'medium',
|
|
28
|
+
sx: { columnGap: 0.5 },
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export {
|
|
32
|
+
Default, WithAdornment, WithHash, WithSizes,
|
|
33
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { useTheme } from '@mui/material'
|
|
2
|
+
import { Identicon, IdenticonProps } from '@xylabs/react-identicon'
|
|
3
|
+
import React, { forwardRef } from 'react'
|
|
4
|
+
|
|
5
|
+
import { HeadingPaper, HeadingPaperProps } from '../HeadingPaper/index.ts'
|
|
6
|
+
|
|
7
|
+
export interface HashHeadingPaperProps extends HeadingPaperProps {
|
|
8
|
+
hash?: string
|
|
9
|
+
identiconProps?: IdenticonProps
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const HashHeadingPaper = forwardRef<HTMLDivElement, HashHeadingPaperProps>(({
|
|
13
|
+
hash, identiconProps, ...props
|
|
14
|
+
}, ref) => {
|
|
15
|
+
const theme = useTheme()
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<HeadingPaper
|
|
19
|
+
heading={hash}
|
|
20
|
+
fallbackText="No hash provided"
|
|
21
|
+
ref={ref}
|
|
22
|
+
IconComponent={
|
|
23
|
+
hash
|
|
24
|
+
? (
|
|
25
|
+
<Identicon
|
|
26
|
+
size={Number.parseInt(theme.spacing(3).replace('px', ''))}
|
|
27
|
+
p={0.25}
|
|
28
|
+
value={hash}
|
|
29
|
+
sx={{ background: theme.palette.background.paper }}
|
|
30
|
+
{...identiconProps}
|
|
31
|
+
/>
|
|
32
|
+
)
|
|
33
|
+
: null
|
|
34
|
+
}
|
|
35
|
+
sx={{ columnGap: 1 }}
|
|
36
|
+
{...props}
|
|
37
|
+
/>
|
|
38
|
+
)
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
HashHeadingPaper.displayName = 'HashHeadingPaper'
|
|
42
|
+
|
|
43
|
+
export { HashHeadingPaper }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './HashHeadingPaper.tsx'
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { TypographyVariant } from '@mui/material'
|
|
2
|
+
import { FlexGrowRow } from '@xylabs/react-flexbox'
|
|
3
|
+
import { EllipsizeBox } from '@xyo-network/react-shared'
|
|
4
|
+
import React, { useRef } from 'react'
|
|
5
|
+
|
|
6
|
+
import { BWHeadingProps, HeadingTextSizes } from './HeadingProps.tsx'
|
|
7
|
+
|
|
8
|
+
export const BWHeading: React.FC<BWHeadingProps> = ({
|
|
9
|
+
AdornmentEnd,
|
|
10
|
+
AdornmentStart,
|
|
11
|
+
heading,
|
|
12
|
+
headingProps,
|
|
13
|
+
IconComponent,
|
|
14
|
+
size = 'medium',
|
|
15
|
+
fallbackText = 'No heading Provided',
|
|
16
|
+
...props
|
|
17
|
+
}) => {
|
|
18
|
+
const ellipsizeRef = useRef<HTMLDivElement | null>(null)
|
|
19
|
+
const headingText = heading ?? fallbackText
|
|
20
|
+
|
|
21
|
+
const sizeParser = (size: HeadingTextSizes) => {
|
|
22
|
+
const map: Record<HeadingTextSizes, TypographyVariant> = {
|
|
23
|
+
large: 'h4',
|
|
24
|
+
medium: 'body1',
|
|
25
|
+
small: 'caption',
|
|
26
|
+
}
|
|
27
|
+
const mappedSize = map[size]
|
|
28
|
+
if (mappedSize === undefined) {
|
|
29
|
+
throw new Error(`${size} is not a recognized TextSize`)
|
|
30
|
+
}
|
|
31
|
+
return mappedSize
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<FlexGrowRow columnGap={2} {...props}>
|
|
36
|
+
{AdornmentStart}
|
|
37
|
+
{IconComponent}
|
|
38
|
+
<EllipsizeBox
|
|
39
|
+
title={headingText}
|
|
40
|
+
width="100%"
|
|
41
|
+
typographyProps={{ variant: sizeParser(size), ...headingProps }}
|
|
42
|
+
ref={ellipsizeRef}
|
|
43
|
+
>
|
|
44
|
+
{headingText}
|
|
45
|
+
</EllipsizeBox>
|
|
46
|
+
{AdornmentEnd}
|
|
47
|
+
</FlexGrowRow>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Paper, PaperProps, styled,
|
|
3
|
+
} from '@mui/material'
|
|
4
|
+
import React, { forwardRef } from 'react'
|
|
5
|
+
|
|
6
|
+
import { BWHeading } from '../Heading.tsx'
|
|
7
|
+
import { BWHeadingProps } from '../HeadingProps.tsx'
|
|
8
|
+
|
|
9
|
+
export interface HeadingPaperProps extends BWHeadingProps {
|
|
10
|
+
paperProps?: PaperProps
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const HeadingPaper = forwardRef<HTMLDivElement, HeadingPaperProps>((props, ref) => {
|
|
14
|
+
const {
|
|
15
|
+
AdornmentStart, AdornmentEnd, paperProps,
|
|
16
|
+
} = props
|
|
17
|
+
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
19
|
+
const { paperProps: excludedPaperProps, ...bwHeadingProps } = props
|
|
20
|
+
return (
|
|
21
|
+
<StyledHeadingPaper hasAdornmentStart={!!AdornmentStart} hasAdornmentEnd={!!AdornmentEnd} elevation={4} ref={ref} {...paperProps}>
|
|
22
|
+
<BWHeading {...bwHeadingProps} />
|
|
23
|
+
</StyledHeadingPaper>
|
|
24
|
+
)
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
HeadingPaper.displayName = 'HeadingPaper'
|
|
28
|
+
|
|
29
|
+
export { HeadingPaper }
|
|
30
|
+
|
|
31
|
+
interface StyledHeadingPaperProps extends PaperProps {
|
|
32
|
+
hasAdornmentEnd?: boolean
|
|
33
|
+
hasAdornmentStart?: boolean
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const StyledHeadingPaper = styled(Paper, {
|
|
37
|
+
name: 'StyledHeadingPaper',
|
|
38
|
+
shouldForwardProp: prop => !['hasAdornmentEnd', 'hasAdornmentStart', 'paperProps'].includes(prop as string),
|
|
39
|
+
})<StyledHeadingPaperProps>(({
|
|
40
|
+
hasAdornmentEnd, hasAdornmentStart, theme,
|
|
41
|
+
}) => ({
|
|
42
|
+
alignItems: 'center',
|
|
43
|
+
columnGap: theme.spacing(2),
|
|
44
|
+
display: 'flex',
|
|
45
|
+
flexDirection: 'row',
|
|
46
|
+
overflow: 'hidden',
|
|
47
|
+
padding: theme.spacing(1),
|
|
48
|
+
...(hasAdornmentStart && { paddingLeft: 0 }),
|
|
49
|
+
...(hasAdornmentEnd && { paddingRight: 0 }),
|
|
50
|
+
...((hasAdornmentStart || hasAdornmentEnd) && { paddingBottom: 0, paddingTop: 0 }),
|
|
51
|
+
paddingRight: theme.spacing(1),
|
|
52
|
+
}))
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './HeadingPaper.tsx'
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TypographyProps } from '@mui/material'
|
|
2
|
+
import { FlexBoxProps } from '@xylabs/react-flexbox'
|
|
3
|
+
import { ReactNode } from 'react'
|
|
4
|
+
|
|
5
|
+
export type HeadingTextSizes = 'small' | 'medium' | 'large'
|
|
6
|
+
|
|
7
|
+
export interface BWHeadingProps extends FlexBoxProps {
|
|
8
|
+
AdornmentEnd?: ReactNode
|
|
9
|
+
AdornmentStart?: ReactNode
|
|
10
|
+
IconComponent?: ReactNode
|
|
11
|
+
fallbackText?: string
|
|
12
|
+
heading?: string
|
|
13
|
+
headingProps?: TypographyProps
|
|
14
|
+
size?: HeadingTextSizes
|
|
15
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BoundWitness } from '@xyo-network/boundwitness-model'
|
|
2
|
+
import { PayloadTableProps } from '@xyo-network/react-payload-table'
|
|
3
|
+
import { PropertyGroup, PropertyGroupProps } from '@xyo-network/react-property'
|
|
4
|
+
import React from 'react'
|
|
5
|
+
|
|
6
|
+
import { BoundWitnessPayloadsTable } from './PayloadsTable.tsx'
|
|
7
|
+
|
|
8
|
+
export type BoundWitnessPayloadsProps = PropertyGroupProps & {
|
|
9
|
+
payload?: BoundWitness
|
|
10
|
+
payloadTableProps?: PayloadTableProps
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const BoundWitnessPayloads: React.FC<BoundWitnessPayloadsProps> = ({
|
|
14
|
+
payload: boundwitness, payloadTableProps, ...props
|
|
15
|
+
}) => {
|
|
16
|
+
let elevation = 2
|
|
17
|
+
if (props.paper) {
|
|
18
|
+
elevation += props.elevation ?? 0
|
|
19
|
+
}
|
|
20
|
+
return (
|
|
21
|
+
<PropertyGroup titleProps={{ elevation }} title="Payloads" tip="The hash and schema for each payload witnessed" {...props}>
|
|
22
|
+
<BoundWitnessPayloadsTable boundwitness={boundwitness} {...payloadTableProps} />
|
|
23
|
+
</PropertyGroup>
|
|
24
|
+
)
|
|
25
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { BoundWitness, BoundWitnessSchema } from '@xyo-network/boundwitness-model'
|
|
2
|
+
import { PayloadTableProps } from '@xyo-network/react-payload-table'
|
|
3
|
+
import { usePayloadHash } from '@xyo-network/react-shared'
|
|
4
|
+
import { TableEx } from '@xyo-network/react-table'
|
|
5
|
+
import React, { PropsWithChildren } from 'react'
|
|
6
|
+
|
|
7
|
+
import { BoundWitnessFilteredPayloadTableBody, BoundWitnessPayloadTableHead } from './payloads-table/index.ts'
|
|
8
|
+
|
|
9
|
+
export interface BoundWitnessPayloadTableProps extends PayloadTableProps {
|
|
10
|
+
boundwitness?: BoundWitness
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const BoundWitnessPayloadsTable: React.FC<BoundWitnessPayloadTableProps> = ({ boundwitness, ...props }) => {
|
|
14
|
+
const hash = usePayloadHash(boundwitness)
|
|
15
|
+
return (
|
|
16
|
+
<BoundWitnessPayloadsTableInner {...props}>
|
|
17
|
+
<BoundWitnessFilteredPayloadTableBody
|
|
18
|
+
eventNoun="payload"
|
|
19
|
+
schemaFilter={BoundWitnessSchema}
|
|
20
|
+
bwFilterType="notEqual"
|
|
21
|
+
noResults={boundwitness?.payload_hashes.length === 0}
|
|
22
|
+
payloadHashes={boundwitness?.payload_hashes}
|
|
23
|
+
payloadSchemas={boundwitness?.payload_schemas}
|
|
24
|
+
boundwitnessHash={boundwitness ? hash : ''}
|
|
25
|
+
/>
|
|
26
|
+
</BoundWitnessPayloadsTableInner>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const BoundWitnessPayloadsTableForBWs: React.FC<BoundWitnessPayloadTableProps> = ({ boundwitness, ...props }) => {
|
|
31
|
+
const hash = usePayloadHash(boundwitness)
|
|
32
|
+
return (
|
|
33
|
+
<BoundWitnessPayloadsTableInner {...props}>
|
|
34
|
+
<BoundWitnessFilteredPayloadTableBody
|
|
35
|
+
eventNoun="boundwitness"
|
|
36
|
+
schemaFilter={BoundWitnessSchema}
|
|
37
|
+
noResults={boundwitness?.payload_hashes.length === 0}
|
|
38
|
+
payloadHashes={boundwitness?.payload_hashes}
|
|
39
|
+
payloadSchemas={boundwitness?.payload_schemas}
|
|
40
|
+
boundwitnessHash={boundwitness ? hash : ''}
|
|
41
|
+
/>
|
|
42
|
+
</BoundWitnessPayloadsTableInner>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const BoundWitnessPayloadsTableInner: React.FC<PropsWithChildren<BoundWitnessPayloadTableProps>> = ({ children, ...props }) => (
|
|
47
|
+
<TableEx {...props}>
|
|
48
|
+
<BoundWitnessPayloadTableHead />
|
|
49
|
+
{children}
|
|
50
|
+
</TableEx>
|
|
51
|
+
)
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
+
import {
|
|
3
|
+
TableBody, TableCell, TableRow,
|
|
4
|
+
} from '@mui/material'
|
|
5
|
+
import { EventNoun, useEvent } from '@xyo-network/react-event'
|
|
6
|
+
import { PayloadTableBodyProps, TableRowNoData } from '@xyo-network/react-payload-table'
|
|
7
|
+
import { HashTableCell } from '@xyo-network/react-shared'
|
|
8
|
+
import { useTableHeight } from '@xyo-network/react-table'
|
|
9
|
+
import React, { useLayoutEffect, useRef } from 'react'
|
|
10
|
+
|
|
11
|
+
export interface BoundWitnessPayloadTableBodyProps extends PayloadTableBodyProps {
|
|
12
|
+
boundwitnessHash?: string
|
|
13
|
+
eventNoun?: EventNoun
|
|
14
|
+
payloadHashes?: string[]
|
|
15
|
+
payloadSchemas?: string[]
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const BoundWitnessPayloadTableBody: React.FC<BoundWitnessPayloadTableBodyProps> = ({
|
|
19
|
+
boundwitnessHash,
|
|
20
|
+
eventNoun = 'payload',
|
|
21
|
+
payloadHashes,
|
|
22
|
+
payloadSchemas,
|
|
23
|
+
...props
|
|
24
|
+
}) => {
|
|
25
|
+
const {
|
|
26
|
+
payloads, archive, maxSchemaDepth, onRowClick, exploreDomain, emptyRows, noResults, NoResultRowComponent, ...tableProps
|
|
27
|
+
} = props
|
|
28
|
+
const ref = useRef<HTMLTableSectionElement | null>(null)
|
|
29
|
+
const [tableRef, dispatch] = useEvent<HTMLTableSectionElement>(undefined, ref)
|
|
30
|
+
|
|
31
|
+
const { setRowHeight } = useTableHeight()
|
|
32
|
+
const tableRowRef = useRef<HTMLTableRowElement | null>(null)
|
|
33
|
+
|
|
34
|
+
const handleOnClick = (hash: string) => {
|
|
35
|
+
dispatch(eventNoun, 'click', hash)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
useLayoutEffect(() => {
|
|
39
|
+
if (tableRowRef.current) {
|
|
40
|
+
setRowHeight?.(tableRowRef.current.offsetHeight)
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<TableBody ref={tableRef} {...tableProps}>
|
|
46
|
+
{noResults && NoResultRowComponent
|
|
47
|
+
? <NoResultRowComponent />
|
|
48
|
+
: null}
|
|
49
|
+
{(
|
|
50
|
+
payloadHashes
|
|
51
|
+
&& payloadSchemas
|
|
52
|
+
&& payloadHashes.length > 0
|
|
53
|
+
&& payloadHashes?.map((hash, index) => {
|
|
54
|
+
return (
|
|
55
|
+
<TableRow ref={tableRowRef} key={boundwitnessHash + hash} onClick={() => handleOnClick(hash)} sx={{ cursor: 'pointer' }}>
|
|
56
|
+
<TableCell title={payloadSchemas[index]}>{payloadSchemas[index]}</TableCell>
|
|
57
|
+
<HashTableCell title={hash}>{hash}</HashTableCell>
|
|
58
|
+
</TableRow>
|
|
59
|
+
)
|
|
60
|
+
})) || (
|
|
61
|
+
<>
|
|
62
|
+
<TableRowNoData additionalCells={1} />
|
|
63
|
+
</>
|
|
64
|
+
)}
|
|
65
|
+
</TableBody>
|
|
66
|
+
)
|
|
67
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React, { useMemo, useState } from 'react'
|
|
2
|
+
|
|
3
|
+
import { BoundWitnessPayloadTableBody, BoundWitnessPayloadTableBodyProps } from './TableBody.tsx'
|
|
4
|
+
|
|
5
|
+
export interface BoundWitnessFilteredPayloadTableBodyProps extends BoundWitnessPayloadTableBodyProps {
|
|
6
|
+
bwFilterType?: 'equal' | 'notEqual'
|
|
7
|
+
schemaFilter?: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const BoundWitnessFilteredPayloadTableBody: React.FC<BoundWitnessFilteredPayloadTableBodyProps> = ({
|
|
11
|
+
bwFilterType = 'equal',
|
|
12
|
+
eventNoun = 'payload',
|
|
13
|
+
payloadHashes,
|
|
14
|
+
payloadSchemas,
|
|
15
|
+
schemaFilter,
|
|
16
|
+
...props
|
|
17
|
+
}) => {
|
|
18
|
+
const [bwPayloadHashes, setBWPayloadHashes] = useState<string[]>()
|
|
19
|
+
const [bwPayloadSchemas, setBWPayloadSchemas] = useState<string[]>()
|
|
20
|
+
|
|
21
|
+
useMemo(() => {
|
|
22
|
+
// if no filter, display all hashes and schemas
|
|
23
|
+
if (!schemaFilter) {
|
|
24
|
+
setBWPayloadHashes(payloadHashes)
|
|
25
|
+
setBWPayloadSchemas(payloadSchemas)
|
|
26
|
+
}
|
|
27
|
+
}, [payloadHashes, payloadSchemas, schemaFilter])
|
|
28
|
+
|
|
29
|
+
useMemo(() => {
|
|
30
|
+
if (payloadSchemas && schemaFilter) {
|
|
31
|
+
const filteredSchemas = payloadSchemas.filter((schema) => {
|
|
32
|
+
return bwFilterType === 'equal' ? schema === schemaFilter : schema !== schemaFilter
|
|
33
|
+
})
|
|
34
|
+
setBWPayloadSchemas(filteredSchemas)
|
|
35
|
+
}
|
|
36
|
+
}, [bwFilterType, payloadSchemas, schemaFilter])
|
|
37
|
+
|
|
38
|
+
useMemo(() => {
|
|
39
|
+
if (payloadHashes && payloadSchemas && schemaFilter) {
|
|
40
|
+
// eslint-disable-next-line unicorn/no-array-reduce
|
|
41
|
+
const filteredHashes = payloadSchemas.reduce<string[]>((acc, schema, index) => {
|
|
42
|
+
if (bwFilterType === 'equal' ? schema === schemaFilter : schema !== schemaFilter) {
|
|
43
|
+
acc.push(payloadHashes[index])
|
|
44
|
+
}
|
|
45
|
+
return acc
|
|
46
|
+
}, [])
|
|
47
|
+
setBWPayloadHashes(filteredHashes)
|
|
48
|
+
}
|
|
49
|
+
}, [bwFilterType, payloadHashes, payloadSchemas, schemaFilter])
|
|
50
|
+
return <BoundWitnessPayloadTableBody payloadHashes={bwPayloadHashes} payloadSchemas={bwPayloadSchemas} eventNoun={eventNoun} {...props} />
|
|
51
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
styled, TableHead, TableRow, Typography,
|
|
3
|
+
} from '@mui/material'
|
|
4
|
+
import { PayloadTableHeadProps } from '@xyo-network/react-payload-table'
|
|
5
|
+
import { TableCellEx } from '@xyo-network/react-table'
|
|
6
|
+
import React from 'react'
|
|
7
|
+
|
|
8
|
+
export const BoundWitnessPayloadTableHead: React.FC<PayloadTableHeadProps> = (props) => {
|
|
9
|
+
const {
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11
|
+
columns, ...tableHeadProps
|
|
12
|
+
} = props
|
|
13
|
+
return (
|
|
14
|
+
<TableHead {...tableHeadProps}>
|
|
15
|
+
<TableRow>
|
|
16
|
+
<TableCellEx>
|
|
17
|
+
<TableCellTypography variant="caption">Schema</TableCellTypography>
|
|
18
|
+
</TableCellEx>
|
|
19
|
+
<TableCellEx>
|
|
20
|
+
<TableCellTypography variant="caption">Hash</TableCellTypography>
|
|
21
|
+
</TableCellEx>
|
|
22
|
+
</TableRow>
|
|
23
|
+
</TableHead>
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const TableCellTypography = styled(Typography, { name: 'TableCellTypography' })(() => ({ fontWeight: 'bold' }))
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BoundWitness } from '@xyo-network/boundwitness-model'
|
|
2
|
+
import { PropertyGroup, PropertyGroupProps } from '@xyo-network/react-property'
|
|
3
|
+
import React from 'react'
|
|
4
|
+
|
|
5
|
+
import { BoundWitnessSignatureTable } from './SignatureTable.tsx'
|
|
6
|
+
|
|
7
|
+
export type BoundWitnessSignatureDetailsProps = PropertyGroupProps & {
|
|
8
|
+
block?: BoundWitness
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const BoundWitnessSignatureDetails: React.FC<BoundWitnessSignatureDetailsProps> = ({ block, ...props }) => {
|
|
12
|
+
let elevation = 2
|
|
13
|
+
if (props.paper) {
|
|
14
|
+
elevation += props.elevation ?? 0
|
|
15
|
+
}
|
|
16
|
+
return (
|
|
17
|
+
<PropertyGroup titleProps={{ elevation }} title="Signatures" tip="The list of signatures for this block" {...props}>
|
|
18
|
+
<BoundWitnessSignatureTable block={block} />
|
|
19
|
+
</PropertyGroup>
|
|
20
|
+
)
|
|
21
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Meta, StoryFn } from '@storybook/react'
|
|
2
|
+
import { sampleBlock } from '@xyo-network/react-storybook'
|
|
3
|
+
import React from 'react'
|
|
4
|
+
import { BrowserRouter } from 'react-router-dom'
|
|
5
|
+
|
|
6
|
+
import { BoundWitnessSignatureTable } from './SignatureTable.tsx'
|
|
7
|
+
|
|
8
|
+
const StorybookEntry = {
|
|
9
|
+
argTypes: {},
|
|
10
|
+
component: BoundWitnessSignatureTable,
|
|
11
|
+
parameters: { docs: { page: null } },
|
|
12
|
+
title: 'boundwitness/SignatureTable',
|
|
13
|
+
} as Meta<typeof BoundWitnessSignatureTable>
|
|
14
|
+
|
|
15
|
+
const Template: StoryFn<typeof BoundWitnessSignatureTable> = args => (
|
|
16
|
+
<BrowserRouter>
|
|
17
|
+
<BoundWitnessSignatureTable {...args}></BoundWitnessSignatureTable>
|
|
18
|
+
</BrowserRouter>
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
const Default = Template.bind({})
|
|
22
|
+
Default.args = {}
|
|
23
|
+
|
|
24
|
+
const WithData = Template.bind({})
|
|
25
|
+
WithData.args = { block: sampleBlock }
|
|
26
|
+
|
|
27
|
+
export { Default, WithData }
|
|
28
|
+
|
|
29
|
+
export default StorybookEntry
|