File tree Expand file tree Collapse file tree 3 files changed +15
-4
lines changed Expand file tree Collapse file tree 3 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -160,6 +160,8 @@ const ProposalTypeAndProposer: React.FC<{ proposal: Proposal }> = ({
160
160
} ) => {
161
161
const { type, proposerAddress, submitTime } = proposal ;
162
162
163
+ const typeNameId = getProposalTypeMessage ( type ) ;
164
+
163
165
return (
164
166
< div
165
167
className = { cn (
@@ -175,7 +177,7 @@ const ProposalTypeAndProposer: React.FC<{ proposal: Proposal }> = ({
175
177
< LocalizedText messageID = "ProposalDetail.proposalType" />
176
178
</ p >
177
179
< p className = { cn ( "text-sm" , "mb-4" ) } >
178
- < LocalizedText messageID = { getProposalTypeMessage ( type ) } />
180
+ { typeNameId !== null ? < LocalizedText messageID = { typeNameId } /> : type }
179
181
</ p >
180
182
< p className = { cn ( "text-sm" , "text-app-lightgreen" , "mb-1" ) } >
181
183
< LocalizedText messageID = "ProposalDetail.publishedBy" />
Original file line number Diff line number Diff line change @@ -50,6 +50,11 @@ const ProposalCard: React.FC<ProposalCardProps> = (props) => {
50
50
} ) ;
51
51
} , [ proposal ] ) ;
52
52
53
+ const proposalTypeNameId = useMemo (
54
+ ( ) => getProposalTypeMessage ( proposal . type ) ,
55
+ [ proposal ]
56
+ ) ;
57
+
53
58
return (
54
59
< div
55
60
className = { cn (
@@ -86,7 +91,11 @@ const ProposalCard: React.FC<ProposalCardProps> = (props) => {
86
91
"text-app-darkgrey"
87
92
) }
88
93
>
89
- < LocalizedText messageID = { getProposalTypeMessage ( proposal . type ) } />
94
+ { proposalTypeNameId !== null ? (
95
+ < LocalizedText messageID = { proposalTypeNameId } />
96
+ ) : (
97
+ proposal . type
98
+ ) }
90
99
</ span >
91
100
< h1
92
101
className = { cn (
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ export function getProposalStatusBadgeConfig(
27
27
}
28
28
}
29
29
30
- export function getProposalTypeMessage ( type : ProposalType ) : MessageID {
30
+ export function getProposalTypeMessage ( type : string ) : MessageID | null {
31
31
switch ( type ) {
32
32
case ProposalType . Text :
33
33
return "ProposalScreen.proposalType.text" ;
@@ -40,7 +40,7 @@ export function getProposalTypeMessage(type: ProposalType): MessageID {
40
40
case ProposalType . CancelSoftwareUpgrade :
41
41
return "ProposalScreen.proposalType.cancelSoftwareUpgrade" ;
42
42
default :
43
- throw new Error ( "Unknown proposal type" ) ;
43
+ return null ;
44
44
}
45
45
}
46
46
You can’t perform that action at this time.
0 commit comments