diff --git a/src/components/dashboard/TasksSection.tsx b/src/components/dashboard/TasksSection.tsx index 0f795229d..8d2e1bc03 100644 --- a/src/components/dashboard/TasksSection.tsx +++ b/src/components/dashboard/TasksSection.tsx @@ -1,20 +1,3 @@ -/** - * TASKS SECTION - * - * Dynamic recommendations based on user state. - * All task logic comes from the SSOT recommendations service. - * - * KEY PRINCIPLES: - * - No hardcoded tasks - all from SSOT - * - Context-aware - shows only relevant tasks - * - Progressive - harder tasks after basics complete - * - Low friction - minimal clicks, immediate feedback - * - * Created: 2025-01-XX (original) - * Last Modified: 2026-01-07 - * Last Modified Summary: Refactored to use recommendations service SSOT - */ - 'use client'; import { useState } from 'react'; @@ -38,22 +21,16 @@ import { TASK_DEFINITIONS } from '@/services/recommendations/tasks'; import type { RecommendedTask, TaskPriority } from '@/services/recommendations/types'; import type { LucideIcon } from 'lucide-react'; -// Build a lookup map from task ID to icon (since icons can't be serialized via API) const TASK_ICON_MAP: Record = Object.fromEntries( TASK_DEFINITIONS.map(task => [task.id, task.icon]) ); interface TasksSectionProps { className?: string; - /** Maximum tasks to display */ maxTasks?: number; - /** Show smart questions when profile complete */ showQuestions?: boolean; } -/** - * Get priority styling - */ function getPriorityColor(priority: TaskPriority): string { switch (priority) { case 'critical': @@ -67,9 +44,6 @@ function getPriorityColor(priority: TaskPriority): string { } } -/** - * Get priority label - */ function getPriorityLabel(priority: TaskPriority): string { switch (priority) { case 'critical': @@ -101,14 +75,12 @@ export default function TasksSection({ celebration, markTaskCompleted, completedTaskIds, - } = useRecommendations({ limit: maxTasks + 2 }); // Fetch extra for "show more" + } = useRecommendations({ limit: maxTasks + 2 }); - // Not authenticated if (!user || !profile) { return null; } - // Loading state if (isLoading) { return ( @@ -120,12 +92,10 @@ export default function TasksSection({ ); } - // Error state if (error) { - return null; // Silent fail - don't block dashboard + return null; } - // Celebration state - all setup tasks done if (celebration) { return (
@@ -134,17 +104,10 @@ export default function TasksSection({
-

- {celebration.title} -

+

{celebration.title}

{celebration.description}

- - {/* Show smart questions for engaged users */} {showQuestions && questions.length > 0 && ( - + )} @@ -152,7 +115,6 @@ export default function TasksSection({ ); } - // No tasks - shouldn't happen but handle gracefully if (tasks.length === 0) { return null; } @@ -176,9 +138,7 @@ export default function TasksSection({
-
- {taskCompletion}% Setup -
+
{taskCompletion}% Setup
{tasks.length} task{tasks.length !== 1 ? 's' : ''} remaining
@@ -197,7 +157,6 @@ export default function TasksSection({
- {/* Progress bar */}
- {visibleTasks.map((task) => ( + {visibleTasks.map(task => ( 0 && (
-
)}
- {/* Show smart questions if profile is mostly complete */} {showQuestions && questions.length > 0 && profileCompletion >= 75 && ( - + )} )} @@ -245,9 +196,6 @@ export default function TasksSection({ ); } -/** - * Individual task card - */ function TaskCard({ task, onComplete, @@ -257,20 +205,15 @@ function TaskCard({ onComplete: () => void; isCompleted: boolean; }) { - // Look up icon from the map since icons can't be serialized via API const IconComponent = TASK_ICON_MAP[task.id] || Target; return (
- {/* Checkbox */}