feat: add pinned tag functionality and UI enhancements

- Introduced `isPinned` property to the `Tag` model for marking main objectives.
- Updated `TagForm` to include a checkbox for setting tags as pinned, enhancing user interaction.
- Enhanced `KanbanBoardContainer` to display pinned tasks in a dedicated `ObjectivesBoard`, improving task visibility.
- Modified `KanbanFilters` to support filtering by pinned tags, streamlining task management.
- Adjusted `TasksContext` to separate pinned tasks from regular tasks for better organization.
This commit is contained in:
Julien Froidefond
2025-09-14 22:23:55 +02:00
parent c4f68bb00c
commit a589c0cc2f
10 changed files with 309 additions and 27 deletions

View File

@@ -33,7 +33,8 @@ const PRESET_COLORS = [
export function TagForm({ isOpen, onClose, onSubmit, tag, loading = false }: TagFormProps) {
const [formData, setFormData] = useState({
name: '',
color: '#3B82F6'
color: '#3B82F6',
isPinned: false
});
const [errors, setErrors] = useState<string[]>([]);
@@ -42,12 +43,14 @@ export function TagForm({ isOpen, onClose, onSubmit, tag, loading = false }: Tag
if (tag) {
setFormData({
name: tag.name,
color: tag.color
color: tag.color,
isPinned: tag.isPinned || false
});
} else {
setFormData({
name: '',
color: TagsClient.generateRandomColor()
color: TagsClient.generateRandomColor(),
isPinned: false
});
}
setErrors([]);
@@ -166,6 +169,30 @@ export function TagForm({ isOpen, onClose, onSubmit, tag, loading = false }: Tag
</div>
</div>
{/* Objectif principal */}
<div className="space-y-2">
<label className="block text-sm font-mono font-medium text-slate-300 uppercase tracking-wider">
Type de tag
</label>
<div className="flex items-center gap-3">
<label className="flex items-center gap-2 cursor-pointer">
<input
type="checkbox"
checked={formData.isPinned}
onChange={(e) => setFormData(prev => ({ ...prev, isPinned: e.target.checked }))}
disabled={loading}
className="w-4 h-4 rounded border border-slate-600 bg-slate-800 text-purple-600 focus:ring-purple-500 focus:ring-2 disabled:cursor-not-allowed"
/>
<span className="text-sm text-slate-300">
🎯 Objectif principal
</span>
</label>
</div>
<p className="text-xs text-slate-400">
Les tâches avec ce tag apparaîtront dans la section "Objectifs Principaux" au-dessus du Kanban
</p>
</div>
{/* Erreurs */}
{errors.length > 0 && (
<div className="bg-red-900/20 border border-red-500/30 rounded-lg p-3">