Skip to content

Cleanup: Unused React in the website#124

Open
saurabh007007 wants to merge 1 commit intoaboutcode-org:mainfrom
saurabh007007:main
Open

Cleanup: Unused React in the website#124
saurabh007007 wants to merge 1 commit intoaboutcode-org:mainfrom
saurabh007007:main

Conversation

@saurabh007007
Copy link

This PR removes unused React-related code and dependencies that were part of the older version of the website.

In the previous implementation, React was used, but the current version no longer relies on it. Some leftover React imports, configs, and references were still present, which were unnecessary.

Copilot AI review requested due to automatic review settings February 7, 2026 12:18
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

This PR aims to clean up leftover React-era code in the Docusaurus website by removing unused React imports/references and normalizing formatting in several page/component files.

Changes:

  • Removed import React from ... where it’s no longer needed and standardized imports/quoting.
  • Reformatted JSX in homepage/page components for consistent indentation and style.
  • Updated several archived ProjectGrid variants and the active ProjectGridTemplate component.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 21 comments.

Show a summary per file
File Description
website/src/pages/index.js Formatting-only changes to the homepage route component.
website/src/components/archive/ProjectGrid/index.js Removes default React import; formatting + import normalization.
website/src/components/archive/ProjectGrid/index-saved.js Removes default React import; formatting + import normalization.
website/src/components/archive/ProjectGrid/index-new.js Removes default React import; formatting + import normalization.
website/src/components/ProjectGridTemplate/index.js Formatting, string normalization, and modal/tooltip-related code restructuring.
website/src/components/HomepageHeader/index.js Removes unused React import and compresses JSX formatting.
website/src/components/HomepageContent/index.js Removes unused React import and reformats JSX.

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

Comment on lines +63 to +76
// Close modal on Escape key
useEffect(() => {
function handleKeyDown(event) {
if (event.key === "Escape") {
setSelectedProject(null);
setIsModalOpen(false);
}
}
if (selectedProject) {
window.addEventListener("keydown", handleKeyDown);
}
return () => {
window.removeEventListener("keydown", handleKeyDown);
};

// Close modal on Escape key
useEffect(() => {
function handleKeyDown(event) {
if (event.key === 'Escape') {
setSelectedProject(null);
}
}
if (selectedProject) {
window.addEventListener('keydown', handleKeyDown);
}
return () => {
window.removeEventListener('keydown', handleKeyDown);
};
}, [selectedProject]);

// Add tooltip to card and modal.
function DescriptionWithTooltip({ text }) {
const descRef = React.useRef(null);
const [showTooltip, setShowTooltip] = React.useState(false);

React.useEffect(() => {
const el = descRef.current;
if (el) {
// check if content is overflowing its container
setShowTooltip(
el.scrollHeight > el.clientHeight ||
el.scrollWidth > el.clientWidth,
);
}
}, [text]);

return (
<div className={styles.projectDescriptionWrapper}>
<div
ref={descRef}
className={`${styles.projectDescription} ${styles.multiline}`}
>
{text}
</div>
{showTooltip && <div className={styles.tooltip}>{text}</div>}
</div>
}, [selectedProject]);
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

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

The Escape key handler closes the modal by clearing selectedProject, but it does not reset isModalOpen to false. This can leave isModalOpen stuck true, which affects the shared popup-message gating and any other modal-related logic; reuse closeModal() here or also call setIsModalOpen(false).

Copilot uses AI. Check for mistakes.
Comment on lines +163 to +169
<div>
<div className={styles.projectDescriptionWrapper}>
<DescriptionWithTooltip
text={project.description.map((para, idx) => (
<p key={idx}>{para}</p>
))}
/>
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

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

DescriptionWithTooltip’s effect depends on text, but callers pass a newly-created array of <p> elements (project.description.map(...)) each render. That makes the effect run on every render and can cause extra layout reads (scrollHeight/clientHeight) and state updates. Prefer passing a stable value (e.g., the raw string/array of strings) and rendering inside the component, or memoize the mapped nodes.

Copilot uses AI. Check for mistakes.
Comment on lines +13 to +17
// Monitor open modal -- state prevents display of main-page alert
const [isModalOpen, setIsModalOpen] = useState(false);
const openModal = (project) => {
setSelectedProject(project); // sets modal content
};
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

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

isModalOpen is intended to suppress the main-page alert while the modal is open, but it is never updated (and setIsModalOpen is unused). As a result, the popup message can still render while the modal is shown. Either remove isModalOpen entirely and key off selectedProject, or set it to true/false in openModal/closeModal (and in the Escape handler).

Copilot uses AI. Check for mistakes.
Comment on lines 4 to +46
// import projects from '@site/src/data/projects-v02.json';
import projects_library from '@site/src/data/projects-library.json';
import projects_main from '@site/src/data/projects-main.json';
import projects_library from "@site/src/data/projects-library.json";
import projects_main from "@site/src/data/projects-main.json";

export default function ProjectGrid() {
const [message, setMessage] = useState(null);
const [selectedProject, setSelectedProject] = useState(null);
const [activeTab, setActiveTab] = useState('overview');
// Monitor open modal -- state prevents display of main-page alert
const [isModalOpen, setIsModalOpen] = useState(false);
const openModal = (project) => {
setSelectedProject(project); // sets modal content
};
// Use a separate state for the modal alert
const [modalMessage, setModalMessage] = useState(null);

// Close modal on Escape key
useEffect(() => {
function handleKeyDown(event) {
if (event.key === 'Escape') {
setSelectedProject(null);
setActiveTab('overview');
}
}
if (selectedProject) {
window.addEventListener('keydown', handleKeyDown);
}
return () => {
window.removeEventListener('keydown', handleKeyDown);
};
}, [selectedProject]);
const [message, setMessage] = useState(null);
const [selectedProject, setSelectedProject] = useState(null);
const [activeTab, setActiveTab] = useState("overview");
// Monitor open modal -- state prevents display of main-page alert
const [isModalOpen, setIsModalOpen] = useState(false);
const openModal = (project) => {
setSelectedProject(project); // sets modal content
};
// Use a separate state for the modal alert
const [modalMessage, setModalMessage] = useState(null);

const closeModal = () => {
// Close modal on Escape key
useEffect(() => {
function handleKeyDown(event) {
if (event.key === "Escape") {
setSelectedProject(null);
setActiveTab('overview');
setActiveTab("overview");
}
}
if (selectedProject) {
window.addEventListener("keydown", handleKeyDown);
}
return () => {
window.removeEventListener("keydown", handleKeyDown);
};
}, [selectedProject]);

return (
<div className={styles.projectGridWrapper}>
<div className={styles.projectGridContainer}>
<div className={styles.projectGrid}>
{projects.map((project, idx) => (
<div
key={idx}
className={styles.projectCard}
onClick={() => openModal(project)}
>
<div>
<div className={styles.topRow}>
<h4 className={styles.projectName}>
{project.repository_url ? (
<a
href={project.repository_url}
target={
project.repository_url.startsWith(
'http'
)
? '_blank'
: '_self'
}
rel='noopener noreferrer'
className={
styles.modalLinkUrl_break_word
}
onClick={(e) =>
e.stopPropagation()
}
>
{project.name}
</a>
) : (
project.name
)}
</h4>
</div>
</div>
const closeModal = () => {
setSelectedProject(null);
setActiveTab("overview");
};

<div>
<div
className={styles.projectDescriptionWrapper}
>
{project.description}
</div>
</div>
return (
<div className={styles.projectGridWrapper}>
<div className={styles.projectGridContainer}>
<div className={styles.projectGrid}>
{projects.map((project, idx) => (
<div
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

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

projects is used in the render (projects.map(...)) but is never defined/imported (the import is commented out). This file will throw at runtime if it’s ever imported; either restore the projects import or update the code to iterate over projects_library/projects_main instead.

Copilot uses AI. Check for mistakes.
Comment on lines +270 to +274
<p>
{selectedProject.description.map((para, idx) => (
<p key={idx}>{para}</p>
))}
</p>
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

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

The modal description renders a <p> that contains multiple <p> elements from the map. Nested paragraph tags are invalid HTML and can break layout and screen-reader semantics; render the mapped paragraphs inside a container like a <div>/<section>/fragment instead of wrapping them in a <p>.

Suggested change
<p>
{selectedProject.description.map((para, idx) => (
<p key={idx}>{para}</p>
))}
</p>
<div>
{selectedProject.description.map((para, idx) => (
<p key={idx}>{para}</p>
))}
</div>

Copilot uses AI. Check for mistakes.
setSelectedProject(project); // sets modal content
};
// Use a separate state for the modal alert
const [modalMessage, setModalMessage] = useState(null);
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

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

Unused variable setModalMessage.

Suggested change
const [modalMessage, setModalMessage] = useState(null);

Copilot uses AI. Check for mistakes.
};
// Use a separate state for the modal alert
const [modalMessage, setModalMessage] = useState(null);
const [message, setMessage] = useState(null);
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

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

Unused variable setMessage.

Suggested change
const [message, setMessage] = useState(null);
const [message] = useState(null);

Copilot uses AI. Check for mistakes.
setSelectedProject(project); // sets modal content
};
// Use a separate state for the modal alert
const [modalMessage, setModalMessage] = useState(null);
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

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

Unused variable setModalMessage.

Suggested change
const [modalMessage, setModalMessage] = useState(null);

Copilot uses AI. Check for mistakes.
const closeModal = () => {
const [selectedProject, setSelectedProject] = useState(null);
const [isModalOpen, setIsModalOpen] = useState(false);
const [message, setMessage] = useState("");
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

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

Unused variable setMessage.

Suggested change
const [message, setMessage] = useState("");
const [message] = useState("");

Copilot uses AI. Check for mistakes.
const [selectedProject, setSelectedProject] = useState(null);
const [isModalOpen, setIsModalOpen] = useState(false);
const [message, setMessage] = useState("");
const [modalMessage, setModalMessage] = useState("");
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

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

Unused variable setModalMessage.

Suggested change
const [modalMessage, setModalMessage] = useState("");
const [modalMessage] = useState("");

Copilot uses AI. Check for mistakes.
@johnmhoran
Copy link
Member

@saurabh007007 Before you (I mean, Copilot) did all this, did you take the time to read the README and how we view the use of Copilot? https://github.com/aboutcode-org/www.aboutcode.org

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.

2 participants