@@ -3,7 +3,6 @@ import { Box } from "@mui/material";
33import { Trans } from "react-i18next" ;
44
55import { Button , Radio , Typography } from "@atoms" ;
6- import { fadedPurple } from "@/consts" ;
76import { useModal } from "@context" ;
87import {
98 useScreenDimension ,
@@ -13,6 +12,7 @@ import {
1312 useGetVoteContextTextFromFile ,
1413} from "@hooks" ;
1514import { formatDisplayDate } from "@utils" ;
15+ import { fadedPurple } from "@/consts" ;
1616import { ProposalData , ProposalVote , Vote } from "@/models" ;
1717import { VoteContextModalState , SubmittedVotesModalState } from "../organisms" ;
1818
@@ -36,9 +36,9 @@ export const VoteActionForm = ({
3636 useState < boolean > ( false ) ;
3737
3838 const { voter } = useGetVoterInfo ( ) ;
39- const { voteContextText } = useGetVoteContextTextFromFile ( voteContextUrl , voteContextHash ) ;
39+ const { voteContextText } = useGetVoteContextTextFromFile ( voteContextUrl , voteContextHash ) ;
4040
41- const { isMobile, screenWidth } = useScreenDimension ( ) ;
41+ const { isMobile } = useScreenDimension ( ) ;
4242 const { openModal, closeModal } = useModal ( ) ;
4343 const { t } = useTranslation ( ) ;
4444
@@ -60,11 +60,11 @@ export const VoteActionForm = ({
6060 setVoteContextUrl ( url ) ;
6161 setVoteContextHash ( hash ?? undefined ) ;
6262 confirmVote ( vote as Vote , url , hash ) ;
63- setVoteContextData ( url , hash ) ;
63+ setVoteContextData ( url , hash ) ;
6464 } ,
6565 vote : vote as Vote ,
6666 confirmVote,
67- previousRationale : isVoteChanged ? undefined : voteContextText
67+ previousRationale : isVoteChanged ? undefined : voteContextText
6868 } satisfies VoteContextModalState ,
6969 } ) ;
7070 } ;
@@ -78,7 +78,6 @@ export const VoteActionForm = ({
7878 if ( previousVote ?. vote ) {
7979 setValue ( "vote" , previousVote . vote ) ;
8080 setIsVoteSubmitted ( true ) ;
81-
8281 }
8382 } , [ previousVote ?. vote , setValue , setIsVoteSubmitted ] ) ;
8483
@@ -90,32 +89,32 @@ export const VoteActionForm = ({
9089 setVoteContextHash ( previousVote . metadataHash ) ;
9190 }
9291 } , [ previousVote ?. url , setVoteContextUrl ] ) ;
93-
92+
9493 const renderCancelButton = useMemo (
9594 ( ) => (
9695 < Button
97- data-testid = "cancel-button"
98- onClick = { ( ) => setValue ( "vote" , previousVote ?. vote ?? "" ) }
96+ data-testid = "cancel-button"
97+ onClick = { ( ) => setValue ( "vote" , previousVote ?. vote ?? "" ) }
9998 variant = "outlined"
10099 size = "extraLarge"
101100 sx = { {
102101 width : "100%" ,
103102 } }
104- >
103+ >
105104 { t ( "cancel" ) }
106105 </ Button >
107106 ) ,
108107 [ previousVote ?. vote , setValue ] ,
109108 ) ;
110-
109+
111110 const renderChangeVoteButton = useMemo (
112111 ( ) => (
113112 < Button
114- data-testid = "change-vote"
115- onClick = { ( ) => handleVoteClick ( true ) }
116- disabled = { ! canVote }
117- isLoading = { isVoteLoading }
118- variant = "contained"
113+ data-testid = "change-vote"
114+ onClick = { ( ) => handleVoteClick ( true ) }
115+ disabled = { ! canVote }
116+ isLoading = { isVoteLoading }
117+ variant = "contained"
119118 sx = { {
120119 borderRadius : 50 ,
121120 textTransform : "none" ,
@@ -129,10 +128,6 @@ export const VoteActionForm = ({
129128 [ confirmVote , areFormErrors , vote , isVoteLoading ] ,
130129 ) ;
131130
132- useEffect ( ( ) => {
133- console . log ( previousVote ?. metadataHash , voteContextHash )
134- } , [ previousVote ?. metadataHash , voteContextHash ] )
135-
136131 return (
137132 < Box
138133 sx = { {
@@ -249,19 +244,19 @@ export const VoteActionForm = ({
249244 ) }
250245 { voteContextText && (
251246 < >
252- < Typography sx = { { fontSize : "14px" , fontWeight : 500 } } > { t ( "govActions.yourVoteRationale" ) } </ Typography >
253- < Box
254- sx = { {
247+ < Typography sx = { { fontSize : "14px" , fontWeight : 500 } } > { t ( "govActions.yourVoteRationale" ) } </ Typography >
248+ < Box
249+ sx = { {
255250 display : "flex" ,
256251 flexDirection : "column" ,
257- justifyContent : "space-between" ,
252+ justifyContent : "space-between" ,
258253 width : "100%" ,
259254 mt : 2 ,
260255 } }
261- >
262- { voteContextText && (
263- < Box
264- sx = { {
256+ >
257+ { voteContextText && (
258+ < Box
259+ sx = { {
265260 position : "relative" ,
266261 width : "100%" ,
267262 mt : 2 ,
@@ -270,10 +265,10 @@ export const VoteActionForm = ({
270265 backgroundColor : ! showWholeVoteContext ? fadedPurple . c50 : "transparent" ,
271266 padding : 2 ,
272267 } }
273- >
274- < Typography
275- variant = "body2"
276- sx = { {
268+ >
269+ < Typography
270+ variant = "body2"
271+ sx = { {
277272 fontWeight : 400 ,
278273 color : "neutralGray" ,
279274 whiteSpace : "pre-wrap" ,
@@ -285,56 +280,55 @@ export const VoteActionForm = ({
285280 WebkitLineClamp : 2 ,
286281 } ) ,
287282 } }
288- >
289- { voteContextText }
290- </ Typography >
283+ >
284+ { voteContextText }
285+ </ Typography >
291286
292- { ! showWholeVoteContext && (
293- < Box
294- sx = { {
287+ { ! showWholeVoteContext && (
288+ < Box
289+ sx = { {
295290 display : "flex" ,
296291 justifyContent : "flex-end" ,
297292 position : "absolute" ,
298293 bottom : 8 ,
299294 right : 16 ,
300295 background : fadedPurple . c50 ,
301296 } }
302- >
303- < Button
304- onClick = { ( ) => setShowWholeVoteContext ( true ) }
305- sx = { {
297+ >
298+ < Button
299+ onClick = { ( ) => setShowWholeVoteContext ( true ) }
300+ sx = { {
306301 p : 0 ,
307302 minWidth : "unset" ,
308303 ":hover" : { backgroundColor : "transparent" } ,
309304 } }
310- disableRipple
311- variant = "text"
312- data-testid = "external-modal-button"
313- >
314- < Typography
315- variant = "body2"
316- sx = { {
305+ disableRipple
306+ variant = "text"
307+ data-testid = "external-modal-button"
308+ >
309+ < Typography
310+ variant = "body2"
311+ sx = { {
317312 fontWeight : 400 ,
318313 color : "primaryBlue" ,
319314 borderBottom : "1px solid" ,
320315 } }
321- >
322- { t ( "showMore" ) }
323- </ Typography >
324- </ Button >
325- </ Box >
316+ >
317+ { t ( "showMore" ) }
318+ </ Typography >
319+ </ Button >
320+ </ Box >
326321 ) }
327- </ Box >
322+ </ Box >
328323 ) }
329324
330- </ Box >
325+ </ Box >
331326 </ >
332327 ) }
333328
334- < Box sx = { { mt : 4 } } >
335- </ Box >
329+ < Box sx = { { mt : 4 } } />
336330 </ Box >
337- { previousVote ?. vote && previousVote ?. vote !== vote ? (
331+ { previousVote ?. vote && previousVote ?. vote !== vote ? (
338332 < Box
339333 display = "flex"
340334 flexDirection = { isMobile ? "column" : "row" }
@@ -355,7 +349,7 @@ export const VoteActionForm = ({
355349 : ! vote || areFormErrors
356350 }
357351 isLoading = { isVoteLoading }
358- onClick = { ( ) => handleVoteClick ( false ) }
352+ onClick = { ( ) => handleVoteClick ( false ) }
359353 size = "extraLarge"
360354 >
361355 { previousVote ?. vote && previousVote ?. vote === vote
0 commit comments