Skip to content

feat: add savings projection API and dashboard UX states#751

Open
Tybravo wants to merge 5 commits into
Suncrest-Labs:mainfrom
Tybravo:feat/projections-dashboard-ux
Open

feat: add savings projection API and dashboard UX states#751
Tybravo wants to merge 5 commits into
Suncrest-Labs:mainfrom
Tybravo:feat/projections-dashboard-ux

Conversation

@Tybravo

@Tybravo Tybravo commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Summary of Implementation

✅ Backend — Compound Interest Projection API

Implemented

Domain Model (model.go)

  • ProjectionInput with validation for:

    • Deposits
    • APY
    • Periods
    • Compound frequency
  • ProjectionOutput with timeline and summary statistics

  • CompoundFrequency enum:

    • Daily
    • Monthly
  • Error handling for invalid inputs

Service Layer (projection_service.go)

  • ProjectionService with vault integration

  • CompoundInterestCalculator implementing the standard compound interest formula

  • APY retrieval from vault performance data

  • Support for:

    • Generic projections
    • Vault-specific projections

Handler Layer (projection_handler.go)

Implemented the following endpoints:

  • POST /api/v1/tools/projection

    • Generic compound interest calculation
  • GET /api/v1/vaults/{id}/projection

    • Vault-specific projection using live APY

Additional functionality:

  • Request validation
  • Error handling
  • Authentication checks

Unit Tests (calculator_test.go)

Added tests covering:

  • Compound interest calculations
  • Validation against known reference values
  • Edge cases

Features Delivered

  • ✅ Daily and monthly compounding frequencies

  • ✅ Optional recurring monthly contributions

  • ✅ Vault-specific APY retrieval with override capability

  • ✅ Monthly milestone timeline output

  • ✅ Summary statistics:

    • Total deposited
    • Total yield
    • Effective APY
  • ✅ Input validation

    • Positive amounts
    • Valid periods
    • Supported compound frequencies
  • ✅ Clean architecture separation:

Controller
    ↓
Service
    ↓
Compound Interest Calculator

✅ Frontend — Dashboard UX States System

Implemented

Skeleton Components (skeleton.tsx)

Created reusable skeleton primitives:

  • Base Skeleton
  • SkeletonLine
  • SkeletonCard
  • SkeletonTable
  • SkeletonChart

Features:

  • Smooth pulse animation
  • Responsive design
  • Configurable dimensions
  • Dashboard-specific layouts

Empty State Component (empty-state.tsx)

Reusable component supporting:

  • Configurable icon
  • Title
  • Description
  • Action button

Additional features:

  • Small, default, and large sizes
  • Optional illustrations
  • Variant styling
  • Accessibility support with proper ARIA labels

Error Boundary System (error-boundary.tsx)

Implemented reusable:

  • Page-level error boundaries
  • Widget-level error boundaries

Handles:

  • 401 Unauthorized
  • 404 Not Found
  • 429 Rate Limited
  • 500 Server Errors
  • Network Errors

Additional features:

  • Retry mechanisms
  • Countdown for rate limiting
  • Development-only error details

Toast System (toast-provider.tsx)

Implemented a global toast provider featuring:

  • success()
  • error()
  • warning()
  • info()

Capabilities:

  • Configurable auto-dismiss
  • Maximum of three visible toasts
  • Queue management
  • Optional action buttons
  • Persistent error toasts
  • Smooth Framer Motion animations

Dashboard Skeletons (dashboard-skeleton.tsx)

Implemented page-specific loading layouts for:

  • Dashboard
  • Vaults
  • History
  • Settlements
  • Notifications
  • Other dashboard pages

Features:

  • Matches actual page layouts
  • Prevents layout shifts
  • Realistic spacing and proportions

Compound Interest Calculator (savings-calculator.tsx)

Implemented:

  • Complete projection input form
  • Real-time chart visualization using Recharts
  • Backend projection API integration
  • Loading states
  • Error handling
  • Summary cards with formatted currency values

Features Delivered

  • ✅ Reusable skeleton primitives

  • ✅ Smooth loading animations

  • ✅ Page-specific skeleton layouts

  • ✅ Comprehensive error boundary system

  • ✅ Global toast notification system with queue management

  • ✅ Reusable empty state components

  • ✅ Responsive design

    • Desktop
    • Tablet
    • Mobile
  • ✅ Accessibility compliance

    • ARIA labels
    • Keyboard navigation
  • ✅ Mock data abstraction ready for future API integration


Issues Closed

@Tybravo Tybravo requested a review from 0xDeon as a code owner June 26, 2026 11:57
@drips-wave

drips-wave Bot commented Jun 26, 2026

Copy link
Copy Markdown

@Tybravo Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Comment thread apps/api/internal/service/projection_service.go Fixed

@0xDeon 0xDeon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI blocking merge: Dapp Frontend (Next.js) build failed and Security Scanning failed. Fix the frontend build errors and address the security scan findings before merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants