You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| File name | PascalCase + `Page` suffix |`AboutPage.tsx`|
49
49
| Exported component | Default export of a function named `<Name>Page`|`export default function AboutPage()`|
50
50
51
51
The component itself uses `export default function <Name>Page()` — not a named export, and not an arrow const. This keeps imports straightforward and matches every existing page in `src/pages/`:
@@ -67,16 +67,16 @@ Top-level page components take **no props**. They own their own layout, fetching
| The page reads or writes Stellar assets (keys, trades, portfolio) |`useAccount().isConnected` from wagmi|
170
+
| The page reads or writes user-profile data via the backend REST API |`authService.isAuthenticated()`|
171
+
| Both | Call both. Render the placeholder until both resolve; redirect if either is false. |
172
172
173
173
Don't mix the two states in a single component without documenting which is the source of truth for that page — that's the kind of bug that's hard to spot in review.
174
174
@@ -177,7 +177,7 @@ Don't mix the two states in a single component without documenting which is the
177
177
Two pre-existing repo facts you should know before shipping a wagmi-based guard:
178
178
179
179
1.**`<Web3Provider>` is not currently mounted above `<App />` in `src/main.tsx`.** As of writing this guide, `main.tsx` renders `<App />` directly inside `<StrictMode>`. Any wagmi hook — including `useAccount` inside `RequireAuth` — will throw at runtime because the `WagmiProvider` context is missing. Wiring `<Web3Provider>` here is an app-level change and should be tracked separately; reference the tracking issue in your route PR description rather than embedding the wiring fix in your route PR.
180
-
2.**Wagmi has a transient `isConnecting` state** while a fresh wallet handshake is in flight. During this window `isConnected` is `false`, but redirecting the user mid-connect would bounce them away. The example above handles this by rendering `PendingOnboardingPlaceholder` for the `isConnecting` branch — copy that pattern verbatim. (Note: `isReconnecting` is *not* included in that branch — a reconnect of a prior, already-authenticated session keeps the user authenticated, so rendering the protected page during a reconnect is fine and avoids a UX flash.)
180
+
2.**Wagmi has a transient `isConnecting` state** while a fresh wallet handshake is in flight. During this window `isConnected` is `false`, but redirecting the user mid-connect would bounce them away. The example above handles this by rendering `PendingOnboardingPlaceholder` for the `isConnecting` branch — copy that pattern verbatim. (Note: `isReconnecting` is _not_ included in that branch — a reconnect of a prior, already-authenticated session keeps the user authenticated, so rendering the protected page during a reconnect is fine and avoids a UX flash.)
181
181
182
182
If your guard only uses `authService.isAuthenticated()` (no wagmi hooks), neither caveat applies — the helper reads `localStorage` directly.
183
183
@@ -197,23 +197,23 @@ import { Link } from 'react-router';
@@ -261,12 +261,13 @@ If `pnpm build` succeeds and `/about` renders the page with a working "Back to m
261
261
262
262
## Key files at a glance
263
263
264
-
| File | Purpose |
265
-
|---|---|
266
-
|`src/App.tsx`| The single source of truth for routing — the only place routes are registered. |
267
-
|`src/pages/`| Folder where every page component lives. One file per page, PascalCase + `Page` suffix, default export. |
268
-
|`src/components/auth/RequireAuth.tsx`| The recommended wrapper for auth-protected pages. Create it the first time a protected route is added. |
269
-
|`src/main.tsx`| Mounts `<App />` inside React's `createRoot`. **Currently does not wrap `<App />` in `Web3Provider`** — must be updated the first time a wagmi-based route guard lands. |
270
-
|`src/providers/Web3Provider.tsx`| Provides `WagmiProvider` + `QueryClientProvider`. Any auth wrapper that uses `useAccount` only works after this provider is mounted above the router in `main.tsx`. |
271
-
|`CONTRIBUTING.md`| High-level project conventions — read this alongside this guide. |
272
-
|`docs/api-layer.md`| Sibling guide covering how to add backend/API endpoints. |
|`src/App.tsx`| The single source of truth for routing — the only place routes are registered. |
267
+
|`src/pages/`| Folder where every page component lives. One file per page, PascalCase + `Page` suffix, default export. |
268
+
|`src/components/auth/RequireAuth.tsx`| The recommended wrapper for auth-protected pages. Create it the first time a protected route is added. |
269
+
|`src/main.tsx`| Mounts `<App />` inside React's `createRoot`. **Currently does not wrap `<App />` in `Web3Provider`** — must be updated the first time a wagmi-based route guard lands. |
270
+
|`src/providers/Web3Provider.tsx`| Provides `WagmiProvider` + `QueryClientProvider`. Any auth wrapper that uses `useAccount` only works after this provider is mounted above the router in `main.tsx`. |
271
+
|`CONTRIBUTING.md`| High-level project conventions — read this alongside this guide. |
272
+
|`docs/api-layer.md`| Sibling guide covering how to add backend/API endpoints. |
273
+
|[docs/shared-components.md](file:///Users/marvellous/Desktop/accesslayer-client/docs/shared-components.md)| Guide to the project's shared UI component library, key props, and styling. |
0 commit comments