File tree Expand file tree Collapse file tree 5 files changed +45
-20
lines changed
Expand file tree Collapse file tree 5 files changed +45
-20
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ changes.
1313### Added
1414
1515- add support for CIP-129 governance identifiers [ Issue 2183] ( https://github.com/IntersectMBO/govtool/issues/2183 )
16+ - Add label to supporting links in Governance Action details [ Issue 2305] ( https://github.com/IntersectMBO/govtool/issues/2305 )
1617
1718### Fixed
1819
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ import { LinkWithIcon } from "@molecules";
99export const GovernanceActionDetailsCardLinks = ( {
1010 links,
1111} : {
12- links ?: string [ ] ;
12+ links ?: Reference [ ] ;
1313} ) => {
1414 const { isMobile } = useScreenDimension ( ) ;
1515 const { t } = useTranslation ( ) ;
@@ -41,21 +41,31 @@ export const GovernanceActionDetailsCardLinks = ({
4141 rowGap : 2 ,
4242 } }
4343 >
44- { links . map ( ( link ) => (
45- < LinkWithIcon
46- key = { link }
47- label = { link }
48- onClick = { ( ) => {
49- openModal ( {
50- type : "externalLink" ,
51- state : {
52- externalLink : link ,
53- } ,
54- } ) ;
55- } }
56- icon = { < img alt = "link" src = { ICONS . link } /> }
57- cutWithEllipsis
58- />
44+ { links . map ( ( { uri, label } ) => (
45+ < Box flexDirection = "column" >
46+ { label && (
47+ < Typography
48+ data-testid = { `${ label } -${ uri } -label` }
49+ sx = { { fontWeight : "500" } }
50+ >
51+ { label }
52+ </ Typography >
53+ ) }
54+ < LinkWithIcon
55+ key = { uri }
56+ label = { uri }
57+ onClick = { ( ) => {
58+ openModal ( {
59+ type : "externalLink" ,
60+ state : {
61+ externalLink : uri ,
62+ } ,
63+ } ) ;
64+ } }
65+ icon = { < img alt = "link" src = { ICONS . link } /> }
66+ cutWithEllipsis
67+ />
68+ </ Box >
5969 ) ) }
6070 </ Box >
6171 </ >
Original file line number Diff line number Diff line change @@ -176,7 +176,7 @@ export type ProposalDataDTO = {
176176 abstract ?: string ;
177177 motivation ?: string ;
178178 rationale ?: string ;
179- references ?: string [ ] ;
179+ references ?: Reference [ ] ;
180180 title ?: string ;
181181 protocolParams : EpochParams | null ;
182182} & SubmittedVotesData ;
Original file line number Diff line number Diff line change @@ -52,6 +52,13 @@ const commonArgs = {
5252 metadataHash : "exampleMetadataHash" ,
5353 metadataStatus : null ,
5454 metadataValid : true ,
55+ references : [
56+ {
57+ "@type" : "Reference" ,
58+ uri : "https://exampleurl.com" ,
59+ label : "Example label" ,
60+ } ,
61+ ] ,
5562 } satisfies ProposalData ,
5663} ;
5764
@@ -110,6 +117,15 @@ export const GovernanceActionDetailsCardComponent: Story = {
110117
111118 await expect ( canvas . getByText ( args . proposal . title ! ) ) . toBeInTheDocument ( ) ;
112119
120+ if ( args . proposal . references ?. [ 0 ] ) {
121+ await expect (
122+ canvas . getByText ( args . proposal . references [ 0 ] . label ) ,
123+ ) . toBeInTheDocument ( ) ;
124+ await expect (
125+ canvas . getByText ( args . proposal . references [ 0 ] . uri ) ,
126+ ) . toBeInTheDocument ( ) ;
127+ }
128+
113129 await assertGovActionDetails ( canvas , args ) ;
114130 const [ tooltip1 , tooltip2 ] = canvas . getAllByTestId ( "InfoOutlinedIcon" ) ;
115131
Original file line number Diff line number Diff line change @@ -22,9 +22,7 @@ export const mapDtoToProposal = async (
2222 abstract : dto . abstract || validationResponse . metadata ?. abstract ,
2323 motivation : dto . motivation || validationResponse . metadata ?. motivation ,
2424 rationale : dto . rationale || validationResponse . metadata ?. rationale ,
25- references : validationResponse . metadata ?. references ?. map (
26- ( { uri } ) => uri ,
27- ) ,
25+ references : validationResponse . metadata ?. references || [ ] ,
2826 metadataStatus : validationResponse . status || null ,
2927 metadataValid : validationResponse . valid ,
3028 } ;
You can’t perform that action at this time.
0 commit comments