Skip to content

feat(settings): connect NotificationSettings to persistent reminder p… - #554

Open
benedictworks-home wants to merge 2 commits into
OpenLedger-Foundation:mainfrom
benedictworks-home:feat/notification-prefs-wiring-5382511235272062020
Open

feat(settings): connect NotificationSettings to persistent reminder p…#554
benedictworks-home wants to merge 2 commits into
OpenLedger-Foundation:mainfrom
benedictworks-home:feat/notification-prefs-wiring-5382511235272062020

Conversation

@benedictworks-home

Copy link
Copy Markdown
Contributor

Summary

This PR resolves Issue #518 — Wire NotificationSettings to maturity and funding reminder prefs by connecting the notification preferences toggles in the UI to a persistent client-side store and ensuring that all corresponding reminders respect these user preferences globally.

Key Changes

  1. State Persistence (store/settingsStore.ts)

    • Integrated a notifications state object containing preferences for maturity, fundingFilled, and repaymentDue reminders.
    • Reused the existing Zustand with localStorage persistence mechanism to ensure preferences survive page reloads and new sessions.
    • Initialized all preferences to true by default (opt-out safety approach).
  2. Reminder Gating & Dismissal (hooks/)

    • Maturity Reminders: Updated useMaturityReminder to honor the maturity setting.
    • Funding & Repayment Alerts: Newly implemented useFundingReminder and useRepaymentReminder hooks to handle their respective settings.
    • Immediate Active Dismissals: Added logic to dismiss active toast notifications immediately (using explicit toast IDs: "maturityReminder", "fundingAlert", "repaymentAlert") when any setting is toggled off.
    • Global Event Gating: Updated contract-event listeners (useContractEvents.tsx) and the central notification filter (useToast.tsx) to guarantee that both mock and live Web3 chain event alerts strictly honor user preferences.
  3. Complete Localization (i18n)

    • Fully localized all toggles, helper descriptions, and disabled/empty state copy in NotificationSettings.tsx.
    • Updated all four supported locale files:
      • messages/en.json (English)
      • messages/es.json (Spanish)
      • messages/pt-BR.json (Portuguese - Brazil)
      • messages/ar.json (Arabic)
    • Tested under the Right-to-Left (RTL) Arabic locale with no visual breakages identified.
    • Note on translations: These are high-quality, context-aware translations, but they should be reviewed by native speakers if possible prior to production release.
  4. Testing Suite (hooks/__tests__/useReminderPrefs.test.tsx)

    • Added a complete unit test suite verifying:
      • Toggle off → no reminder fires (all three reminder types tested independently).
      • Toggle on → reminder fires as expected.
      • Toggling off an already-scheduled reminder cancels/dismisses it immediately.
      • Storage persistence across simulated reloads.
      • Sensible default value initialization.

Verification Run Results

All validation checks have been run locally and passed successfully:

  • Linter: npm run lint — ✔ No ESLint warnings or errors.
  • Type-checker: npm run type-check — Success (0 errors).
  • Unit Tests: npm run test -- hooks/__tests__/useReminderPrefs.test.tsx — 11/11 tests green.
  • Build: npm run build — Production build completed successfully with no errors.

Acceptance Criteria Checklist

  • Prefs persist across sessions
  • Maturity reminders honor toggles
  • Labels localized (en/es/ar/pt-BR)
  • Clear empty/disabled copy
  • Tests for preference gating (all three reminder types)

Closes #518

google-labs-jules Bot and others added 2 commits July 31, 2026 02:10
…references

Wires the notification preferences toggles in NotificationSettings to settingsStore.
Implements useFundingReminder and useRepaymentReminder hooks to complement useMaturityReminder.
Ensures all reminder hooks respect user preferences globally, with immediate dismissal of active toasts when toggled off.
Fully localizes labels across English, Spanish, Portuguese, and Arabic, and adds unit tests.

Co-authored-by: benedictworks-home <277016530+benedictworks-home@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wire NotificationSettings to maturity and funding reminder prefs

1 participant