Skip to content

Commit 45f2a13

Browse files
committed
feat: add error text on ipfs file upload error on pin vote context
1 parent bbec399 commit 45f2a13

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const VoteContextGovTool = ({
4040

4141
const openLink = () => openInNewTab(LINKS.STORING_INFORMATION_OFFLINE);
4242

43-
const { mutate, isLoading } = useMutation<PostIpfsResponse, Error, { content: string }>({
43+
const { mutate, isLoading , isError } = useMutation<PostIpfsResponse, Error, { content: string }>({
4444
mutationFn: postIpfs,
4545
onSuccess: (data) => {
4646
const ipfsUrl = `ipfs://${data.ipfsCid}`;
@@ -69,6 +69,7 @@ export const VoteContextGovTool = ({
6969
onContinue = {() => {setStep(5)}}
7070
useBackLabel
7171
isContinueDisabled={!apiResponse}
72+
isVoteWithMetadata
7273
>
7374
<Typography sx={{ textAlign: "center" , fontSize : "28px" , fontWeight: 500 }} variant="h4">
7475
{t("createGovernanceAction.rationalePinnedToIPFS")}
@@ -87,7 +88,11 @@ export const VoteContextGovTool = ({
8788
>
8889
{t("createGovernanceAction.learnMore")}
8990
</Link>
90-
{isLoading ? (
91+
{isError ? (
92+
<Typography sx={{ textAlign: "center", color: "error.main", mt: 2 }} variant="body1">
93+
{t("createGovernanceAction.uploadToIPFSError")}
94+
</Typography>
95+
) : isLoading ? (
9196
<Box sx={{ display: "flex", justifyContent: "center" }}>
9297
<CircularProgress size={24} />
9398
</Box>
@@ -129,7 +134,7 @@ export const VoteContextGovTool = ({
129134
</Typography>
130135
</Box>
131136
</>
132-
) : (
137+
) : (
133138
<Typography sx={{ textAlign: "center" }} variant="body1">
134139
{t("createGovernanceAction.uploadingToIPFS")}
135140
</Typography>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@
243243
"storingInformationStep2Link": "Read full guide",
244244
"storingInformationStep3Label": "Paste the URL here",
245245
"storingInformationTitle": "Information Storage Steps",
246+
"uploadToIPFSError" : "An Error occured while trying to upload to IPFS",
246247
"storingInformationURLPlaceholder": "URL",
247248
"supportingLinks": "Supporting links",
248249
"title": "Create a Governance Action",

0 commit comments

Comments
 (0)