Skip to content

Add persistent header with role switcher and lazy provisioning#13

Merged
WWStoryMode merged 1 commit into
mainfrom
feature/persistent-header-role-switcher
Mar 4, 2026
Merged

Add persistent header with role switcher and lazy provisioning#13
WWStoryMode merged 1 commit into
mainfrom
feature/persistent-header-role-switcher

Conversation

@WWStoryMode

Copy link
Copy Markdown
Owner

Summary

  • Added AppHeader component with persistent header on every page (title, DEMO badge, RoleSwitcher avatar, user info, sign-out)
  • RoleSwitcher now navigates to the corresponding role page when switching
  • Home page role cards call setRole() before navigating, removed duplicate headers
  • ProductionAuthProvider responds to role changes with lazy provisioning: auto-creates vendor/delivery records on first role switch
  • Vendor and delivery dashboards handle null IDs gracefully with loading spinners
  • Added RLS INSERT policies for vendors, delivery_persons, and users tables

Test plan

  • Demo mode: AppHeader visible with DEMO badge and RoleSwitcher on every page, role switching navigates correctly
  • Production mode (not logged in): AppHeader shows title only, no RoleSwitcher
  • Production mode (logged in): AppHeader shows user name, sign-out, and RoleSwitcher
  • Role switching: Switch to Vendor → vendor record auto-created → dashboard loads
  • Role switching: Switch to Delivery → delivery record auto-created → dashboard loads
  • Page refresh: No UUID errors when refreshing vendor/delivery pages
  • npm run type-check and npm run build pass

🤖 Generated with Claude Code

- Create AppHeader component with title, DEMO badge, RoleSwitcher, user info, and sign-out
- Integrate AppHeader in layout.tsx inside the provider tree
- RoleSwitcher now navigates to the corresponding role page on switch
- Home page role cards call setRole() before navigating
- ProductionAuthProvider responds to role changes and eagerly fetches vendor/delivery IDs
- Add lazy provisioning: auto-create vendor/delivery records when user switches roles
- Handle null vendorId/deliveryPersonId gracefully with loading spinners
- Guard useVendorOrders/useDeliveryAssignments against empty string UUIDs
- Add RLS INSERT policies for vendors, delivery_persons, and users tables

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel

vercel Bot commented Mar 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
project-firefly Ready Ready Preview, Comment Mar 4, 2026 6:17pm

@WWStoryMode
WWStoryMode merged commit 188f5a0 into main Mar 4, 2026
3 checks passed
@WWStoryMode
WWStoryMode deleted the feature/persistent-header-role-switcher branch March 4, 2026 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant