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:
@@ -138,6 +138,13 @@ export function KanbanFilters({ filters, onFiltersChange, hiddenStatuses: propsH
|
||||
});
|
||||
};
|
||||
|
||||
const handleCompletedLast7DaysFilterToggle = () => {
|
||||
onFiltersChange({
|
||||
...filters,
|
||||
showCompletedLast7Days: !filters.showCompletedLast7Days
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<ControlPanel className="bg-[var(--card)]/50 border-b border-[var(--border)]/50 backdrop-blur-sm">
|
||||
<div className="container mx-auto px-6 py-4">
|
||||
@@ -230,7 +237,9 @@ export function KanbanFilters({ filters, onFiltersChange, hiddenStatuses: propsH
|
||||
|
||||
<GeneralFilters
|
||||
showWithDueDate={filters.showWithDueDate}
|
||||
showCompletedLast7Days={filters.showCompletedLast7Days}
|
||||
onDueDateFilterToggle={handleDueDateFilterToggle}
|
||||
onCompletedLast7DaysFilterToggle={handleCompletedLast7DaysFilterToggle}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -55,4 +55,4 @@ export function KanbanHeader({
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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 (
|
||||
<div className="space-y-2">
|
||||
<label className="block text-xs font-mono font-medium text-[var(--muted-foreground)] uppercase tracking-wider">
|
||||
@@ -30,6 +37,23 @@ export function GeneralFilters({ showWithDueDate = false, onDueDateFilterToggle
|
||||
>
|
||||
Avec date de fin
|
||||
</FilterChip>
|
||||
|
||||
<FilterChip
|
||||
onClick={onCompletedLast7DaysFilterToggle}
|
||||
variant={showCompletedLast7Days ? 'selected' : 'default'}
|
||||
icon={
|
||||
<svg
|
||||
className="w-4 h-4"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
|
||||
</svg>
|
||||
}
|
||||
>
|
||||
Complété les 7 derniers jours
|
||||
</FilterChip>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -517,10 +517,11 @@ const TaskCard = forwardRef<HTMLDivElement, TaskCardProps>(
|
||||
</Badge>
|
||||
)}
|
||||
|
||||
{/* Statut terminé */}
|
||||
{/* Statut terminé avec date de résolution */}
|
||||
{completedAt && (
|
||||
<span className="text-emerald-400 font-mono font-bold">
|
||||
✓ DONE
|
||||
<span className="text-emerald-400 font-mono font-bold flex items-center gap-1">
|
||||
<span>✓</span>
|
||||
<span>{formatDateForDisplay(completedAt, 'DISPLAY_SHORT')}</span>
|
||||
</span>
|
||||
)}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user