feat: optimize active filters display in KanbanFilters
- Replaced `hasActiveFilters` with `activeFiltersCount` for clearer filter count logic. - Updated UI to show the count of active filters instead of a boolean check, enhancing user feedback on active filters.
This commit is contained in:
@@ -79,6 +79,7 @@ export function KanbanFilters({ filters, onFiltersChange }: KanbanFiltersProps)
|
|||||||
};
|
};
|
||||||
|
|
||||||
const hasActiveFilters = filters.search || filters.tags?.length || filters.priorities?.length;
|
const hasActiveFilters = filters.search || filters.tags?.length || filters.priorities?.length;
|
||||||
|
const activeFiltersCount = (filters.tags?.length || 0) + (filters.priorities?.length || 0) + (filters.search ? 1 : 0);
|
||||||
|
|
||||||
const priorityOptions: { value: TaskPriority; label: string; color: string }[] = [
|
const priorityOptions: { value: TaskPriority; label: string; color: string }[] = [
|
||||||
{ value: 'urgent', label: 'Urgent', color: 'bg-red-500' },
|
{ value: 'urgent', label: 'Urgent', color: 'bg-red-500' },
|
||||||
@@ -160,14 +161,14 @@ export function KanbanFilters({ filters, onFiltersChange }: KanbanFiltersProps)
|
|||||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M19 9l-7 7-7-7" />
|
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M19 9l-7 7-7-7" />
|
||||||
</svg>
|
</svg>
|
||||||
Filtres
|
Filtres
|
||||||
{hasActiveFilters && (
|
{activeFiltersCount > 0 && (
|
||||||
<span className="bg-cyan-500 text-slate-900 text-xs px-2 py-0.5 rounded-full font-medium">
|
<span className="bg-cyan-500 text-slate-900 text-xs px-2 py-0.5 rounded-full font-medium">
|
||||||
{(filters.tags?.length || 0) + (filters.priorities?.length || 0) + (filters.search ? 1 : 0)}
|
{activeFiltersCount}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
{hasActiveFilters && (
|
{activeFiltersCount > 0 && (
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
onClick={handleClearFilters}
|
onClick={handleClearFilters}
|
||||||
@@ -233,7 +234,7 @@ export function KanbanFilters({ filters, onFiltersChange }: KanbanFiltersProps)
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Résumé des filtres actifs */}
|
{/* Résumé des filtres actifs */}
|
||||||
{hasActiveFilters && (
|
{activeFiltersCount > 0 && (
|
||||||
<div className="bg-slate-800/30 rounded-lg p-3 border border-slate-700/50">
|
<div className="bg-slate-800/30 rounded-lg p-3 border border-slate-700/50">
|
||||||
<div className="text-xs text-slate-400 font-mono uppercase tracking-wider mb-2">
|
<div className="text-xs text-slate-400 font-mono uppercase tracking-wider mb-2">
|
||||||
Filtres actifs
|
Filtres actifs
|
||||||
|
|||||||
Reference in New Issue
Block a user