Skip to content

feat(frontend): add stale price tooltip warning in FiatEquivalent when feed is older than 5 minutes - #1684

Open
aazminu wants to merge 1 commit into
LabsCrypt:mainfrom
aazminu:feat/issue-1640-fiat-equivalent-stale-price-warning
Open

aazminu wants to merge 1 commit into
LabsCrypt:mainfrom
aazminu:feat/issue-1640-fiat-equivalent-stale-price-warning

Conversation

@aazminu

@aazminu aazminu commented Oct 19, 2026

Copy link
Copy Markdown

Description

Exposes lastUpdatedAt from useTokenPrice (frontend/src/hooks/useTokenPrice.ts) and renders an amber info indicator with an accessible tooltip ("Price estimate last updated X minutes ago") in FiatEquivalent (frontend/src/components/FiatEquivalent.tsx) whenever the cached token price feed is older than 5 minutes (5 * 60 * 1000 ms).

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🔧 Refactoring (no functional changes)
  • ⚡ Performance improvement
  • 🧪 Test addition or update

Related Issues

Closes #1640
Fixes #1640
/claim #1640

Changes Made

  • Exposed lastUpdatedAt (number | null) on the object returned by useTokenPrice in frontend/src/hooks/useTokenPrice.ts (preferring query.data.timestamp with fallback to query.dataUpdatedAt).
  • Added and exported getPriceStaleness(lastUpdatedAt, nowMs) and STALE_PRICE_THRESHOLD_MS (5 * 60 * 1000) in frontend/src/components/FiatEquivalent.tsx.
  • Updated FiatEquivalent to render an amber info badge (data-testid="stale-price-warning", title, aria-label, and role="tooltip") reading "Price estimate last updated X minutes ago" when the price quote is older than 5 minutes.
  • Guarded missing/null price data and timestamps so fresh quotes and loading/null states render cleanly without warnings or runtime errors.
  • Added unit tests in frontend/src/components/__tests__/FiatEquivalent.test.tsx covering fresh quotes (< 5 minutes), stale quotes (> 5 minutes), and null/missing price data.

Testing

Test Coverage

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed

Test Steps

  1. Run npx vitest run src/components/__tests__/FiatEquivalent.test.tsx src/app/streams/[id]/__tests__/stream-details-content.test.tsx src/__tests__/a11y.test.tsx in frontend/ (29/29 tests pass).
  2. Run npx tsc --noEmit in frontend/ (0 errors).
  3. Run npx eslint src/hooks/useTokenPrice.ts src/components/FiatEquivalent.tsx src/components/__tests__/FiatEquivalent.test.tsx in frontend/ (0 errors, 0 warnings).

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have checked for breaking changes and documented them if applicable

Additional Notes

Payout Details

  • USDT/USDC Receiving Wallet (EVM / ERC-20 / Polygon / Arbitrum / Optimism / Base / BSC): 0x9a51790aC01c54184bcFa067bC38f7F0E7C6F6B6

…n feed is older than 5 minutes

Expose `lastUpdatedAt` from `useTokenPrice` and display an amber info indicator
with an accessible tooltip (`Price estimate last updated X minutes ago`) in
`FiatEquivalent` whenever `Date.now() - lastUpdatedAt > 5 * 60 * 1000`.

Fixes LabsCrypt#1640

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.

[Frontend] Add subtle tooltip warning in FiatEquivalent when token price feed is older than 5 minutes

1 participant