Skip to content

Commit ef64d2e

Browse files
committed
Merge remote-tracking branch 'origin/vt-digit-recognition-frontend' into vt-cats-dogs-predict-frontend
2 parents a406718 + 8970124 commit ef64d2e

File tree

21 files changed

+539
-481
lines changed

21 files changed

+539
-481
lines changed

digit-recognition/frontend/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@
1111
},
1212
"dependencies": {
1313
"@polkadot/types": "14.3.1",
14-
"@radix-ui/react-slot": "1.1.0",
1514
"@reown/appkit": "^1.6.0",
1615
"@reown/appkit-adapter-wagmi": "^1.6.0",
1716
"@tanstack/react-query": "^5.59.20",
18-
"class-variance-authority": "^0.7.1",
1917
"react": "^18.3.1",
2018
"react-dom": "^18.3.1",
2119
"wagmi": "^2.12.29"
@@ -32,6 +30,7 @@
3230
"typescript": "~5.6.2",
3331
"typescript-eslint": "^8.11.0",
3432
"vite": "^5.4.10",
33+
"vite-plugin-checker": "0.8.0",
3534
"vite-plugin-svgr": "^4.3.0",
3635
"sass": "1.62.0"
3736
}

digit-recognition/frontend/src/App.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@ import { useAccount } from "wagmi";
33

44
import { WalletButton, Header, Layout } from "@/components";
55
import { Recognition } from "./components/recognition/Recognition";
6+
import { ETH_CHAIN_ID } from "./consts";
67
import styles from "./App.module.scss";
78

89
function App() {
910
const ethAccount = useAccount();
10-
const isConnected = Boolean(ethAccount.chain);
11+
const isConnected = Boolean(
12+
ethAccount.chain && ethAccount.chain.id === ETH_CHAIN_ID
13+
);
1114

1215
return (
1316
<>

digit-recognition/frontend/src/components/recognition/Recognition.module.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,9 @@
3232
text-decoration: none;
3333
font-size: 12px;
3434
}
35+
36+
@media (max-width: 768px) {
37+
.list {
38+
flex-direction: column;
39+
}
40+
}

digit-recognition/frontend/src/components/ui/card/Card.module.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
border: 1px solid #ffffff29;
44
width: 437px;
55
height: 552px;
6+
max-width: 100%;
67
}
78

89
.header {
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
11
.connect {
22
min-width: 168px;
33
}
4+
5+
.button span {
6+
display: none;
7+
}
8+
9+
@media (min-width: 768px) {
10+
.button {
11+
svg {
12+
display: none;
13+
}
14+
span {
15+
display: inline;
16+
}
17+
}
18+
}

digit-recognition/frontend/src/components/wallet/WalletButton.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
import { useAppKit } from "@reown/appkit/react";
22
import { useAccount } from "wagmi";
33
import { Button } from "@/components";
4-
import { useIsTablet } from "@/lib/hooks/use-media";
54
import BurgerMenu from "@/assets/icons/burger-menu.svg?react";
65
import styles from "./WalletButton.module.scss";
76

87
export const WalletButton = () => {
98
const ethAccount = useAccount();
109
const { open } = useAppKit();
1110
const isConnected = Boolean(ethAccount.chainId);
12-
const isTablet = useIsTablet();
1311

1412
return isConnected ? (
1513
<>
16-
<Button onClick={() => open()}>
17-
{isTablet ? ethAccount.address : <BurgerMenu />}
14+
<Button onClick={() => open()} className={styles.button}>
15+
<span>{ethAccount.address}</span>
16+
<BurgerMenu />
1817
</Button>
1918
</>
2019
) : (

digit-recognition/frontend/src/features/digit-recognizer/DigitCanvas.module.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,10 @@
2828
text-transform: uppercase;
2929
color: #ffffff;
3030
}
31+
32+
.canvas {
33+
width: 100%;
34+
height: 100%;
35+
border-radius: 50%;
36+
touch-action: none;
37+
}

digit-recognition/frontend/src/features/digit-recognizer/DigitCanvas.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ export const DigitCanvas = ({
7979
<div className={styles.drawArea}>
8080
<canvas
8181
ref={canvasRef}
82-
onMouseDown={startDrawing}
83-
onMouseMove={draw}
84-
onMouseUp={stopDrawing}
85-
onMouseLeave={stopDrawing}
86-
style={{ width: "100%", height: "100%", borderRadius: "50%" }}
82+
onPointerDown={startDrawing}
83+
onPointerMove={draw}
84+
onPointerUp={stopDrawing}
85+
onPointerLeave={stopDrawing}
86+
className={styles.canvas}
8787
/>
8888
{!isTouched && <div className={styles.drawHint}>Draw a digit here</div>}
8989
</div>

digit-recognition/frontend/src/lib/hooks/use-media.ts

Lines changed: 0 additions & 58 deletions
This file was deleted.

digit-recognition/frontend/src/lib/utils/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import { FixedPoint } from "../types";
2-
3-
export { mergeRefs } from "./merge-refs";
42
export { isMobileDevice, isMobile } from "./device-detection";
53

64
export const copyToClipboard = async ({

0 commit comments

Comments
 (0)