Skip to content

Conversation

odysseus0
Copy link
Collaborator

Summary

  • Add MEV refund metrics widget component that displays real-time data from Dune Analytics
  • Integrate widget into the navbar to show MEV and gas refund values
  • Replace hardcoded mock values with live data from the production API

Changes

  1. New MEV metrics widget component (src/components/MevMetrics.tsx)

    • Fetches data from https://refund-metrics-dune-api.vercel.app/api/metrics
    • Shows loading state while fetching
    • Falls back to mock data on errors
    • Displays values formatted as "X.XX ETH"
  2. Navbar integration

    • Added custom navbar item type support
    • Configured widget to appear in navbar between docs/API links and GitHub link

Testing

  • Tested locally with yarn start
  • Widget successfully displays live data: MEV Refund: 403.64 ETH, Gas Refund: 751.80 ETH
  • Error handling verified by blocking API requests
  • No CORS issues when fetching from the API

Screenshots

Widget displaying in navbar:

Flashbots | Docs | API | Refund | MEV: 403.64 ETH | Gas: 751.80 ETH | GitHub

🤖 Generated with Claude Code

Copy link

vercel bot commented Jul 11, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
flashbots-docs Ready Ready Preview Comment Aug 26, 2025 10:50am

@odysseus0
Copy link
Collaborator Author

Update: Added feature flag support

I've pushed an update that adds runtime feature flag support to control widget visibility:

Changes in this update:

  • Widget now checks showWidget field from API response
  • Returns null early when showWidget === false to completely hide the widget
  • Maintains backward compatibility - displays widget if field is missing
  • Clean implementation with no flash of content during loading

Testing completed:

  • ✅ Widget displays normally when showWidget: true
  • ✅ Widget is completely hidden when showWidget: false
  • ✅ Toggle works at runtime via API environment variable

This allows us to control widget visibility across all sites from a single point (the API's environment variable) without requiring frontend redeployments.

@odysseus0
Copy link
Collaborator Author

Ready for review - navbar alignment fixed with consistent typography hierarchy

- Add comprehensive refund metrics widget showing MEV and gas refund totals
- Fetch live data from configurable Dune Analytics API with feature flag support
- Use navbar__item class for seamless Docusaurus framework integration
- Perfect typography: regular labels, semibold values (font-weight: 500) matching navbar links
- Display format: 'Refund | MEV: X.XX ETH | Gas: X.XX ETH' with separators
- Include click handler redirecting to Dune analytics dashboard
- Responsive design with mobile hide behavior
- Robust error handling with graceful degradation

Technical implementation:
- Multi-metric layout with proper flex alignment and baseline typography
- Custom navbar component following Docusaurus integration patterns
- Server-side rendering compatible with runtime feature flag control
- Minimal CSS leveraging framework styles for consistent appearance
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