import { useTranslation } from 'react-i18next'; import { useQuery } from '@tanstack/react-query'; import { useADHDMode, ADHDSettingsPanel, EnergyCheckIn } from '@/components/adhd'; import { User, Task } from '@shared/schema'; import { Brain, Zap, Focus, Users, Battery, TrendingUp, ArrowLeft, HelpCircle, Clock, Coffee, Sparkles, Timer, Split } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; import { Accordion, AccordionContent, AccordionItem, AccordionTrigger, } from "@/components/ui/accordion"; import { useLocation } from 'wouter'; import { useState } from 'react'; export default function ADHDDashboardPage() { const { t } = useTranslation(); const [, setLocation] = useLocation(); const { isEnabled, settings } = useADHDMode(); const [showEnergyCheckIn, setShowEnergyCheckIn] = useState(false); const { data: user } = useQuery({ queryKey: ['/api/user'], }); const { data: tasks = [] } = useQuery({ queryKey: ['/api/tasks'], }); const { data: breakStats } = useQuery({ queryKey: ['/api/user/break-stats'], enabled: isEnabled, }); const { data: energyHistory } = useQuery({ queryKey: ['/api/energy/history'], enabled: isEnabled, }); const completedToday = tasks.filter(t => { if (t.status !== 'done' || !t.updatedAt) return false; const today = new Date(); const updated = new Date(t.updatedAt); return updated.toDateString() === today.toDateString(); }).length; const quickWins = tasks.filter(t => t.status !== 'done' && t.estimatedDuration && t.estimatedDuration <= 15 ).length; const features = [ { icon: Zap, title: t('adhd.quickWins.title'), description: t('adhd.quickWins.description'), path: '/adhd/quick-wins', color: 'from-yellow-400 to-orange-500', stat: `${quickWins} ${t('adhd.dashboard.available', 'available')}`, }, { icon: Focus, title: t('adhd.singleTask.title'), description: t('adhd.singleTask.description'), path: '/adhd/single-task', color: 'from-blue-400 to-indigo-500', stat: t('adhd.dashboard.focusMode', 'Focus mode'), }, { icon: Users, title: t('adhd.bodyDoubling.title'), description: t('adhd.bodyDoubling.description'), path: '/adhd/body-doubling', color: 'from-green-400 to-teal-500', stat: t('adhd.dashboard.coworking', 'Co-working'), }, ]; return (

{t('adhd.dashboard.title', 'ADHD Dashboard')}

{t('adhd.dashboard.subtitle', 'Tools designed for how your brain works')}

{/* Stats Row */}

{completedToday}

{t('adhd.dashboard.completedToday', 'Done today')}

{user?.currentEnergyLevel || '-'}

{t('adhd.dashboard.energyLevel', 'Energy')}

{quickWins}

{t('adhd.dashboard.quickWins', 'Quick wins')}

{user?.currentStreak || 0}

{t('adhd.dashboard.streak', 'Day streak')}

{/* Energy Check-in Button */} {isEnabled && settings.energyCheckInsEnabled && !user?.todayEnergyCheckedIn && (

{t('adhd.energy.checkInReminder', 'How are you feeling today?')}

{t('adhd.energy.checkInBenefit', 'Track your energy to get better task suggestions')}

)} {/* Feature Cards */}
{features.map((feature) => ( setLocation(feature.path)} >
{feature.title} {feature.description}

{feature.stat}

))}
{/* Settings Panel */} {t('adhd.settings.title', 'ADHD Settings')} {t('adhd.settings.description', 'Customize your ADHD-friendly experience')} {/* Collapsible Help Section */}
{t('adhd.dashboard.helpTitle', 'How Focus Tools Help You')}

{t('adhd.dashboard.helpIntro', 'These tools are designed around how your brain works, not against it. Each feature addresses a specific challenge and provides practical strategies to help you get things done.')}

{/* Quick Wins */}

{t('adhd.dashboard.help.quickWins.title', 'Quick Wins')}

{t('adhd.dashboard.help.why', 'Why')}: {t('adhd.dashboard.help.quickWins.why', 'Starting tasks feels overwhelming when everything seems big.')}

{t('adhd.dashboard.help.how', 'How')}: {t('adhd.dashboard.help.quickWins.how', 'Shows only tasks under 15 minutes. Small wins build momentum and dopamine.')}

{t('adhd.dashboard.help.usage', 'Use it')}: {t('adhd.dashboard.help.quickWins.usage', 'Open Quick Wins when you feel stuck or need to build momentum.')}

{/* Single Task Focus */}

{t('adhd.dashboard.help.singleTask.title', 'Single Task Focus')}

{t('adhd.dashboard.help.why', 'Why')}: {t('adhd.dashboard.help.singleTask.why', 'Task lists are overwhelming. Seeing everything makes it hard to start anything.')}

{t('adhd.dashboard.help.how', 'How')}: {t('adhd.dashboard.help.singleTask.how', 'Shows only ONE task at a time. No distractions, no choices, just focus.')}

{t('adhd.dashboard.help.usage', 'Use it')}: {t('adhd.dashboard.help.singleTask.usage', 'When you have many tasks and feel paralyzed by choice.')}

{/* 5-Minute Starter */}

{t('adhd.dashboard.help.fiveMinute.title', '5-Minute Starter')}

{t('adhd.dashboard.help.why', 'Why')}: {t('adhd.dashboard.help.fiveMinute.why', 'Getting started is the hardest part. Commitment feels impossible.')}

{t('adhd.dashboard.help.how', 'How')}: {t('adhd.dashboard.help.fiveMinute.how', 'Commit to just 5 minutes. Often, starting leads to continuing naturally.')}

{t('adhd.dashboard.help.usage', 'Use it')}: {t('adhd.dashboard.help.fiveMinute.usage', 'For tasks you keep avoiding. Just 5 minutes, then decide if you continue.')}

{/* Visual Timer */}

{t('adhd.dashboard.help.visualTimer.title', 'Visual Timer')}

{t('adhd.dashboard.help.why', 'Why')}: {t('adhd.dashboard.help.visualTimer.why', 'Time blindness makes it hard to feel time passing.')}

{t('adhd.dashboard.help.how', 'How')}: {t('adhd.dashboard.help.visualTimer.how', 'A visual countdown shows time disappearing, making it tangible.')}

{t('adhd.dashboard.help.usage', 'Use it')}: {t('adhd.dashboard.help.visualTimer.usage', 'Set timers for work sessions. The visual helps maintain awareness.')}

{/* Break Reminders */}

{t('adhd.dashboard.help.breaks.title', 'Break Reminders')}

{t('adhd.dashboard.help.why', 'Why')}: {t('adhd.dashboard.help.breaks.why', 'Hyperfocus makes you forget basic needs like rest, food, water.')}

{t('adhd.dashboard.help.how', 'How')}: {t('adhd.dashboard.help.breaks.how', 'Gentle reminders interrupt hyperfocus before burnout.')}

{t('adhd.dashboard.help.usage', 'Use it')}: {t('adhd.dashboard.help.breaks.usage', 'Enable in settings. Take the breaks even when you feel productive.')}

{/* Energy Tracking */}

{t('adhd.dashboard.help.energy.title', 'Energy Tracking')}

{t('adhd.dashboard.help.why', 'Why')}: {t('adhd.dashboard.help.energy.why', 'Energy fluctuates unpredictably. Fighting low energy wastes time.')}

{t('adhd.dashboard.help.how', 'How')}: {t('adhd.dashboard.help.energy.how', 'Track your energy to match tasks to your current state.')}

{t('adhd.dashboard.help.usage', 'Use it')}: {t('adhd.dashboard.help.energy.usage', 'Check in daily. Do hard tasks when high, easy tasks when low.')}

{/* Body Doubling */}

{t('adhd.dashboard.help.bodyDoubling.title', 'Body Doubling')}

{t('adhd.dashboard.help.why', 'Why')}: {t('adhd.dashboard.help.bodyDoubling.why', 'Working alone feels impossible. Presence of others helps focus.')}

{t('adhd.dashboard.help.how', 'How')}: {t('adhd.dashboard.help.bodyDoubling.how', 'Virtual co-working sessions simulate having someone nearby.')}

{t('adhd.dashboard.help.usage', 'Use it')}: {t('adhd.dashboard.help.bodyDoubling.usage', 'Join a session when working from home feels isolating.')}

{/* Task Breakdown */}

{t('adhd.dashboard.help.taskBreakdown.title', 'AI Task Breakdown')}

{t('adhd.dashboard.help.why', 'Why')}: {t('adhd.dashboard.help.taskBreakdown.why', 'Big tasks feel impossible to start when you cannot see the steps.')}

{t('adhd.dashboard.help.how', 'How')}: {t('adhd.dashboard.help.taskBreakdown.how', 'AI breaks large tasks into small, actionable subtasks automatically.')}

{t('adhd.dashboard.help.usage', 'Use it')}: {t('adhd.dashboard.help.taskBreakdown.usage', 'Click breakdown on any overwhelming task to get clear next steps.')}

{/* Hyperfocus Protection */}

{t('adhd.dashboard.help.hyperfocus.title', 'Hyperfocus Protection')}

{t('adhd.dashboard.help.why', 'Why')}: {t('adhd.dashboard.help.hyperfocus.why', 'Hyperfocus can make you lose hours on one thing while neglecting others.')}

{t('adhd.dashboard.help.how', 'How')}: {t('adhd.dashboard.help.hyperfocus.how', 'Alerts when you spend too long on a single task.')}

{t('adhd.dashboard.help.usage', 'Use it')}: {t('adhd.dashboard.help.hyperfocus.usage', 'Enable in settings. When alerted, save your progress and decide consciously.')}

{/* Energy Check-in Modal */} {showEnergyCheckIn && ( setShowEnergyCheckIn(false)} onSubmit={() => setShowEnergyCheckIn(false)} /> )}
); }