feat: add next scheduled check to reminder state and update UI to display next check time

This commit is contained in:
Daniel Volz
2025-12-20 19:55:03 +01:00
parent b588fb2f95
commit 4c351aae2d
3 changed files with 74 additions and 18 deletions
+8 -6
View File
@@ -93,6 +93,7 @@ export default function App() {
smtpSecure: false,
hasSmtpPassword: false,
lastAutoEmailSent: null as string | null,
nextScheduledCheck: null as string | null,
});
const [savedSettings, setSavedSettings] = useState(settings);
const [settingsLoading, setSettingsLoading] = useState(false);
@@ -721,7 +722,7 @@ export default function App() {
{settings.emailEnabled && (
<>
<div className="setting-info-box">
<p>🤖 <strong>How it works:</strong> The server checks hourly. When a medication drops below the threshold, you get an email.</p>
<p>🤖 <strong>How it works:</strong> The server checks daily at 6:00 AM. When a medication drops below the threshold, you get an email.</p>
</div>
<div className="setting-group">
<label>
@@ -758,11 +759,12 @@ export default function App() {
<span className="toggle-slider"></span>
</label>
</div>
{settings.lastAutoEmailSent && (
<div className="setting-info-box success">
<p> Last automatic email: <strong>{new Date(settings.lastAutoEmailSent).toLocaleString()}</strong></p>
</div>
)}
<div className="setting-info-box">
<p> <strong>Next automatic check:</strong> {settings.nextScheduledCheck ? new Date(settings.nextScheduledCheck).toLocaleString() : "—"}</p>
{settings.lastAutoEmailSent && (
<p style={{ marginTop: "0.5rem" }}> Last automatic email: <strong>{new Date(settings.lastAutoEmailSent).toLocaleString()}</strong></p>
)}
</div>
</>
)}