feat(ui): panneau repliable, carnets plus lisibles et accueil plus clair

Harmonise la liste des notes et l’éditeur (titres, dates, retour),
rend la saisie rapide et les raccourcis de l’accueil utilisables
sur téléphone, et conserve le panneau latéral repliable.
This commit is contained in:
Antigravity
2026-09-05 20:53:48 +00:00
parent a7b16870a4
commit 3bdbec575a
37 changed files with 1138 additions and 482 deletions

View File

@@ -72,3 +72,42 @@ export function formatAbsoluteDateLocalized(
}
return format(d, pattern, { locale })
}
const INTL_LOCALE: Record<string, string> = {
zh: 'zh-CN',
fa: 'fa-IR',
}
/**
* Calendar day for note lists and the editor, in the user's locale.
* Uses the local timezone (same as `formatAbsoluteDateLocalized`) so a late-evening
* note does not jump to the previous UTC day. Persian uses Jalali + Persian digits.
*/
export function formatNoteCalendarDate(
date: Date | string,
language: string,
): string {
const d = typeof date === 'string' ? new Date(date) : date
if (Number.isNaN(d.getTime())) return ''
if (language === 'fa') {
return formatJalaliAbsolute(d, 'd MMM yyyy')
}
const locale = INTL_LOCALE[language] || language
try {
return new Intl.DateTimeFormat(locale, {
day: 'numeric',
month: 'long',
year: 'numeric',
}).format(d)
} catch {
return new Intl.DateTimeFormat('en', {
day: 'numeric',
month: 'long',
year: 'numeric',
}).format(d)
}
}
export function dateTextDirection(language: string): 'rtl' | 'ltr' {
return language === 'fa' || language === 'ar' ? 'rtl' : 'ltr'
}