The LifeQuest frontend is a modern, responsive Single Page Application (SPA) built with React and Vite. It provides a rich, gamified user interface for the LifeQuest productivity system. The design emphasizes "Dark Mode" aesthetics with glassmorphism effects, focusing on user engagement through visual feedback (animations, toasts, progress bars).
- Core: React 18
- Build Tool: Vite
- Styling: TailwindCSS (Utility-first CSS) + Custom Animations
- Icons: Lucide React
- Animations: Framer Motion
- HTTP Client: Axios
- Routing: React Router DOM
- Charts: Chart.js (via
react-chartjs-2) for Analytics
frontend/src/
├── api/ # API configuration
│ └── axios.js # Axios instance with Interceptors (Auto-token refresh)
├── components/ # Reusable UI components
│ ├── modals/ # CreateTask, RenewTodoModal, etc.
│ ├── ui/ # Generic UI (Modal, Toast, Button)
│ ├── Layout.jsx # Main application wrapper (Sidebar + Content)
│ ├── StatsBar.jsx # Header showing HP, XP, Gold, Level
│ ├── TodoCard.jsx # Smart "Betting" Card for Todos (Active/Overdue)
│ ├── HabitCard.jsx # Component for Habits (+/- buttons)
│ ├── DailyCard.jsx # Legacy Daily Tasks
│ └── TaskColumn.jsx # Vertical list container
├── context/ # React Context for Global State
│ └── GameProvider.jsx # Global Game Data (Todos, Habits, User Stats)
│ └── AuthProvider.jsx # Login/Auth state
├── pages/ # Main Route Views
│ ├── Login.jsx # Auth
│ ├── Dashboard.jsx # Analytics + Quick Links
│ ├── TodosPage.jsx # dedicated "Betting Board" for Todos
│ ├── HabitsPage.jsx # Habit Tracker
│ └── ShopPage.jsx # Item Store
├── App.jsx # Router
└── main.jsx # Entry
- Persistent HUD showing Game Status.
- Visualizes real-time Gold/XP updates from actions.
The frontend visualizes the "Bet" nature of the new backend.
-
TodoCard.jsx:- Active: Shows Deadline and "Bet X Gold".
- Overdue: Turns Red. Shows "Penalty Applied". Displays a "Renew" button.
- Completed: Turns Green. Shows success state.
- Timezone: All deadlines are automatically formatted to IST (Asia/Kolkata).
-
RenewTodoModal.jsx:- Pops up when clicking "Renew" on an overdue card.
- Asks user to confirm the 10% fee and pick a new deadline.
-
CreateTaskModal.jsx:- Dynamic Fields: Changes based on type (Habit vs Todo vs Daily).
- Gold Warning: If a user sets a deadline, a warning appears explaining the "Loan/Bet" mechanics (Upfront Gold vs Double Penalty).
HabitsPage.jsx: Split view for "Build" vs "Break".HabitCard.jsx: Interactive +/– buttons with streak flames.
Dashboard.jsx:- Uses
Chart.jsto visualize Weekly Activity (Bar Chart) and Task Distribution (Doughnut). - Displays "Captain's Log" (Recent activity history).
- Connects to the new Context to distinguish between Habits, Dailies, and Todos.
- Uses
- Centralizes all data fetching:
fetchTodos,fetchHabits,createTodo,renewTodo, etc. - Ensures distinct arrays for
todos(New System) andtasks(Legacy/Dailies). - Auto-refreshes user stats (Gold/XP) after every action to keep the HUD in sync.
-
Environment Variables: Create a
.envfile infrontend/:VITE_API_URL=http://localhost:8000
-
Install Dependencies:
npm install
-
Run Development Server:
npm run dev # Runs on http://localhost:5173