fixed due date overlay to now read expenses past due date as well as on due date
All checks were successful
Deploy / deploy (push) Successful in 56s
Security Tests / security-non-db (push) Successful in 19s
Security Tests / security-db (push) Successful in 26s

This commit is contained in:
2026-03-21 17:37:20 -05:00
parent 9c7f4d5139
commit ad82e914fc

View File

@@ -354,33 +354,32 @@ export default function DashboardPage() {
return dateStringToUTCMidnight(nextDateStr, userTimezone); return dateStringToUTCMidnight(nextDateStr, userTimezone);
} }
// Detect if any fixed plan is due today; show overlay to confirm due date and pay-now // Detect if any fixed plan is due/overdue and needs user payment confirmation.
// Include fully funded overdue plans so missed-day confirmations still surface.
useEffect(() => { useEffect(() => {
let cancelled = false; let cancelled = false;
async function checkDueToday() { async function checkDueToday() {
if (!data || !shouldLoadDashboard || hasCheckedDueToday) return; if (!data || !shouldLoadDashboard || hasCheckedDueToday) return;
try { try {
const res = await fixedPlansApi.due({ daysAhead: 0 }); const res = await fixedPlansApi.due({ daysAhead: 0 });
const items = (res.items || []).filter((x) => x.isDue && !x.isOverdue); const items = (res.items || [])
.filter((x) => x.isDue && (!x.isOverdue || x.remainingCents <= 0))
.filter((x) => {
const dismissedUntilStr = localStorage.getItem(`overdue-dismissed-${x.id}`);
if (!dismissedUntilStr) return true;
const dismissedUntil = parseInt(dismissedUntilStr, 10);
if (!Number.isFinite(dismissedUntil) || Date.now() >= dismissedUntil) {
localStorage.removeItem(`overdue-dismissed-${x.id}`);
return true;
}
return false;
});
if (!cancelled && items.length > 0) { if (!cancelled && items.length > 0) {
setHasCheckedDueToday(true); setHasCheckedDueToday(true);
const first = items[0]; const first = items[0];
// Check if user has dismissed this overdue prompt recently
const dismissedUntilStr = localStorage.getItem(`overdue-dismissed-${first.id}`);
if (dismissedUntilStr) {
const dismissedUntil = parseInt(dismissedUntilStr, 10);
if (Date.now() < dismissedUntil) {
// Still within the "remind me later" window - skip this prompt
return;
} else {
// Expired - remove it
localStorage.removeItem(`overdue-dismissed-${first.id}`);
}
}
await openDueItem(first); await openDueItem(first);
// Store queue for potential future bills // Store queue for potential future bills
setDueQueue(items.map((i) => ({ setDueQueue(items.map((i) => ({
id: i.id, id: i.id,