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
This commit is contained in:
Daniel Volz
2026-03-06 19:51:19 +01:00
committed by GitHub
parent 30c97e2f0d
commit 5b6c6abb69
5 changed files with 18 additions and 6 deletions
+4
View File
@@ -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),
});
});
+4
View File
@@ -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,
};
+2 -2
View File
@@ -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",
+2 -2
View File
@@ -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",
+6 -2
View File
@@ -479,11 +479,15 @@ export function SettingsPage() {
</div>
<div className="schedule-row">
<span className="schedule-label">{t("settings.schedule.stockCheck")}</span>
<span className="schedule-value">{t("settings.schedule.dailyAt6")}</span>
<span className="schedule-value">
{t("settings.schedule.dailyAtHour", { hour: settings.reminderHour })}
</span>
</div>
<div className="schedule-row">
<span className="schedule-label">{t("settings.schedule.intakeCheck")}</span>
<span className="schedule-value">{t("settings.schedule.15minBefore")}</span>
<span className="schedule-value">
{t("settings.schedule.minutesBefore", { minutes: settings.reminderMinutesBefore })}
</span>
</div>
{settings.nextScheduledCheck && (
<div className="schedule-row">