Skip to content

[2026-01-21] Guest Mode: Auth State & UI Implementation

Task Metadata

  • 📆 Date: 2026-01-21
  • 🚥 Status: Complete

Objective

Goal: Permanently enable the Dashboard for unauthenticated users and implement a "Guest" auth state to support offline logging.

  • Trigger: Guest Mode Architecture requires the UI to be accessible without a login session.
  • Current State: The Authenticator gate prevents access to /track for unauthenticated users.

Technical Strategy

We will adopt a "Null Object" pattern for the guest user to simplify component logic and remove the hard auth gate in Tracker.tsx.

  • Key Decisions:
    • GUEST_USER Constant: Define a standard user object for guests.
    • Auth Guard Removal: Modify Tracker.tsx to render the dashboard by default, showing the Authenticator only when "Sign In" is explicitly clicked.
    • Conditional UI: Update Header and Dashboard to adapt based on whether the user is a guest (e.g., showing "Sign In" instead of "Sign Out").
  • Files Modified:
    • frontend/src/pages/Tracker.tsx: Removed the mandatory Authenticator wrap.
    • frontend/src/pages/Dashboard.tsx: Added GUEST_USER and handled conditional session fetching.
    • frontend/src/components/Header.tsx: Added support for guest state (Sign In button).

Execution Plan

  • Step 1: Modify Header.tsx to toggle between "Sign In" (Guest) and "Sign Out" (Auth).
  • Step 2: Define GUEST_USER constant and update Dashboard.tsx.
  • Step 3: Modify Tracker.tsx to remove the Auth Guard.

Execution Notes

  • Implementation: Successfully transitioned to a "Guest First" UI where the dashboard is the default entry point.
  • Documentation: Updated docs/architecture/decisions/006_guest_mode_architecture/index.md to reflect these UI changes.

User Approval & Key Learnings

Key Learnings

  • The "Null Object" pattern for the guest user significantly reduced conditional logic (ternaries/null checks) in child components.