From 5b6c6abb690b6dd61bb7d8dc7a3bfd709476b7df Mon Sep 17 00:00:00 2001 From: Daniel Volz Date: Fri, 6 Mar 2026 19:51:19 +0100 Subject: [PATCH] feat: display actual reminder schedule from server config (#386) - Expose REMINDER_HOUR and REMINDER_MINUTES_BEFORE env values via settings API - Add reminderHour and reminderMinutesBefore to frontend Settings interface - Replace hardcoded i18n strings with parameterized translations - Settings page now shows configured schedule instead of static 6:00 / 15 min --- backend/src/routes/settings.ts | 4 ++++ frontend/src/hooks/useSettings.ts | 4 ++++ frontend/src/i18n/de.json | 4 ++-- frontend/src/i18n/en.json | 4 ++-- frontend/src/pages/SettingsPage.tsx | 8 ++++++-- 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/backend/src/routes/settings.ts b/backend/src/routes/settings.ts index 0da6980..67e5d1d 100644 --- a/backend/src/routes/settings.ts +++ b/backend/src/routes/settings.ts @@ -326,6 +326,8 @@ export async function settingsRoutes(app: FastifyInstance) { const userId = await getUserId(request, reply); const settings = await getOrCreateUserSettings(userId); + const reminderHour = envInt("REMINDER_HOUR", 6); + const reminderMinutesBefore = envInt("REMINDER_MINUTES_BEFORE", 15); return reply.send({ // User notification settings (from DB) @@ -376,6 +378,8 @@ export async function settingsRoutes(app: FastifyInstance) { lastPrescriptionReminderChannel: settings.lastPrescriptionReminderChannel ?? null, lastPrescriptionReminderMedNames: settings.lastPrescriptionReminderMedNames ?? null, // Server settings (from .env, read-only) + reminderHour, + reminderMinutesBefore, expiryWarningDays: parseInt(process.env.EXPIRY_WARNING_DAYS ?? "30", 10), }); }); diff --git a/frontend/src/hooks/useSettings.ts b/frontend/src/hooks/useSettings.ts index 320416c..41b512b 100644 --- a/frontend/src/hooks/useSettings.ts +++ b/frontend/src/hooks/useSettings.ts @@ -49,6 +49,8 @@ export interface Settings { upcomingTodayOnly: boolean; shareScheduleTodayOnly: boolean; swapDashboardMainSections: boolean; + reminderHour: number; + reminderMinutesBefore: number; expiryWarningDays: number; } @@ -96,6 +98,8 @@ const defaultSettings: Settings = { upcomingTodayOnly: false, shareScheduleTodayOnly: false, swapDashboardMainSections: false, + reminderHour: 6, + reminderMinutesBefore: 15, expiryWarningDays: 30, }; diff --git a/frontend/src/i18n/de.json b/frontend/src/i18n/de.json index 190b100..0760ba6 100644 --- a/frontend/src/i18n/de.json +++ b/frontend/src/i18n/de.json @@ -323,9 +323,9 @@ "schedule": { "title": "Erinnerungsplan", "stockCheck": "Bestands- & Rezeptprüfung", - "dailyAt6": "Täglich um 6:00 Uhr", + "dailyAtHour": "Täglich um {{hour}}:00 Uhr", "intakeCheck": "Einnahmeprüfung", - "15minBefore": "15 Min. vor geplanter Zeit", + "minutesBefore": "{{minutes}} Min. vor geplanter Zeit", "nextCheck": "Nächste Bestandsprüfung", "lastSent": "Letzte Benachrichtigung", "lastStockSent": "Letzte Bestands-Erinnerung", diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json index f1306e7..db44436 100644 --- a/frontend/src/i18n/en.json +++ b/frontend/src/i18n/en.json @@ -323,9 +323,9 @@ "schedule": { "title": "Reminder Schedule", "stockCheck": "Stock & prescription check", - "dailyAt6": "Daily at 6:00 AM", + "dailyAtHour": "Daily at {{hour}}:00", "intakeCheck": "Intake check", - "15minBefore": "15 min before scheduled time", + "minutesBefore": "{{minutes}} min before scheduled time", "nextCheck": "Next stock check", "lastSent": "Last notification sent", "lastStockSent": "Last stock reminder", diff --git a/frontend/src/pages/SettingsPage.tsx b/frontend/src/pages/SettingsPage.tsx index a4f9ec4..f5896f7 100644 --- a/frontend/src/pages/SettingsPage.tsx +++ b/frontend/src/pages/SettingsPage.tsx @@ -479,11 +479,15 @@ export function SettingsPage() {
{t("settings.schedule.stockCheck")} - {t("settings.schedule.dailyAt6")} + + {t("settings.schedule.dailyAtHour", { hour: settings.reminderHour })} +
{t("settings.schedule.intakeCheck")} - {t("settings.schedule.15minBefore")} + + {t("settings.schedule.minutesBefore", { minutes: settings.reminderMinutesBefore })} +
{settings.nextScheduledCheck && (