Skip to content

added FAQ page and improved app.jsx#77

Closed
dikshajha13 wants to merge 2 commits into
kunalverma2512:mainfrom
dikshajha13:main
Closed

added FAQ page and improved app.jsx#77
dikshajha13 wants to merge 2 commits into
kunalverma2512:mainfrom
dikshajha13:main

Conversation

@dikshajha13
Copy link
Copy Markdown

@dikshajha13 dikshajha13 commented May 18, 2026

##changes made:
-added FAQ page component
-updated app.jsx with new changes

##purpose:
contribution for GSSoC project

Summary by CodeRabbit

  • New Features
    • A new FAQ page is available at /faq. FAQs are organized by category (default: General); users can switch categories and expand questions to reveal answers. The page is integrated into the app layout and supports browsing categories and toggling individual items for quick access to help content.

Review Change Stack

@github-actions
Copy link
Copy Markdown

🚀 PR Received Successfully

Hello @dikshajha13,

Thank you for taking the initiative to contribute to this project.

Please ensure that your PR follows all project guidelines properly before requesting review.

⚠️ Important Instructions

  • Maintain proper code quality and structure
  • Do not make unnecessary changes/files
  • Ensure responsiveness across devices
  • Follow existing project conventions strictly
  • Attach screenshots/videos for UI-related changes
  • Resolve merge conflicts before requesting review
  • Avoid AI-generated low quality PRs or copied implementations

📌 Mandatory for GSSoC'26 Participants

Joining the community group and announcement channel is compulsory for all contributors participating through GSSoC'26.

Failure to follow contribution guidelines may lead to PR rejection.

We appreciate your effort and wish you a great open-source journey ahead. ✨

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 18, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3267371f-2036-46c4-a509-45efff170852

📥 Commits

Reviewing files that changed from the base of the PR and between 9da1e0a and 136fcc3.

📒 Files selected for processing (1)
  • frontend/src/App.jsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/src/App.jsx

📝 Walkthrough

Walkthrough

Adds a new FAQ page component with category-filtered, expandable Q&A and wires it into the app by registering a /faq route in App.jsx.

Changes

FAQ Page Feature

Layer / File(s) Summary
FAQ page component with data and state
frontend/src/pages/FAQ.jsx
New FAQ component: hardcoded FAQ array, selectedCategory and openQuestion state, and category buttons that set category on hover.
FAQ page UI and interactivity
frontend/src/pages/FAQ.jsx
Renders filtered FAQ list; items toggle answer visibility on click; component exported as default.
FAQ route integration
frontend/src/App.jsx
Imports FAQ and registers a new route path="/faq" that renders <FAQ /> inside the existing layout and Routes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

enhancement, Frontend, UI/UX, GSSoC26, quality:clean

🐰 I hopped a tiny route to play,
Questions and answers lined the way,
Hover to sort and click to show,
A pocket of knowledge, ready to grow. 📚✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'added FAQ page and improved app.jsx' accurately reflects the main changes: a new FAQ page component and updates to app.jsx to incorporate it via routing.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (2)
frontend/src/pages/FAQ.jsx (1)

79-112: ⚡ Quick win

Consider adding accessibility attributes for FAQ items.

The FAQ items lack semantic HTML and ARIA attributes that would improve keyboard navigation and screen reader support. While the current implementation functions, adding aria-expanded and proper keyboard handlers would better serve all users.

♿ Suggested accessibility improvements
                     <div
                         key={index}
                         onClick={()=>
                             setOpenQuestion(
                                 openQuestion ===index?null:index
                             )
                         }
+                        onKeyDown={(e) => {
+                            if (e.key === 'Enter' || e.key === ' ') {
+                                e.preventDefault();
+                                setOpenQuestion(openQuestion === index ? null : index);
+                            }
+                        }}
+                        role="button"
+                        tabIndex={0}
+                        aria-expanded={openQuestion === index}
                             className="border rounded-2xl p-5 cursor-pointer hover:shadow-lg transition-all duration-300"  
                     >
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/src/pages/FAQ.jsx` around lines 79 - 112, The FAQ list uses a
clickable div for each item but lacks accessibility attributes and keyboard
support; update the clickable element (preferably replace the div with a
semantic <button> or at minimum add role="button" and tabIndex={0}) for the
mapping over faq and make it expose aria-expanded={openQuestion === index} and
aria-controls pointing to the answer panel id (e.g., "faq-answer-{index}"), give
the answer <p> an id matching that aria-controls, and add an onKeyDown handler
that toggles setOpenQuestion (same logic as the onClick) when Enter or Space is
pressed so keyboard and screen reader users can open/close items (refer to
setOpenQuestion, openQuestion, faq, selectedCategory, item, index).
frontend/src/App.jsx (1)

67-68: 💤 Low value

Consider formatting the FAQ route consistently.

The FAQ route is split across two lines, while similar public routes (lines 70-78, 87-88) use single-line format. For consistency, consider:

-            <Route
-               path="/faq" element={<FAQ />} />
+            <Route path="/faq" element={<FAQ />} />
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/src/App.jsx` around lines 67 - 68, The FAQ route JSX is split across
two lines; make it consistent with other public routes by collapsing the Route
element into a single line (change the Route that references FAQ to the
single-line form using Route with path="/faq" and element={<FAQ />}), update the
Route JSX in App.jsx where the FAQ Route is declared, and reformat/run Prettier
so it matches the existing route formatting style used for other routes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@frontend/src/pages/FAQ.jsx`:
- Around line 63-74: The category buttons currently use onMouseEnter which
causes accessibility/usability issues; replace the onMouseEnter handlers with
onClick handlers on the same button elements so
setSelectedCategory("GENERAL"/"TOOLS"/"CONTESTS"/"DASHBOARD") is called on
click, and ensure the existing button elements retain keyboard focusability and
visible focus styles (no additional role changes required because they are
native <button> elements).
- Around line 63-74: The category buttons currently render unstyled; add
className attributes and active-state classes so they get CSS styling and show
selection. For each button that calls setSelectedCategory (e.g., the buttons for
"GENERAL", "TOOLS", "CONTESTS", "DASHBOARD"), add a base class like
"faq-category-button" and conditionally add an "active" or "selected" class when
selectedCategory === "GENERAL"/"TOOLS"/...; ensure styles exist in the
corresponding CSS/SCSS (or module) to handle base, :hover, and .active states
and consider also adding an onClick handler and aria-pressed attribute tied to
selectedCategory for keyboard/accessibility.
- Around line 5-46: The FAQ array named faq in FAQ.jsx should be extracted out
of the component to improve reusability and testability; create a new module
(e.g., frontend/src/data/faqData.js) that exports the constant (e.g., FAQ_DATA)
containing the current objects, or move the faq constant to the top-level of
FAQ.jsx above the component, then replace the in-file definition with an import
or reference to FAQ_DATA and update any references inside the component
accordingly (search for the variable name faq inside the component to locate
usages).
- Around line 5-46: The faq array contains answer strings with accidental
leading spaces and a few typos; remove any leading space characters at the start
of each answer value in the faq entries and correct the text mistakes: in the
entry with ques "Are upcoming coding constests tracked on CodeLens?" change
"constests" → "contests" and "constest" → "contest", and in the entry with ques
"What insights are available in the dashboard? " change "coing" → "coding";
update the relevant answer strings in the faq constant accordingly (locate by
the ques values above).

---

Nitpick comments:
In `@frontend/src/App.jsx`:
- Around line 67-68: The FAQ route JSX is split across two lines; make it
consistent with other public routes by collapsing the Route element into a
single line (change the Route that references FAQ to the single-line form using
Route with path="/faq" and element={<FAQ />}), update the Route JSX in App.jsx
where the FAQ Route is declared, and reformat/run Prettier so it matches the
existing route formatting style used for other routes.

In `@frontend/src/pages/FAQ.jsx`:
- Around line 79-112: The FAQ list uses a clickable div for each item but lacks
accessibility attributes and keyboard support; update the clickable element
(preferably replace the div with a semantic <button> or at minimum add
role="button" and tabIndex={0}) for the mapping over faq and make it expose
aria-expanded={openQuestion === index} and aria-controls pointing to the answer
panel id (e.g., "faq-answer-{index}"), give the answer <p> an id matching that
aria-controls, and add an onKeyDown handler that toggles setOpenQuestion (same
logic as the onClick) when Enter or Space is pressed so keyboard and screen
reader users can open/close items (refer to setOpenQuestion, openQuestion, faq,
selectedCategory, item, index).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 13f2c4f6-5090-4111-87fa-d56dd1dc3299

📥 Commits

Reviewing files that changed from the base of the PR and between d2f35e0 and 9da1e0a.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • frontend/src/App.jsx
  • frontend/src/pages/FAQ.jsx

Comment on lines +5 to +46
const faq=[
{
category: "GENERAL",
ques: "What is CodeLens?",
answer: " CodeLens is basically a developer platform. CodeLens aggregates your GitHub, LeetCode, and Codeforces data into a single AI-powered command center that tells you exactly what to learn next.",
},
{
category: "GENERAL",
ques: "How does Codelens help developers?",
answer: " It helps users track coding progresses, analyze profiles, explore various contests, and improve problem-solving consistency across multiple coding platforms",
},
{
category: "GENERAL",
ques: "What are different platform integrated with CodeLens?",
answer: "CodeLens currently supports integrations and tracking with platforms like LeetCode, Codeforces , Codechef, Git and Github",
},
{
category: "TOOLS",
ques: "Which type of tools are provided?",
answer: "CodeLens offers AI-powered developer tools",
},
{
category: "TOOLS",
ques: "What is Vela AI used for?",
answer: "Vela AI helps developers receive intelligent coding guidance, recommendations, and assistance inside the CodeLens platform.",
},
{
category:"TOOLS",
ques: "How does Apex AI improve coding preparation?",
answer: "Apex AI analyzes user activity and provides insights , recommendations, and learning assistance for competitive programming improvement.",
},
{
category: "CONTESTS",
ques: "Are upcoming coding constests tracked on CodeLens?",
answer: "YES. CodeLens provides constest tracking for multiple competitive programming platform in one centralized interface.",
},
{
category: "DASHBOARD",
ques: "What insights are available in the dashboard? ",
answer: "The dashboard helps users monitor coing activity, platform statistics and progress across the platforms used in one place.",
},
];
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Extract FAQ data to a separate constant or file.

The FAQ data array is currently defined inside the component, which reduces reusability and makes testing harder. Consider moving it outside the component or to a separate faqData.js file.

♻️ Suggested refactor

Option 1: Move above the component in the same file:

 import {useState} from "react";

+const FAQ_DATA = [
+  {
+    category: "GENERAL",
+    ques: "What is CodeLens?",
+    answer: "CodeLens is basically a developer platform...",
+  },
+  // ... rest of FAQ items
+];
+
 function FAQ(){
-    const faq=[
-    {
-        category: "GENERAL",
-        ques: "What is CodeLens?",
-        answer: " CodeLens is basically...",
-    },
-    // ... rest of FAQ items
-];
+    const faq = FAQ_DATA;

Option 2: Extract to frontend/src/data/faqData.js:

// frontend/src/data/faqData.js
export const FAQ_DATA = [
  {
    category: "GENERAL",
    ques: "What is CodeLens?",
    answer: "CodeLens is basically a developer platform...",
  },
  // ... rest of FAQ items
];

Then import in FAQ.jsx:

 import {useState} from "react";
+import {FAQ_DATA} from "../data/faqData";

 function FAQ(){
-    const faq=[
-      // ... FAQ items
-    ];
+    const faq = FAQ_DATA;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/src/pages/FAQ.jsx` around lines 5 - 46, The FAQ array named faq in
FAQ.jsx should be extracted out of the component to improve reusability and
testability; create a new module (e.g., frontend/src/data/faqData.js) that
exports the constant (e.g., FAQ_DATA) containing the current objects, or move
the faq constant to the top-level of FAQ.jsx above the component, then replace
the in-file definition with an import or reference to FAQ_DATA and update any
references inside the component accordingly (search for the variable name faq
inside the component to locate usages).

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix leading spaces in answer strings and correct typos.

Several FAQ answers have leading spaces that will display awkwardly, and there are typos in user-facing content:

Leading spaces in lines 9, 14, 19, 24, 29, 34, 39, 44 - remove the space at the start of each answer string.

Typos to fix:

  • Line 38: "constests" → "contests"
  • Line 39: "constest" → "contest"
  • Line 44: "coing" → "coding"
📝 Proposed fixes
     {
         category: "GENERAL",
         ques: "What is CodeLens?",
-        answer: " CodeLens is basically a developer platform. CodeLens aggregates your GitHub, LeetCode, and Codeforces data into a single AI-powered command center that tells you exactly what to learn next.",
+        answer: "CodeLens is basically a developer platform. CodeLens aggregates your GitHub, LeetCode, and Codeforces data into a single AI-powered command center that tells you exactly what to learn next.",
     },
     {
         category: "GENERAL",
         ques: "How does Codelens help developers?",
-        answer: " It helps users track coding progresses, analyze profiles, explore various contests, and improve problem-solving consistency across multiple coding platforms",
+        answer: "It helps users track coding progresses, analyze profiles, explore various contests, and improve problem-solving consistency across multiple coding platforms",
     },
     { 
         category: "GENERAL",
         ques: "What are different platform integrated with CodeLens?",
-        answer: "CodeLens currently supports integrations and tracking with platforms like LeetCode, Codeforces , Codechef, Git and Github",
+        answer: "CodeLens currently supports integrations and tracking with platforms like LeetCode, Codeforces, Codechef, Git and Github",
     },
     {
         category: "TOOLS",
         ques: "Which type of tools are provided?",
-        answer: "CodeLens offers AI-powered developer tools",
+        answer: "CodeLens offers AI-powered developer tools",
     },
     {
         category: "TOOLS",
         ques: "What is Vela AI used for?",
-        answer: "Vela AI helps developers receive intelligent coding guidance, recommendations, and assistance inside the CodeLens platform.",
+        answer: "Vela AI helps developers receive intelligent coding guidance, recommendations, and assistance inside the CodeLens platform.",
     },
     {
         category:"TOOLS",
         ques: "How does Apex AI improve coding preparation?",
-        answer: "Apex AI analyzes user activity and provides insights , recommendations, and learning assistance for competitive programming improvement.",
+        answer: "Apex AI analyzes user activity and provides insights, recommendations, and learning assistance for competitive programming improvement.",
     },
     {
         category: "CONTESTS",
-        ques: "Are upcoming coding constests tracked on CodeLens?",
-        answer: "YES. CodeLens provides constest tracking for multiple competitive programming platform in one centralized interface.",
+        ques: "Are upcoming coding contests tracked on CodeLens?",
+        answer: "YES. CodeLens provides contest tracking for multiple competitive programming platform in one centralized interface.",
     },
     {
         category: "DASHBOARD",
         ques: "What insights are available in the dashboard? ",
-        answer: "The dashboard helps users monitor coing activity, platform statistics and progress across the platforms used in one place.",
+        answer: "The dashboard helps users monitor coding activity, platform statistics and progress across the platforms used in one place.",
     },
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/src/pages/FAQ.jsx` around lines 5 - 46, The faq array contains
answer strings with accidental leading spaces and a few typos; remove any
leading space characters at the start of each answer value in the faq entries
and correct the text mistakes: in the entry with ques "Are upcoming coding
constests tracked on CodeLens?" change "constests" → "contests" and "constest" →
"contest", and in the entry with ques "What insights are available in the
dashboard? " change "coing" → "coding"; update the relevant answer strings in
the faq constant accordingly (locate by the ques values above).

Comment on lines +63 to +74
<button onMouseEnter={() => setSelectedCategory("GENERAL")}>
GENERAL
</button>
<button onMouseEnter={() => setSelectedCategory("TOOLS")}>
TOOLS
</button>
<button onMouseEnter={() => setSelectedCategory("CONTESTS")}>
CONTESTS
</button>
<button onMouseEnter={() => setSelectedCategory("DASHBOARD")}>
DASHBOARD
</button>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Replace onMouseEnter with onClick for category selection.

Using onMouseEnter for category switching creates severe usability and accessibility problems:

  • Accidental hovers change content unexpectedly
  • No keyboard navigation support (violates WCAG 2.1.1)
  • Touch devices cannot hover
  • Users cannot see category content before committing to selection
♿ Proposed accessibility fix
-                <button onMouseEnter={() => setSelectedCategory("GENERAL")}>
+                <button onClick={() => setSelectedCategory("GENERAL")}>
                     GENERAL
                 </button>
-                <button onMouseEnter={() => setSelectedCategory("TOOLS")}>
+                <button onClick={() => setSelectedCategory("TOOLS")}>
                     TOOLS
                 </button>
-                <button onMouseEnter={() => setSelectedCategory("CONTESTS")}>
+                <button onClick={() => setSelectedCategory("CONTESTS")}>
                     CONTESTS
                 </button>
-                <button onMouseEnter={() => setSelectedCategory("DASHBOARD")}>
+                <button onClick={() => setSelectedCategory("DASHBOARD")}>
                     DASHBOARD
                 </button>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<button onMouseEnter={() => setSelectedCategory("GENERAL")}>
GENERAL
</button>
<button onMouseEnter={() => setSelectedCategory("TOOLS")}>
TOOLS
</button>
<button onMouseEnter={() => setSelectedCategory("CONTESTS")}>
CONTESTS
</button>
<button onMouseEnter={() => setSelectedCategory("DASHBOARD")}>
DASHBOARD
</button>
<button onClick={() => setSelectedCategory("GENERAL")}>
GENERAL
</button>
<button onClick={() => setSelectedCategory("TOOLS")}>
TOOLS
</button>
<button onClick={() => setSelectedCategory("CONTESTS")}>
CONTESTS
</button>
<button onClick={() => setSelectedCategory("DASHBOARD")}>
DASHBOARD
</button>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/src/pages/FAQ.jsx` around lines 63 - 74, The category buttons
currently use onMouseEnter which causes accessibility/usability issues; replace
the onMouseEnter handlers with onClick handlers on the same button elements so
setSelectedCategory("GENERAL"/"TOOLS"/"CONTESTS"/"DASHBOARD") is called on
click, and ensure the existing button elements retain keyboard focusability and
visible focus styles (no additional role changes required because they are
native <button> elements).

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Add styling to category buttons.

The category buttons have no className attributes, so they will render as unstyled, making the interface appear broken and buttons unrecognizable.

🎨 Proposed styling fix
         <div
             className="flex gap-4 mt-10">
-                <button onMouseEnter={() => setSelectedCategory("GENERAL")}>
+                <button 
+                    onMouseEnter={() => setSelectedCategory("GENERAL")}
+                    className={`px-6 py-2 rounded-lg font-semibold transition-colors ${
+                        selectedCategory === "GENERAL" 
+                            ? "bg-blue-600 text-white" 
+                            : "bg-gray-200 text-gray-700 hover:bg-gray-300"
+                    }`}
+                >
                     GENERAL
                 </button>
-                <button onMouseEnter={() => setSelectedCategory("TOOLS")}>
+                <button 
+                    onMouseEnter={() => setSelectedCategory("TOOLS")}
+                    className={`px-6 py-2 rounded-lg font-semibold transition-colors ${
+                        selectedCategory === "TOOLS" 
+                            ? "bg-blue-600 text-white" 
+                            : "bg-gray-200 text-gray-700 hover:bg-gray-300"
+                    }`}
+                >
                     TOOLS
                 </button>
-                <button onMouseEnter={() => setSelectedCategory("CONTESTS")}>
+                <button 
+                    onMouseEnter={() => setSelectedCategory("CONTESTS")}
+                    className={`px-6 py-2 rounded-lg font-semibold transition-colors ${
+                        selectedCategory === "CONTESTS" 
+                            ? "bg-blue-600 text-white" 
+                            : "bg-gray-200 text-gray-700 hover:bg-gray-300"
+                    }`}
+                >
                     CONTESTS
                 </button>
-                <button onMouseEnter={() => setSelectedCategory("DASHBOARD")}>
+                <button 
+                    onMouseEnter={() => setSelectedCategory("DASHBOARD")}
+                    className={`px-6 py-2 rounded-lg font-semibold transition-colors ${
+                        selectedCategory === "DASHBOARD" 
+                            ? "bg-blue-600 text-white" 
+                            : "bg-gray-200 text-gray-700 hover:bg-gray-300"
+                    }`}
+                >
                     DASHBOARD
                 </button>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/src/pages/FAQ.jsx` around lines 63 - 74, The category buttons
currently render unstyled; add className attributes and active-state classes so
they get CSS styling and show selection. For each button that calls
setSelectedCategory (e.g., the buttons for "GENERAL", "TOOLS", "CONTESTS",
"DASHBOARD"), add a base class like "faq-category-button" and conditionally add
an "active" or "selected" class when selectedCategory === "GENERAL"/"TOOLS"/...;
ensure styles exist in the corresponding CSS/SCSS (or module) to handle base,
:hover, and .active states and consider also adding an onClick handler and
aria-pressed attribute tied to selectedCategory for keyboard/accessibility.

@kunalverma2512
Copy link
Copy Markdown
Owner

@coderabbitai review this entire PR thoroughly and point out every area that can be improved, optimized, or made more logically consistent so the overall implementation becomes cleaner, stronger, and production-ready for the project.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
echo "=== frontend/src/App.jsx ==="
cat frontend/src/App.jsx

echo ""
echo "=== frontend/src/pages/FAQ.jsx ==="
cat frontend/src/pages/FAQ.jsx

echo ""
echo "=== Directory structure of pages ==="
fd . frontend/src/pages --type f

echo ""
echo "=== Check for existing routing patterns ==="
rg "Route" frontend/src/App.jsx -n

echo ""
echo "=== Check for existing page components for style reference ==="
fd . frontend/src/pages --type f -e jsx | head -5 | xargs -I{} sh -c 'echo "=== {} ===" && head -30 {}'

Length of output: 17244


@kunalverma2512 Here is a thorough review of PR #77 covering every area that needs improvement before this is production-ready:


frontend/src/App.jsx

1. 🔴 Unused Import — Dead Code

FAQSection is imported but never used anywhere in App.jsx. This should be removed immediately.

// REMOVE this line — it's unused:
import FAQSection from "./components/explore/FAQSection";

2. 🟡 Inconsistent Route Formatting & Placement

The /faq route has inconsistent indentation (extra leading space) and is placed between auth routes and public routes with no logical grouping. It should be formatted consistently and placed next to /terms and /privacy (which are the other informational public pages).

// Current (broken indentation):
<Route
   path="/faq" element={<FAQ />} />

// Should be:
<Route path="/faq" element={<FAQ />} />

3. 🟡 File Naming Convention

Every other page file follows the <Name>Page.jsx convention (TermsPage.jsx, PrivacyPage.jsx, NotFoundPage.jsx, etc.). This file is named FAQ.jsx — it should be renamed to FAQPage.jsx for consistency, and the import and route updated accordingly.


frontend/src/pages/FAQ.jsx

4. 🔴 Functional Bug — openQuestion Not Reset on Category Change

openQuestion stores the index within the filtered array. When the user switches categories, the new filtered array gets its own indices (0, 1, 2…). If openQuestion was 1 in GENERAL, switching to TOOLS will immediately show TOOLS item at index 1 as expanded — without the user clicking it. Fix: reset openQuestion whenever the category changes.

// Instead of just:
onMouseEnter={() => setSelectedCategory("GENERAL")}

// Do:
onMouseEnter={() => { setSelectedCategory("GENERAL"); setOpenQuestion(null); }}

5. 🔴 onMouseEnter Used for Category Selection — Wrong Event

Using onMouseEnter to switch categories means the category changes on hover, which is highly unexpected behaviour. A user casually moving their mouse across the buttons will cause the FAQ list to flicker between categories. This should be onClick.

// Wrong:
<button onMouseEnter={() => setSelectedCategory("GENERAL")}>

// Correct:
<button onClick={() => { setSelectedCategory("GENERAL"); setOpenQuestion(null); }}>

6. 🔴 FAQ Data Defined Inside the Component — Performance Issue

The faq array is declared inside the FAQ() function body. This means it is re-created as a brand new array on every single render. Move it outside the component.

// Move this outside the function:
const FAQ_DATA = [
  { category: "GENERAL", ques: "What is CodeLens?", answer: "..." },
  // ...
];

function FAQ() {
  // Now FAQ_DATA is a stable reference
  const filtered = FAQ_DATA.filter(item => item.category === selectedCategory);
  // ...
}

7. 🟡 index Used as key — Anti-Pattern

Using .map((item, index) => <div key={index}>...) is an anti-pattern when the list is filtered (the index changes between renders/categories). Use a stable unique key derived from the question itself.

// Instead of key={index}, use:
key={`${item.category}-${item.ques}`}

8. 🟡 No Visual Feedback for Active Category Button

All four category buttons look identical at all times — there is no way for the user to know which category is currently selected. Add a conditional style for the active category.

<button
  onClick={() => { setSelectedCategory("GENERAL"); setOpenQuestion(null); }}
  className={`px-4 py-2 rounded font-semibold border transition-all ${
    selectedCategory === "GENERAL"
      ? "bg-black text-white"
      : "bg-white text-black hover:bg-gray-100"
  }`}
>
  GENERAL
</button>

9. 🟡 Multiple Content Typos

These will look unprofessional on a production page:

Location Typo Correction
CONTESTS question "constests" "contests"
CONTESTS answer "constest tracking" "contest tracking"
DASHBOARD answer "coing activity" "coding activity"
GENERAL answer "coding progresses" "coding progress"

10. 🟡 Accessibility Issues

  • Category <button> elements have no aria-pressed or aria-selected attributes to communicate state to screen readers.
  • The FAQ accordion <div> elements act as interactive controls but are not <button> elements — this breaks keyboard navigation (no Tab focus, no Enter/Space activation). Wrap each FAQ item in a <button> or add role="button" with tabIndex={0} and an onKeyDown handler.
// FAQ item should be a button or at minimum:
<div
  role="button"
  tabIndex={0}
  onKeyDown={(e) => e.key === "Enter" && setOpenQuestion(openQuestion === index ? null : index)}
  onClick={...}
  ...
>

11. 🟡 Missing Dark Mode Support

The component uses hardcoded text-gray-500 and text-gray-600 with no dark: variants, while the rest of the project (e.g., CodeforcesPage.jsx, AccountCenterPage.jsx) consistently uses Tailwind dark mode classes. Add dark:text-gray-400, dark:border-gray-700, dark:bg-gray-800 equivalents to match the app's design system.

12. 🟢 Component Declaration Style Inconsistency

All other page components use export default function ComponentName() directly. FAQ.jsx uses a function FAQ() declaration followed by a separate export default FAQ. Prefer the direct export style for consistency:

// Other pages use:
export default function FAQPage() { ... }

Summary Table

# Severity File Issue
1 🔴 Bug FAQ.jsx openQuestion not reset on category switch
2 🔴 UX Bug FAQ.jsx onMouseEnter used instead of onClick for category selection
3 🔴 Perf FAQ.jsx faq array redefined on every render
4 🔴 Dead code App.jsx Unused FAQSection import
5 🟡 FAQ.jsx index used as key in filtered list
6 🟡 FAQ.jsx No active state indicator on category buttons
7 🟡 FAQ.jsx 4 content typos
8 🟡 FAQ.jsx Accessibility: no keyboard navigation, no ARIA attributes
9 🟡 FAQ.jsx No dark mode Tailwind variants
10 🟡 App.jsx Inconsistent route indentation and placement
11 🟢 Both File naming (FAQ.jsxFAQPage.jsx) and export style inconsistency

The 🔴 issues (especially items 1 & 2) need to be fixed before merge as they cause incorrect functional behaviour. The rest are important for code quality and production readiness.

@kunalverma2512
Copy link
Copy Markdown
Owner

@dikshajha13
firstly make your PR description well and good - currently it doesnt have which issue it solves by tagging that link
also its not showing nicely about what work done in this PR

See what coderabbitai suggestion and do reasoning about what is said and make sure to come up with PR having everything resolved

Stick screenshot of the page and stick video (via drive link) showcasing your work

Looking for your contributions
Go ahead

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