|
1 | | -import { Button, Card, Text } from "@stellar/design-system"; |
| 1 | +import { Button, Card, Link, Text } from "@stellar/design-system"; |
2 | 2 | import { Box } from "../../components/layout/Box"; |
3 | 3 | import { useState } from "react"; |
| 4 | +import { labPrefix } from "../../contracts/util"; |
4 | 5 |
|
5 | 6 | type ValidationResponseCard = { |
6 | 7 | variant: "primary" | "success" | "error"; |
@@ -68,6 +69,15 @@ export const ValidationResponseCard = ({ |
68 | 69 | }: ValidationResponseCard) => { |
69 | 70 | const [isExpanded, setIsExpanded] = useState(false); |
70 | 71 |
|
| 72 | + const txHash = |
| 73 | + typeof summary === "object" && summary !== null && "_owner" in summary |
| 74 | + ? (( |
| 75 | + summary as { |
| 76 | + _owner?: { memoizedProps?: { response?: { hash?: string } } }; |
| 77 | + } |
| 78 | + )._owner?.memoizedProps?.response?.hash ?? "") |
| 79 | + : ""; |
| 80 | + |
71 | 81 | const renderSummary = () => { |
72 | 82 | if (summary) { |
73 | 83 | return ( |
@@ -109,22 +119,30 @@ export const ValidationResponseCard = ({ |
109 | 119 | style={{ display: "flex", flexDirection: "column", gap: "2 rem" }} |
110 | 120 | > |
111 | 121 | {renderSummary()} |
112 | | - |
113 | | - <Button |
114 | | - title="Expand" |
115 | | - variant="tertiary" |
116 | | - size="sm" |
117 | | - onClick={() => setIsExpanded(!isExpanded)} |
118 | | - style={ |
119 | | - { |
120 | | - // ...styles.responsiveButtons, |
121 | | - alignSelf: "flex-end", |
122 | | - marginBottom: "1rem", |
123 | | - } as React.CSSProperties |
124 | | - } |
| 122 | + <Box |
| 123 | + gap="xs" |
| 124 | + direction="row" |
| 125 | + style={{ alignSelf: "flex-end", marginBottom: "1rem" }} |
125 | 126 | > |
126 | | - {isExpanded ? "Hide " : "Show "} Details |
127 | | - </Button> |
| 127 | + <Button |
| 128 | + title="Expand" |
| 129 | + variant="tertiary" |
| 130 | + size="sm" |
| 131 | + onClick={() => setIsExpanded(!isExpanded)} |
| 132 | + > |
| 133 | + {isExpanded ? "Hide " : "Show "} Details |
| 134 | + </Button> |
| 135 | + {txHash ? ( |
| 136 | + <Link |
| 137 | + href={`${labPrefix()}&txDashboard$transactionHash=${txHash}`} |
| 138 | + size="xs" |
| 139 | + > |
| 140 | + See on lab |
| 141 | + </Link> |
| 142 | + ) : ( |
| 143 | + <></> |
| 144 | + )} |
| 145 | + </Box> |
128 | 146 | {isExpanded && ( |
129 | 147 | <Card variant="secondary" noPadding> |
130 | 148 | <div style={styles.content}> |
|
0 commit comments