summaryrefslogtreecommitdiff
path: root/package.json
diff options
context:
space:
mode:
authorPawel Zelawski <pawel.zelawski@outlook.com>2025-04-10 10:55:22 +0200
committerPawel Zelawski <pawel.zelawski@outlook.com>2025-04-10 10:55:22 +0200
commitc852aa92f84d0c18b1bd7361163498a542461d45 (patch)
treefeb1b34c35c4e7a2d35c70dba35b3367c7f638b0 /package.json
parent326caf949ec8622c04b0e3352c5eac5370f161e4 (diff)
feat(client): implement react frontend application
- Created main entry point `src/client/main.tsx`. - Created main `App` component `src/client/App.tsx`. - Implemented state management (`initial`, `waiting`, `success`, `failed`) using `useState`. - Implemented `handleStart` to call backend `/api/digiid/start` and transition to `waiting` state. - Implemented `useEffect` hook for polling backend `/api/digiid/status/:sessionId` in `waiting` state. - Updates UI state based on polling response (`success`/`failed`). - Handles polling errors and cleanup. - Implemented `handleReset` to return to `initial` state. - Implemented views for each state: - `initial`: Welcome message, Start button. - `waiting`: QR code display, status message, Cancel button. - `success`: Success message, verified address, address type, Start Over button. - `failed`: Failure message, error details, Try Again button. - Added client-side address type helper `getDigiByteAddressType` in `src/client/utils.ts`. - Added basic CSS styling in `src/client/index.css` with light/dark mode support. - Added frontend-related scripts (`dev:frontend`, `dev`, `build`, `lint`, `preview`) to `package.json`. - Fixed linter type issue with `setInterval` return value.
Diffstat (limited to 'package.json')
-rw-r--r--package.json7
1 files changed, 6 insertions, 1 deletions
diff --git a/package.json b/package.json
index 9224785..113d16c 100644
--- a/package.json
+++ b/package.json
@@ -6,7 +6,12 @@
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
- "dev:backend": "nodemon --watch src/server --ext ts --exec \"node --loader ts-node/esm src/server/main.ts\""
+ "dev:frontend": "vite",
+ "dev:backend": "nodemon --watch src/server --ext ts --exec \"node --loader ts-node/esm src/server/main.ts\"",
+ "dev": "npm-run-all --parallel dev:frontend dev:backend",
+ "build": "tsc && vite build",
+ "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
+ "preview": "vite preview"
},
"repository": {
"type": "git",