From 4f9cff94f3b7f9ea79363efc06920da4fb992813 Mon Sep 17 00:00:00 2001 From: Julien Froidefond Date: Thu, 18 Sep 2025 21:13:09 +0200 Subject: [PATCH] feat: integrate Jira ticket information in EditTaskForm - Added functionality to display Jira ticket details in the `EditTaskForm` when the task source is 'jira'. - Implemented a helper function to construct the Jira ticket URL based on user preferences. - Included badges for Jira key, project, and type, enhancing task visibility and user interaction. - Utilized `useUserPreferences` to fetch Jira configuration dynamically. --- components/forms/EditTaskForm.tsx | 54 +++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/components/forms/EditTaskForm.tsx b/components/forms/EditTaskForm.tsx index 0ad1b89..5e2066b 100644 --- a/components/forms/EditTaskForm.tsx +++ b/components/forms/EditTaskForm.tsx @@ -6,7 +6,9 @@ import { Button } from '@/components/ui/Button'; import { Input } from '@/components/ui/Input'; import { TagInput } from '@/components/ui/TagInput'; import { RelatedTodos } from '@/components/forms/RelatedTodos'; +import { Badge } from '@/components/ui/Badge'; import { Task, TaskPriority, TaskStatus } from '@/lib/types'; +import { useUserPreferences } from '@/contexts/UserPreferencesContext'; // UpdateTaskData removed - using Server Actions directly import { getAllStatuses, getAllPriorities } from '@/lib/status-config'; @@ -19,6 +21,7 @@ interface EditTaskFormProps { } export function EditTaskForm({ isOpen, onClose, onSubmit, task, loading = false }: EditTaskFormProps) { + const { preferences } = useUserPreferences(); const [formData, setFormData] = useState<{ title: string; description: string; @@ -37,6 +40,13 @@ export function EditTaskForm({ isOpen, onClose, onSubmit, task, loading = false const [errors, setErrors] = useState>({}); + // Helper pour construire l'URL Jira + const getJiraTicketUrl = (jiraKey: string): string => { + const baseUrl = preferences.jiraConfig.baseUrl; + if (!baseUrl || !jiraKey) return ''; + return `${baseUrl}/browse/${jiraKey}`; + }; + // Pré-remplir le formulaire quand la tâche change useEffect(() => { if (task) { @@ -179,6 +189,50 @@ export function EditTaskForm({ isOpen, onClose, onSubmit, task, loading = false disabled={loading} /> + {/* Informations Jira */} + {task.source === 'jira' && task.jiraKey && ( +
+ + +
+ {preferences.jiraConfig.baseUrl ? ( + + + {task.jiraKey} + + + ) : ( + + {task.jiraKey} + + )} + + {task.jiraProject && ( + + {task.jiraProject} + + )} + + {task.jiraType && ( + + {task.jiraType} + + )} +
+
+ )} + {/* Tags */}