The FloatingContributors component is a dynamic React component that displays live GitHub activity and a list of contributors for the recodehive/recode-website repository. It fetches data from GitHub APIs, processes it, and renders it in an interactive and animated UI.
- Displays recent events such as pushes, pull requests, comments, and more.
- Cycles through activities every 4 seconds.
- Shows the top contributors with their avatars, GitHub profiles, and contribution counts.
- Displays tooltips with additional contributor details.
- Smooth animations for floating effects, hover interactions, and transitions using
framer-motion.
- Uses hardcoded fallback data when GitHub API calls fail.
- Caches API responses in
localStoragefor 2 minutes to reduce API calls.
- Endpoint:
https://api.github.com/repos/recodehive/recode-website/events?per_page=30 - Purpose: Fetches live activity data (e.g., pushes, pull requests, comments).
- Endpoint:
https://api.github.com/repos/recodehive/recode-website/contributors?per_page=100 - Purpose: Fetches contributor data (e.g., avatars, contribution counts).
- Formats timestamps into relative time strings (e.g., "2 hours ago").
- Generates URLs for GitHub events based on the action type.
- Maps action types to icons and descriptive text.
- Add support for more event types (e.g.,
IssuesEventfor issue creation). - Use authentication tokens to increase API rate limits.
- Add user controls to pause or skip activities.
- Allow users to view all contributors in a modal or separate page.
- Convert CSS to a CSS-in-JS solution (e.g., styled-components).
- Add theme support for light and dark modes.
- Display error messages in the UI.
- Retry failed API calls with exponential backoff.
-
Import the component:
import FloatingContributors from './FloatingContributors';
-
Use it in your application:
<FloatingContributors heroEmbedded={false} />
reactframer-motion
- The component auto-refreshes data every 60 seconds.
- It uses
localStoragefor caching API responses.
For future reference, you can check out the following GitHub profiles: