From ee64fe2ff33ce91c13345e97fa868da6d743cc16 Mon Sep 17 00:00:00 2001 From: Julien Froidefond Date: Tue, 23 Sep 2025 08:30:25 +0200 Subject: [PATCH] chore : remove unused methods --- src/actions/daily.ts | 51 ---------------------------------- src/actions/metrics.ts | 18 ------------ src/actions/tags.ts | 13 --------- src/hooks/useDaily.ts | 63 +----------------------------------------- 4 files changed, 1 insertion(+), 144 deletions(-) diff --git a/src/actions/daily.ts b/src/actions/daily.ts index bd43263..6281680 100644 --- a/src/actions/daily.ts +++ b/src/actions/daily.ts @@ -48,34 +48,6 @@ export async function toggleCheckbox(checkboxId: string): Promise<{ } } -/** - * Ajoute une checkbox à une date donnée - */ -export async function addCheckboxToDaily(dailyId: string, content: string, taskId?: string): Promise<{ - success: boolean; - data?: DailyCheckbox; - error?: string; -}> { - try { - // Le dailyId correspond à la date au format YYYY-MM-DD - const date = parseDate(dailyId); - - const newCheckbox = await dailyService.addCheckbox({ - date, - text: content, - taskId - }); - - revalidatePath('/daily'); - return { success: true, data: newCheckbox }; - } catch (error) { - console.error('Erreur addCheckboxToDaily:', error); - return { - success: false, - error: error instanceof Error ? error.message : 'Erreur inconnue' - }; - } -} /** * Ajoute une checkbox pour aujourd'hui @@ -133,29 +105,6 @@ export async function addYesterdayCheckbox(content: string, type?: 'task' | 'mee } } -/** - * Met à jour le contenu d'une checkbox - */ -export async function updateCheckboxContent(checkboxId: string, content: string): Promise<{ - success: boolean; - data?: DailyCheckbox; - error?: string; -}> { - try { - const updatedCheckbox = await dailyService.updateCheckbox(checkboxId, { - text: content - }); - - revalidatePath('/daily'); - return { success: true, data: updatedCheckbox }; - } catch (error) { - console.error('Erreur updateCheckboxContent:', error); - return { - success: false, - error: error instanceof Error ? error.message : 'Erreur inconnue' - }; - } -} /** * Met à jour une checkbox complète diff --git a/src/actions/metrics.ts b/src/actions/metrics.ts index d94a0ab..f6168b9 100644 --- a/src/actions/metrics.ts +++ b/src/actions/metrics.ts @@ -2,7 +2,6 @@ import { MetricsService, WeeklyMetricsOverview, VelocityTrend } from '@/services/metrics'; import { getToday } from '@/lib/date-utils'; -import { revalidatePath } from 'next/cache'; /** * Récupère les métriques hebdomadaires pour une date donnée @@ -60,20 +59,3 @@ export async function getVelocityTrends(weeksBack: number = 4): Promise<{ } } -/** - * Rafraîchir les données de métriques (invalide le cache) - */ -export async function refreshMetrics(): Promise<{ - success: boolean; - error?: string; -}> { - try { - revalidatePath('/manager'); - return { success: true }; - } catch { - return { - success: false, - error: 'Failed to refresh metrics' - }; - } -} diff --git a/src/actions/tags.ts b/src/actions/tags.ts index 5746ad4..7b04214 100644 --- a/src/actions/tags.ts +++ b/src/actions/tags.ts @@ -86,16 +86,3 @@ export async function deleteTag(tagId: string): Promise { } } -/** - * Action rapide pour créer un tag depuis un input - */ -export async function quickCreateTag(formData: FormData): Promise> { - const name = formData.get('name') as string; - const color = formData.get('color') as string; - - if (!name?.trim()) { - return { success: false, error: 'Tag name is required' }; - } - - return createTag(name.trim(), color || '#3B82F6'); -} diff --git a/src/hooks/useDaily.ts b/src/hooks/useDaily.ts index 55e831a..9ceb86a 100644 --- a/src/hooks/useDaily.ts +++ b/src/hooks/useDaily.ts @@ -1,7 +1,7 @@ 'use client'; import { useState, useEffect, useCallback, useTransition } from 'react'; -import { dailyClient, DailyHistoryFilters, DailySearchFilters, ReorderCheckboxesData } from '@/clients/daily-client'; +import { dailyClient, ReorderCheckboxesData } from '@/clients/daily-client'; import { DailyView, DailyCheckbox, UpdateDailyCheckboxData, DailyCheckboxType } from '@/lib/types'; import { addDays, subtractDays, getToday } from '@/lib/date-utils'; import { @@ -403,65 +403,4 @@ export function useDaily(initialDate?: Date, initialDailyView?: DailyView): UseD goToToday, setDate }; -} - -/** - * Hook pour l'historique des checkboxes - */ -export function useDailyHistory() { - const [history, setHistory] = useState<{ date: Date; checkboxes: DailyCheckbox[] }[]>([]); - const [loading, setLoading] = useState(false); - const [error, setError] = useState(null); - - const loadHistory = useCallback(async (filters?: DailyHistoryFilters) => { - try { - setLoading(true); - setError(null); - - const historyData = await dailyClient.getCheckboxHistory(filters); - setHistory(historyData); - } catch (err) { - setError(err instanceof Error ? err.message : 'Erreur lors du chargement de l\'historique'); - console.error('Erreur loadHistory:', err); - } finally { - setLoading(false); - } - }, []); - - const searchCheckboxes = useCallback(async (filters: DailySearchFilters) => { - try { - setLoading(true); - setError(null); - - const checkboxes = await dailyClient.searchCheckboxes(filters); - // Grouper par date pour l'affichage - const groupedHistory = checkboxes.reduce((acc, checkbox) => { - const dateKey = checkbox.date.toDateString(); - const existing = acc.find(item => item.date.toDateString() === dateKey); - - if (existing) { - existing.checkboxes.push(checkbox); - } else { - acc.push({ date: checkbox.date, checkboxes: [checkbox] }); - } - - return acc; - }, [] as { date: Date; checkboxes: DailyCheckbox[] }[]); - - setHistory(groupedHistory); - } catch (err) { - setError(err instanceof Error ? err.message : 'Erreur lors de la recherche'); - console.error('Erreur searchCheckboxes:', err); - } finally { - setLoading(false); - } - }, []); - - return { - history, - loading, - error, - loadHistory, - searchCheckboxes - }; } \ No newline at end of file