Overview
The component architecture follows a feature-based organization with shared UI components from shadcn/ui. Components are split between client and server components for optimal performance.Component Structure
Authentication Components
GoogleSignIn
Location:components/auth/google-signin.tsx
Handles Google OAuth authentication flow.
- Client-side OAuth initiation
- Loading state management
- Automatic redirect handling
Dashboard Components
Dashboard
Location:components/dashboard/dashboard.tsx
Main dashboard container with tabbed interface.
- Three-tab interface (Billing, Invoices, Account)
- Animated tab indicator with Framer Motion
- Responsive design for mobile/desktop
- Props drilling for data distribution
products- Available subscription productsuser- Supabase user objectuserSubscription- User record and current subscriptioninvoices- Payment history
SubscriptionManagement
Location:components/dashboard/subscription-management.tsx
Displays and manages subscription details.
- Current plan display with status badges
- Conditional action buttons based on subscription state
- Feature list from product metadata
- Billing date display
- Free tier fallback
- Shows “Upgrade Plan” button for free tier users
- Shows “Change Plan” and “Cancel” for active subscriptions
- Shows “Restore” button for cancelled subscriptions
Plan Management Dialogs
UpdatePlanDialog
Location:components/dashboard/update-plan-dialog.tsx
Allows users to change or upgrade their subscription plan.
CancelSubscriptionDialog
Location:components/dashboard/cancel-subscription-dialog.tsx
Confirmation dialog for subscription cancellation.
RestoreSubscriptionDialog
Location:components/dashboard/restore-subscription-dialog.tsx
Allows users to restore a cancelled subscription.
InvoiceHistory
Location:components/dashboard/invoice-history.tsx
Displays payment invoice history in a table.
AccountManagement
Location:components/dashboard/account-management.tsx
User account settings and danger zone.
Layout Components
Header
Location:components/layout/header.tsx
Application header with navigation and user menu.
UI Components
Location:components/ui/
Shadcn/ui components providing consistent design system:
- button.tsx - Button variants and sizes
- card.tsx - Card container with header/content
- dialog.tsx - Modal dialogs
- alert-dialog.tsx - Confirmation dialogs
- table.tsx - Data tables
- tabs.tsx - Tab navigation
- badge.tsx - Status badges
- input.tsx - Form inputs
- select.tsx - Dropdown selects
- skeleton.tsx - Loading placeholders
Component Patterns
Client vs Server Components
Client Components ("use client")
- Interactive components with state
- Event handlers
- Browser APIs
- React hooks
- Data fetching
- Direct database access
- No client-side JavaScript
