feat: refactor daily task management with new pending tasks section
- Added `PendingTasksSection` to `DailyPageClient` for displaying uncompleted tasks. - Implemented `getPendingCheckboxes` method in `DailyClient` and `DailyService` to fetch pending tasks. - Introduced `getDaysAgo` utility function for calculating elapsed days since a date. - Updated `TODO.md` to reflect the new task management features and adjustments. - Cleaned up and organized folder structure to align with Next.js 13+ best practices.
This commit is contained in:
@@ -153,6 +153,34 @@ export class DailyClient {
|
||||
const response = await httpClient.get<{ dates: string[] }>('/daily/dates');
|
||||
return response.dates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupère les checkboxes en attente (non cochées)
|
||||
*/
|
||||
async getPendingCheckboxes(options?: {
|
||||
maxDays?: number;
|
||||
excludeToday?: boolean;
|
||||
type?: 'task' | 'meeting';
|
||||
limit?: number;
|
||||
}): Promise<DailyCheckbox[]> {
|
||||
const params = new URLSearchParams();
|
||||
if (options?.maxDays) params.append('maxDays', options.maxDays.toString());
|
||||
if (options?.excludeToday !== undefined) params.append('excludeToday', options.excludeToday.toString());
|
||||
if (options?.type) params.append('type', options.type);
|
||||
if (options?.limit) params.append('limit', options.limit.toString());
|
||||
|
||||
const queryString = params.toString();
|
||||
const result = await httpClient.get<ApiCheckbox[]>(`/daily/pending${queryString ? `?${queryString}` : ''}`);
|
||||
return result.map((cb: ApiCheckbox) => this.transformCheckboxDates(cb));
|
||||
}
|
||||
|
||||
/**
|
||||
* Archive une checkbox
|
||||
*/
|
||||
async archiveCheckbox(checkboxId: string): Promise<DailyCheckbox> {
|
||||
const result = await httpClient.patch<ApiCheckbox>(`/daily/checkboxes/${checkboxId}/archive`);
|
||||
return this.transformCheckboxDates(result);
|
||||
}
|
||||
}
|
||||
|
||||
// Instance singleton du client
|
||||
|
||||
Reference in New Issue
Block a user