Skip to content

Conversation

iitzIrFan
Copy link
Member

@iitzIrFan iitzIrFan commented Sep 12, 2025

Description

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.

More details can be viewed in the Readme file under the FloatingContributors

Solves: #321

Type of Change

  • New feature (e.g., new page, component, or functionality)
  • Bug fix (non-breaking change that fixes an issue)
  • UI/UX improvement (design, layout, or styling updates)
  • Performance optimization (e.g., code splitting, caching)
  • Documentation update (README, contribution guidelines, etc.)
  • Other (please specify):

Changes Made

  • Describe the key changes (e.g., new sections, updated components, responsive fixes).

Dependencies

  • List any new dependencies or tools required for this change.
  • Mention any version updates or configurations that need to be considered.

Checklist

  • My code follows the style guidelines of this project.
  • I have tested my changes across major browsers/devices
  • My changes do not generate new console warnings or errors , I ran npm run build and attached scrrenshot in this PR.
  • This is already assigned Issue to me, not an unassigned issue.

Copy link

vercel bot commented Sep 12, 2025

Someone is attempting to deploy a commit to the recode Team on Vercel.

A member of the Team first needs to authorize it.

@iitzIrFan iitzIrFan requested a review from Copilot September 12, 2025 17:31
Copy link

Thank you for submitting your pull request! 🙌 We'll review it as soon as possible. The estimated time for response is 5–8 hrs.

In the meantime, please provide all necessary screenshots and make sure you run - npm build run , command and provide a screenshot, a video recording, or an image of the update you made below, which helps speed up the review and assignment. If you have questions, reach out to LinkedIn. Your contributions are highly appreciated!😊

Note: I maintain the repo issue every day twice at 8:00 AM IST and 9:00 PM IST. If your PR goes stale for more than one day, you can tag and comment on this same issue by tagging @sanjay-kv.

We are here to help you on this journey of open source. Consistent 20 contributions are eligible for sponsorship 💰

🎁 check our list of amazing people we sponsored so far: GitHub Sponsorship. ✨

📚Your perks for contribution to this community 👇🏻

  1. Get free Consultation use code recode50 to get free: Mentorship for free.

  2. Get the Ebook for free use code recode at checkout: Data Science cheatsheet for Beginners.

  3. Check out this weekly Newsletter: Sanjay's Newsletter.

If there are any specific instructions or feedback regarding your PR, we'll provide them here. Thanks again for your contribution! 😊

@iitzIrFan iitzIrFan self-assigned this Sep 12, 2025
@iitzIrFan iitzIrFan moved this to In Progress in @recode-web Sep 12, 2025
@iitzIrFan iitzIrFan added the under review Review under the maintainers or the admins label Sep 12, 2025
@iitzIrFan iitzIrFan requested a review from sanjay-kv September 12, 2025 17:32
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

The PR adds a new FloatingContributors component that displays live GitHub activity and contributor information for the recodehive/recode-website repository. It replaces static demo data with real-time GitHub API integration and implements comprehensive fallback mechanisms.

Key changes:

  • Complete rewrite of activity data fetching to use real GitHub Events API
  • Addition of comprehensive type definitions for GitHub API responses
  • Implementation of localStorage caching with 2-minute expiration for API optimization
  • Enhanced UI interactions with clickable elements and improved accessibility

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/components/FloatingContributors/index.tsx Complete rewrite with live GitHub API integration, caching, and enhanced interactivity
src/components/FloatingContributors/README.md New comprehensive documentation covering features, API integration, and usage
src/components/FloatingContributors/FloatingContributors.css Enhanced styling with new activity item styles, hover effects, and accessibility improvements
package.json Added date-fns dependency

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines 4 to +27

// Format relative time (e.g., "2 hours ago")
const formatTimeAgo = (date: Date): string => {
const seconds = Math.floor((new Date().getTime() - date.getTime()) / 1000);

let interval = Math.floor(seconds / 31536000);
if (interval > 1) return `${interval} years ago`;

interval = Math.floor(seconds / 2592000);
if (interval > 1) return `${interval} months ago`;

interval = Math.floor(seconds / 86400);
if (interval > 1) return `${interval} days ago`;
if (interval === 1) return `1 day ago`;

interval = Math.floor(seconds / 3600);
if (interval > 1) return `${interval} hours ago`;
if (interval === 1) return `1 hour ago`;

interval = Math.floor(seconds / 60);
if (interval > 1) return `${interval} minutes ago`;
if (interval === 1) return `1 minute ago`;

return `just now`;
Copy link

Copilot AI Sep 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The date-fns import is missing, but formatTimeAgo function is implemented manually. Since date-fns was added as a dependency, consider using its format functions like formatDistanceToNow for more robust time formatting instead of the custom implementation.

Suggested change
// Format relative time (e.g., "2 hours ago")
const formatTimeAgo = (date: Date): string => {
const seconds = Math.floor((new Date().getTime() - date.getTime()) / 1000);
let interval = Math.floor(seconds / 31536000);
if (interval > 1) return `${interval} years ago`;
interval = Math.floor(seconds / 2592000);
if (interval > 1) return `${interval} months ago`;
interval = Math.floor(seconds / 86400);
if (interval > 1) return `${interval} days ago`;
if (interval === 1) return `1 day ago`;
interval = Math.floor(seconds / 3600);
if (interval > 1) return `${interval} hours ago`;
if (interval === 1) return `1 hour ago`;
interval = Math.floor(seconds / 60);
if (interval > 1) return `${interval} minutes ago`;
if (interval === 1) return `1 minute ago`;
return `just now`;
import { formatDistanceToNow } from 'date-fns';
// Format relative time (e.g., "2 hours ago")
const formatTimeAgo = (date: Date): string => {
return formatDistanceToNow(date, { addSuffix: true });

Copilot uses AI. Check for mistakes.

Comment on lines +178 to +181
if (lastFetched && now - lastFetched < 30000) {
// Don't fetch more than once every 30 seconds
return;
}
Copy link

Copilot AI Sep 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 30-second throttle value should be extracted as a named constant (e.g., const FETCH_THROTTLE_MS = 30000) to improve maintainability and make the timing configurable.

Copilot uses AI. Check for mistakes.

Comment on lines +584 to +586
{contributors.length > 12 && (
<div className="contributors-more">
<span>+{contributors.length - 8}</span>
<span>+{contributors.length - 12} more</span>
Copy link

Copilot AI Sep 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a logic inconsistency: the code displays 'more than 12' contributors but only shows the top 5 (line 549: .slice(0, 5)). The condition should check contributors.length > 5 and display +{contributors.length - 5} more to match the actual display count.

Copilot uses AI. Check for mistakes.

Comment on lines +346 to +353
fallbackActivities.forEach(activity => {
const login = activity.contributor.login;
if (!contributorsMap.has(login)) {
contributorsMap.set(login, {
id: `fallback-${login}`,
login,
avatar_url: activity.contributor.avatar_url,
contributions: Math.floor(Math.random() * 50) + 10,
Copy link

Copilot AI Sep 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using Math.random() for fallback contribution counts creates non-deterministic behavior. Consider using fixed values or deriving them from array indices to ensure consistent fallback data across renders.

Suggested change
fallbackActivities.forEach(activity => {
const login = activity.contributor.login;
if (!contributorsMap.has(login)) {
contributorsMap.set(login, {
id: `fallback-${login}`,
login,
avatar_url: activity.contributor.avatar_url,
contributions: Math.floor(Math.random() * 50) + 10,
fallbackActivities.forEach((activity, idx) => {
const login = activity.contributor.login;
if (!contributorsMap.has(login)) {
contributorsMap.set(login, {
id: `fallback-${login}`,
login,
avatar_url: activity.contributor.avatar_url,
contributions: 10 + 5 * idx,

Copilot uses AI. Check for mistakes.

Copy link

vercel bot commented Sep 13, 2025

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

Project Deployment Preview Comments Updated (UTC)
recode-website Ready Ready Preview Comment Sep 13, 2025 4:38am

@sanjay-kv sanjay-kv added this to the recode:launch 3.0 milestone Sep 13, 2025
@sanjay-kv sanjay-kv merged commit 088e7f4 into recodehive:main Sep 13, 2025
4 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in @recode-web Sep 13, 2025
@iitzIrFan iitzIrFan added documentation Improvements or additions to documentation enhancement New feature or request and removed under review Review under the maintainers or the admins labels Sep 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants