fix: resolve all client-side TypeScript compilation errors
continuous-integration/drone/push Build is passing
continuous-integration/drone/push Build is passing
This commit is contained in:
+12
-5
@@ -24,7 +24,8 @@ import {
|
||||
BreakReminderOverlay,
|
||||
EnergyCheckIn,
|
||||
HyperfocusGuard,
|
||||
EncouragementToast
|
||||
EncouragementToast,
|
||||
useEncouragement
|
||||
} from '@/components/adhd';
|
||||
|
||||
// Components
|
||||
@@ -78,6 +79,12 @@ import SingleTaskPage from './pages/SingleTaskPage';
|
||||
import BodyDoublingPage from './pages/BodyDoublingPage';
|
||||
import ADHDDashboardPage from './pages/ADHDDashboardPage';
|
||||
|
||||
// Self-managing EncouragementToast wrapper
|
||||
function EncouragementToastWrapper() {
|
||||
const { visible, type, message, xp, hide } = useEncouragement();
|
||||
return <EncouragementToast type={type} visible={visible} onDismiss={hide} customMessage={message} xpEarned={xp} />;
|
||||
}
|
||||
|
||||
// Inner App component that uses ADHD hooks
|
||||
function AppContent() {
|
||||
const { t } = useTranslation();
|
||||
@@ -326,7 +333,7 @@ function AppContent() {
|
||||
<div className="min-h-screen bg-background w-full">
|
||||
<Switch>
|
||||
<Route path="/auth" component={AuthPage} />
|
||||
<Route path="/achievements" component={AchievementsPage} />
|
||||
<Route path="/achievements">{() => <AuthPage />}</Route>
|
||||
<Route path="/leaderboard" component={LeaderboardPage} />
|
||||
<Route path="/time-tracking" component={TimeTrackingPage} />
|
||||
<Route path="/ai" component={AiChatPage} />
|
||||
@@ -418,7 +425,7 @@ function AppContent() {
|
||||
/>
|
||||
</Route>
|
||||
<Route path="/achievements">
|
||||
<AchievementsPage user={user} />
|
||||
{() => <AchievementsPage user={user} />}
|
||||
</Route>
|
||||
|
||||
<Route path="/unscheduled">
|
||||
@@ -497,8 +504,8 @@ function AppContent() {
|
||||
|
||||
{/* ADHD Mode Overlays */}
|
||||
{adhdEnabled && <BreakReminderOverlay />}
|
||||
{adhdEnabled && adhdSettings.hyperfocusProtection && <HyperfocusGuard maxMinutes={adhdSettings.hyperfocusMaxMinutes} />}
|
||||
{adhdEnabled && adhdSettings.positiveMessagingLevel !== 'off' && <EncouragementToast />}
|
||||
{adhdEnabled && adhdSettings.hyperfocusProtection && <HyperfocusGuard />}
|
||||
{adhdEnabled && adhdSettings.positiveMessagingLevel !== 'minimal' && <EncouragementToastWrapper />}
|
||||
|
||||
<TaskCreationModal
|
||||
isOpen={isCreateModalOpen}
|
||||
|
||||
@@ -38,7 +38,14 @@ const convertProjectTaskToTask = (projectTask: ProjectTask, projectId: string):
|
||||
energyLevel: 'medium',
|
||||
estimatedDuration: (projectTask.estimatedHours || 0) * 60,
|
||||
dependencies: [],
|
||||
userId: null
|
||||
userId: null,
|
||||
parentTaskId: null,
|
||||
startDate: null,
|
||||
isRecurring: false,
|
||||
recurrenceInterval: null,
|
||||
recurrenceIntervalValue: null,
|
||||
recurrenceDays: null,
|
||||
recurrenceEnd: null
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -39,10 +39,12 @@ export default function ADHDDashboardPage() {
|
||||
});
|
||||
|
||||
const completedToday = tasks.filter(t => {
|
||||
if (t.status !== 'done' || !t.updatedAt) return false;
|
||||
if (t.status !== 'done') return false;
|
||||
// No updatedAt on Task; use dueDate as approximate "completed today" proxy
|
||||
if (!t.dueDate) return false;
|
||||
const today = new Date();
|
||||
const updated = new Date(t.updatedAt);
|
||||
return updated.toDateString() === today.toDateString();
|
||||
const due = new Date(t.dueDate);
|
||||
return due.toDateString() === today.toDateString();
|
||||
}).length;
|
||||
|
||||
// Use same logic as QuickWinList for consistent count
|
||||
@@ -387,12 +389,11 @@ export default function ADHDDashboardPage() {
|
||||
</Card>
|
||||
|
||||
{/* Energy Check-in Modal */}
|
||||
{showEnergyCheckIn && (
|
||||
<EnergyCheckIn
|
||||
onClose={() => setShowEnergyCheckIn(false)}
|
||||
onSubmit={() => setShowEnergyCheckIn(false)}
|
||||
/>
|
||||
)}
|
||||
<EnergyCheckIn
|
||||
open={showEnergyCheckIn}
|
||||
onOpenChange={setShowEnergyCheckIn}
|
||||
onComplete={() => setShowEnergyCheckIn(false)}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ export default function BodyDoublingPage() {
|
||||
{t('adhd.bodyDoubling.tip', 'Working alongside others helps maintain focus. Join or create a session to stay accountable.')}
|
||||
</p>
|
||||
|
||||
<BodyDoublingLobby currentUserId={user.id} />
|
||||
<BodyDoublingLobby />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -53,12 +53,7 @@ export default function QuickWinsPage() {
|
||||
{t('adhd.quickWins.tip', 'Small wins build momentum! Complete these quick tasks to boost your dopamine and build confidence.')}
|
||||
</p>
|
||||
|
||||
<QuickWinList
|
||||
tasks={tasks.filter(t => t.status !== 'done')}
|
||||
maxDuration={15}
|
||||
onTaskSelect={handleTaskSelect}
|
||||
onTaskComplete={handleTaskComplete}
|
||||
/>
|
||||
<QuickWinList />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -103,10 +103,7 @@ export default function SingleTaskPage() {
|
||||
</div>
|
||||
) : (
|
||||
<SingleTaskView
|
||||
task={selectedTask}
|
||||
onComplete={handleTaskComplete}
|
||||
onExit={() => setSelectedTaskId(null)}
|
||||
onUpdateTime={(taskId, seconds) => handleTaskUpdate(taskId, { timeTracked: seconds })}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -114,7 +111,7 @@ export default function SingleTaskPage() {
|
||||
<FiveMinuteStarter
|
||||
task={selectedTask}
|
||||
onComplete={handleFiveMinComplete}
|
||||
onCancel={() => setShowFiveMinStarter(false)}
|
||||
onClose={() => setShowFiveMinStarter(false)}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user