Skip to content

Commit 8ed023f

Browse files
committed
chore: fix es lint issues
1 parent 85c0c76 commit 8ed023f

File tree

12 files changed

+200
-216
lines changed

12 files changed

+200
-216
lines changed

govtool/frontend/src/components/molecules/VoteActionForm.tsx

Lines changed: 54 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { Box } from "@mui/material";
33
import { Trans } from "react-i18next";
44

55
import { Button, Radio, Typography } from "@atoms";
6-
import { fadedPurple } from "@/consts";
76
import { useModal } from "@context";
87
import {
98
useScreenDimension,
@@ -13,6 +12,7 @@ import {
1312
useGetVoteContextTextFromFile,
1413
} from "@hooks";
1514
import { formatDisplayDate } from "@utils";
15+
import { fadedPurple } from "@/consts";
1616
import { ProposalData, ProposalVote, Vote } from "@/models";
1717
import { 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

govtool/frontend/src/components/organisms/VoteContext/VoteContextChoice.tsx

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ type VoteContextChoiceProps = {
1414
setJsonldContent: Dispatch<SetStateAction<NodeObject | null>>;
1515
setMetadataHash: Dispatch<SetStateAction<string | null>>;
1616
generateMetadata: () => Promise<{ jsonld: NodeObject; jsonHash: string }>;
17-
onCancel: () => void;
1817
};
1918

2019
export const VoteContextChoice = ({
@@ -23,7 +22,6 @@ export const VoteContextChoice = ({
2322
setJsonldContent,
2423
setMetadataHash,
2524
generateMetadata,
26-
onCancel,
2725
}: VoteContextChoiceProps) => {
2826
const { t } = useTranslation();
2927
const { isMobile } = useScreenDimension();
@@ -44,13 +42,13 @@ export const VoteContextChoice = ({
4442
};
4543

4644
return (
47-
<VoteContextWrapper hideAllBtn={true}>
48-
<Typography sx={{ textAlign: "center" , fontWeight : 500 , marginTop: isMobile ? 0 : 1 }} variant="headline4">
49-
{t("createGovernanceAction.storingOptionsForYourVoterRationale")}
50-
</Typography>
51-
<Link
52-
onClick={openLink}
53-
sx={{
45+
<VoteContextWrapper hideAllBtn>
46+
<Typography sx={{ textAlign: "center", fontWeight: 500, marginTop: isMobile ? 0 : 1 }} variant="headline4">
47+
{t("createGovernanceAction.storingOptionsForYourVoterRationale")}
48+
</Typography>
49+
<Link
50+
onClick={openLink}
51+
sx={{
5452
cursor: "pointer",
5553
fontSize: 16,
5654
fontWeight: 500,
@@ -59,30 +57,30 @@ export const VoteContextChoice = ({
5957
textAlign: "center",
6058
textDecoration: "none",
6159
}}
60+
>
61+
{t("createGovernanceAction.learnMoreAboutStoringInformation")}
62+
</Link>
63+
<Spacer y={isMobile ? 14 : 16} />
64+
<Typography sx={{ textAlign: "center", fontWeight: 700 }} variant="body1">
65+
{t("createGovernanceAction.chooseDataStorageOption")}
66+
</Typography>
67+
<Spacer y={4} />
68+
<Box sx={{ display: "flex", flexDirection: isMobile ? "column" : "row", width: "100%", justifyContent: isMobile ? "none" : "space-between", gap: isMobile ? "14px" : "0px" }}>
69+
<Button
70+
variant="outlined"
71+
onClick={handleLetGovToolStore}
72+
sx={{ width: isMobile ? "100%" : "259px", whiteSpace: "nowrap", height: "48px", fontWeight: "500" }}
6273
>
63-
{t("createGovernanceAction.learnMoreAboutStoringInformation")}
64-
</Link>
65-
<Spacer y={isMobile ? 14 : 16} />
66-
<Typography sx={{ textAlign: "center" , fontWeight: 700 }} variant="body1">
67-
{t("createGovernanceAction.chooseDataStorageOption")}
68-
</Typography>
69-
<Spacer y={4}/>
70-
<Box sx={{ display: "flex", flexDirection: isMobile ? "column" : "row" , width: "100%", justifyContent: isMobile ? "none" : "space-between" , gap: isMobile ? "14px" : "0px" }}>
71-
<Button
72-
variant="outlined"
73-
onClick={handleLetGovToolStore}
74-
sx={{ width: isMobile ? "100%" : "259px", whiteSpace: "nowrap" , height:"48px" , fontWeight:"500" }}
75-
>
76-
{t("createGovernanceAction.govToolPinsDataToIPFS")}
77-
</Button>
78-
<Button
79-
variant="outlined"
80-
onClick={handleStoreItMyself}
81-
sx={{ width: isMobile ? "100%" : "287px", whiteSpace: "nowrap" , height:"48px" , fontWeight:"500" }}
82-
>
83-
{t("createGovernanceAction.downloadAndStoreYourself")}
84-
</Button>
85-
</Box>
74+
{t("createGovernanceAction.govToolPinsDataToIPFS")}
75+
</Button>
76+
<Button
77+
variant="outlined"
78+
onClick={handleStoreItMyself}
79+
sx={{ width: isMobile ? "100%" : "287px", whiteSpace: "nowrap", height: "48px", fontWeight: "500" }}
80+
>
81+
{t("createGovernanceAction.downloadAndStoreYourself")}
82+
</Button>
83+
</Box>
8684
</VoteContextWrapper>
8785
);
8886
};

0 commit comments

Comments
 (0)