Skip to content

feat: add/edit savings goal modal with validation and live state#495

Merged
Baskarayelu merged 2 commits into
Remitwise-Org:mainfrom
ekwe7:Implement-the-Add-Edit-Savings-Goal-form-and-wire-app-goals-to-live-state
Jun 18, 2026
Merged

feat: add/edit savings goal modal with validation and live state#495
Baskarayelu merged 2 commits into
Remitwise-Org:mainfrom
ekwe7:Implement-the-Add-Edit-Savings-Goal-form-and-wire-app-goals-to-live-state

Conversation

@ekwe7

@ekwe7 ekwe7 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

closes #462
Description
Previously, the savings goals page rendered a static grid. This PR lifts the goals
list into component state and adds a robust, validated modal form for creating and
editing goals. It also ensures all UI elements are localized and accessible.

Key Features

  • Live State Management: The goals list and summary statistics (Total Target,
    Total Saved) now update instantly when a goal is added or modified.
  • Validated Modal Form:
    • Added SavingsGoalModal with inputs for title, description, target amount,
      and date.
    • Integrated lib/validation/savings-goals.ts to provide real-time localized
      feedback.
    • Added an icon selector with gradient previews.
  • Dynamic Calculation: Fields like daysLeft and isOverdue are now derived
    dynamically from the targetDate, ensuring accuracy as time progresses.
  • Internationalization (i18n):
    • All strings, including validation errors and status labels (e.g., "Almost
      there", "Overdue"), are externalized to en.json.
  • Accessibility (A11y):
    🛠 Technical Implementation
  • Validator Refactor: Updated the savings-goals validator to return i18n keys
    instead of hardcoded strings, allowing the UI to handle localization centrally.
  • UI Robustness: Applied line-clamp to prevent layout breaks from long
    user-generated content.
  • Utility Testing: Created a new test suite for date-based utility functions to
    ensure zero-regressions in status tracking.

✅ Verification Results

Automated Tests

  • Coverage: 100% for lib/validation/savings-goals.ts and
    app/dashboard/goals/utils.ts.
  • Command: npm run test:coverage
  • Result: All 37 tests passed.

Quality Checks

  • Linting: npm run lint passes for all modified files.
  • Type-checking: npx tsc --noEmit passes for all modified files.

ekwe7 added 2 commits June 18, 2026 00:11
Implements the Add/Edit Savings Goal flow by lifting goalsData into
 component state and providing a fully accessible modal form.

 Key changes:
 - Integrated lib/validation/savings-goals for real-time form validation.
 - Externalized all strings and error messages to en.json for full i18n
      support.
 - Implemented modal accessibility (focus trap, ESC to close, and
      motion-reduce).
- Recomputed daysLeft and isOverdue dynamically from the target date.
 - Added 100% test coverage for goals utilities and validation logic.
 - Improved UI robustness with line-clamping for long titles and descriptions
… reflection

Cleans up unrelated syntax errors, missing imports, and type issues in app/ and components/ to ensure a green CI build for the savings goals feature.
@Baskarayelu

Copy link
Copy Markdown
Contributor

the add/edit savings goal modal with validation and live state is exactly the flow we wanted. landed as part of your stack via #504. merged 👍

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.

Implement the Add / Edit Savings Goal form and wire app/dashboard/goals/page.tsx to live state

2 participants