Skip to content

Feature/replace demo dashboard data on web with wallet scoped live portfolio mapping - #240

Merged
Cedarich merged 3 commits into
Zyntarivoid:mainfrom
oreoluwa648:feature/Replace-demo-dashboard-data-on-web-with-wallet-scoped-live-portfolio-mapping
Jul 28, 2026
Merged

Feature/replace demo dashboard data on web with wallet scoped live portfolio mapping#240
Cedarich merged 3 commits into
Zyntarivoid:mainfrom
oreoluwa648:feature/Replace-demo-dashboard-data-on-web-with-wallet-scoped-live-portfolio-mapping

Conversation

@oreoluwa648

Copy link
Copy Markdown
Contributor

Summary

Replace demo/fallback dashboard data with wallet-scoped live portfolio data from the indexer. Dashboard now requires authenticated wallet connection and fetches real positions, transactions, and oracle prices.

Closes #177

Scope

  • Backend/API or indexing
  • Soroban contract
  • Mobile app
  • Web app
  • Documentation or contributor process

Validation

  • Tests were added or updated for changed behavior.
  • Relevant local test command passed.
  • Documentation was updated where contributor or API behavior changed.

Security and data handling

  • Wallet/session/auth changes preserve existing access controls.
  • User data, secrets, and payment-related values are not logged or exposed.
  • Error responses avoid leaking private implementation details.
  • Not applicable for this PR.

Reviewer notes

  • Dashboard now redirects unauthenticated users to home
  • fetchDashboardData() now requires wallet address parameter; DEMO_ADDRESS fallback removed
  • Added DashboardClient with AbortController support and exponential backoff retry
  • New useDashboardData hook handles auto-refresh, stale detection, and visibility change handling
  • WalletConnect component supports compact, full, and default variants with tooltip support

Closes #177

…mapping

This commit implements wallet-scoped live data fetching and removes all demo/fallback
data from the dashboard production path, addressing issue Zyntarivoid#177.

Key Changes:
- Remove DEMO_ADDRESS and mock pricing assumptions from dashboard API
- Add wallet address validation requiring 'G' prefix
- Integrate real oracle price fetching for accurate USD values
- Implement proper health factor calculation with Infinity handling
- Add wallet-scoped data fetching with error boundaries

UI/UX Improvements:
- Add comprehensive loading states with skeleton placeholders
- Implement detailed error handling with actionable error messages
- Show connected wallet address in dashboard header
- Display last updated timestamp for data freshness
- Add proper empty states for no assets/activity
- Improve number formatting with proper decimal places

Wallet Integration:
- Add connection status display in landing page
- Implement retry logic for connection failures
- Add Freighter wallet installation detection and prompts
- Show wallet address truncation throughout the app

Component Enhancements:
- Add variant support to WalletConnect (default, compact, full)
- Enhance WalletStatus with tooltip error display
- Improve Layout components with cn utility and responsive grid
- Add GridResponsive for better responsive layouts
- Add onSuccess/onError callbacks for wallet actions

New Files:
- src/lib/api/dashboard-client.ts: Client-side dashboard API wrapper
- src/lib/hooks/useDashboardData.ts: React hook for dashboard data

Technical Improvements:
- Add proper TypeScript types with no implicit any
- Implement abort controller for request cancellation
- Add automatic retry with exponential backoff
- Implement stale state detection and refresh
- Add visibility change handling for data freshness
- Improve error messages with actionable guidance

Breaking Changes:
- fetchDashboardData now requires wallet address parameter
- Removed demo fallback address (DEMO_ADDRESS)
- Dashboard requires authenticated wallet connection
…eliability

This commit addresses multiple TypeScript errors and enhances the data fetching
layer with better type safety, error handling, and component support.

Key Changes:

TypeScript Fixes:
- Fix type predicate error in dashboard-client.ts by using null filtering pattern
- Fix type error in usePositionSync.ts with proper address validation
- Add missing tooltip.tsx UI component for WalletStatus
- Install @vitest/ui and upgrade vitest to v3.2.7 for test support

Data Fetching Improvements (dashboard-client.ts):
- Refactor transaction mapping to use null filtering pattern
- Add explicit ActivityEvent type for better type safety
- Enhance asset symbol extraction with common asset detection (USDC, XLM, BTC, ETH)
- Improve transaction type mapping with support for SUPPLY, REPAYMENT, WITHDRAWAL
- Add console warnings for unknown transaction types

Position Sync Improvements (usePositionSync.ts):
- Add proper address validation before fetching
- Implement AbortController for request cancellation
- Reset state on address changes
- Improve error handling with abort error detection
- Add cleanup on unmount to prevent memory leaks
- Type-safe refs with proper TypeScript types

UI Components:
- Add tooltip.tsx component with Radix UI integration
- Tooltip supports dark theme matching application design

Dependencies:
- Add @vitest/ui for test UI interface
- Upgrade vitest from 3.2.6 to 3.2.7

Related Issues:
- Resolves TypeScript errors: TS2307, TS2677, TS2345
- Remove unused imports (Skeleton, Flex)
- Fix setState-in-effect errors with setTimeout wrappers
- Move helper functions outside component in dashboard/page
- Fix default export anonymous object in Layout
- Add proper ref handling for recursive fetch calls
- Clean up ESLint disable directives

Files affected:
- src/app/dashboard/page.tsx
- src/app/page.tsx
- src/components/Layout.tsx
- src/components/WalletConnect.tsx
- src/lib/hooks/useDashboardData.ts
- src/lib/hooks/usePositionSync.ts
@Cedarich
Cedarich merged commit a4e2529 into Zyntarivoid:main Jul 28, 2026
1 check passed
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.

7. Replace demo dashboard data on web with wallet-scoped live portfolio mapping

2 participants