feat(notifications): display recurring transaction due date and navigate to details modal
Overview
This PR improves the recurring transaction reminder notifications by including the specific due date in the notification content and seamlessly navigating users directly into the Recurring Transaction Details Modal when clicking "View details" (Xem chi tiết).
Key Changes
1. Notification Due Date Formatting (src/lib/notification-format.ts)
- Added
extractNotificationDueDate()utility to dynamically resolve the transaction's due date fromnotification.data.dueDate, URL query parameters (actionUrl), or notification message patterns. - Enhanced message formatting for
RECURRING_PAYMENT_DUEnotifications to clearly state the due date in both English and Vietnamese.
2. Deep-Link Navigation to Schedule Details (src/pages/notifications/index.tsx)
- Extracted
scheduleIdfromactionUrl/notification.dataupon clicking "View details". - Forwarded
scheduleIdthrough React Routerlocation.stateand search parameters to the recurring transactions page.
3. Auto-Open Details Modal (src/pages/recurring-transactions/index.tsx)
- Automatically detects
scheduleIdfrom navigation state or URL query params upon landing. - Opens
RecurringTransactionDetailsModalimmediately for the targeted schedule. - If the schedule is not yet loaded in the current paginated list, it fetches the schedule individually using the new hook.
4. Service & Hook Additions
-
src/services/recurring-transaction.service.ts: AddedgetById(id)to retrieve single schedule details by ID. -
src/hooks/use-recurring-transactions.ts: AddeduseRecurringTransaction(id)React Query hook with query key caching.
5. Enhanced Schedule Details Modal (RecurringTransactionDetailsModal.tsx)
- Enriched modal display: transaction amount (income/expense colored), wallet name, category, recurring interval, next execution date, start/end dates, reminder configuration, upcoming preview dates, and execution history.
6. Localization (en.json, vi.json)
- Added translation keys:
notification.dueDateLabel,notification.recurringDueMessage, andnotification.recurringDueMessageWithName.