fix(scheduling): 近7天 filter should be time-only, not exclude cancelled

Previously the toggle hid cancelled records, so users who clicked a
record timestamped within 7 days but later cancelled would see nothing.
Now 近7天 filters purely by createdAt; combine with status tabs to
narrow further.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
kkfluous
2026-04-17 09:56:30 +08:00
parent 9d1e8c4d30
commit e32b0b58b3

View File

@@ -67,7 +67,7 @@ export default function NotificationHistory({ onClose, onChange, recentOnly = fa
const visibleRecords = recent7d const visibleRecords = recent7d
? records.filter(r => { ? records.filter(r => {
const t = Date.parse(r.createdAt); const t = Date.parse(r.createdAt);
return Number.isFinite(t) && Date.now() - t <= SEVEN_DAYS_MS && r.status !== 'cancelled'; return Number.isFinite(t) && Date.now() - t <= SEVEN_DAYS_MS;
}) })
: records; : records;
@@ -161,7 +161,7 @@ export default function NotificationHistory({ onClose, onChange, recentOnly = fa
className={`text-[11px] px-3 py-1 rounded-full font-medium cursor-pointer transition-colors ${ className={`text-[11px] px-3 py-1 rounded-full font-medium cursor-pointer transition-colors ${
recent7d ? 'bg-emerald-600 text-white' : 'bg-slate-100 text-slate-500 hover:bg-slate-200' recent7d ? 'bg-emerald-600 text-white' : 'bg-slate-100 text-slate-500 hover:bg-slate-200'
}`} }`}
title="仅看最近 7 天(不含已取消)" title="仅看最近 7 天"
> >
7 7
</button> </button>