@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
package/package.json
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json.schemastore.org/package.json",
|
|
3
|
+
"name": "@xyo-network/react-chain-boundwitness",
|
|
4
|
+
"version": "1.0.1",
|
|
5
|
+
"description": "XYO Layer One SDK",
|
|
6
|
+
"homepage": "https://xylabs.com",
|
|
7
|
+
"bugs": {
|
|
8
|
+
"url": "git+https://github.com/xylabs/xyo-chain/issues",
|
|
9
|
+
"email": "support@xylabs.com"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/xylabs/xyo-chain.git"
|
|
14
|
+
},
|
|
15
|
+
"license": "LGPL-3.0-only",
|
|
16
|
+
"author": {
|
|
17
|
+
"name": "XY Labs Development Team",
|
|
18
|
+
"email": "support@xylabs.com",
|
|
19
|
+
"url": "https://xylabs.com"
|
|
20
|
+
},
|
|
21
|
+
"sideEffects": false,
|
|
22
|
+
"type": "module",
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"browser": {
|
|
26
|
+
"types": "./dist/types/index.d.ts",
|
|
27
|
+
"default": "./dist/browser/index.mjs"
|
|
28
|
+
},
|
|
29
|
+
"types": "./dist/types/index.d.ts",
|
|
30
|
+
"default": "./dist/browser/index.mjs"
|
|
31
|
+
},
|
|
32
|
+
"./package.json": "./package.json"
|
|
33
|
+
},
|
|
34
|
+
"module": "dist/browser/index.mjs",
|
|
35
|
+
"types": "dist/types/index.d.ts",
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@xylabs/arraybuffer": "^4.6.0",
|
|
38
|
+
"@xylabs/eth-address": "^4.6.0",
|
|
39
|
+
"@xylabs/react-flexbox": "^6.0.5",
|
|
40
|
+
"@xylabs/react-hooks": "^6.0.5",
|
|
41
|
+
"@xylabs/react-identicon": "^6.0.5",
|
|
42
|
+
"@xylabs/react-promise": "^6.0.5",
|
|
43
|
+
"@xylabs/react-quick-tip-button": "^6.0.5",
|
|
44
|
+
"@xyo-network/boundwitness-model": "^3.9.37",
|
|
45
|
+
"@xyo-network/boundwitness-validator": "^3.9.37",
|
|
46
|
+
"@xyo-network/payload-model": "^3.9.37",
|
|
47
|
+
"@xyo-network/react-card": "^5.0.3",
|
|
48
|
+
"@xyo-network/react-event": "^5.0.3",
|
|
49
|
+
"@xyo-network/react-payload-details": "^5.0.3",
|
|
50
|
+
"@xyo-network/react-payload-plugin": "^5.0.3",
|
|
51
|
+
"@xyo-network/react-payload-plugin-resolver": "^5.0.3",
|
|
52
|
+
"@xyo-network/react-payload-raw-info": "^5.0.3",
|
|
53
|
+
"@xyo-network/react-payload-table": "^5.0.3",
|
|
54
|
+
"@xyo-network/react-property": "^5.0.3",
|
|
55
|
+
"@xyo-network/react-shared": "^5.0.3",
|
|
56
|
+
"@xyo-network/react-table": "^5.0.3",
|
|
57
|
+
"react-icons": "^5.5.0"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@emotion/react": "^11.14.0",
|
|
61
|
+
"@emotion/styled": "^11.14.0",
|
|
62
|
+
"@mui/icons-material": "^6.4.7",
|
|
63
|
+
"@mui/material": "^6.4.7",
|
|
64
|
+
"@mui/styles": "^6.4.7",
|
|
65
|
+
"@storybook/react": "^8.6.4",
|
|
66
|
+
"@types/react": "^19.0.10",
|
|
67
|
+
"@xylabs/hex": "^4.6.0",
|
|
68
|
+
"@xylabs/ts-scripts-yarn3": "^6.0.9",
|
|
69
|
+
"@xylabs/tsconfig-react": "^6.0.9",
|
|
70
|
+
"@xyo-network/react-storybook": "^5.0.3",
|
|
71
|
+
"eslint": "^9.22.0",
|
|
72
|
+
"react": "^19.0.0",
|
|
73
|
+
"react-dom": "^19.0.0",
|
|
74
|
+
"react-router-dom": "^7.3.0",
|
|
75
|
+
"storybook": "^8.6.4",
|
|
76
|
+
"typescript": "^5.8.2"
|
|
77
|
+
},
|
|
78
|
+
"peerDependencies": {
|
|
79
|
+
"@emotion/react": "^11",
|
|
80
|
+
"@emotion/styled": "^11",
|
|
81
|
+
"@mui/icons-material": "^6",
|
|
82
|
+
"@mui/material": "^6",
|
|
83
|
+
"@mui/styles": "^6",
|
|
84
|
+
"react": "^19",
|
|
85
|
+
"react-dom": "^19",
|
|
86
|
+
"react-router-dom": "^7"
|
|
87
|
+
},
|
|
88
|
+
"publishConfig": {
|
|
89
|
+
"access": "restricted"
|
|
90
|
+
},
|
|
91
|
+
"docs": "dist/docs.json"
|
|
92
|
+
}
|
package/src/Plugin.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Payload } from '@xyo-network/payload-model'
|
|
2
|
+
import { createPayloadRenderPlugin, PayloadRenderPlugin } from '@xyo-network/react-payload-plugin'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
BoundWitnessCardContent, BoundWitnessCardHeader, BoundWitnessDetailsBox,
|
|
6
|
+
} from './components/index.ts'
|
|
7
|
+
|
|
8
|
+
export const BoundWitnessRenderPlugin: PayloadRenderPlugin = {
|
|
9
|
+
...createPayloadRenderPlugin({
|
|
10
|
+
canRender: (payload?: Payload) => payload?.schema === 'network.xyo.boundwitness',
|
|
11
|
+
components: {
|
|
12
|
+
box: { detailsBox: BoundWitnessDetailsBox },
|
|
13
|
+
card: {
|
|
14
|
+
content: BoundWitnessCardContent,
|
|
15
|
+
header: BoundWitnessCardHeader,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
name: 'BoundWitness',
|
|
19
|
+
}),
|
|
20
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Meta, StoryFn } from '@storybook/react'
|
|
2
|
+
import { sampleBlock } from '@xyo-network/react-storybook'
|
|
3
|
+
import React from 'react'
|
|
4
|
+
|
|
5
|
+
import { BoundWitnessRendererCard } from './Card.tsx'
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
component: BoundWitnessRendererCard,
|
|
9
|
+
title: 'plugin/boundwitness/CardRenderer',
|
|
10
|
+
} as Meta
|
|
11
|
+
|
|
12
|
+
const Template: StoryFn<typeof BoundWitnessRendererCard> = (props) => {
|
|
13
|
+
return <BoundWitnessRendererCard {...props} />
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const Default = Template.bind({})
|
|
17
|
+
Default.args = { payload: sampleBlock }
|
|
18
|
+
|
|
19
|
+
const WithActive = Template.bind({})
|
|
20
|
+
WithActive.args = { active: true, payload: sampleBlock }
|
|
21
|
+
|
|
22
|
+
export { Default, WithActive }
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Card, CardProps } from '@mui/material'
|
|
2
|
+
import { BoundWitness } from '@xyo-network/boundwitness-model'
|
|
3
|
+
import { Payload } from '@xyo-network/payload-model'
|
|
4
|
+
import React from 'react'
|
|
5
|
+
|
|
6
|
+
import { BoundWitnessCardContent } from './CardContent/index.ts'
|
|
7
|
+
import { BoundWitnessCardHeader } from './CardHeader/index.ts'
|
|
8
|
+
|
|
9
|
+
export interface BoundWitnessCardProps extends CardProps {
|
|
10
|
+
active?: boolean
|
|
11
|
+
payload?: Payload
|
|
12
|
+
}
|
|
13
|
+
export const BoundWitnessRendererCard: React.FC<BoundWitnessCardProps> = ({
|
|
14
|
+
payload, active, ...props
|
|
15
|
+
}) => {
|
|
16
|
+
const boundwitness = payload as BoundWitness
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<Card {...props}>
|
|
20
|
+
<BoundWitnessCardHeader payload={boundwitness} active={active} hideJSONButton hidePreviousHash hideValidation />
|
|
21
|
+
<BoundWitnessCardContent payload={boundwitness} active={active} />
|
|
22
|
+
</Card>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Avatar, AvatarGroup, AvatarGroupProps,
|
|
3
|
+
} from '@mui/material'
|
|
4
|
+
import { Identicon } from '@xylabs/react-identicon'
|
|
5
|
+
import React, { useRef } from 'react'
|
|
6
|
+
|
|
7
|
+
export interface AddressAvatarGroupProps extends AvatarGroupProps {
|
|
8
|
+
addresses?: string[]
|
|
9
|
+
maxAvatars?: number
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const AddressAvatarGroup: React.FC<AddressAvatarGroupProps> = ({
|
|
13
|
+
addresses, maxAvatars = 4, ...props
|
|
14
|
+
}) => {
|
|
15
|
+
const ref = useRef<HTMLDivElement | null>(null)
|
|
16
|
+
|
|
17
|
+
const size = ref.current ? ref.current.clientWidth * 0.65 : undefined
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<AvatarGroup max={maxAvatars} total={addresses?.length} {...props}>
|
|
21
|
+
{addresses?.map((address, index) => (
|
|
22
|
+
<Avatar key={index + address} title={address} ref={ref} sx={{ bgcolor: 'background.paper' }}>
|
|
23
|
+
<Identicon value={address} position="absolute" p={0.25} top={0} bottom={0} left={0} right={0} size={size} />
|
|
24
|
+
</Avatar>
|
|
25
|
+
))}
|
|
26
|
+
</AvatarGroup>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { CardContentProps } from '@mui/material'
|
|
2
|
+
import { BoundWitness } from '@xyo-network/boundwitness-model'
|
|
3
|
+
import { Payload } from '@xyo-network/payload-model'
|
|
4
|
+
import React, { forwardRef } from 'react'
|
|
5
|
+
|
|
6
|
+
import { AddressAvatarGroup } from './AddressAvatarGroup.tsx'
|
|
7
|
+
import {
|
|
8
|
+
CardColumnsFlex, CardColumnTitleH2, CardContentFlex,
|
|
9
|
+
} from './layout/index.ts'
|
|
10
|
+
import { SchemaAvatarGroup } from './SchemaAvatarGroup.tsx'
|
|
11
|
+
|
|
12
|
+
export interface BoundWitnessCardContentProps extends CardContentProps {
|
|
13
|
+
active?: boolean
|
|
14
|
+
payload?: Payload
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const BoundWitnessCardContent = forwardRef<HTMLDivElement, BoundWitnessCardContentProps>(({
|
|
18
|
+
payload, active, ...props
|
|
19
|
+
}, ref) => {
|
|
20
|
+
const boundwitness = payload as Payload<BoundWitness>
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<CardContentFlex ref={ref} active={active} {...props}>
|
|
24
|
+
<CardColumnsFlex>
|
|
25
|
+
<CardColumnTitleH2>Payloads</CardColumnTitleH2>
|
|
26
|
+
<SchemaAvatarGroup schemas={boundwitness?.payload_schemas} />
|
|
27
|
+
</CardColumnsFlex>
|
|
28
|
+
<CardColumnsFlex>
|
|
29
|
+
<CardColumnTitleH2>Signers</CardColumnTitleH2>
|
|
30
|
+
<AddressAvatarGroup addresses={boundwitness?.addresses} />
|
|
31
|
+
</CardColumnsFlex>
|
|
32
|
+
</CardContentFlex>
|
|
33
|
+
)
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
BoundWitnessCardContent.displayName = 'BoundWitnessCardContent'
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Avatar, AvatarGroup, AvatarGroupProps,
|
|
3
|
+
} from '@mui/material'
|
|
4
|
+
import { BoundWitnessSchema } from '@xyo-network/boundwitness-model'
|
|
5
|
+
import { usePayloadRenderPluginResolver } from '@xyo-network/react-payload-plugin-resolver'
|
|
6
|
+
import React, { useCallback } from 'react'
|
|
7
|
+
// eslint-disable-next-line import-x/no-internal-modules
|
|
8
|
+
import { VscSymbolMethod, VscSymbolNamespace } from 'react-icons/vsc'
|
|
9
|
+
|
|
10
|
+
interface SchemaAvatarGroupProps extends AvatarGroupProps {
|
|
11
|
+
maxAvatars?: number
|
|
12
|
+
schemas?: string[]
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const SchemaAvatarGroup: React.FC<SchemaAvatarGroupProps> = ({
|
|
16
|
+
schemas, maxAvatars = 4, ...props
|
|
17
|
+
}) => {
|
|
18
|
+
const { resolver } = usePayloadRenderPluginResolver()
|
|
19
|
+
|
|
20
|
+
const resolveSchemaToIcon = useCallback(
|
|
21
|
+
(schema: string, index: number) => {
|
|
22
|
+
const SchemaAvatar = resolver?.resolve({ schema })?.components.avatar.image
|
|
23
|
+
return SchemaAvatar
|
|
24
|
+
? <SchemaAvatar key={index + schema} />
|
|
25
|
+
: (
|
|
26
|
+
<Avatar
|
|
27
|
+
key={index + schema}
|
|
28
|
+
title={schema}
|
|
29
|
+
sx={{ bgcolor: 'primary.main', color: 'primary.contrastText' }}
|
|
30
|
+
>
|
|
31
|
+
{schema === BoundWitnessSchema
|
|
32
|
+
? <VscSymbolMethod />
|
|
33
|
+
: <VscSymbolNamespace />}
|
|
34
|
+
</Avatar>
|
|
35
|
+
)
|
|
36
|
+
},
|
|
37
|
+
[resolver],
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<AvatarGroup max={maxAvatars} total={schemas?.length} {...props}>
|
|
42
|
+
{schemas?.map((schema, index) => resolveSchemaToIcon(schema, index))}
|
|
43
|
+
</AvatarGroup>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
styled, Typography, TypographyProps,
|
|
3
|
+
} from '@mui/material'
|
|
4
|
+
import React from 'react'
|
|
5
|
+
|
|
6
|
+
export const CardColumnTitle = styled(Typography, { name: 'CardColumnTitle' })(({ theme }) => ({
|
|
7
|
+
color: theme.palette.text.primary,
|
|
8
|
+
fontWeight: 500,
|
|
9
|
+
}))
|
|
10
|
+
|
|
11
|
+
export const CardColumnTitleH2: React.FC<TypographyProps> = props => <CardColumnTitle {...props} />
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { styled } from '@mui/material'
|
|
2
|
+
import { FlexCol } from '@xylabs/react-flexbox'
|
|
3
|
+
|
|
4
|
+
export const CardColumnsFlex = styled(FlexCol, { name: 'CardColumnsFlex' })(({ theme }) => ({
|
|
5
|
+
['@media only screen and (min-width: 333px)']: { minWidth: '50%' },
|
|
6
|
+
minWidth: '100%',
|
|
7
|
+
rowGap: theme.spacing(1),
|
|
8
|
+
}))
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
alpha, CardContent, styled,
|
|
3
|
+
} from '@mui/material'
|
|
4
|
+
|
|
5
|
+
export interface CardContentFlexProps {
|
|
6
|
+
active?: boolean
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const CardContentFlex = styled(CardContent, { name: 'CardContentFlex', shouldForwardProp: prop => prop !== 'active' })<CardContentFlexProps>(
|
|
10
|
+
({ theme, active }) => ({
|
|
11
|
+
[':last-child']: { paddingBottom: theme.spacing(1) },
|
|
12
|
+
...(active && { background: alpha(theme.palette.secondary.dark, 0.33) }),
|
|
13
|
+
display: 'flex',
|
|
14
|
+
flexDirection: 'row',
|
|
15
|
+
flexWrap: 'wrap',
|
|
16
|
+
justifyContent: 'center',
|
|
17
|
+
rowGap: theme.spacing(1),
|
|
18
|
+
}),
|
|
19
|
+
)
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CardHeader, CardHeaderProps,
|
|
3
|
+
styled, useTheme,
|
|
4
|
+
} from '@mui/material'
|
|
5
|
+
import { Identicon } from '@xylabs/react-identicon'
|
|
6
|
+
import { BoundWitness } from '@xyo-network/boundwitness-model'
|
|
7
|
+
import { Payload } from '@xyo-network/payload-model'
|
|
8
|
+
import { usePayloadHash } from '@xyo-network/react-shared'
|
|
9
|
+
import React, { forwardRef, ReactNode } from 'react'
|
|
10
|
+
|
|
11
|
+
import { BWActions, BWHeading } from '../../_shared/index.ts'
|
|
12
|
+
|
|
13
|
+
export interface BoundWitnessCardHeaderProps extends CardHeaderProps {
|
|
14
|
+
active?: boolean
|
|
15
|
+
activeBgColor?: boolean
|
|
16
|
+
additionalActions?: ReactNode
|
|
17
|
+
hideJSONButton?: boolean
|
|
18
|
+
hidePreviousHash?: boolean
|
|
19
|
+
hideValidation?: boolean
|
|
20
|
+
payload?: Payload
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const BoundWitnessCardHeader = forwardRef<HTMLDivElement, BoundWitnessCardHeaderProps>(
|
|
24
|
+
|
|
25
|
+
({
|
|
26
|
+
active = false,
|
|
27
|
+
activeBgColor = true,
|
|
28
|
+
additionalActions,
|
|
29
|
+
hideJSONButton,
|
|
30
|
+
hidePreviousHash,
|
|
31
|
+
hideValidation,
|
|
32
|
+
payload,
|
|
33
|
+
...props
|
|
34
|
+
}, ref) => {
|
|
35
|
+
const boundwitness = payload as BoundWitness
|
|
36
|
+
const theme = useTheme()
|
|
37
|
+
const hash = usePayloadHash(boundwitness)
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<CardHeaderHash
|
|
41
|
+
ref={ref}
|
|
42
|
+
active={active}
|
|
43
|
+
activeBgColor={activeBgColor}
|
|
44
|
+
title={(
|
|
45
|
+
<BWHeading
|
|
46
|
+
heading={hash}
|
|
47
|
+
IconComponent={(
|
|
48
|
+
<Identicon
|
|
49
|
+
size={Number.parseInt(theme.spacing(2.5).replace('px', ''))}
|
|
50
|
+
p={0.5}
|
|
51
|
+
value={hash}
|
|
52
|
+
sx={{ background: theme.palette.background.paper }}
|
|
53
|
+
/>
|
|
54
|
+
)}
|
|
55
|
+
/>
|
|
56
|
+
)}
|
|
57
|
+
action={(
|
|
58
|
+
<BWActions
|
|
59
|
+
hideJSONButton={hideJSONButton}
|
|
60
|
+
hideValidation={hideValidation}
|
|
61
|
+
hidePreviousHash={hidePreviousHash}
|
|
62
|
+
boundwitness={boundwitness}
|
|
63
|
+
additionalActions={additionalActions}
|
|
64
|
+
/>
|
|
65
|
+
)}
|
|
66
|
+
{...props}
|
|
67
|
+
/>
|
|
68
|
+
)
|
|
69
|
+
},
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
BoundWitnessCardHeader.displayName = 'BoundWitnessCardHeader'
|
|
73
|
+
|
|
74
|
+
interface CardHeaderHashProps extends CardHeaderProps {
|
|
75
|
+
active?: boolean
|
|
76
|
+
activeBgColor?: boolean
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const CardHeaderHash = styled(CardHeader, {
|
|
80
|
+
name: 'CardHeaderHash',
|
|
81
|
+
shouldForwardProp: prop => !['active', 'activeBgColor'].includes(prop as string),
|
|
82
|
+
})<CardHeaderHashProps>(({
|
|
83
|
+
theme, active, activeBgColor,
|
|
84
|
+
}) => ({
|
|
85
|
+
'& .MuiCardHeader-action': {
|
|
86
|
+
marginBottom: 0,
|
|
87
|
+
marginTop: 0,
|
|
88
|
+
},
|
|
89
|
+
'& .MuiCardHeader-content': { overflow: 'visible' },
|
|
90
|
+
'&.MuiCardHeader-root': {
|
|
91
|
+
...(active && activeBgColor && { backgroundColor: theme.palette.info }),
|
|
92
|
+
borderBottom: `1px solid ${theme.palette.divider}`,
|
|
93
|
+
paddingBottom: theme.spacing(1),
|
|
94
|
+
paddingTop: theme.spacing(1),
|
|
95
|
+
},
|
|
96
|
+
'padding': `${theme.spacing(0.5)} ${theme.spacing(2)}`,
|
|
97
|
+
}))
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './CardHeader.tsx'
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Typography } from '@mui/material'
|
|
2
|
+
import { FlexRow } from '@xylabs/react-flexbox'
|
|
3
|
+
import { BoundWitness } from '@xyo-network/boundwitness-model'
|
|
4
|
+
import { useEvent } from '@xyo-network/react-event'
|
|
5
|
+
import {
|
|
6
|
+
Property, PropertyGroup, PropertyGroupProps,
|
|
7
|
+
} from '@xyo-network/react-property'
|
|
8
|
+
import React from 'react'
|
|
9
|
+
|
|
10
|
+
export type BoundWitnessLinksDetails = PropertyGroupProps & {
|
|
11
|
+
value?: BoundWitness
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const BoundWitnessLinksDetails: React.FC<BoundWitnessLinksDetails> = ({ value, ...props }) => {
|
|
15
|
+
let elevation = 2
|
|
16
|
+
if (props.paper) {
|
|
17
|
+
elevation += props.elevation ?? 0
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const [ref, dispatch] = useEvent<HTMLDivElement>()
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<PropertyGroup titleProps={{ elevation }} title="Links" tip="Blocks that are linked to this block" {...props}>
|
|
24
|
+
{value?.previous_hashes.map((hash) => {
|
|
25
|
+
return (
|
|
26
|
+
<Property key={hash} titleProps={{ elevation }} flexGrow={1} title="Previous Hash" tip={hash}>
|
|
27
|
+
{hash
|
|
28
|
+
? (
|
|
29
|
+
<FlexRow ref={ref} onClick={() => dispatch?.('boundwitness', 'click', hash)}>
|
|
30
|
+
<Typography fontFamily="monospace">{hash}</Typography>
|
|
31
|
+
</FlexRow>
|
|
32
|
+
)
|
|
33
|
+
: 'None'}
|
|
34
|
+
</Property>
|
|
35
|
+
)
|
|
36
|
+
})}
|
|
37
|
+
</PropertyGroup>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Meta, StoryFn } from '@storybook/react'
|
|
2
|
+
import { Payload } from '@xyo-network/payload-model'
|
|
3
|
+
import { useEvent } from '@xyo-network/react-event'
|
|
4
|
+
import { sampleAddressHistory } from '@xyo-network/react-storybook'
|
|
5
|
+
import React, { useRef } from 'react'
|
|
6
|
+
|
|
7
|
+
import { BoundWitnessDetailsBox } from './DetailsBox.tsx'
|
|
8
|
+
|
|
9
|
+
const StorybookEntry = {
|
|
10
|
+
argTypes: {},
|
|
11
|
+
component: BoundWitnessDetailsBox,
|
|
12
|
+
parameters: { docs: { page: null } },
|
|
13
|
+
title: 'plugin/boundwitness/DetailsBox',
|
|
14
|
+
} as Meta<typeof BoundWitnessDetailsBox>
|
|
15
|
+
|
|
16
|
+
const Template: StoryFn<typeof BoundWitnessDetailsBox> = (args) => {
|
|
17
|
+
const sharedRef = useRef<HTMLDivElement>(null)
|
|
18
|
+
useEvent<HTMLDivElement>((noun, verb, data) => console.log(`[${noun}|${verb}|${data}]`), sharedRef)
|
|
19
|
+
useEvent<HTMLDivElement>(() => console.log('2nd Listener'), sharedRef)
|
|
20
|
+
useEvent<HTMLDivElement>(() => console.log('3rd Listener'), sharedRef)
|
|
21
|
+
|
|
22
|
+
return <BoundWitnessDetailsBox ref={sharedRef} {...args} />
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const Default = Template.bind({})
|
|
26
|
+
Default.args = {}
|
|
27
|
+
|
|
28
|
+
const WithNoData = Template.bind({})
|
|
29
|
+
WithNoData.args = {
|
|
30
|
+
payload: {
|
|
31
|
+
_signatures: [],
|
|
32
|
+
addresses: [],
|
|
33
|
+
payload_hashes: [],
|
|
34
|
+
payload_schemas: [],
|
|
35
|
+
previous_hashes: [],
|
|
36
|
+
schema: 'network.xyo.boundwitness',
|
|
37
|
+
} as Payload,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const WithData = Template.bind({})
|
|
41
|
+
WithData.args = { payload: sampleAddressHistory[1] }
|
|
42
|
+
|
|
43
|
+
const WithNestedBWPayloads = Template.bind({})
|
|
44
|
+
WithNestedBWPayloads.args = {
|
|
45
|
+
payload: {
|
|
46
|
+
$signatures: ['2a6c7e55d2344ec4f839296fcdc88b11dd27b474e832e1227d956838247d7183c2d47c24b4fe1b07c623e039c78babb08f1f12131747673175475c1abf0f719f'],
|
|
47
|
+
addresses: ['db8af7b3084f5a03589af4915e37cbeb3f19afb0'],
|
|
48
|
+
payload_hashes: [
|
|
49
|
+
'1d31053d99a3392f717c7f775df5fc0f999725fb57d705ddcbc01ee4f7288b6d',
|
|
50
|
+
'29fd0b9b3207a55be2bff6022176c041863c7074eb573e103fe571295d263952',
|
|
51
|
+
'c8ab93c970f4ef0d68ee22efd0119f228c089ae77551eda6e707b24bcec589ec',
|
|
52
|
+
],
|
|
53
|
+
payload_schemas: ['network.xyo.boundwitness', 'network.xyo.id', 'network.xyo.query.archivist.insert'],
|
|
54
|
+
previous_hashes: ['d67b91381ca8015613361470ff3e5dad3618d0ba471af21a1db89b0024c9322e'],
|
|
55
|
+
query: 'c8ab93c970f4ef0d68ee22efd0119f228c089ae77551eda6e707b24bcec589ec',
|
|
56
|
+
schema: 'network.xyo.boundwitness.query',
|
|
57
|
+
timestamp: 1_676_043_487_737,
|
|
58
|
+
} as Payload,
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export {
|
|
62
|
+
Default, WithData, WithNestedBWPayloads, WithNoData,
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export default StorybookEntry
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Divider } from '@mui/material'
|
|
2
|
+
import { FlexBoxProps, FlexCol } from '@xylabs/react-flexbox'
|
|
3
|
+
import { BoundWitness, BoundWitnessSchema } from '@xyo-network/boundwitness-model'
|
|
4
|
+
import { PayloadDetailsListRenderProps, PayloadDetailsRenderProps } from '@xyo-network/react-payload-plugin'
|
|
5
|
+
import { usePayloadHash } from '@xyo-network/react-shared'
|
|
6
|
+
import { TableHeightProvider } from '@xyo-network/react-table'
|
|
7
|
+
import React, { forwardRef, useMemo } from 'react'
|
|
8
|
+
// eslint-disable-next-line import-x/no-internal-modules
|
|
9
|
+
import { FaSignature } from 'react-icons/fa'
|
|
10
|
+
// eslint-disable-next-line import-x/no-internal-modules
|
|
11
|
+
import { VscSymbolMethod, VscSymbolNamespace } from 'react-icons/vsc'
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
BoundWitnessPayloadsTable,
|
|
15
|
+
BoundWitnessPayloadsTableForBWs,
|
|
16
|
+
BoundWitnessSignatureTable,
|
|
17
|
+
BWActions,
|
|
18
|
+
HashHeadingPaper,
|
|
19
|
+
HeadingPaper,
|
|
20
|
+
} from '../../_shared/index.ts'
|
|
21
|
+
|
|
22
|
+
const BoundWitnessDetailsBox: React.FC<PayloadDetailsListRenderProps & FlexBoxProps> = ({ visibleRows, ...props }) => {
|
|
23
|
+
return (
|
|
24
|
+
<TableHeightProvider defaultVisibleRows={visibleRows} additionalRows={1}>
|
|
25
|
+
<BoundWitnessDetailsBoxInner {...props} />
|
|
26
|
+
</TableHeightProvider>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
BoundWitnessDetailsBox.displayName = 'BoundWitnessDetailsBox'
|
|
31
|
+
|
|
32
|
+
const BoundWitnessDetailsBoxInner: React.FC<PayloadDetailsRenderProps & FlexBoxProps> = ({ payload, ...props }) => {
|
|
33
|
+
const boundWitness = payload as BoundWitness
|
|
34
|
+
const partialBoundWitness = boundWitness as Partial<BoundWitness>
|
|
35
|
+
const hash = usePayloadHash(payload)
|
|
36
|
+
|
|
37
|
+
const hasBWPayloads = useMemo(() => (partialBoundWitness ? partialBoundWitness.payload_schemas?.includes(BoundWitnessSchema) : false), [partialBoundWitness])
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<FlexCol alignItems="stretch" rowGap={4} {...props}>
|
|
41
|
+
<HashHeadingPaper
|
|
42
|
+
hash={hash}
|
|
43
|
+
paperProps={{ sx: { p: 2 } }}
|
|
44
|
+
AdornmentEnd={<BWActions boundwitness={boundWitness} />}
|
|
45
|
+
identiconProps={{ p: 0.75, size: 24 }}
|
|
46
|
+
/>
|
|
47
|
+
<Divider flexItem />
|
|
48
|
+
<FlexCol alignItems="stretch" rowGap={1} mb={1}>
|
|
49
|
+
<HeadingPaper IconComponent={<VscSymbolNamespace />} heading="Payloads" />
|
|
50
|
+
<BoundWitnessPayloadsTable boundwitness={boundWitness} />
|
|
51
|
+
</FlexCol>
|
|
52
|
+
{hasBWPayloads
|
|
53
|
+
? (
|
|
54
|
+
<FlexCol alignItems="stretch" rowGap={1} mb={1}>
|
|
55
|
+
<HeadingPaper IconComponent={<VscSymbolMethod />} heading="Bound Witnesses" />
|
|
56
|
+
<BoundWitnessPayloadsTableForBWs boundwitness={boundWitness} />
|
|
57
|
+
</FlexCol>
|
|
58
|
+
)
|
|
59
|
+
: null}
|
|
60
|
+
<FlexCol alignItems="stretch" rowGap={1} mb={1}>
|
|
61
|
+
<HeadingPaper IconComponent={<FaSignature />} heading="Signatures" />
|
|
62
|
+
<BoundWitnessSignatureTable block={boundWitness} />
|
|
63
|
+
</FlexCol>
|
|
64
|
+
</FlexCol>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
BoundWitnessDetailsBoxInner.displayName = 'BoundWitnessDetailsBoxInner'
|
|
69
|
+
|
|
70
|
+
export { BoundWitnessDetailsBox }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './DetailsBox.tsx'
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Decorator, Meta, StoryFn,
|
|
3
|
+
} from '@storybook/react'
|
|
4
|
+
import { useEvent } from '@xyo-network/react-event'
|
|
5
|
+
import { sampleBlock } from '@xyo-network/react-storybook'
|
|
6
|
+
import React, { useRef } from 'react'
|
|
7
|
+
|
|
8
|
+
import { BoundWitnessDetailsCard } from './DetailsCard.tsx'
|
|
9
|
+
|
|
10
|
+
const WithEventDecorator: Decorator = (Story, args) => {
|
|
11
|
+
const ref = useRef<HTMLDivElement | null>(null)
|
|
12
|
+
const [tableRef] = useEvent<HTMLDivElement>((noun, verb, data) => console.log(`${noun}|${verb}|${data}`), ref)
|
|
13
|
+
args.args.ref = tableRef
|
|
14
|
+
|
|
15
|
+
return <Story {...args} />
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default {
|
|
19
|
+
component: BoundWitnessDetailsCard,
|
|
20
|
+
title: 'plugin/boundwitness/DetailsCard',
|
|
21
|
+
} as Meta
|
|
22
|
+
|
|
23
|
+
const Template: StoryFn<typeof BoundWitnessDetailsCard> = props => <BoundWitnessDetailsCard {...props} />
|
|
24
|
+
|
|
25
|
+
const Default = Template.bind({})
|
|
26
|
+
Default.args = { payload: sampleBlock }
|
|
27
|
+
|
|
28
|
+
const WithRef = Template.bind({})
|
|
29
|
+
WithRef.decorators = [WithEventDecorator]
|
|
30
|
+
WithRef.args = { payload: sampleBlock }
|
|
31
|
+
|
|
32
|
+
const WithVisibleRows = Template.bind({})
|
|
33
|
+
WithVisibleRows.args = { payload: sampleBlock, visibleRows: 3 }
|
|
34
|
+
|
|
35
|
+
export {
|
|
36
|
+
Default, WithRef, WithVisibleRows,
|
|
37
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CardProps } from '@mui/material'
|
|
2
|
+
import { PayloadDetailsListRenderProps } from '@xyo-network/react-payload-plugin'
|
|
3
|
+
import { TableHeightProvider } from '@xyo-network/react-table'
|
|
4
|
+
import React, { forwardRef } from 'react'
|
|
5
|
+
|
|
6
|
+
import { BoundWitnessDetailsCardInner } from './DetailsCardInner.tsx'
|
|
7
|
+
|
|
8
|
+
const BoundWitnessDetailsCard = forwardRef<HTMLDivElement, PayloadDetailsListRenderProps & CardProps>(({ visibleRows, ...props }, ref) => {
|
|
9
|
+
return (
|
|
10
|
+
<TableHeightProvider defaultVisibleRows={visibleRows} additionalRows={1}>
|
|
11
|
+
<BoundWitnessDetailsCardInner ref={ref} {...props} />
|
|
12
|
+
</TableHeightProvider>
|
|
13
|
+
)
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
BoundWitnessDetailsCard.displayName = 'BoundWitnessDetailsCard'
|
|
17
|
+
|
|
18
|
+
export { BoundWitnessDetailsCard }
|