From e2e5d7e5fab8a40fd7932f02dba65aea652f4a01 Mon Sep 17 00:00:00 2001 From: Birdup <34012548+birdup000@users.noreply.github.com> Date: Sat, 21 Dec 2024 23:21:02 -0600 Subject: [PATCH] checkpoint --- app/components/AIAssistantPanel.tsx | 235 +++++ app/components/LoadingScreen.tsx | 16 + app/components/LoginForm.tsx | 48 +- app/components/RuleForm.tsx | 280 ++++++ app/components/TaskAnalytics.tsx | 127 +++ app/components/TaskAttachments.tsx | 199 ++++ app/components/TaskAutomation.tsx | 278 ++++++ app/components/TaskComments.tsx | 153 +++ app/components/TaskDependencies.tsx | 197 ++++ app/components/TaskDependencyGraph.tsx | 246 +++++ app/components/TaskDetailsPanel.tsx | 282 ++++++ app/components/TaskHistory.tsx | 143 +++ app/components/TaskLabels.tsx | 238 +++++ app/components/TaskNotifications.tsx | 222 +++++ app/components/TaskPanel.tsx | 1210 ++++-------------------- app/components/TaskPriorityMatrix.tsx | 169 ++++ app/components/TaskProgress.tsx | 168 ++++ app/components/TaskRecurrence.tsx | 233 +++++ app/components/TaskTimer.tsx | 196 ++++ app/hooks/useAIAssistant.ts | 165 ++++ app/page.tsx | 29 +- app/providers/AuthProvider.tsx | 41 +- app/tasks/page.tsx | 27 + app/types/task.ts | 29 + app/utils/auth.ts | 150 +-- package-lock.json | 719 ++++++++++++++ package.json | 62 +- 27 files changed, 4756 insertions(+), 1106 deletions(-) create mode 100644 app/components/AIAssistantPanel.tsx create mode 100644 app/components/LoadingScreen.tsx create mode 100644 app/components/RuleForm.tsx create mode 100644 app/components/TaskAnalytics.tsx create mode 100644 app/components/TaskAttachments.tsx create mode 100644 app/components/TaskAutomation.tsx create mode 100644 app/components/TaskComments.tsx create mode 100644 app/components/TaskDependencies.tsx create mode 100644 app/components/TaskDependencyGraph.tsx create mode 100644 app/components/TaskDetailsPanel.tsx create mode 100644 app/components/TaskHistory.tsx create mode 100644 app/components/TaskLabels.tsx create mode 100644 app/components/TaskNotifications.tsx create mode 100644 app/components/TaskPriorityMatrix.tsx create mode 100644 app/components/TaskProgress.tsx create mode 100644 app/components/TaskRecurrence.tsx create mode 100644 app/components/TaskTimer.tsx create mode 100644 app/hooks/useAIAssistant.ts create mode 100644 app/tasks/page.tsx diff --git a/app/components/AIAssistantPanel.tsx b/app/components/AIAssistantPanel.tsx new file mode 100644 index 0000000..f30be40 --- /dev/null +++ b/app/components/AIAssistantPanel.tsx @@ -0,0 +1,235 @@ +"use client"; + +import React, { useState } from 'react'; +import { useAIAssistant } from '../hooks/useAIAssistant'; +import { Task } from '../types/task'; + +interface AIAssistantPanelProps { + backendUrl: string; + authToken: string; + onTaskSuggestion: (task: Partial) => void; + onTaskOptimization: (taskIds: string[]) => void; + tasks: Task[]; + selectedTask: Task | null; + className?: string; +} + +const AIAssistantPanel: React.FC = ({ + backendUrl, + authToken, + onTaskSuggestion, + onTaskOptimization, + tasks, + selectedTask, + className = '', +}) => { + const [context, setContext] = useState(''); + const [suggestions, setSuggestions] = useState([]); + const [analysis, setAnalysis] = useState(null); + const [isExpanded, setIsExpanded] = useState(true); + + const { + isProcessing, + error, + selectedAgent, + setSelectedAgent, + generateTaskSuggestions, + optimizeTaskOrder, + analyzeTaskProgress, + generateSubtasks, + } = useAIAssistant({ backendUrl, authToken }); + + const handleGenerateSuggestions = async () => { + const result = await generateTaskSuggestions(context); + setSuggestions(result); + }; + + const handleOptimizeOrder = async () => { + const result = await optimizeTaskOrder(tasks); + if (result) { + onTaskOptimization(result); + } + }; + + const handleAnalyzeTask = async () => { + if (!selectedTask) return; + const result = await analyzeTaskProgress(selectedTask); + setAnalysis(result); + }; + + const handleGenerateSubtasks = async () => { + if (!selectedTask) return; + const result = await generateSubtasks(selectedTask); + if (result) { + onTaskSuggestion({ ...selectedTask, subtasks: result.subtasks }); + } + }; + + return ( +
+
+

AI Assistant

+ +
+ + {isExpanded && ( +
+ {error && ( +
+ {error} +
+ )} + +
+ + +
+ +
+ +