About Us: replace hardcoded contributor list with live API fetch + clickable profile modal#63
About Us: replace hardcoded contributor list with live API fetch + clickable profile modal#63himanshujha05 wants to merge 3 commits intoReduxISU:ReduxAPI_GUIfrom
Conversation
Added contributor data fetching and dynamic rendering of contributor names with links.
There was a problem hiding this comment.
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.
| {contributors.map((name, index) => { | ||
| const data = contributorData[name]; | ||
| const nameSlug = name.replace(/\s+/g, '-').toLowerCase(); |
There was a problem hiding this comment.
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.
| • <Link href={`/contributor/${nameSlug}`} legacyBehavior> | ||
| <a | ||
| style={{ color: "#f47920", textDecoration: "underline", cursor: "pointer" }} | ||
| > | ||
| {name} | ||
| </a> | ||
| </Link> |
There was a problem hiding this comment.
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.
| }; | ||
|
|
||
| fetchAllContributorData(); | ||
| }, []); |
There was a problem hiding this comment.
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.
| 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"; |
There was a problem hiding this comment.
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.
| import { createTheme, ThemeProvider, Container, Box, Button, Collapse } from "@mui/material"; | |
| import { createTheme, ThemeProvider, Container, Box } from "@mui/material"; |
| const encodedName = encodeURIComponent(name); | ||
| const response = await fetch(`https://api.redux.portneuf.cose.isu.edu/Navigation/ContributorProfile/${encodedName}`); | ||
| if (response.ok) { |
There was a problem hiding this comment.
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.
| 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); | ||
| } | ||
| } |
There was a problem hiding this comment.
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.
Refactor contributor data fetching and modal handling. Update publication titles for clarity and add Dialog component for contributor profiles.
Andrija-Sevaljevic
left a comment
There was a problem hiding this comment.
https://github.com/ReduxISU/Redux_GUI/actions/runs/21261813477/job/61190943937
238:134 Error: ' can be escaped with ', ‘, ', ’. react/no-unescaped-entities
Jobs don't pass checks. Please review compilation issues and resubmit.
What this PR does
The About Us page previously had a hardcoded array of 26 contributor names baked directly into the frontend source code. This meant that every time a new student joined the project, someone had to manually edit
pages/aboutus/index.js, commit it, and redeploy the frontend — just to get a name to show up on the page.This PR removes that hardcoded array entirely and replaces it with a live fetch from the backend. It also adds a clickable profile modal so visitors can see a contributor's personal info, GitHub profile, and contribution breakdown without leaving the page.
The problem with the old approach
This created an unnecessary coupling between the contributor list and the frontend codebase. It also meant the list could silently fall out of date if someone forgot to update it.
What changed
1. Contributor names are now fetched from the backend
On page load, a single call goes to:
This endpoint returns an array of entries like
{ name, githubUsername }. The component extracts the names for the list and builds agithubMap(name → GitHub username) for use in the modal. No more hardcoded array.2. Profiles load lazily — only when you click a name
Previously, the page was firing off 26 individual API calls on mount to pre-fetch every contributor's full profile data. Now nothing is fetched until a user actually clicks a name. This makes the initial page load significantly lighter.
3. Clickable contributor names open a profile modal
Each name in the contributors list is now a styled, clickable link (orange, underlined, with a hover lighten effect). Clicking it opens a MUI Dialog showing:
githubUsernameis present in the JSON)github.com/<username>.png4. API base URL uses the environment variable
All fetch calls use
process.env.NEXT_PUBLIC_REDUX_BASE_URL, which is already configured in.env.development(http://localhost:27000/) and.env.production(https://api.redux.portneuf.cose.isu.edu/). The previously hardcodedlocalhost:27000URL and the hardcoded Swagger link in Learn More are both fixed.How the new contributor flow works
contributorInfo.jsonon the backendFiles changed
pages/aboutus/index.js— only file changedTesting done
npm run build— no errors.catch(() => {})swallows the error silently)Reviewer notes
GET /Navigation/ContributorProfile/directoryendpoint that returns[{ name: string, githubUsername?: string }]. Please confirm this route exists and is deployed before merging.github.com/<username>.png) is loaded directly from GitHub's CDN — no auth needed, but it will silently show nothing if the username is wrong or the user has no avatar set.