From 4de8eab879b239e29b02fde32e2657cd13d99349 Mon Sep 17 00:00:00 2001 From: alma Date: Fri, 16 Jan 2026 13:03:57 +0100 Subject: [PATCH] Pages corrections journal --- app/pages/page.tsx | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/app/pages/page.tsx b/app/pages/page.tsx index 09bb16c..75f8722 100644 --- a/app/pages/page.tsx +++ b/app/pages/page.tsx @@ -427,7 +427,26 @@ export default function CarnetPage() { // Frontend expects: { id, title, content, lastModified, type, mime, etag } const mappedNotes: Note[] = data.map((file: any) => { // Extract title from filename (remove .md extension if present) - const title = file.name?.replace(/\.md$/, '') || file.name || 'Untitled'; + let title = file.name?.replace(/\.md$/, '') || file.name || 'Untitled'; + + // For Diary/Health folders, convert sanitized filename back to formatted title + // Example: "16_janvier_2026" -> "16 janvier 2026" + if ((folderLowercase === 'diary' || folderLowercase === 'health') && title.includes('_')) { + // Check if it matches the date pattern: DD_mois_YYYY + const datePattern = /^(\d{1,2})_([a-zéèêà]+)_(\d{4})$/i; + const match = title.match(datePattern); + if (match) { + const day = match[1]; + const month = match[2]; + const year = match[3]; + // Capitalize first letter of month + const monthCapitalized = month.charAt(0).toUpperCase() + month.slice(1); + title = `${day} ${monthCapitalized} ${year}`; + } else { + // If pattern doesn't match, just replace underscores with spaces + title = title.replace(/_/g, ' '); + } + } return { id: file.key || file.id || '',