From adfef551ab6d7ffa7c34220f9963eaa3e13a85fa Mon Sep 17 00:00:00 2001 From: Julien Froidefond Date: Mon, 15 Sep 2025 22:16:34 +0200 Subject: [PATCH] feat: enhance DailyCheckbox model and service for type management - Added `DailyCheckboxType` to define checkbox types ('task' | 'meeting') in TypeScript. - Updated `DailyCheckbox` model in Prisma schema to include `type` field with a default value of 'task'. - Modified `DailyService` to handle checkbox type during creation and updates. - Adjusted API route to accept checkbox type in requests. - Refactored `DailyPageClient` to support type management in checkbox operations. --- components/daily/DailyAddForm.tsx | 108 +++++++++ components/daily/DailyCheckboxItem.tsx | 162 +++++++++++++ components/daily/DailySection.tsx | 87 +++++++ components/daily/EditCheckboxModal.tsx | 154 ++++++++++++ components/daily/TaskSelector.tsx | 183 ++++++++++++++ lib/types.ts | 5 + .../migration.sql | 21 ++ prisma/schema.prisma | 1 + services/daily.ts | 5 +- src/app/api/daily/route.ts | 1 + src/app/daily/DailyPageClient.tsx | 228 ++---------------- 11 files changed, 744 insertions(+), 211 deletions(-) create mode 100644 components/daily/DailyAddForm.tsx create mode 100644 components/daily/DailyCheckboxItem.tsx create mode 100644 components/daily/DailySection.tsx create mode 100644 components/daily/EditCheckboxModal.tsx create mode 100644 components/daily/TaskSelector.tsx create mode 100644 prisma/migrations/20250915195121_add_checkbox_type/migration.sql diff --git a/components/daily/DailyAddForm.tsx b/components/daily/DailyAddForm.tsx new file mode 100644 index 0000000..2b23112 --- /dev/null +++ b/components/daily/DailyAddForm.tsx @@ -0,0 +1,108 @@ +'use client'; + +import { useState, useRef } from 'react'; +import { DailyCheckboxType } from '@/lib/types'; +import { Button } from '@/components/ui/Button'; +import { Input } from '@/components/ui/Input'; + +interface DailyAddFormProps { + onAdd: (text: string, type: DailyCheckboxType) => Promise; + disabled?: boolean; + placeholder?: string; +} + +export function DailyAddForm({ onAdd, disabled = false, placeholder = "Ajouter une tâche..." }: DailyAddFormProps) { + const [newCheckboxText, setNewCheckboxText] = useState(''); + const [selectedType, setSelectedType] = useState('task'); + const [addingCheckbox, setAddingCheckbox] = useState(false); + const inputRef = useRef(null); + + const handleAddCheckbox = async () => { + if (!newCheckboxText.trim()) return; + + setAddingCheckbox(true); + try { + await onAdd(newCheckboxText.trim(), selectedType); // Pas de taskId lors de l'ajout + setNewCheckboxText(''); + // Garder le type sélectionné pour enchaîner les créations du même type + // setSelectedType('task'); // <- Supprimé pour garder la sélection + // Garder le focus sur l'input pour enchainer les entrées + setTimeout(() => { + inputRef.current?.focus(); + }, 100); + } finally { + setAddingCheckbox(false); + } + }; + + const handleKeyPress = (e: React.KeyboardEvent) => { + if (e.key === 'Enter') { + e.preventDefault(); + handleAddCheckbox(); + } + }; + + const getPlaceholder = () => { + if (placeholder !== "Ajouter une tâche...") return placeholder; + return selectedType === 'meeting' ? 'Ajouter une réunion...' : 'Ajouter une tâche...'; + }; + + return ( +
+ {/* Sélecteur de type */} +
+ + +
+ + {/* Champ de saisie et options */} +
+ setNewCheckboxText(e.target.value)} + onKeyDown={handleKeyPress} + disabled={addingCheckbox || disabled} + className="flex-1 min-w-[300px]" + /> + +
+
+ ); +} diff --git a/components/daily/DailyCheckboxItem.tsx b/components/daily/DailyCheckboxItem.tsx new file mode 100644 index 0000000..a2deb9c --- /dev/null +++ b/components/daily/DailyCheckboxItem.tsx @@ -0,0 +1,162 @@ +'use client'; + +import { useState } from 'react'; +import Link from 'next/link'; +import { DailyCheckbox, DailyCheckboxType } from '@/lib/types'; +import { Input } from '@/components/ui/Input'; +import { EditCheckboxModal } from './EditCheckboxModal'; + +interface DailyCheckboxItemProps { + checkbox: DailyCheckbox; + onToggle: (checkboxId: string) => Promise; + onUpdate: (checkboxId: string, text: string, type: DailyCheckboxType, taskId?: string) => Promise; + onDelete: (checkboxId: string) => Promise; + saving?: boolean; +} + +export function DailyCheckboxItem({ + checkbox, + onToggle, + onUpdate, + onDelete, + saving = false +}: DailyCheckboxItemProps) { + const [inlineEditingId, setInlineEditingId] = useState(null); + const [inlineEditingText, setInlineEditingText] = useState(''); + const [editingCheckbox, setEditingCheckbox] = useState(null); + + // Édition inline simple + const handleStartInlineEdit = () => { + setInlineEditingId(checkbox.id); + setInlineEditingText(checkbox.text); + }; + + const handleSaveInlineEdit = async () => { + if (!inlineEditingText.trim()) return; + + try { + await onUpdate(checkbox.id, inlineEditingText.trim(), checkbox.type, checkbox.taskId); + setInlineEditingId(null); + setInlineEditingText(''); + } catch (error) { + console.error('Erreur lors de la modification:', error); + } + }; + + const handleCancelInlineEdit = () => { + setInlineEditingId(null); + setInlineEditingText(''); + }; + + const handleInlineEditKeyPress = (e: React.KeyboardEvent) => { + if (e.key === 'Enter') { + e.preventDefault(); + handleSaveInlineEdit(); + } else if (e.key === 'Escape') { + e.preventDefault(); + handleCancelInlineEdit(); + } + }; + + // Modal d'édition avancée + const handleStartAdvancedEdit = () => { + setEditingCheckbox(checkbox); + }; + + const handleSaveAdvancedEdit = async (text: string, type: DailyCheckboxType, taskId?: string) => { + await onUpdate(checkbox.id, text, type, taskId); + setEditingCheckbox(null); + }; + + const handleCloseAdvancedEdit = () => { + setEditingCheckbox(null); + }; + + return ( + <> +
+ {/* Checkbox */} + onToggle(checkbox.id)} + disabled={saving} + className="w-4 h-4 rounded border border-[var(--border)] text-[var(--primary)] focus:ring-[var(--primary)]/20 focus:ring-2" + /> + + {/* Contenu principal */} + {inlineEditingId === checkbox.id ? ( + setInlineEditingText(e.target.value)} + onKeyDown={handleInlineEditKeyPress} + onBlur={handleSaveInlineEdit} + autoFocus + className="flex-1 h-8 text-sm" + /> + ) : ( +
+ {/* Texte cliquable pour édition inline */} + + {checkbox.text} + + + {/* Icône d'édition avancée */} + +
+ )} + + {/* Lien vers la tâche si liée */} + {checkbox.task && ( + + #{checkbox.task.id.slice(-6)} + + )} + + {/* Bouton de suppression */} + +
+ + {/* Modal d'édition avancée */} + {editingCheckbox && ( + + )} + + ); +} diff --git a/components/daily/DailySection.tsx b/components/daily/DailySection.tsx new file mode 100644 index 0000000..dcda622 --- /dev/null +++ b/components/daily/DailySection.tsx @@ -0,0 +1,87 @@ +'use client'; + +import { DailyCheckbox, DailyCheckboxType } from '@/lib/types'; +import { Card } from '@/components/ui/Card'; +import { DailyCheckboxItem } from './DailyCheckboxItem'; +import { DailyAddForm } from './DailyAddForm'; + +interface DailySectionProps { + title: string; + date: Date; + checkboxes: DailyCheckbox[]; + onAddCheckbox: (text: string, type: DailyCheckboxType) => Promise; + onToggleCheckbox: (checkboxId: string) => Promise; + onUpdateCheckbox: (checkboxId: string, text: string, type: DailyCheckboxType, taskId?: string) => Promise; + onDeleteCheckbox: (checkboxId: string) => Promise; + saving: boolean; + refreshing?: boolean; +} + +export function DailySection({ + title, + date, + checkboxes, + onAddCheckbox, + onToggleCheckbox, + onUpdateCheckbox, + onDeleteCheckbox, + saving, + refreshing = false +}: DailySectionProps) { + const formatShortDate = (date: Date) => { + return date.toLocaleDateString('fr-FR', { + day: '2-digit', + month: '2-digit', + year: 'numeric' + }); + }; + + return ( + + {/* Header */} +
+
+

+ {title} ({formatShortDate(date)}) + {refreshing && ( +
+ )} +

+ + {checkboxes.filter(cb => cb.isChecked).length}/{checkboxes.length} + +
+
+ + {/* Liste des checkboxes - zone scrollable */} +
+
+ {checkboxes.map((checkbox) => ( + + ))} + + {checkboxes.length === 0 && ( +
+ Aucune tâche pour cette période +
+ )} +
+
+ + {/* Footer - Formulaire d'ajout toujours en bas */} +
+ +
+
+ ); +} diff --git a/components/daily/EditCheckboxModal.tsx b/components/daily/EditCheckboxModal.tsx new file mode 100644 index 0000000..669ae08 --- /dev/null +++ b/components/daily/EditCheckboxModal.tsx @@ -0,0 +1,154 @@ +'use client'; + +import { useState } from 'react'; +import { DailyCheckbox, DailyCheckboxType } from '@/lib/types'; +import { Button } from '@/components/ui/Button'; +import { Input } from '@/components/ui/Input'; +import { Modal } from '@/components/ui/Modal'; +import { TaskSelector } from './TaskSelector'; + +interface EditCheckboxModalProps { + checkbox: DailyCheckbox; + isOpen: boolean; + onClose: () => void; + onSave: (text: string, type: DailyCheckboxType, taskId?: string) => Promise; + saving?: boolean; +} + +export function EditCheckboxModal({ + checkbox, + isOpen, + onClose, + onSave, + saving = false +}: EditCheckboxModalProps) { + const [text, setText] = useState(checkbox.text); + const [type, setType] = useState(checkbox.type); + const [taskId, setTaskId] = useState(checkbox.taskId); + + const handleSave = async () => { + if (!text.trim()) return; + + try { + await onSave(text.trim(), type, taskId); + onClose(); + } catch (error) { + console.error('Erreur lors de la sauvegarde:', error); + } + }; + + const handleKeyPress = (e: React.KeyboardEvent) => { + if (e.key === 'Enter' && !e.shiftKey) { + e.preventDefault(); + handleSave(); + } + }; + + const resetForm = () => { + setText(checkbox.text); + setType(checkbox.type); + setTaskId(checkbox.taskId); + }; + + const handleClose = () => { + resetForm(); + onClose(); + }; + + return ( + +
+ {/* Texte */} +
+ + setText(e.target.value)} + onKeyDown={handleKeyPress} + placeholder="Description de la tâche..." + className="w-full" + autoFocus + /> +
+ + {/* Type */} +
+ +
+ + +
+
+ + {/* Liaison tâche (seulement pour les tâches) */} + {type === 'task' && ( +
+ +
+ + {taskId && ( +
+ Tâche liée : #{taskId.slice(-6)} +
+ )} +
+
+ )} + + {/* Actions */} +
+ + +
+
+
+ ); +} diff --git a/components/daily/TaskSelector.tsx b/components/daily/TaskSelector.tsx new file mode 100644 index 0000000..63bf86f --- /dev/null +++ b/components/daily/TaskSelector.tsx @@ -0,0 +1,183 @@ +'use client'; + +import { useState, useEffect } from 'react'; +import { Task } from '@/lib/types'; +import { tasksClient } from '@/clients/tasks-client'; +import { Button } from '@/components/ui/Button'; + +interface TaskSelectorProps { + selectedTaskId?: string; + onTaskSelect: (taskId: string | undefined) => void; + disabled?: boolean; +} + +export function TaskSelector({ selectedTaskId, onTaskSelect, disabled }: TaskSelectorProps) { + const [tasks, setTasks] = useState([]); + const [loading, setLoading] = useState(false); + const [isOpen, setIsOpen] = useState(false); + const [search, setSearch] = useState(''); + + const selectedTask = tasks.find(task => task.id === selectedTaskId); + + useEffect(() => { + if (isOpen && tasks.length === 0) { + loadTasks(); + } + }, [isOpen]); + + const loadTasks = async () => { + setLoading(true); + try { + const response = await tasksClient.getTasks({ + status: ['todo', 'in_progress', 'backlog'], + limit: 100 + }); + setTasks(response.data); + } catch (error) { + console.error('Erreur lors du chargement des tâches:', error); + } finally { + setLoading(false); + } + }; + + const filteredTasks = tasks.filter(task => + task.title.toLowerCase().includes(search.toLowerCase()) || + task.description?.toLowerCase().includes(search.toLowerCase()) + ); + + const handleTaskSelect = (taskId: string) => { + onTaskSelect(taskId); + setIsOpen(false); + setSearch(''); + }; + + const handleClear = () => { + onTaskSelect(undefined); + setIsOpen(false); + setSearch(''); + }; + + if (!isOpen) { + return ( +
+ + {selectedTask && ( + + )} +
+ ); + } + + return ( +
+
+
+
+

Lier à une tâche

+ +
+ + setSearch(e.target.value)} + className="w-full mb-2 px-2 py-1 text-xs border border-[var(--border)] rounded bg-[var(--background)] text-[var(--foreground)]" + autoFocus + /> + +
+ {loading ? ( +
+ Chargement... +
+ ) : filteredTasks.length === 0 ? ( +
+ Aucune tâche trouvée +
+ ) : ( + filteredTasks.map((task) => ( + + )) + )} +
+ +
+ + +
+
+
+
+ ); +} diff --git a/lib/types.ts b/lib/types.ts index 9e9630c..ea586fb 100644 --- a/lib/types.ts +++ b/lib/types.ts @@ -164,11 +164,14 @@ export class ValidationError extends Error { } // Types pour les dailies +export type DailyCheckboxType = 'task' | 'meeting'; + export interface DailyCheckbox { id: string; date: Date; text: string; isChecked: boolean; + type: DailyCheckboxType; order: number; taskId?: string; task?: Task; // Relation optionnelle vers une tâche @@ -180,6 +183,7 @@ export interface DailyCheckbox { export interface CreateDailyCheckboxData { date: Date; text: string; + type?: DailyCheckboxType; taskId?: string; order?: number; isChecked?: boolean; @@ -188,6 +192,7 @@ export interface CreateDailyCheckboxData { export interface UpdateDailyCheckboxData { text?: string; isChecked?: boolean; + type?: DailyCheckboxType; taskId?: string; order?: number; } diff --git a/prisma/migrations/20250915195121_add_checkbox_type/migration.sql b/prisma/migrations/20250915195121_add_checkbox_type/migration.sql new file mode 100644 index 0000000..3d3bf04 --- /dev/null +++ b/prisma/migrations/20250915195121_add_checkbox_type/migration.sql @@ -0,0 +1,21 @@ +-- RedefineTables +PRAGMA defer_foreign_keys=ON; +PRAGMA foreign_keys=OFF; +CREATE TABLE "new_daily_checkboxes" ( + "id" TEXT NOT NULL PRIMARY KEY, + "date" DATETIME NOT NULL, + "text" TEXT NOT NULL, + "isChecked" BOOLEAN NOT NULL DEFAULT false, + "type" TEXT NOT NULL DEFAULT 'task', + "order" INTEGER NOT NULL DEFAULT 0, + "taskId" TEXT, + "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" DATETIME NOT NULL, + CONSTRAINT "daily_checkboxes_taskId_fkey" FOREIGN KEY ("taskId") REFERENCES "tasks" ("id") ON DELETE SET NULL ON UPDATE CASCADE +); +INSERT INTO "new_daily_checkboxes" ("createdAt", "date", "id", "isChecked", "order", "taskId", "text", "updatedAt") SELECT "createdAt", "date", "id", "isChecked", "order", "taskId", "text", "updatedAt" FROM "daily_checkboxes"; +DROP TABLE "daily_checkboxes"; +ALTER TABLE "new_daily_checkboxes" RENAME TO "daily_checkboxes"; +CREATE INDEX "daily_checkboxes_date_idx" ON "daily_checkboxes"("date"); +PRAGMA foreign_keys=ON; +PRAGMA defer_foreign_keys=OFF; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index c42b54a..74a7755 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -72,6 +72,7 @@ model DailyCheckbox { date DateTime // Date de la checkbox (YYYY-MM-DD) text String // Texte de la checkbox isChecked Boolean @default(false) + type String @default("task") // "task" | "meeting" order Int @default(0) // Ordre d'affichage pour cette date taskId String? // Liaison optionnelle vers une tâche createdAt DateTime @default(now()) diff --git a/services/daily.ts b/services/daily.ts index 5b1a3aa..eb6b9dd 100644 --- a/services/daily.ts +++ b/services/daily.ts @@ -1,5 +1,5 @@ import { prisma } from './database'; -import { DailyCheckbox, DailyView, CreateDailyCheckboxData, UpdateDailyCheckboxData, BusinessError } from '@/lib/types'; +import { DailyCheckbox, DailyView, CreateDailyCheckboxData, UpdateDailyCheckboxData, BusinessError, DailyCheckboxType } from '@/lib/types'; /** * Service pour la gestion des checkboxes daily @@ -67,6 +67,7 @@ export class DailyService { data: { date: normalizedDate, text: data.text.trim(), + type: data.type ?? 'task', taskId: data.taskId, order, isChecked: data.isChecked ?? false @@ -85,6 +86,7 @@ export class DailyService { if (data.text !== undefined) updateData.text = data.text.trim(); if (data.isChecked !== undefined) updateData.isChecked = data.isChecked; + if (data.type !== undefined) updateData.type = data.type; if (data.taskId !== undefined) updateData.taskId = data.taskId; if (data.order !== undefined) updateData.order = data.order; @@ -214,6 +216,7 @@ export class DailyService { date: checkbox.date, text: checkbox.text, isChecked: checkbox.isChecked, + type: checkbox.type as DailyCheckboxType, order: checkbox.order, taskId: checkbox.taskId, task: checkbox.task ? { diff --git a/src/app/api/daily/route.ts b/src/app/api/daily/route.ts index 843eea3..e05254b 100644 --- a/src/app/api/daily/route.ts +++ b/src/app/api/daily/route.ts @@ -88,6 +88,7 @@ export async function POST(request: Request) { const checkbox = await dailyService.addCheckbox({ date, text: body.text, + type: body.type, taskId: body.taskId, order: body.order, isChecked: body.isChecked diff --git a/src/app/daily/DailyPageClient.tsx b/src/app/daily/DailyPageClient.tsx index b639b0b..ddcf094 100644 --- a/src/app/daily/DailyPageClient.tsx +++ b/src/app/daily/DailyPageClient.tsx @@ -1,216 +1,16 @@ 'use client'; -import { useState, useRef, useEffect } from 'react'; +import { useState, useEffect } from 'react'; import React from 'react'; import { useDaily } from '@/hooks/useDaily'; -import { DailyCheckbox, DailyView } from '@/lib/types'; +import { DailyView, DailyCheckboxType } from '@/lib/types'; import { Button } from '@/components/ui/Button'; -import { Input } from '@/components/ui/Input'; import { Card } from '@/components/ui/Card'; -import Link from 'next/link'; import { DailyCalendar } from '@/components/daily/DailyCalendar'; +import { DailySection } from '@/components/daily/DailySection'; import { dailyClient } from '@/clients/daily-client'; import { SimpleHeader } from '@/components/ui/SimpleHeader'; -interface DailySectionProps { - title: string; - date: Date; - checkboxes: DailyCheckbox[]; - onAddCheckbox: (text: string) => Promise; - onToggleCheckbox: (checkboxId: string) => Promise; - onUpdateCheckbox: (checkboxId: string, text: string) => Promise; - onDeleteCheckbox: (checkboxId: string) => Promise; - saving: boolean; - refreshing?: boolean; -} - -function DailySectionComponent({ - title, - date, - checkboxes, - onAddCheckbox, - onToggleCheckbox, - onUpdateCheckbox, - onDeleteCheckbox, - saving, - refreshing = false -}: DailySectionProps) { - const [newCheckboxText, setNewCheckboxText] = useState(''); - const [addingCheckbox, setAddingCheckbox] = useState(false); - const [editingCheckboxId, setEditingCheckboxId] = useState(null); - const [editingText, setEditingText] = useState(''); - const inputRef = useRef(null); - - const formatShortDate = (date: Date) => { - return date.toLocaleDateString('fr-FR', { - day: '2-digit', - month: '2-digit', - year: 'numeric' - }); - }; - - const handleAddCheckbox = async () => { - if (!newCheckboxText.trim()) return; - - setAddingCheckbox(true); - try { - await onAddCheckbox(newCheckboxText.trim()); - setNewCheckboxText(''); - // Garder le focus sur l'input pour enchainer les entrées - setTimeout(() => { - inputRef.current?.focus(); - }, 100); - } finally { - setAddingCheckbox(false); - } - }; - - const handleStartEdit = (checkbox: DailyCheckbox) => { - setEditingCheckboxId(checkbox.id); - setEditingText(checkbox.text); - }; - - const handleSaveEdit = async () => { - if (!editingCheckboxId || !editingText.trim()) return; - - try { - await onUpdateCheckbox(editingCheckboxId, editingText.trim()); - setEditingCheckboxId(null); - setEditingText(''); - } catch (error) { - console.error('Erreur lors de la modification:', error); - } - }; - - const handleCancelEdit = () => { - setEditingCheckboxId(null); - setEditingText(''); - }; - - const handleEditKeyPress = (e: React.KeyboardEvent) => { - if (e.key === 'Enter') { - e.preventDefault(); - handleSaveEdit(); - } else if (e.key === 'Escape') { - e.preventDefault(); - handleCancelEdit(); - } - }; - - const handleKeyPress = (e: React.KeyboardEvent) => { - if (e.key === 'Enter') { - e.preventDefault(); - handleAddCheckbox(); - } - }; - - return ( - -
-

- {title} ({formatShortDate(date)}) - {refreshing && ( -
- )} -

- - {checkboxes.filter(cb => cb.isChecked).length}/{checkboxes.length} - -
- - {/* Liste des checkboxes */} -
- {checkboxes.map((checkbox) => ( -
- onToggleCheckbox(checkbox.id)} - disabled={saving} - className="w-4 h-4 rounded border border-[var(--border)] text-[var(--primary)] focus:ring-[var(--primary)]/20 focus:ring-2" - /> - - {editingCheckboxId === checkbox.id ? ( - setEditingText(e.target.value)} - onKeyDown={handleEditKeyPress} - onBlur={handleSaveEdit} - autoFocus - className="flex-1 h-8 text-sm" - /> - ) : ( - handleStartEdit(checkbox)} - > - {checkbox.text} - - )} - - {/* Lien vers la tâche si liée */} - {checkbox.task && ( - - #{checkbox.task.id.slice(-6)} - - )} - - {/* Bouton de suppression */} - -
- ))} - - {checkboxes.length === 0 && ( -
- Aucune tâche pour cette période -
- )} -
- - {/* Formulaire d'ajout */} -
- setNewCheckboxText(e.target.value)} - onKeyDown={handleKeyPress} - disabled={addingCheckbox || saving} - className="flex-1 min-w-[300px]" - /> - -
-
- ); -} - interface DailyPageClientProps { initialDailyView?: DailyView; initialDailyDates?: string[]; @@ -260,12 +60,14 @@ export function DailyPageClient({ } }, [initialDailyDates.length]); - const handleAddTodayCheckbox = async (text: string) => { + const handleAddTodayCheckbox = async (text: string, type: DailyCheckboxType) => { try { const { dailyClient } = await import('@/clients/daily-client'); await dailyClient.addCheckbox({ date: currentDate, text, + type, + // Pas de taskId lors de l'ajout - sera ajouté via l'édition isChecked: false }); // Recharger silencieusement la vue daily (sans clignotement) @@ -277,7 +79,7 @@ export function DailyPageClient({ } }; - const handleAddYesterdayCheckbox = async (text: string) => { + const handleAddYesterdayCheckbox = async (text: string, type: DailyCheckboxType) => { try { const yesterday = new Date(currentDate); yesterday.setDate(yesterday.getDate() - 1); @@ -286,6 +88,8 @@ export function DailyPageClient({ await dailyClient.addCheckbox({ date: yesterday, text, + type, + // Pas de taskId lors de l'ajout - sera ajouté via l'édition isChecked: false }); // Recharger silencieusement la vue daily (sans clignotement) @@ -307,8 +111,12 @@ export function DailyPageClient({ await refreshDailyDates(); }; - const handleUpdateCheckbox = async (checkboxId: string, text: string) => { - await updateCheckbox(checkboxId, { text }); + const handleUpdateCheckbox = async (checkboxId: string, text: string, type: DailyCheckboxType, taskId?: string) => { + await updateCheckbox(checkboxId, { + text, + type, + taskId: type === 'task' ? taskId : undefined // Supprimer la liaison tâche si on passe en réunion + }); }; const getYesterdayDate = () => { @@ -430,7 +238,7 @@ export function DailyPageClient({ {dailyView && (
{/* Section Hier */} - {/* Section Aujourd'hui */} - - {/* Footer avec stats */} + {/* Footer avec stats - dans le flux normal */} {dailyView && (