fix: update KanbanFilters to use regularTasks instead of tasks
- Changed `tasks` to `regularTasks` in `KanbanFilters` for accurate task counting. - Updated priority and tag count calculations to reflect the new `regularTasks` prop, ensuring filters work with non-pinned tasks. - Adjusted `TasksContext` to provide `regularTasks`, enhancing task management clarity.
This commit is contained in:
@@ -26,7 +26,7 @@ interface KanbanFiltersProps {
|
||||
}
|
||||
|
||||
export function KanbanFilters({ filters, onFiltersChange }: KanbanFiltersProps) {
|
||||
const { tags: availableTags, tasks } = useTasksContext();
|
||||
const { tags: availableTags, regularTasks } = useTasksContext();
|
||||
const [isExpanded, setIsExpanded] = useState(false);
|
||||
const [isSortExpanded, setIsSortExpanded] = useState(false);
|
||||
const sortDropdownRef = useRef<HTMLDivElement>(null);
|
||||
@@ -117,19 +117,19 @@ export function KanbanFilters({ filters, onFiltersChange }: KanbanFiltersProps)
|
||||
const priorityCounts = useMemo(() => {
|
||||
const counts: Record<string, number> = {};
|
||||
getAllPriorities().forEach(priority => {
|
||||
counts[priority.key] = tasks.filter(task => task.priority === priority.key).length;
|
||||
counts[priority.key] = regularTasks.filter(task => task.priority === priority.key).length;
|
||||
});
|
||||
return counts;
|
||||
}, [tasks]);
|
||||
}, [regularTasks]);
|
||||
|
||||
// Calculer les compteurs pour les tags
|
||||
const tagCounts = useMemo(() => {
|
||||
const counts: Record<string, number> = {};
|
||||
availableTags.forEach(tag => {
|
||||
counts[tag.name] = tasks.filter(task => task.tags?.includes(tag.name)).length;
|
||||
counts[tag.name] = regularTasks.filter(task => task.tags?.includes(tag.name)).length;
|
||||
});
|
||||
return counts;
|
||||
}, [tasks, availableTags]);
|
||||
}, [regularTasks, availableTags]);
|
||||
|
||||
const priorityOptions = getAllPriorities().map(priorityConfig => ({
|
||||
value: priorityConfig.key,
|
||||
|
||||
Reference in New Issue
Block a user