@xyo-network/react-chain-boundwitness 1.2.6 → 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,44 +0,0 @@
|
|
|
1
|
-
import { ContentCopy } from '@mui/icons-material'
|
|
2
|
-
import type { DialogContentProps } from '@mui/material'
|
|
3
|
-
import {
|
|
4
|
-
Alert, AlertTitle, Collapse,
|
|
5
|
-
DialogContent,
|
|
6
|
-
} from '@mui/material'
|
|
7
|
-
import { FlexGrowRow, FlexRow } from '@xylabs/react-flexbox'
|
|
8
|
-
import type { BoundWitness } from '@xyo-network/boundwitness-model'
|
|
9
|
-
import { EllipsizeBox } from '@xyo-network/react-shared'
|
|
10
|
-
import React, { useState } from 'react'
|
|
11
|
-
|
|
12
|
-
export interface PreviousHashDialogProps extends DialogContentProps {
|
|
13
|
-
boundwitness?: BoundWitness
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const PreviousHashDialogContent: React.FC<PreviousHashDialogProps> = ({ boundwitness, ...props }) => {
|
|
17
|
-
const [copied, setCopied] = useState(false)
|
|
18
|
-
|
|
19
|
-
const onCopy = async () => {
|
|
20
|
-
await navigator.clipboard.writeText(boundwitness?.previous_hashes[0] ?? '')
|
|
21
|
-
setCopied(true)
|
|
22
|
-
setTimeout(() => {
|
|
23
|
-
setCopied(false)
|
|
24
|
-
}, 5000)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<DialogContent {...props}>
|
|
29
|
-
<FlexGrowRow columnGap={2}>
|
|
30
|
-
<ContentCopy sx={{ cursor: 'pointer' }} onClick={() => void onCopy()} />
|
|
31
|
-
<EllipsizeBox flexGrow="1" typographyProps={{ variant: 'body1' }}>
|
|
32
|
-
{boundwitness?.previous_hashes.join(',')}
|
|
33
|
-
</EllipsizeBox>
|
|
34
|
-
</FlexGrowRow>
|
|
35
|
-
<FlexRow>
|
|
36
|
-
<Collapse in={copied} unmountOnExit>
|
|
37
|
-
<Alert>
|
|
38
|
-
<AlertTitle>Previous hash copied to clipboard</AlertTitle>
|
|
39
|
-
</Alert>
|
|
40
|
-
</Collapse>
|
|
41
|
-
</FlexRow>
|
|
42
|
-
</DialogContent>
|
|
43
|
-
)
|
|
44
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Link } from '@mui/icons-material'
|
|
2
|
-
import { ListItemIcon, MenuItem } from '@mui/material'
|
|
3
|
-
import type { MouseEventHandler } from 'react'
|
|
4
|
-
import React, { useState } from 'react'
|
|
5
|
-
|
|
6
|
-
import type { ActionMenuItemProps } from '../_shared/index.ts'
|
|
7
|
-
import { MenuItemDialog } from '../_shared/index.ts'
|
|
8
|
-
import { PreviousHashDialogContent } from './DialogContent.tsx'
|
|
9
|
-
|
|
10
|
-
export interface BWPreviousHashMenuItemProps extends ActionMenuItemProps {}
|
|
11
|
-
|
|
12
|
-
export const BWPreviousHashMenuItem: React.FC<BWPreviousHashMenuItemProps> = ({
|
|
13
|
-
boundwitness, onClick, onDialogClose, ...props
|
|
14
|
-
}) => {
|
|
15
|
-
const [open, setOpen] = useState(false)
|
|
16
|
-
const onClose = () => {
|
|
17
|
-
onDialogClose?.()
|
|
18
|
-
setOpen(false)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const handleMenuClick: MouseEventHandler<HTMLLIElement> = (e) => {
|
|
22
|
-
onClick?.(e)
|
|
23
|
-
setOpen(true)
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<>
|
|
28
|
-
<MenuItem onClick={handleMenuClick} {...props}>
|
|
29
|
-
<ListItemIcon><Link /></ListItemIcon>
|
|
30
|
-
Previous Hash
|
|
31
|
-
</MenuItem>
|
|
32
|
-
<MenuItemDialog open={open} onClose={onClose} dialogTitle="Previous Hash">
|
|
33
|
-
<PreviousHashDialogContent boundwitness={boundwitness} />
|
|
34
|
-
</MenuItemDialog>
|
|
35
|
-
</>
|
|
36
|
-
)
|
|
37
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { LinkRounded as LinkRoundedIcon } from '@mui/icons-material'
|
|
2
|
-
import { ellipsize } from '@xylabs/eth-address'
|
|
3
|
-
import type { QuickTipButtonProps } from '@xylabs/react-quick-tip-button'
|
|
4
|
-
import { QuickTipButton } from '@xylabs/react-quick-tip-button'
|
|
5
|
-
import type { BoundWitness } from '@xyo-network/boundwitness-model'
|
|
6
|
-
import React from 'react'
|
|
7
|
-
|
|
8
|
-
import { PreviousHashDialogContent } from './DialogContent.tsx'
|
|
9
|
-
|
|
10
|
-
export interface BWPreviousHashQuickTipButtonProps extends QuickTipButtonProps {
|
|
11
|
-
boundwitness?: BoundWitness
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const BWPreviousHashQuickTipButton: React.FC<BWPreviousHashQuickTipButtonProps> = ({ boundwitness, ...props }) => {
|
|
15
|
-
const previousHash = boundwitness?.previous_hashes[0] ?? null
|
|
16
|
-
const formattedPreviousHash = previousHash === null ? 'No Previous Hash' : `Previous Hash - ${ellipsize(previousHash, 8)}`
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<QuickTipButton
|
|
20
|
-
Icon={LinkRoundedIcon}
|
|
21
|
-
disabled={previousHash === null}
|
|
22
|
-
hoverText={formattedPreviousHash}
|
|
23
|
-
disableDialog={previousHash === null}
|
|
24
|
-
dialogProps={{ fullWidth: true, maxWidth: 'md' }}
|
|
25
|
-
{...props}
|
|
26
|
-
>
|
|
27
|
-
{previousHash === null
|
|
28
|
-
? null
|
|
29
|
-
: <PreviousHashDialogContent boundwitness={boundwitness} />}
|
|
30
|
-
</QuickTipButton>
|
|
31
|
-
)
|
|
32
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ArrowBackRounded } from '@mui/icons-material'
|
|
2
|
-
import type { 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
|
-
)
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { styled } from '@mui/material'
|
|
2
|
-
import type { FlexBoxProps } from '@xylabs/react-flexbox'
|
|
3
|
-
import { FlexCol } from '@xylabs/react-flexbox'
|
|
4
|
-
|
|
5
|
-
export interface PaperAdornmentProps extends FlexBoxProps {
|
|
6
|
-
clickable?: boolean
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const PaperAdornment = styled(FlexCol, {
|
|
10
|
-
name: 'PaperAdornment',
|
|
11
|
-
shouldForwardProp: (prop: string) => !['clickable'].includes(prop),
|
|
12
|
-
})<PaperAdornmentProps>(({ theme, clickable }) => ({
|
|
13
|
-
backgroundColor: theme.palette.secondary.dark,
|
|
14
|
-
cursor: clickable ? 'pointer' : 'auto',
|
|
15
|
-
}))
|
package/src/components/_shared/Heading/HashHeadingPaper/Adornment/PaperAdornmentIconButton.tsx
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { IconButtonProps } from '@mui/material'
|
|
2
|
-
import { IconButton, styled } from '@mui/material'
|
|
3
|
-
|
|
4
|
-
export interface PaperAdornmentIconButton extends IconButtonProps {
|
|
5
|
-
themePadding?: number
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export const PaperAdornmentIconButton = styled(IconButton, { name: 'PaperAdornmentIconButton' })<PaperAdornmentIconButton>(
|
|
9
|
-
({ theme, themePadding = 1 }) => ({
|
|
10
|
-
borderRadius: 0,
|
|
11
|
-
padding: theme.spacing(themePadding),
|
|
12
|
-
}),
|
|
13
|
-
)
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { 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
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { useTheme } from '@mui/material'
|
|
2
|
-
import type { IdenticonProps } from '@xylabs/react-identicon'
|
|
3
|
-
import { Identicon } from '@xylabs/react-identicon'
|
|
4
|
-
import React from 'react'
|
|
5
|
-
|
|
6
|
-
import type { HeadingPaperProps } from '../HeadingPaper/index.ts'
|
|
7
|
-
import { HeadingPaper } from '../HeadingPaper/index.ts'
|
|
8
|
-
|
|
9
|
-
export interface HashHeadingPaperProps extends HeadingPaperProps {
|
|
10
|
-
hash?: string
|
|
11
|
-
identiconProps?: IdenticonProps
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const HashHeadingPaper = ({
|
|
15
|
-
ref, hash, identiconProps, ...props
|
|
16
|
-
}: HashHeadingPaperProps & { ref?: React.Ref<HTMLDivElement | null> }) => {
|
|
17
|
-
const theme = useTheme()
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<HeadingPaper
|
|
21
|
-
heading={hash}
|
|
22
|
-
fallbackText="No hash provided"
|
|
23
|
-
ref={ref}
|
|
24
|
-
IconComponent={
|
|
25
|
-
hash
|
|
26
|
-
? (
|
|
27
|
-
<Identicon
|
|
28
|
-
size={Number.parseInt(theme.spacing(3).replace('px', ''))}
|
|
29
|
-
p={0.25}
|
|
30
|
-
value={hash}
|
|
31
|
-
sx={{ background: theme.palette.background.paper }}
|
|
32
|
-
{...identiconProps}
|
|
33
|
-
/>
|
|
34
|
-
)
|
|
35
|
-
: null
|
|
36
|
-
}
|
|
37
|
-
sx={{ columnGap: 1 }}
|
|
38
|
-
{...props}
|
|
39
|
-
/>
|
|
40
|
-
)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
HashHeadingPaper.displayName = 'HashHeadingPaper'
|
|
44
|
-
|
|
45
|
-
export { HashHeadingPaper }
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './HashHeadingPaper.tsx'
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { 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 type { 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
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import type { PaperProps } from '@mui/material'
|
|
2
|
-
import { Paper, styled } from '@mui/material'
|
|
3
|
-
import React from 'react'
|
|
4
|
-
|
|
5
|
-
import { BWHeading } from '../Heading.tsx'
|
|
6
|
-
import type { BWHeadingProps } from '../HeadingProps.tsx'
|
|
7
|
-
|
|
8
|
-
export interface HeadingPaperProps extends BWHeadingProps {
|
|
9
|
-
paperProps?: PaperProps
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const HeadingPaper = ({ ref, ...props }: HeadingPaperProps & { ref?: React.Ref<HTMLDivElement | null> }) => {
|
|
13
|
-
const {
|
|
14
|
-
AdornmentStart, AdornmentEnd, paperProps,
|
|
15
|
-
} = props
|
|
16
|
-
|
|
17
|
-
const { paperProps: excludedPaperProps, ...bwHeadingProps } = props
|
|
18
|
-
return (
|
|
19
|
-
<StyledHeadingPaper hasAdornmentStart={!!AdornmentStart} hasAdornmentEnd={!!AdornmentEnd} elevation={4} ref={ref} {...paperProps}>
|
|
20
|
-
<BWHeading {...bwHeadingProps} />
|
|
21
|
-
</StyledHeadingPaper>
|
|
22
|
-
)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
HeadingPaper.displayName = 'HeadingPaper'
|
|
26
|
-
|
|
27
|
-
export { HeadingPaper }
|
|
28
|
-
|
|
29
|
-
interface StyledHeadingPaperProps extends PaperProps {
|
|
30
|
-
hasAdornmentEnd?: boolean
|
|
31
|
-
hasAdornmentStart?: boolean
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const StyledHeadingPaper = styled(Paper, {
|
|
35
|
-
name: 'StyledHeadingPaper',
|
|
36
|
-
shouldForwardProp: prop => !['hasAdornmentEnd', 'hasAdornmentStart', 'paperProps'].includes(prop as string),
|
|
37
|
-
})<StyledHeadingPaperProps>(({
|
|
38
|
-
hasAdornmentEnd, hasAdornmentStart, theme,
|
|
39
|
-
}) => ({
|
|
40
|
-
alignItems: 'center',
|
|
41
|
-
columnGap: theme.spacing(2),
|
|
42
|
-
display: 'flex',
|
|
43
|
-
flexDirection: 'row',
|
|
44
|
-
overflow: 'hidden',
|
|
45
|
-
padding: theme.spacing(1),
|
|
46
|
-
...(hasAdornmentStart && { paddingLeft: 0 }),
|
|
47
|
-
...(hasAdornmentEnd && { paddingRight: 0 }),
|
|
48
|
-
...((hasAdornmentStart || hasAdornmentEnd) && { paddingBottom: 0, paddingTop: 0 }),
|
|
49
|
-
paddingRight: theme.spacing(1),
|
|
50
|
-
}))
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './HeadingPaper.tsx'
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { TypographyProps } from '@mui/material'
|
|
2
|
-
import type { FlexBoxProps } from '@xylabs/react-flexbox'
|
|
3
|
-
import type { 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
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { BoundWitness } from '@xyo-network/boundwitness-model'
|
|
2
|
-
import type { PayloadTableProps } from '@xyo-network/react-payload-table'
|
|
3
|
-
import type { PropertyGroupProps } from '@xyo-network/react-property'
|
|
4
|
-
import { PropertyGroup } from '@xyo-network/react-property'
|
|
5
|
-
import React from 'react'
|
|
6
|
-
|
|
7
|
-
import { BoundWitnessPayloadsTable } from './PayloadsTable.tsx'
|
|
8
|
-
|
|
9
|
-
export type BoundWitnessPayloadsProps = PropertyGroupProps & {
|
|
10
|
-
payload?: BoundWitness
|
|
11
|
-
payloadTableProps?: PayloadTableProps
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const BoundWitnessPayloads: React.FC<BoundWitnessPayloadsProps> = ({
|
|
15
|
-
payload: boundwitness, payloadTableProps, ...props
|
|
16
|
-
}) => {
|
|
17
|
-
let elevation = 2
|
|
18
|
-
if (props.paper) {
|
|
19
|
-
elevation += props.elevation ?? 0
|
|
20
|
-
}
|
|
21
|
-
return (
|
|
22
|
-
<PropertyGroup titleProps={{ elevation }} title="Payloads" tip="The hash and schema for each payload witnessed" {...props}>
|
|
23
|
-
<BoundWitnessPayloadsTable boundwitness={boundwitness} {...payloadTableProps} />
|
|
24
|
-
</PropertyGroup>
|
|
25
|
-
)
|
|
26
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import type { BoundWitness } from '@xyo-network/boundwitness-model'
|
|
2
|
-
import { BoundWitnessSchema } from '@xyo-network/boundwitness-model'
|
|
3
|
-
import type { PayloadTableProps } from '@xyo-network/react-payload-table'
|
|
4
|
-
import { usePayloadHash } from '@xyo-network/react-shared'
|
|
5
|
-
import { TableEx } from '@xyo-network/react-table'
|
|
6
|
-
import type { PropsWithChildren } from 'react'
|
|
7
|
-
import React from 'react'
|
|
8
|
-
|
|
9
|
-
import { BoundWitnessFilteredPayloadTableBody, BoundWitnessPayloadTableHead } from './payloads-table/index.ts'
|
|
10
|
-
|
|
11
|
-
export interface BoundWitnessPayloadTableProps extends PayloadTableProps {
|
|
12
|
-
boundwitness?: BoundWitness
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const BoundWitnessPayloadsTable: React.FC<BoundWitnessPayloadTableProps> = ({ boundwitness, ...props }) => {
|
|
16
|
-
const hash = usePayloadHash(boundwitness)
|
|
17
|
-
return (
|
|
18
|
-
<BoundWitnessPayloadsTableInner {...props}>
|
|
19
|
-
<BoundWitnessFilteredPayloadTableBody
|
|
20
|
-
eventNoun="payload"
|
|
21
|
-
schemaFilter={BoundWitnessSchema}
|
|
22
|
-
bwFilterType="notEqual"
|
|
23
|
-
noResults={boundwitness?.payload_hashes.length === 0}
|
|
24
|
-
payloadHashes={boundwitness?.payload_hashes}
|
|
25
|
-
payloadSchemas={boundwitness?.payload_schemas}
|
|
26
|
-
boundwitnessHash={boundwitness ? hash : ''}
|
|
27
|
-
/>
|
|
28
|
-
</BoundWitnessPayloadsTableInner>
|
|
29
|
-
)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export const BoundWitnessPayloadsTableForBWs: React.FC<BoundWitnessPayloadTableProps> = ({ boundwitness, ...props }) => {
|
|
33
|
-
const hash = usePayloadHash(boundwitness)
|
|
34
|
-
return (
|
|
35
|
-
<BoundWitnessPayloadsTableInner {...props}>
|
|
36
|
-
<BoundWitnessFilteredPayloadTableBody
|
|
37
|
-
eventNoun="boundwitness"
|
|
38
|
-
schemaFilter={BoundWitnessSchema}
|
|
39
|
-
noResults={boundwitness?.payload_hashes.length === 0}
|
|
40
|
-
payloadHashes={boundwitness?.payload_hashes}
|
|
41
|
-
payloadSchemas={boundwitness?.payload_schemas}
|
|
42
|
-
boundwitnessHash={boundwitness ? hash : ''}
|
|
43
|
-
/>
|
|
44
|
-
</BoundWitnessPayloadsTableInner>
|
|
45
|
-
)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export const BoundWitnessPayloadsTableInner: React.FC<PropsWithChildren<BoundWitnessPayloadTableProps>> = ({ children, ...props }) => (
|
|
49
|
-
<TableEx {...props}>
|
|
50
|
-
<BoundWitnessPayloadTableHead />
|
|
51
|
-
{children}
|
|
52
|
-
</TableEx>
|
|
53
|
-
)
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
TableBody, TableCell, TableRow,
|
|
3
|
-
} from '@mui/material'
|
|
4
|
-
import type { EventNoun } from '@xyo-network/react-event'
|
|
5
|
-
import { useEvent } from '@xyo-network/react-event'
|
|
6
|
-
import type { PayloadTableBodyProps } from '@xyo-network/react-payload-table'
|
|
7
|
-
import { TableRowNoData } from '@xyo-network/react-payload-table'
|
|
8
|
-
import { HashTableCell } from '@xyo-network/react-shared'
|
|
9
|
-
import { useTableHeight } from '@xyo-network/react-table'
|
|
10
|
-
import React, { useLayoutEffect, useRef } from 'react'
|
|
11
|
-
|
|
12
|
-
export interface BoundWitnessPayloadTableBodyProps extends PayloadTableBodyProps {
|
|
13
|
-
boundwitnessHash?: string
|
|
14
|
-
eventNoun?: EventNoun
|
|
15
|
-
payloadHashes?: string[]
|
|
16
|
-
payloadSchemas?: string[]
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const BoundWitnessPayloadTableBody: React.FC<BoundWitnessPayloadTableBodyProps> = ({
|
|
20
|
-
boundwitnessHash,
|
|
21
|
-
eventNoun = 'payload',
|
|
22
|
-
payloadHashes,
|
|
23
|
-
payloadSchemas,
|
|
24
|
-
...props
|
|
25
|
-
}) => {
|
|
26
|
-
const {
|
|
27
|
-
payloads, archive, maxSchemaDepth, onRowClick, exploreDomain, emptyRows, noResults, NoResultRowComponent, ...tableProps
|
|
28
|
-
} = props
|
|
29
|
-
const ref = useRef<HTMLTableSectionElement | null>(null)
|
|
30
|
-
const [tableRef, dispatch] = useEvent<HTMLTableSectionElement>(undefined, ref)
|
|
31
|
-
|
|
32
|
-
const { setRowHeight } = useTableHeight()
|
|
33
|
-
const tableRowRef = useRef<HTMLTableRowElement | null>(null)
|
|
34
|
-
|
|
35
|
-
const handleOnClick = (hash: string) => {
|
|
36
|
-
dispatch(eventNoun, 'click', hash)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
useLayoutEffect(() => {
|
|
40
|
-
if (tableRowRef.current) {
|
|
41
|
-
setRowHeight?.(tableRowRef.current.offsetHeight)
|
|
42
|
-
}
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
return (
|
|
46
|
-
<TableBody ref={tableRef} {...tableProps}>
|
|
47
|
-
{noResults && NoResultRowComponent
|
|
48
|
-
? <NoResultRowComponent />
|
|
49
|
-
: null}
|
|
50
|
-
{(
|
|
51
|
-
payloadHashes
|
|
52
|
-
&& payloadSchemas
|
|
53
|
-
&& payloadHashes.length > 0
|
|
54
|
-
&& payloadHashes?.map((hash, index) => {
|
|
55
|
-
return (
|
|
56
|
-
<TableRow ref={tableRowRef} key={boundwitnessHash + hash} onClick={() => handleOnClick(hash)} sx={{ cursor: 'pointer' }}>
|
|
57
|
-
<TableCell title={payloadSchemas[index]}>{payloadSchemas[index]}</TableCell>
|
|
58
|
-
<HashTableCell title={hash}>{hash}</HashTableCell>
|
|
59
|
-
</TableRow>
|
|
60
|
-
)
|
|
61
|
-
})) || (
|
|
62
|
-
<TableRowNoData additionalCells={1} />
|
|
63
|
-
)}
|
|
64
|
-
</TableBody>
|
|
65
|
-
)
|
|
66
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import React, { useMemo, useState } from 'react'
|
|
2
|
-
|
|
3
|
-
import type { BoundWitnessPayloadTableBodyProps } from './TableBody.tsx'
|
|
4
|
-
import { BoundWitnessPayloadTableBody } from './TableBody.tsx'
|
|
5
|
-
|
|
6
|
-
export interface BoundWitnessFilteredPayloadTableBodyProps extends BoundWitnessPayloadTableBodyProps {
|
|
7
|
-
bwFilterType?: 'equal' | 'notEqual'
|
|
8
|
-
schemaFilter?: string
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const BoundWitnessFilteredPayloadTableBody: React.FC<BoundWitnessFilteredPayloadTableBodyProps> = ({
|
|
12
|
-
bwFilterType = 'equal',
|
|
13
|
-
eventNoun = 'payload',
|
|
14
|
-
payloadHashes,
|
|
15
|
-
payloadSchemas,
|
|
16
|
-
schemaFilter,
|
|
17
|
-
...props
|
|
18
|
-
}) => {
|
|
19
|
-
const [bwPayloadHashes, setBWPayloadHashes] = useState<string[]>()
|
|
20
|
-
const [bwPayloadSchemas, setBWPayloadSchemas] = useState<string[]>()
|
|
21
|
-
|
|
22
|
-
useMemo(() => {
|
|
23
|
-
// if no filter, display all hashes and schemas
|
|
24
|
-
if (!schemaFilter) {
|
|
25
|
-
setBWPayloadHashes(payloadHashes)
|
|
26
|
-
setBWPayloadSchemas(payloadSchemas)
|
|
27
|
-
}
|
|
28
|
-
}, [payloadHashes, payloadSchemas, schemaFilter])
|
|
29
|
-
|
|
30
|
-
useMemo(() => {
|
|
31
|
-
if (payloadSchemas && schemaFilter) {
|
|
32
|
-
const filteredSchemas = payloadSchemas.filter((schema) => {
|
|
33
|
-
return bwFilterType === 'equal' ? schema === schemaFilter : schema !== schemaFilter
|
|
34
|
-
})
|
|
35
|
-
setBWPayloadSchemas(filteredSchemas)
|
|
36
|
-
}
|
|
37
|
-
}, [bwFilterType, payloadSchemas, schemaFilter])
|
|
38
|
-
|
|
39
|
-
useMemo(() => {
|
|
40
|
-
if (payloadHashes && payloadSchemas && schemaFilter) {
|
|
41
|
-
// eslint-disable-next-line unicorn/no-array-reduce
|
|
42
|
-
const filteredHashes = payloadSchemas.reduce<string[]>((acc, schema, index) => {
|
|
43
|
-
if (bwFilterType === 'equal' ? schema === schemaFilter : schema !== schemaFilter) {
|
|
44
|
-
acc.push(payloadHashes[index])
|
|
45
|
-
}
|
|
46
|
-
return acc
|
|
47
|
-
}, [])
|
|
48
|
-
setBWPayloadHashes(filteredHashes)
|
|
49
|
-
}
|
|
50
|
-
}, [bwFilterType, payloadHashes, payloadSchemas, schemaFilter])
|
|
51
|
-
return <BoundWitnessPayloadTableBody payloadHashes={bwPayloadHashes} payloadSchemas={bwPayloadSchemas} eventNoun={eventNoun} {...props} />
|
|
52
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
styled, TableHead, TableRow, Typography,
|
|
3
|
-
} from '@mui/material'
|
|
4
|
-
import type { 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 { columns, ...tableHeadProps } = props
|
|
10
|
-
return (
|
|
11
|
-
<TableHead {...tableHeadProps}>
|
|
12
|
-
<TableRow>
|
|
13
|
-
<TableCellEx>
|
|
14
|
-
<TableCellTypography variant="caption">Schema</TableCellTypography>
|
|
15
|
-
</TableCellEx>
|
|
16
|
-
<TableCellEx>
|
|
17
|
-
<TableCellTypography variant="caption">Hash</TableCellTypography>
|
|
18
|
-
</TableCellEx>
|
|
19
|
-
</TableRow>
|
|
20
|
-
</TableHead>
|
|
21
|
-
)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const TableCellTypography = styled(Typography, { name: 'TableCellTypography' })(() => ({ fontWeight: 'bold' }))
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { BoundWitness } from '@xyo-network/boundwitness-model'
|
|
2
|
-
import type { PropertyGroupProps } from '@xyo-network/react-property'
|
|
3
|
-
import { PropertyGroup } from '@xyo-network/react-property'
|
|
4
|
-
import React from 'react'
|
|
5
|
-
|
|
6
|
-
import { BoundWitnessSignatureTable } from './SignatureTable.tsx'
|
|
7
|
-
|
|
8
|
-
export type BoundWitnessSignatureDetailsProps = PropertyGroupProps & {
|
|
9
|
-
block?: BoundWitness
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const BoundWitnessSignatureDetails: React.FC<BoundWitnessSignatureDetailsProps> = ({ block, ...props }) => {
|
|
13
|
-
let elevation = 2
|
|
14
|
-
if (props.paper) {
|
|
15
|
-
elevation += props.elevation ?? 0
|
|
16
|
-
}
|
|
17
|
-
return (
|
|
18
|
-
<PropertyGroup titleProps={{ elevation }} title="Signatures" tip="The list of signatures for this block" {...props}>
|
|
19
|
-
<BoundWitnessSignatureTable block={block} />
|
|
20
|
-
</PropertyGroup>
|
|
21
|
-
)
|
|
22
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { 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
|