feat: recent activity card on Home and Retention card on Settings

This commit is contained in:
fsylvain committed 2026-10-07 16:01:28 +02:00
1 parent 35db442cd3
commit 43469ef08d
33 files changed
+2748 -204

No files matched your search

+15
View File
@@ -64,6 +64,21 @@ export function whenLabel(iso: string, now: Date = new Date()) {
return t('{0} h ago', [Math.floor(elapsed / HOUR_MS)])
}
export function recentWhenLabel(iso: string, now: Date = new Date()) {
const date = new Date(iso)
const key = localDayKey(date)
if (key === localDayKey(now)) return whenLabel(iso, now)
const today = startOfDay(now)
const yesterday = new Date(today.getFullYear(), today.getMonth(), today.getDate() - 1)
if (key === localDayKey(yesterday)) return `${t('Yesterday')}, ${clock(date, false, false)}`
return localDayTime(iso)
}
export function localDayTime(iso: string) {
const date = new Date(iso)
return `${formatAbsoluteDay(date)}, ${clock(date, false, false)}`
}
export function fullLocalTime(iso: string) {
const date = new Date(iso)
return `${formatAbsoluteDay(date)}, ${clock(date, true, false)}`