diff options
author | Pawel Zelawski <pawel.zelawski@outlook.com> | 2025-04-10 10:55:22 +0200 |
---|---|---|
committer | Pawel Zelawski <pawel.zelawski@outlook.com> | 2025-04-10 10:55:22 +0200 |
commit | c852aa92f84d0c18b1bd7361163498a542461d45 (patch) | |
tree | feb1b34c35c4e7a2d35c70dba35b3367c7f638b0 /src/client/index.css | |
parent | 326caf949ec8622c04b0e3352c5eac5370f161e4 (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 'src/client/index.css')
-rw-r--r-- | src/client/index.css | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/src/client/index.css b/src/client/index.css new file mode 100644 index 0000000..2349c9b --- /dev/null +++ b/src/client/index.css @@ -0,0 +1,115 @@ +:root { + font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; + line-height: 1.5; + font-weight: 400; + color-scheme: light dark; + color: rgba(255, 255, 255, 0.87); + background-color: #242424; + + font-synthesis: none; + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +body { + margin: 0; + display: flex; + place-items: center; + min-width: 320px; + min-height: 100vh; +} + +#root { + max-width: 1280px; + margin: 0 auto; + padding: 2rem; + text-align: center; +} + +.app-container { + display: flex; + flex-direction: column; + align-items: center; + gap: 1.5rem; +} + +h1 { + font-size: 2.5em; + line-height: 1.1; + margin-bottom: 1rem; +} + +button { + border-radius: 8px; + border: 1px solid transparent; + padding: 0.6em 1.2em; + font-size: 1em; + font-weight: 500; + font-family: inherit; + background-color: #1a1a1a; + cursor: pointer; + transition: border-color 0.25s; +} +button:hover { + border-color: #646cff; +} +button:focus, +button:focus-visible { + outline: 4px auto -webkit-focus-ring-color; +} +button:disabled { + background-color: #333; + cursor: not-allowed; + opacity: 0.6; +} + +.initial-view, .waiting-view, .success-view, .failed-view { + padding: 1.5rem; + border: 1px solid #555; + border-radius: 8px; + display: flex; + flex-direction: column; + align-items: center; + gap: 1rem; + min-width: 300px; +} + +.waiting-view img { + background-color: white; /* Ensure QR code background is white */ + padding: 10px; + border-radius: 4px; +} + +.address { + font-family: monospace; + background-color: #333; + padding: 0.5em; + border-radius: 4px; + word-break: break-all; +} + +.error-message { + color: #ff6b6b; + font-weight: bold; +} + + +@media (prefers-color-scheme: light) { + :root { + color: #213547; + background-color: #ffffff; + } + button { + background-color: #f9f9f9; + } + .app-container { + /* Add light mode adjustments if needed */ + } + .initial-view, .waiting-view, .success-view, .failed-view { + border-color: #ccc; + } + .address { + background-color: #eee; + } +}
\ No newline at end of file |