feat: refactor ObjectivesBoard and enhance column visibility management
- Replaced local state management in `ObjectivesBoard` with `useObjectivesCollapse` hook for better state handling. - Updated collapse button logic to use the new hook's toggle function, improving code clarity. - Refactored `useColumnVisibility` to load user preferences on mount and persist visibility changes, enhancing user experience. - Integrated user preferences for Kanban filters in `TasksContext`, allowing for persistent filter settings across sessions.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
'use client';
|
||||
|
||||
import { useState } from 'react';
|
||||
import { useObjectivesCollapse } from '@/hooks/useObjectivesCollapse';
|
||||
import { Task } from '@/lib/types';
|
||||
import { TaskCard } from './TaskCard';
|
||||
import { Card, CardHeader, CardContent } from '@/components/ui/Card';
|
||||
@@ -23,7 +23,7 @@ export function ObjectivesBoard({
|
||||
compactView = false,
|
||||
pinnedTagName = "Objectifs"
|
||||
}: ObjectivesBoardProps) {
|
||||
const [isCollapsed, setIsCollapsed] = useState(false);
|
||||
const { isCollapsed, toggleCollapse } = useObjectivesCollapse();
|
||||
|
||||
if (tasks.length === 0) {
|
||||
return null; // Ne rien afficher s'il n'y a pas d'objectifs
|
||||
@@ -36,7 +36,7 @@ export function ObjectivesBoard({
|
||||
<CardHeader className="pb-3">
|
||||
<div className="flex items-center justify-between">
|
||||
<button
|
||||
onClick={() => setIsCollapsed(!isCollapsed)}
|
||||
onClick={toggleCollapse}
|
||||
className="flex items-center gap-3 hover:bg-purple-900/20 rounded-lg p-2 -m-2 transition-colors group"
|
||||
>
|
||||
<div className="w-3 h-3 bg-purple-400 rounded-full animate-pulse shadow-purple-400/50 shadow-lg"></div>
|
||||
@@ -69,7 +69,7 @@ export function ObjectivesBoard({
|
||||
|
||||
{/* Bouton collapse séparé pour mobile */}
|
||||
<button
|
||||
onClick={() => setIsCollapsed(!isCollapsed)}
|
||||
onClick={toggleCollapse}
|
||||
className="lg:hidden p-1 hover:bg-purple-900/20 rounded transition-colors"
|
||||
aria-label={isCollapsed ? "Développer" : "Réduire"}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user