feat: add filter for completed tasks in the last 7 days
- Implemented `showCompletedLast7Days` filter in `KanbanFilters` to toggle visibility of tasks completed in the last week. - Updated `GeneralFilters` to include a new filter chip for the completed tasks toggle. - Enhanced `TasksProvider` to filter tasks based on the new criteria, improving task management capabilities. - Adjusted `FilterSummary` to display the active filter status for better user feedback.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user