docs(01-02): complete auth screens and app shell plan
This commit is contained in:
1 parent
e7d300f9c2
commit
105574d907
1 file changed
+152
@@ -0,0 +1,152 @@
|
||||
---
|
||||
phase: "01"
|
||||
plan: "02"
|
||||
subsystem: foundation
|
||||
tags: [auth, clerk, app-shell, sidebar, mobile-nav, onboarding]
|
||||
dependency_graph:
|
||||
requires:
|
||||
- proxy.ts (Clerk auth enforcement — from Plan 01)
|
||||
- createTRPCCaller (RSC server caller — from Plan 01)
|
||||
- ActivePetProvider + useActivePet (from Plan 01)
|
||||
- shadcn components: button, input, label, card, avatar, dropdown-menu, badge
|
||||
provides:
|
||||
- (auth)/layout.tsx — 448px centered auth layout
|
||||
- (auth)/sign-up/[[...sign-up]]/page.tsx — Clerk SignUp with orange-500 appearance
|
||||
- (auth)/log-in/[[...sign-in]]/page.tsx — Clerk SignIn with orange-500 appearance
|
||||
- (auth)/forgot-password/page.tsx — Clerk 7 resetPasswordEmailCode flow
|
||||
- (auth)/reset-password/page.tsx — Clerk 7 resetPasswordEmailCode.verifyCode + submitPassword + finalize
|
||||
- (auth)/verify-email/page.tsx — email verification pending screen + ResendEmailButton island
|
||||
- (app)/layout.tsx — protected app shell with auth() + pets.list + onboarding redirect
|
||||
- Sidebar.tsx — 240px desktop nav with pet switcher + nav links
|
||||
- MobileNav.tsx — fixed bottom tab bar with pet switcher
|
||||
- onboarding/pet/page.tsx — stub for Plan 03 pet form
|
||||
affects:
|
||||
- All subsequent plans that depend on (app) layout being wired
|
||||
tech_stack:
|
||||
added: []
|
||||
patterns:
|
||||
- Clerk 7 SignInFutureResource API (useSignIn returns { errors, fetchStatus, signIn } — no isLoaded/setActive)
|
||||
- Clerk 7 resetPasswordEmailCode.sendCode/verifyCode/submitPassword pattern for custom password reset
|
||||
- Clerk 7 SignUpFutureVerifications.sendEmailCode() for resend email verification
|
||||
- base-nova shadcn uses @base-ui/react/menu (no asChild on DropdownMenu components)
|
||||
- Server-side tRPC caller in RSC layout for pets.list with redirect guard
|
||||
key_files:
|
||||
created:
|
||||
- src/app/(auth)/layout.tsx
|
||||
- src/app/(auth)/sign-up/[[...sign-up]]/page.tsx
|
||||
- src/app/(auth)/log-in/[[...sign-in]]/page.tsx
|
||||
- src/app/(auth)/forgot-password/page.tsx
|
||||
- src/app/(auth)/reset-password/page.tsx
|
||||
- src/app/(auth)/verify-email/page.tsx
|
||||
- src/app/(auth)/verify-email/ResendEmailButton.tsx
|
||||
- src/components/layout/Sidebar.tsx
|
||||
- src/components/layout/MobileNav.tsx
|
||||
modified:
|
||||
- src/app/(app)/layout.tsx (replaced skeleton with auth check + pets.list + Sidebar + MobileNav)
|
||||
- src/app/(app)/onboarding/pet/page.tsx (replaced walking skeleton form with Plan 03 stub)
|
||||
decisions:
|
||||
- "Clerk 7 SignInFutureResource replaces old SignInResource — useSignIn() returns { errors, fetchStatus, signIn } (no isLoaded, no setActive, no attemptFirstFactor)"
|
||||
- "Reset password uses two-step Clerk 7 API: signIn.create({ identifier }) then signIn.resetPasswordEmailCode.sendCode()"
|
||||
- "shadcn base-nova style uses @base-ui/react/menu which lacks asChild support — DropdownMenuItem navigation uses onClick+useRouter instead of asChild+Link"
|
||||
- "Clerk 7 UserButton no longer accepts afterSignOutUrl — removed prop, sign-out URL is configured in Clerk dashboard"
|
||||
- "onboarding/pet layout is intentionally outside the (app) shell's no-pets guard — owners are redirected HERE when they have no pets, so shell renders without requiring an existing pet"
|
||||
metrics:
|
||||
duration: "~30 minutes"
|
||||
completed: "2026-06-06T07:05:00Z"
|
||||
tasks_completed: 2
|
||||
tasks_total: 3
|
||||
files_created: 9
|
||||
files_modified: 2
|
||||
---
|
||||
|
||||
# Phase 01 Plan 02: Auth Screens and App Shell Summary
|
||||
|
||||
**One-liner:** Clerk-rendered auth pages (sign-up, log-in, forgot/reset password, verify-email) with orange-500 appearance + protected app shell (240px sidebar, mobile bottom nav) with server-side pets.list guard redirecting no-pet owners to onboarding
|
||||
|
||||
## What Was Built
|
||||
|
||||
**Task 1 — Auth layout and Clerk-rendered auth pages:**
|
||||
- `(auth)/layout.tsx`: centered 448px container (`max-w-[448px]`), `min-h-screen flex items-center justify-center bg-background`
|
||||
- `sign-up/[[...sign-up]]/page.tsx`: Clerk `<SignUp>` with `colorPrimary: '#F97316'` appearance, redirects to `/onboarding/pet` after sign-up
|
||||
- `log-in/[[...sign-in]]/page.tsx`: Clerk `<SignIn>` with `colorPrimary: '#F97316'` appearance, redirects to `/pets` after login
|
||||
- `forgot-password/page.tsx`: two-step Clerk 7 reset initiation — `signIn.create({ identifier })` + `signIn.resetPasswordEmailCode.sendCode()`; shows confirmation message and redirects to `/reset-password`
|
||||
- `reset-password/page.tsx`: three-step Clerk 7 reset completion — `resetPasswordEmailCode.verifyCode({ code })` + `submitPassword({ password })` + `finalize()`; client-side validation per UI-SPEC ("Password must be at least 8 characters.", "Passwords don't match.")
|
||||
- `verify-email/page.tsx`: static server component with `ResendEmailButton` client island; resend uses `signUp.verifications.sendEmailCode()`
|
||||
|
||||
**Task 2 — Protected app shell:**
|
||||
- `(app)/layout.tsx`: replaced minimal skeleton with full server component — `auth()` check (belt-and-suspenders), `createTRPCCaller()` + `pets.list()`, redirect to `/onboarding/pet` when pets.length === 0, renders `<Sidebar>` + `<main>` + `<MobileNav>`
|
||||
- `Sidebar.tsx`: 240px left nav (`hidden lg:flex`), OnlyPets wordmark + PawPrint icon (orange-500), pet switcher dropdown with active orange-500 dot, nav links (Home/My Pets active; Explore/Notifications/Messages aria-disabled placeholders), Clerk UserButton at bottom
|
||||
- `MobileNav.tsx`: fixed bottom bar (`lg:hidden`, h-16), active pet switcher bar above tabs, 5 tabs (Home, Explore placeholder, Post center orange-500 circle, Notifications placeholder, Profile)
|
||||
- `onboarding/pet/page.tsx`: replaced walking skeleton with Plan 03 stub (dashed border placeholder, correct copy per UI-SPEC)
|
||||
|
||||
## Deviations from Plan
|
||||
|
||||
### Auto-fixed Issues
|
||||
|
||||
**1. [Rule 1 - Bug] Clerk 7 useSignIn/useSignUp API changed — no isLoaded, no setActive, no attemptFirstFactor**
|
||||
- **Found during:** Task 1, TypeScript check
|
||||
- **Issue:** The plan's implementation instructions assumed the Clerk 6.x API (`useSignIn().isLoaded`, `signIn.create({ strategy: 'reset_password_email_code' })`, `attemptFirstFactor()`, `setActive()`). In Clerk 7, `useSignIn()` returns `SignInSignalValue { errors, fetchStatus, signIn: SignInFutureResource }` — no `isLoaded`, no `setActive`. `SignInFutureResource` uses a new API with method groups (`resetPasswordEmailCode.sendCode()`, `.verifyCode()`, `.submitPassword()`, `.finalize()`).
|
||||
- **Fix:** Rewrote forgot-password and reset-password pages using Clerk 7 `SignInFutureResource` API. For forgot-password: `signIn.create({ identifier })` → `signIn.resetPasswordEmailCode.sendCode()`. For reset-password: `resetPasswordEmailCode.verifyCode({ code })` → `.submitPassword({ password })` → `signIn.finalize()`. Used `fetchStatus === 'fetching'` for loading state instead of `isLoaded`.
|
||||
- **Files modified:** `src/app/(auth)/forgot-password/page.tsx`, `src/app/(auth)/reset-password/page.tsx`
|
||||
- **Commit:** 325eaa9
|
||||
|
||||
**2. [Rule 1 - Bug] Clerk 7 useSignUp API changed — SignUpFutureResource has no prepareEmailAddressVerification**
|
||||
- **Found during:** Task 1, TypeScript check
|
||||
- **Issue:** `useSignUp().signUp` returns `SignUpFutureResource` in Clerk 7, which does not have `prepareEmailAddressVerification()`. Resend email verification is now `signUp.verifications.sendEmailCode()` (on `SignUpFutureVerifications`).
|
||||
- **Fix:** Updated `ResendEmailButton.tsx` to use `signUp.verifications.sendEmailCode()`. Removed `isLoaded` — used `fetchStatus === 'fetching'` instead.
|
||||
- **Files modified:** `src/app/(auth)/verify-email/ResendEmailButton.tsx`
|
||||
- **Commit:** 325eaa9
|
||||
|
||||
**3. [Rule 1 - Bug] shadcn base-nova uses @base-ui/react/menu which lacks asChild prop**
|
||||
- **Found during:** Task 2, TypeScript check
|
||||
- **Issue:** The plan called for `<DropdownMenuTrigger asChild>` and `<DropdownMenuItem asChild>` patterns. The `base-nova` shadcn preset uses `@base-ui/react/menu` instead of `@radix-ui/react-dropdown-menu`. Base UI's `MenuPrimitive.Trigger` and `MenuPrimitive.Item` do not expose an `asChild` prop.
|
||||
- **Fix:** Removed `asChild` from `DropdownMenuTrigger` (it already renders as a button). For navigation `DropdownMenuItem` entries (e.g., "Add Pet"), replaced `asChild+Link` with `onClick={() => router.push(...)}` using `useRouter`.
|
||||
- **Files modified:** `src/components/layout/Sidebar.tsx`, `src/components/layout/MobileNav.tsx`
|
||||
- **Commit:** e7d300f
|
||||
|
||||
**4. [Rule 1 - Bug] Clerk 7 UserButton no longer accepts afterSignOutUrl**
|
||||
- **Found during:** Task 2, TypeScript check
|
||||
- **Issue:** `UserButtonProps` in Clerk 7 no longer includes `afterSignOutUrl`. The prop was removed from `UserButtonProps`.
|
||||
- **Fix:** Removed `afterSignOutUrl="/log-in"` from `<UserButton />`. Sign-out URL is configured in the Clerk dashboard or via `ClerkProvider.afterSignOutUrl`.
|
||||
- **Files modified:** `src/components/layout/Sidebar.tsx`
|
||||
- **Commit:** e7d300f
|
||||
|
||||
## Known Stubs
|
||||
|
||||
| File | Location | Stub | Reason |
|
||||
|------|----------|------|--------|
|
||||
| `src/app/(app)/onboarding/pet/page.tsx` | Full page | Dashed border placeholder div instead of PetForm | Plan 03 wires the actual PetForm with species/breed selectors, bio, and avatar upload |
|
||||
|
||||
## Task 3: Checkpoint (Awaiting Human Action)
|
||||
|
||||
Task 3 is a `checkpoint:human-action` requiring the user to run `npm run dev` and verify:
|
||||
1. Unauthenticated `/pets` redirects to `/log-in`
|
||||
2. `/log-in` renders Clerk sign-in with orange CTA
|
||||
3. `/sign-up` renders Clerk sign-up with orange CTA
|
||||
4. Sign up → redirect to `/onboarding/pet` with app shell (sidebar) visible
|
||||
5. `/forgot-password` renders the "Reset your password" form
|
||||
6. Desktop sidebar (240px) visible at >= 1024px
|
||||
7. Mobile bottom tab bar visible at < 768px
|
||||
|
||||
## Threat Flags
|
||||
|
||||
None — no new trust boundaries introduced. Auth pages are correctly on the public route list in `proxy.ts`. The `(app)/layout.tsx` server-side auth check matches the existing proxy.ts enforcement.
|
||||
|
||||
## Self-Check: PASSED
|
||||
|
||||
Files verified:
|
||||
- src/app/(auth)/layout.tsx: FOUND
|
||||
- src/app/(auth)/sign-up/[[...sign-up]]/page.tsx: FOUND
|
||||
- src/app/(auth)/log-in/[[...sign-in]]/page.tsx: FOUND
|
||||
- src/app/(auth)/forgot-password/page.tsx: FOUND
|
||||
- src/app/(auth)/reset-password/page.tsx: FOUND
|
||||
- src/app/(auth)/verify-email/page.tsx: FOUND
|
||||
- src/app/(auth)/verify-email/ResendEmailButton.tsx: FOUND
|
||||
- src/app/(app)/layout.tsx: FOUND
|
||||
- src/app/(app)/onboarding/pet/page.tsx: FOUND
|
||||
- src/components/layout/Sidebar.tsx: FOUND
|
||||
- src/components/layout/MobileNav.tsx: FOUND
|
||||
|
||||
Commits verified:
|
||||
- 325eaa9: feat(01-02) auth pages
|
||||
- e7d300f: feat(01-02) app shell
|
||||
Reference in new issue
Block a user