Skip to content

Implement contributor data fetching and display#63

Open
himanshujha05 wants to merge 2 commits intoReduxISU:ReduxAPI_GUIfrom
himanshujha05:ReduxAPI_GUI
Open

Implement contributor data fetching and display#63
himanshujha05 wants to merge 2 commits intoReduxISU:ReduxAPI_GUIfrom
himanshujha05:ReduxAPI_GUI

Conversation

@himanshujha05
Copy link
Collaborator

Added contributor data fetching and dynamic rendering of contributor names with links.

Added contributor data fetching and dynamic rendering of contributor names with links.
Copilot AI review requested due to automatic review settings January 22, 2026 18:38
Copy link

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

Adds contributor profile fetching and updates the About Us page to render contributor names as clickable links.

Changes:

  • Added client-side fetching of contributor profile metadata from the backend on page load
  • Added state to store fetched contributor profile data
  • Updated the contributor list UI to render each contributor name as a Next.js link

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 189 to 191
{contributors.map((name, index) => {
const data = contributorData[name];
const nameSlug = name.replace(/\s+/g, '-').toLowerCase();
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

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

contributorData is fetched and stored, but the only read is const data = contributorData[name]; and data is never used. This results in extra network traffic and state updates with no UI impact. Either use the fetched data to drive rendering (e.g., link target/label) or remove the fetch/state entirely.

Copilot uses AI. Check for mistakes.
Comment on lines 195 to 201
• <Link href={`/contributor/${nameSlug}`} legacyBehavior>
<a
style={{ color: "#f47920", textDecoration: "underline", cursor: "pointer" }}
>
{name}
</a>
</Link>
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

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

This Link points to /contributor/${nameSlug}, but there is no pages/contributor/* route in the current codebase, so these links will 404. Either add the corresponding Next.js page route (e.g., a dynamic contributor page) or change the link to an existing route/URL.

Copilot uses AI. Check for mistakes.
};

fetchAllContributorData();
}, []);
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

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

The effect depends on contributors but the dependency array is empty. With next/core-web-vitals, this typically raises a react-hooks/exhaustive-deps warning and can become a real bug if the contributors list ever changes. Consider moving contributors outside the component or including it in the dependency array.

Copilot uses AI. Check for mistakes.
import ResponsiveAppBar from "../../components/widgets/ResponsiveAppBar";
import { createTheme, ThemeProvider, Container, Box } from "@mui/material";
import "bootstrap/dist/css/bootstrap.min.css";
import { createTheme, ThemeProvider, Container, Box, Button, Collapse } from "@mui/material";
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

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

Button and Collapse are imported from @mui/material but not used in this file, which can trigger lint failures during next build and adds noise. Remove the unused imports or use them in the JSX.

Suggested change
import { createTheme, ThemeProvider, Container, Box, Button, Collapse } from "@mui/material";
import { createTheme, ThemeProvider, Container, Box } from "@mui/material";

Copilot uses AI. Check for mistakes.
Comment on lines 29 to 31
const encodedName = encodeURIComponent(name);
const response = await fetch(`https://api.redux.portneuf.cose.isu.edu/Navigation/ContributorProfile/${encodedName}`);
if (response.ok) {
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

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

This fetch hard-codes the production API host. The repo already defines NEXT_PUBLIC_REDUX_BASE_URL (see pages/index.js:42 and .env.*), so use that base URL here to avoid breaking local/dev/staging environments and to keep configuration centralized.

Copilot uses AI. Check for mistakes.
Comment on lines 27 to 38
for (const name of contributors) {
try {
const encodedName = encodeURIComponent(name);
const response = await fetch(`https://api.redux.portneuf.cose.isu.edu/Navigation/ContributorProfile/${encodedName}`);
if (response.ok) {
const data = await response.json();
dataMap[name] = data;
}
} catch (error) {
console.warn(`Failed to fetch data for ${name}:`, error);
}
}
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

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

Contributor profiles are fetched sequentially inside a for...of with await, which will make page load time grow linearly with the number of contributors. Consider issuing requests concurrently (e.g., build an array of promises and await them together) or adding a backend batch endpoint.

Copilot uses AI. Check for mistakes.
Refactor contributor data fetching and modal handling. Update publication titles for clarity and add Dialog component for contributor profiles.
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