diff --git a/src/components/kanban/KanbanFilters.tsx b/src/components/kanban/KanbanFilters.tsx index 8257544..94f7c53 100644 --- a/src/components/kanban/KanbanFilters.tsx +++ b/src/components/kanban/KanbanFilters.tsx @@ -138,6 +138,13 @@ export function KanbanFilters({ filters, onFiltersChange, hiddenStatuses: propsH }); }; + const handleCompletedLast7DaysFilterToggle = () => { + onFiltersChange({ + ...filters, + showCompletedLast7Days: !filters.showCompletedLast7Days + }); + }; + return (
@@ -230,7 +237,9 @@ export function KanbanFilters({ filters, onFiltersChange, hiddenStatuses: propsH
diff --git a/src/components/kanban/KanbanHeader.tsx b/src/components/kanban/KanbanHeader.tsx index 67c4a7c..eee5397 100644 --- a/src/components/kanban/KanbanHeader.tsx +++ b/src/components/kanban/KanbanHeader.tsx @@ -55,4 +55,4 @@ export function KanbanHeader({ )} ); -} +} \ No newline at end of file diff --git a/src/components/kanban/filters/GeneralFilters.tsx b/src/components/kanban/filters/GeneralFilters.tsx index c64a92b..b256df4 100644 --- a/src/components/kanban/filters/GeneralFilters.tsx +++ b/src/components/kanban/filters/GeneralFilters.tsx @@ -4,10 +4,17 @@ import { FilterChip } from '@/components/ui'; interface GeneralFiltersProps { showWithDueDate?: boolean; + showCompletedLast7Days?: boolean; onDueDateFilterToggle: () => void; + onCompletedLast7DaysFilterToggle: () => void; } -export function GeneralFilters({ showWithDueDate = false, onDueDateFilterToggle }: GeneralFiltersProps) { +export function GeneralFilters({ + showWithDueDate = false, + showCompletedLast7Days = false, + onDueDateFilterToggle, + onCompletedLast7DaysFilterToggle +}: GeneralFiltersProps) { return (
); diff --git a/src/components/ui/FilterSummary.tsx b/src/components/ui/FilterSummary.tsx index a3eceb6..c8864c3 100644 --- a/src/components/ui/FilterSummary.tsx +++ b/src/components/ui/FilterSummary.tsx @@ -9,6 +9,7 @@ interface FilterSummaryProps { priorities?: string[]; tags?: string[]; showWithDueDate?: boolean; + showCompletedLast7Days?: boolean; showJiraOnly?: boolean; hideJiraTasks?: boolean; jiraProjects?: string[]; @@ -72,6 +73,15 @@ export function FilterSummary({ }); } + // Affichage complété les 7 derniers jours + if (filters.showCompletedLast7Days) { + filterItems.push({ + label: 'Affichage', + value: 'Complété les 7 derniers jours', + variant: 'success' + }); + } + // Jira if (filters.showJiraOnly) { filterItems.push({ diff --git a/src/components/ui/TaskCard.tsx b/src/components/ui/TaskCard.tsx index 4eb5f8d..5f1c6ea 100644 --- a/src/components/ui/TaskCard.tsx +++ b/src/components/ui/TaskCard.tsx @@ -517,10 +517,11 @@ const TaskCard = forwardRef( )} - {/* Statut terminé */} + {/* Statut terminé avec date de résolution */} {completedAt && ( - - ✓ DONE + + + {formatDateForDisplay(completedAt, 'DISPLAY_SHORT')} )} diff --git a/src/contexts/TasksContext.tsx b/src/contexts/TasksContext.tsx index 0433be2..f2740c6 100644 --- a/src/contexts/TasksContext.tsx +++ b/src/contexts/TasksContext.tsx @@ -61,6 +61,7 @@ export function TasksProvider({ children, initialTasks, initialTags, initialStat swimlanesByTags: preferences.viewPreferences.swimlanesByTags || false, swimlanesMode: preferences.viewPreferences.swimlanesMode || 'tags', showWithDueDate: preferences.kanbanFilters.showWithDueDate || false, + showCompletedLast7Days: preferences.kanbanFilters.showCompletedLast7Days || false, // Filtres Jira showJiraOnly: preferences.kanbanFilters.showJiraOnly || false, hideJiraTasks: preferences.kanbanFilters.hideJiraTasks || false, @@ -82,6 +83,7 @@ export function TasksProvider({ children, initialTasks, initialTags, initialStat showCompleted: newFilters.showCompleted, sortBy: newFilters.sortBy, showWithDueDate: newFilters.showWithDueDate, + showCompletedLast7Days: newFilters.showCompletedLast7Days, // Filtres Jira showJiraOnly: newFilters.showJiraOnly, hideJiraTasks: newFilters.hideJiraTasks, @@ -106,6 +108,7 @@ export function TasksProvider({ children, initialTasks, initialTags, initialStat ]); }; + // Séparer les tâches épinglées (objectifs) des autres et les trier const { pinnedTasks, regularTasks } = useMemo(() => { const pinnedTagNames = tags.filter(tag => tag.isPinned).map(tag => tag.name); @@ -141,6 +144,7 @@ export function TasksProvider({ children, initialTasks, initialTags, initialStat (kanbanFilters.priorities?.filter(Boolean).length || 0) + (kanbanFilters.search ? 1 : 0) + (kanbanFilters.showWithDueDate ? 1 : 0) + + (kanbanFilters.showCompletedLast7Days ? 1 : 0) + (kanbanFilters.jiraProjects?.filter(Boolean).length || 0) + (kanbanFilters.jiraTypes?.filter(Boolean).length || 0) + (kanbanFilters.showJiraOnly ? 1 : 0) + @@ -220,6 +224,18 @@ export function TasksProvider({ children, initialTasks, initialTags, initialStat filtered = filtered.filter(task => task.dueDate != null); } + // Filtre par tâches complétées les 7 derniers jours + if (kanbanFilters.showCompletedLast7Days) { + const sevenDaysAgo = new Date(); + sevenDaysAgo.setDate(sevenDaysAgo.getDate() - 7); + + filtered = filtered.filter(task => + task.status === 'done' && + task.completedAt && + task.completedAt >= sevenDaysAgo + ); + } + // Tri des tâches if (kanbanFilters.sortBy) { const sortOption = getSortOption(kanbanFilters.sortBy); diff --git a/src/lib/types.ts b/src/lib/types.ts index ad0157b..5effd99 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -79,6 +79,7 @@ export interface KanbanFilters { showCompleted?: boolean; sortBy?: string; showWithDueDate?: boolean; + showCompletedLast7Days?: boolean; // Filtres spécifiques Jira showJiraOnly?: boolean; hideJiraTasks?: boolean;