Add a warning banner system that displays above the Tips component on relevant pages, alerting users to upcoming and overdue deadlines. The warning should show counts of items requiring attention and provide snooze options.
Currently, users have no proactive notification of approaching deadlines. They must manually check each entity to discover overdue or upcoming items. This feature will improve user awareness and help prevent missed deadlines.
As a compliance manager, I want to see warnings about upcoming deadlines when I visit relevant pages, so that I can prioritize my work and avoid missing important dates.
Phase 1: Tasks
- Display on Tasks page (
/tasks) - Show overdue tasks count
- Show tasks due within 14 days count
Future Phases:
- Vendors (review_date)
- Policies (next_review_date)
- Risks (mitigation deadline)
-
Warning Banner Position
- Display above TipBox component
- Only show on relevant pages (Tasks page for Phase 1)
- Do not show if there are no warnings
-
Warning Categories
- 🔴 Overdue: Items past their due date
- 🟡 Due Soon: Items due within 14 days
-
Display Format
- Show aggregated counts, not individual items
- Example: "3 overdue tasks • 5 tasks due within 14 days"
- Clickable to filter/scroll to relevant items (optional)
-
Snooze Options
- "Snooze for 1 hour"
- "Snooze for 24 hours"
- "Snooze for 1 week"
- Store snooze state in localStorage with expiry timestamp
-
Dismiss Behavior
- X button opens snooze menu (not immediate dismiss)
- Snooze persists per user (localStorage keyed by userId)
-
Frontend Components
- Create
DeadlineWarningBoxcomponent (similar to TipBox) - Create
useDeadlineWarningshook for data fetching and snooze management - Reuse existing
InfoBoxcomponent withvariant="warning"
- Create
-
Backend API
- Create endpoint:
GET /api/deadlines/summary - Response format:
{ "tasks": { "overdue": 3, "dueSoon": 5, "threshold": 14 } } - Filter by user's accessible projects
- Create endpoint:
-
Data Sources
Entity Field Overdue Logic Tasks due_datedue_date < today AND status != 'Done' -
localStorage Schema
{ "key": "verifywise_deadline_snooze_{userId}_{entity}", "value": { "snoozedUntil": "2024-12-03T10:00:00Z" } }
┌─────────────────────────────────────────────────────────────────┐
│ ⚠️ Upcoming deadlines [⋮] │
│ ───────────────────────────────────────────────────────────────│
│ 🔴 3 overdue • 🟡 5 due within 14 days │
└─────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────┐
│ 💡 Tip 1 of 3: Managing Tasks [×] │
│ ... │
└─────────────────────────────────────────────────────────────────┘
┌──────────────────────┐
│ Snooze for 1 hour │
│ Snooze for 24 hours │
│ Snooze for 1 week │
└──────────────────────┘
| Element | Value |
|---|---|
| Background | linear-gradient(135deg, #FEF3C7 0%, #FFFBEB 100%) (amber/warning) |
| Border | 1px solid #FCD34D |
| Border radius | 4px |
| Overdue chip background | #FEE2E2 |
| Overdue chip text | #DC2626 |
| Due soon chip background | #FEF3C7 |
| Due soon chip text | #D97706 |
- Warning banner appears on Tasks page when there are overdue or upcoming tasks
- Banner shows correct counts for overdue and due-soon items
- Snooze menu appears when clicking the menu icon
- Snooze persists across page refreshes (localStorage)
- Banner reappears after snooze period expires
- Banner does not appear if no deadlines exist
- Banner appears above Tips component
- Responsive design works on mobile
| File | Purpose |
|---|---|
Clients/src/presentation/components/DeadlineWarningBox/index.tsx |
Main warning banner component |
Clients/src/application/hooks/useDeadlineWarnings.ts |
Hook for fetching and managing warnings |
Clients/src/application/config/deadlineConfig.ts |
Configuration constants |
Servers/controllers/deadline.ctrl.ts |
Backend controller |
Servers/routes/deadline.route.ts |
API routes |
Servers/utils/deadline.utils.ts |
Database queries |
| File | Change |
|---|---|
Clients/src/presentation/pages/Tasks/index.tsx |
Add DeadlineWarningBox component |
Servers/index.ts |
Register deadline routes |
-
Existing components to reuse:
InfoBoxcomponent (supportsvariant="warning")DaysChipcomponent (for deadline display)
-
Existing backend logic:
- Tasks model already has
isOverdue()method
- Tasks model already has
| Entity | Field | Type | Current State |
|---|---|---|---|
| Tasks | due_date |
DATE | ✅ Has isOverdue() method |
| Vendors | review_date |
DATE | Has review status enum |
| Policies | next_review_date |
DATE | Field exists |
| Risks | deadline |
DATE | Mitigation deadline |
| Models | status_date |
DATE | Status tracking only |
| Training | N/A | ENUM | No date field |
enhancement, frontend, backend, ux, phase-1
| Area | Time |
|---|---|
| Backend API | 2-3 hours |
| Frontend Component | 4-5 hours |
| Testing | 2 hours |
| Total | 8-10 hours |