Skip to content

Commit 32fbbfb

Browse files
committed
feat: kleros-app
1 parent 884674e commit 32fbbfb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+3071
-747
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,3 +202,6 @@ subgraph/*/contracts/*
202202

203203
# Local Netlify folder
204204
.netlify
205+
206+
#.parcel
207+
.parcel-cache

kleros-app/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# kleros-app

kleros-app/eslint.config.mjs

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
import { fixupConfigRules, fixupPluginRules } from "@eslint/compat";
2+
import react from "eslint-plugin-react";
3+
import reactHooks from "eslint-plugin-react-hooks";
4+
import security from "eslint-plugin-security";
5+
import _import from "eslint-plugin-import";
6+
import globals from "globals";
7+
import tsParser from "@typescript-eslint/parser";
8+
import path from "node:path";
9+
import { fileURLToPath } from "node:url";
10+
import js from "@eslint/js";
11+
import { FlatCompat } from "@eslint/eslintrc";
12+
13+
const __filename = fileURLToPath(import.meta.url);
14+
const __dirname = path.dirname(__filename);
15+
const compat = new FlatCompat({
16+
baseDirectory: __dirname,
17+
recommendedConfig: js.configs.recommended,
18+
allConfig: js.configs.all,
19+
});
20+
21+
export default [
22+
{
23+
ignores: ["src/assets"],
24+
},
25+
...fixupConfigRules(
26+
compat.extends(
27+
"plugin:react/recommended",
28+
"plugin:react-hooks/recommended",
29+
"plugin:import/recommended",
30+
"plugin:import/react",
31+
"plugin:@typescript-eslint/recommended",
32+
"plugin:prettier/recommended",
33+
"prettier"
34+
)
35+
),
36+
{
37+
plugins: {
38+
react: fixupPluginRules(react),
39+
"react-hooks": fixupPluginRules(reactHooks),
40+
security: fixupPluginRules(security),
41+
import: fixupPluginRules(_import),
42+
},
43+
44+
languageOptions: {
45+
globals: {
46+
...globals.browser,
47+
...globals.node,
48+
Atomics: "readonly",
49+
SharedArrayBuffer: "readonly",
50+
},
51+
52+
parser: tsParser,
53+
ecmaVersion: 2020,
54+
sourceType: "module",
55+
56+
parserOptions: {
57+
ecmaFeatures: {
58+
jsx: true,
59+
},
60+
},
61+
},
62+
63+
settings: {
64+
react: {
65+
version: "^18.3.1",
66+
},
67+
68+
"import/resolver": {
69+
typescript: {
70+
project: "./tsconfig.json",
71+
},
72+
},
73+
},
74+
75+
rules: {
76+
"max-len": [
77+
"warn",
78+
{
79+
code: 120,
80+
},
81+
],
82+
83+
"react/prop-types": 0,
84+
"no-unused-vars": "off",
85+
86+
"@typescript-eslint/no-unused-vars": [
87+
"error",
88+
{
89+
varsIgnorePattern: "(^_+[0-9]*$)|([iI]gnored$)|(^ignored)",
90+
argsIgnorePattern: "(^_+[0-9]*$)|([iI]gnored$)|(^ignored)",
91+
},
92+
],
93+
94+
"no-console": [
95+
"error",
96+
{
97+
allow: ["warn", "error", "info", "debug"],
98+
},
99+
],
100+
101+
"@typescript-eslint/no-non-null-assertion": "off",
102+
"@typescript-eslint/no-explicit-any": "off",
103+
"security/detect-object-injection": "off",
104+
"security/detect-non-literal-fs-filename": "off",
105+
106+
"import/extensions": [
107+
"error",
108+
"ignorePackages",
109+
{
110+
js: "never",
111+
jsx: "never",
112+
ts: "never",
113+
tsx: "never",
114+
},
115+
],
116+
117+
"import/no-unresolved": "off",
118+
},
119+
},
120+
];

kleros-app/package.json

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
"name": "@kleros/kleros-app",
3+
"version": "1.0.0",
4+
"source": "src/lib/index.ts",
5+
"main": "dist/main.js",
6+
"module": "dist/module.js",
7+
"types": "dist/index.d.ts",
8+
"scripts": {
9+
"clear": "rm -r ../.parcel-cache",
10+
"clean": "rm -rf dist",
11+
"start": "parcel src/index.html",
12+
"build": "yarn clear & yarn clean & yarn parcel build",
13+
"check-style": "eslint 'src/**/*.{ts,tsx}' -fix",
14+
"check-types": "tsc --noEmit"
15+
},
16+
"repository": {
17+
"type": "git",
18+
"url": "git+ssh://git@github.com/kleros/kleros-v2.git"
19+
},
20+
"keywords": [
21+
"kleros",
22+
"dapp",
23+
"atlas"
24+
],
25+
"author": "Kleros",
26+
"license": "MIT",
27+
"bugs": {
28+
"url": "https://github.com/kleros/kleros-v2/issues"
29+
},
30+
"homepage": "https://github.com/kleros/kleros-v2#readme",
31+
"description": "",
32+
"files": [
33+
"dist"
34+
],
35+
"prettier": "@kleros/kleros-v2-prettier-config",
36+
"devDependencies": {
37+
"@eslint/compat": "^1.2.2",
38+
"@eslint/eslintrc": "^3.1.0",
39+
"@eslint/js": "^9.14.0",
40+
"@kleros/kleros-v2-eslint-config": "workspace:^",
41+
"@kleros/kleros-v2-prettier-config": "workspace:^",
42+
"@types/react": "^18.3.12",
43+
"@types/react-dom": "^18.3.1",
44+
"eslint": "^9.14.0",
45+
"eslint-config-prettier": "^9.1.0",
46+
"globals": "^15.12.0",
47+
"parcel": "^2.12.0",
48+
"typescript": "^5.6.3"
49+
},
50+
"dependencies": {
51+
"@kleros/ui-components-library": "^2.15.0",
52+
"jose": "^5.9.6",
53+
"wagmi": "^2.13.0"
54+
},
55+
"peerDependencies": {
56+
"@tanstack/react-query": "^5.59.20",
57+
"graphql": "^16.9.0",
58+
"graphql-request": "^7.1.2",
59+
"react": "^18.3.1",
60+
"react-dom": "^18.3.1",
61+
"viem": "^2.21.42"
62+
}
63+
}

kleros-app/src/App.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { createRoot } from "react-dom/client";
2+
import React from "react";
3+
4+
const App = () => {
5+
return (
6+
<React.StrictMode>
7+
<div>
8+
<h1>Kleros</h1>
9+
</div>
10+
</React.StrictMode>
11+
);
12+
};
13+
14+
const app = document.getElementById("app");
15+
if (app) {
16+
const root = createRoot(app);
17+
root.render(<App />);
18+
}

kleros-app/src/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>Kleros App</title>
7+
</head>
8+
9+
<body>
10+
<div id="app"></div>
11+
<script type="module" src="App.tsx"></script>
12+
</body>
13+
</html>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { useState } from "react";
2+
3+
export function useSessionStorage<T>(keyName: string, defaultValue: T) {
4+
const [storedValue, setStoredValue] = useState<T>(() => {
5+
try {
6+
const value = window.sessionStorage.getItem(keyName);
7+
8+
return value ? JSON.parse(value) : defaultValue;
9+
} catch (err) {
10+
return defaultValue;
11+
}
12+
});
13+
14+
const setValue = (newValue: T) => {
15+
try {
16+
window.sessionStorage.setItem(keyName, JSON.stringify(newValue));
17+
} finally {
18+
setStoredValue(newValue);
19+
}
20+
};
21+
22+
return [storedValue, setValue] as [T, (newValue: T) => void];
23+
}

kleros-app/src/lib/atlas/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from "./providers";
2+
export * from "./utils";

0 commit comments

Comments
 (0)