Skip to content

fix(dashboard): compute dynamic trends for StatCards and fix auth typings - #821

Open
Proxima84-code wants to merge 2 commits into
MergeFi:mainfrom
Proxima84-code:fix/statcard-dynamic-trends
Open

Proxima84-code wants to merge 2 commits into
MergeFi:mainfrom
Proxima84-code:fix/statcard-dynamic-trends

Conversation

@Proxima84-code

Copy link
Copy Markdown

Summary of Changes

This PR resolves hardcoded trend values across the contributor and sponsor dashboards, implements reusable history-based trend utilities, and cleans up TypeScript interfaces and test isolation in authentication modules.

1. Dynamic StatCard Trends (src/lib/utils.ts, dashboards)

  • Exported calculateTrend(current, previous) to compute relative percentage delta with safe edge-case handling.
  • Exported calculateTrendFromHistory(history) to derive period-over-period trend deltas from historical series data.
  • Replaced hardcoded dummy percentage values (12, 8, 18) in ContributorDashboardClient.tsx and SponsorDashboardClient.tsx with dynamic computations based on historical series.

2. Auth Context Typings (src/context/AuthContext.tsx)

  • Added the missing degraded: boolean property to AuthContextValue interface.
  • Cleaned up duplicate interface definitions and syntax artifacts.

3. Test Isolation & Assertions (src/app/auth/callback/CallbackClient.test.tsx)

  • Fixed variable scoping and initialization order for mocked auth hooks in beforeEach.
  • Resolved undefined variable references (expected, login) and aligned route expectations.
  • Eliminated redundant mock collision in the unfinished wallet link test case (/connect).

Verification

  • Typecheck: pnpm exec tsc --noEmit (0 errors)
  • CallbackClient Tests: pnpm exec jest src/app/auth/callback/CallbackClient.test.tsx --no-coverage (9/9 passed)
  • StatCard Tests: pnpm exec jest src/components/ui/StatCard.test.tsx --no-coverage (23/23 passed)
  • Commit Signature: Verified with SSH signing key (git log --show-signature -1).

…ings

- replace hardcoded trend percentages with calculateTrendFromHistory in contributor and sponsor dashboards
- export calculateTrend and calculateTrendFromHistory utilities in src/lib/utils.ts
- add degraded boolean property to AuthContextValue interface
- fix useSearchParams and login mock handling in CallbackClient.test.tsx
@vercel

vercel Bot commented Oct 29, 2026

Copy link
Copy Markdown

@Proxima84-code is attempting to deploy a commit to the chonilius' projects Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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.

1 participant