Skip to content

Commit d58b8a6

Browse files
committed
feat(#2911): show drep metadata url and hash on detailed profile view
1 parent 07d521b commit d58b8a6

File tree

3 files changed

+52
-2
lines changed

3 files changed

+52
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ changes.
1212

1313
### Added
1414

15-
-
15+
- Add metadata url and hash to drep details [Issue 2911](https://github.com/IntersectMBO/govtool/issues/2911)
1616

1717
### Fixed
1818

govtool/frontend/src/components/organisms/DRepDetailsCard.tsx

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export const DRepDetailsCard = ({
4848
drepId,
4949
votingPower,
5050
isScriptBased,
51+
metadataHash,
5152
} = dRepData;
5253

5354
const groupedReferences = references?.reduce<Record<string, Reference[]>>(
@@ -235,6 +236,53 @@ export const DRepDetailsCard = ({
235236
/>
236237
)}
237238
</DRepDetailsInfoItem>
239+
{url && (
240+
<DRepDetailsInfoItem
241+
label={t("forms.dRepData.metadataUrl")}
242+
dataTestId="metadata-url"
243+
>
244+
<Link
245+
data-testid="metadata-url-link"
246+
href={url}
247+
target="_blank"
248+
sx={{
249+
overflow: "hidden",
250+
textOverflow: "ellipsis",
251+
display: "flex",
252+
gap: 1,
253+
alignItems: "center",
254+
}}
255+
>
256+
<Typography
257+
color="primary"
258+
fontWeight={400}
259+
sx={{
260+
overflow: "hidden",
261+
textOverflow: "ellipsis",
262+
}}
263+
>
264+
{url}
265+
</Typography>
266+
<img
267+
alt="link"
268+
height={16}
269+
src={ICONS.externalLinkIcon}
270+
width={16}
271+
/>
272+
</Link>
273+
</DRepDetailsInfoItem>
274+
)}
275+
{metadataHash && (
276+
<DRepDetailsInfoItem
277+
label={t("forms.dRepData.metadataHash")}
278+
dataTestId="metadata-hash"
279+
>
280+
<CopyableText
281+
value={metadataHash}
282+
dataTestId="copy-metadata-hash"
283+
/>
284+
</DRepDetailsInfoItem>
285+
)}
238286
</>
239287
)}
240288
{/* CIP-119 DATA END */}

govtool/frontend/src/i18n/locales/en.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,9 @@
328328
"references": "References",
329329
"referenceDescription": "Description",
330330
"referenceDescriptionHelpfulText": "Limit: 80 characters",
331-
"referenceURL": "URL"
331+
"referenceURL": "URL",
332+
"metadataUrl": "Metadata URL",
333+
"metadataHash": "Metadata Hash"
332334
},
333335
"errors": {
334336
"tooLongUrl": "Url must be less than 128 bytes",

0 commit comments

Comments
 (0)