Skip to content

Commit ec69044

Browse files
committed
feat(web): integrate-kleros-app
1 parent 06af22f commit ec69044

File tree

25 files changed

+481
-1061
lines changed

25 files changed

+481
-1061
lines changed

web/package.json

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@
4646
"devDependencies": {
4747
"@graphql-codegen/cli": "^4.0.1",
4848
"@graphql-codegen/client-preset": "^4.2.0",
49+
"@kleros/curate-v2-tsconfig": "workspace:^",
4950
"@kleros/kleros-v2-contracts": "^0.3.2",
50-
"@types/react": "^18.2.59",
51-
"@types/react-dom": "^18.2.19",
51+
"@types/react": "^18.3.12",
52+
"@types/react-dom": "^18.3.1",
5253
"@types/react-modal": "^3.16.3",
5354
"@types/styled-components": "^5.1.34",
5455
"@typescript-eslint/eslint-plugin": "^5.62.0",
@@ -69,10 +70,11 @@
6970
"dependencies": {
7071
"@cyntler/react-doc-viewer": "^1.17.0",
7172
"@kleros/curate-v2-templates": "workspace:^",
73+
"@kleros/kleros-app": "^2.0.1",
7274
"@kleros/ui-components-library": "^2.15.0",
7375
"@sentry/react": "^7.93.0",
7476
"@sentry/tracing": "^7.93.0",
75-
"@tanstack/react-query": "^5.40.1",
77+
"@tanstack/react-query": "^5.59.20",
7678
"@web3modal/ethereum": "^2.7.1",
7779
"@web3modal/react": "^2.2.2",
7880
"@web3modal/wagmi": "^5.1.6",
@@ -81,8 +83,8 @@
8183
"chartjs-adapter-moment": "^1.0.1",
8284
"core-js": "^3.35.0",
8385
"ethers": "^5.7.2",
84-
"graphql": "^16.8.1",
85-
"graphql-request": "~6.1.0",
86+
"graphql": "^16.9.0",
87+
"graphql-request": "^7.1.2",
8688
"jose": "^5.3.0",
8789
"json-2-csv": "^5.5.5",
8890
"moment": "^2.30.1",
@@ -103,7 +105,7 @@
103105
"react-use": "^17.4.3",
104106
"styled-components": "^5.3.11",
105107
"subgraph-status": "^1.2.3",
106-
"viem": "^2.21.2",
107-
"wagmi": "^2.12.8"
108+
"viem": "^2.21.51",
109+
"wagmi": "^2.13.0"
108110
}
109111
}

web/src/components/ActionButton/Modal/EvidenceUpload.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import React, { Dispatch, SetStateAction, useEffect, useState } from "react";
22
import styled from "styled-components";
3-
import { toast } from "react-toastify";
43
import { FileUploader, Textarea } from "@kleros/ui-components-library";
54
import LabeledInput from "components/LabeledInput";
65
import { responsiveSize } from "styles/responsiveSize";
7-
import { OPTIONS as toastOptions } from "utils/wrapWithToast";
8-
import { useAtlasProvider } from "context/AtlasProvider";
9-
import { Roles } from "utils/atlas";
6+
import { errorToast, infoToast, successToast } from "utils/wrapWithToast";
7+
import { Roles, useAtlasProvider } from "@kleros/kleros-app";
108

119
const Container = styled.div`
1210
width: 100%;
@@ -71,14 +69,16 @@ const EvidenceUpload: React.FC<IEvidenceUpload> = ({ setEvidence, setIsEvidenceU
7169

7270
const handleFileUpload = (file: File) => {
7371
setIsEvidenceUploading(true);
72+
infoToast("Uploading to IPFS...");
7473
uploadFile(file, Roles.Evidence)
7574
.then(async (fileURI) => {
7675
if (!fileURI) throw new Error("Error uploading file to IPFS");
7776
setFileURI(fileURI);
77+
successToast("Uploaded successfully!");
7878
})
7979
.catch((err) => {
8080
console.log(err);
81-
toast.error(err?.message, toastOptions);
81+
errorToast(`Upload failed: ${err?.message}`);
8282
})
8383
.finally(() => setIsEvidenceUploading(false));
8484
};

web/src/components/EnsureAuth.tsx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import React from "react";
1+
import React, { useCallback } from "react";
22

33
import { useAccount } from "wagmi";
44

55
import { Button } from "@kleros/ui-components-library";
6-
7-
import { useAtlasProvider } from "context/AtlasProvider";
6+
import { useAtlasProvider } from "@kleros/kleros-app";
7+
import { errorToast, infoToast, successToast } from "utils/wrapWithToast";
88

99
interface IEnsureAuth {
1010
children: React.ReactElement;
@@ -14,12 +14,22 @@ interface IEnsureAuth {
1414
const EnsureAuth: React.FC<IEnsureAuth> = ({ children, className }) => {
1515
const { address } = useAccount();
1616
const { isVerified, isSigningIn, authoriseUser } = useAtlasProvider();
17+
const handleClick = useCallback(() => {
18+
infoToast(`Signing in User...`);
19+
20+
authoriseUser()
21+
.then(() => successToast("Signed In successfully!"))
22+
.catch((err) => {
23+
console.log(err);
24+
errorToast(`Sign-In failed: ${err?.message}`);
25+
});
26+
}, [authoriseUser]);
1727
return isVerified ? (
1828
children
1929
) : (
2030
<Button
2131
text="Sign In"
22-
onClick={authoriseUser}
32+
onClick={handleClick}
2333
disabled={isSigningIn || !address}
2434
isLoading={isSigningIn}
2535
{...{ className }}

0 commit comments

Comments
 (0)