Skip to content

feat(ui): enhance UX with smooth fade-up animations using Framer Motion#378

Open
Abhishek2005-ard wants to merge 10 commits into
AOSSIE-Org:mainfrom
Abhishek2005-ard:feature/ui-animation-enhancement
Open

feat(ui): enhance UX with smooth fade-up animations using Framer Motion#378
Abhishek2005-ard wants to merge 10 commits into
AOSSIE-Org:mainfrom
Abhishek2005-ard:feature/ui-animation-enhancement

Conversation

@Abhishek2005-ard

@Abhishek2005-ard Abhishek2005-ard commented Mar 29, 2026

Copy link
Copy Markdown
Contributor

Overview
This PR introduces smooth and modern UI animations across key components using Framer Motion. The goal is to improve user experience by adding subtle, non-intrusive entrance transitions.

Key Changes
Added reusable animation utilities:
MotionContainer for managing animation flow
MotionItem for animating individual elements
Implemented fade-up (slide + opacity) animation for UI elements
Improved page transition experience with smoother motion

Animation Details
Elements animate with:
Slight upward movement (y: 20 → 0)
Opacity transition (0 → 1)
Custom easing for a natural feel
Designed to be subtle and professional (no aggressive motion)

Files Updated
components/animations/FallAnimation.tsx
App.tsx (global animation wrapper)

Impact
Enhances visual hierarchy and readability
Provides a modern, SaaS-like UI experience
Improves perceived performance and smoothness

Future Improvements
Extend animations to:
Chat messages (DebateRoom)
Leaderboard and feeds
Add micro-interactions (hover, click feedback)
Introduce scroll-based animations

Checklist
Code follows project structure
No breaking changes
Tested on key pages

Summary by CodeRabbit

  • New Features

    • Added an animation library and reusable entrance/page-transition animations.
    • New "Support DebateAI" page and a short public redirect route.
  • UI/Style

    • Authentication page refreshed with purple-to-blue gradient, updated logo text, and hover/transition effects.
    • Profile dialog layout adjusted; conversation area scrolling/bounds behavior changed.
  • Behavior

    • Home actions now show temporary loading state and disable buttons during navigation.

@coderabbitai

coderabbitai Bot commented Mar 29, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Adds Framer Motion dependency and new motion components, applies route-aware rendering and animated route transitions, changes App routing (adds /n redirect, moves support-debateai), introduces async loading state/delays in Home handlers (buttons disabled while loading), enhances Authentication visuals, and adjusts Profile dialog scrolling/layout. Changes are frontend-only.

Changes

Cohort / File(s) Summary
Dependency
frontend/package.json
Added framer-motion ^12.38.0 and normalized JSON formatting.
Animation components
frontend/src/components/animations/FallAnimation.tsx
New exports MotionContainer and MotionItem implementing entry animations via Framer Motion.
Routing / App
frontend/src/App.tsx
Switched to useLocation() + <Routes location={location}>; reorganized public/protected routes, added short redirect "/n" → "/startDebate", removed SupportOpenSource import, and added "/support-debateai" as a non-layout route rendering SupportDebateAI.
Layout transitions
frontend/src/components/Layout.tsx
Wrapped Outlet in a keyed motion.div keyed by location.pathname; uses useReducedMotion() to disable animations when requested.
Home interactions
frontend/src/Pages/Home.tsx
Added loading state, async handlers with 800ms delay before navigation, buttons disabled while loading. Note: logoutHandler function was removed but still referenced in JSX.
Auth UI updates
frontend/src/Pages/Authentication.tsx
Left section restyled to purple→blue gradient with backdrop blur; replaced SVG placeholder with Arguehub text link; added image/quote hover/transition effects and removed empty SVG.
Profile layout
frontend/src/Pages/Profile.tsx
Formatting/string normalization; increased Debate Details dialog max-height to 90vh and switched to flex layout; removed bounded wrapper around full conversation (affects scrolling behaviour).
New Support page
frontend/src/Pages/SupportDebateAI.tsx
Added new SupportDebateAI page component (default export).

Sequence Diagram(s)

sequenceDiagram
    participant User as "User"
    participant Home as "Home Page"
    participant Auth as "Auth Context"
    participant Router as "App Router"
    participant LayoutMotion as "Layout (motion.div)"

    User->>Home: Click "Play Online" / "Practice with Bot"
    Home->>Home: set loading ("online"|"bot"), await 800ms
    Home->>Auth: check isAuthenticated
    alt authenticated
        Home->>Router: navigate to /game or /bot-selection
    else not authenticated
        Home->>Router: navigate to /auth
    end
    Router->>LayoutMotion: render route (Routes with location prop)
    LayoutMotion->>Router: animate mount (keyed by pathname)
    Router->>User: final page rendered
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐇
I hop through routes with gentle motion,
gradients shimmer like a soft devotion,
buttons pause, then off we dart,
dialogs grow tall and pages start,
I nibble code and prance—what a commotion! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title directly and accurately describes the primary change: adding smooth fade-up animations using Framer Motion to enhance UX, which is the core focus evident from the new FallAnimation.tsx component and Layout animation wrapper.

✏️ 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
frontend/src/Pages/Profile.tsx (2)

638-677: ⚠️ Potential issue | 🟠 Major

Don’t collapse connection load failures into empty states.

response.ok === false and thrown fetch errors both fall through to the "No followers yet" / "Not following anyone yet" UI once loading ends. That shows incorrect data when the request failed. Please track a per-list error state and reserve the empty copy for successful loads.

Also applies to: 692-757

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/src/Pages/Profile.tsx` around lines 638 - 677, fetchFollowers and
fetchFollowing currently treat non-ok responses and network errors the same as
an empty result; create per-list error state variables (e.g., followersError,
followingError via useState) and update them: clear the corresponding error at
start of each fetch, set the error when response.ok is false (include
response.status/text) or in the catch block, and only setFollowers/setFollowing
when the response was successful. Keep setLoadingFollowers/setLoadingFollowing
in finally but do not clear errors there; ensure the UI uses
followersError/followingError to show an error message distinct from the
empty-state copy.

623-636: ⚠️ Potential issue | 🟠 Major

Hoist FollowersFollowingSection out of Profile.

This component is declared inside Profile, which has 13+ state variables. Every Profile state change (editingField, avatar modal, debate selection, transcript loading, etc.) triggers a rerender. On each rerender, React creates a new FollowersFollowingSection function reference and treats it as a new component type, causing unmounting, state reset, and retriggering of the useEffect that fetches followers/following data unnecessarily.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/src/Pages/Profile.tsx` around lines 623 - 636, Move the
FollowersFollowingSection component out of the Profile component to the
module/top-level scope so it is not recreated on every Profile render; update
FollowersFollowingSection to accept the minimal props it needs (e.g., userId or
user from useUser, and optionally baseURL) and reference those props instead of
closed-over Profile state, keep its internal hooks fetchFollowers and
fetchFollowing as-is but use the passed-in userId in the useEffect dependency
array, and update the Profile JSX to render <FollowersFollowingSection
userId={user?.id} /> (or pass user) so the component remains stable across
Profile re-renders.
🧹 Nitpick comments (1)
frontend/src/Pages/Authentication.tsx (1)

32-33: Respect reduced-motion preferences for hover transforms.

The blockquote on lines 32-33 applies a hover:translate-y-[-5px] transform without respecting user motion preferences. This project uses Tailwind CSS 3.4.13, which supports built-in motion-safe and motion-reduce variants. Wrap transform and transition utilities with motion-safe: to ensure users with reduced-motion preferences are not affected by the animation:

Suggested fix
    <blockquote className="space-y-2 
-    hover:translate-y-[-5px] transition-all duration-300">
+    motion-safe:hover:-translate-y-1 motion-safe:transition-all motion-safe:duration-300">
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/src/Pages/Authentication.tsx` around lines 32 - 33, The blockquote
element in Authentication.tsx applies a hover translation and transition that
ignores reduced-motion preferences; update the blockquote's Tailwind utilities
(the className on the blockquote element) to wrap the transform and transition
utilities with the motion-safe variant (e.g., change hover:translate-y-[-5px]
and transition-all duration-300 so they only apply under motion-safe) so users
with motion-reduce settings won't see the animation.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@frontend/src/App.tsx`:
- Around line 71-126: Header.tsx contains a nav item and breadcrumb mapping for
the route key "n" but the Routes tree no longer defines a matching Route for
"/n", causing the fallback Navigate to "/" to trigger; fix by either adding a
route alias (e.g., add a <Route path="/n" element={<DesiredComponent/>} />
within the appropriate <Routes> block or inside the <Route
element={<ProtectedRoute />}> if it should be protected) or update Header.tsx to
point the nav and breadcrumb mapping to an existing path (e.g., "startDebate" or
whatever new route you intend) so the nav key "n" is removed/renamed
consistently; ensure you update the breadcrumb mapping name in Header.tsx to
match the chosen route and keep usage of ProtectedRoute, Layout, and relevant
component names consistent.

In `@frontend/src/Pages/Authentication.tsx`:
- Around line 14-18: The interactive affordance (cursor-pointer and
hover:scale-105 transition-transform duration-300) is applied to the outer div
but the actual actionable element is the Link element; move those classes from
the wrapper div to the Link component so the hit-area and hover effects match
the real clickable target (update the div className to only non-interactive
layout classes and add cursor-pointer and hover/transition classes to the Link
element that currently renders "Arguehub").

In `@frontend/src/Pages/Home.tsx`:
- Around line 23-49: The click handlers handlePlayDebateClick and
handlePlayBotClick currently allow re-entry during the 800ms delay, causing
concurrent/contradictory navigations; add a guard at the top of each handler
that immediately returns if loading is already set (e.g., if (loading) return),
and ensure the UI disables the corresponding buttons when loading is non-null so
users cannot click while a transition is in progress; keep existing
setLoading(...) and setLoading(null) logic but prevent re-entry and disable the
buttons in the component JSX.

In `@frontend/src/Pages/Profile.tsx`:
- Line 1336: The dialog lost vertical spacing when removing the spacing
utilities; restore layout by adding back the spacing classes while keeping the
single-scroll container. Specifically, on the dialog body div that currently has
className "flex-1 overflow-y-auto p-4" reintroduce "space-y-4" (e.g., "flex-1
overflow-y-auto p-4 space-y-4"), and on the transcript list container (the
element that wraps the message bubbles / transcript entries) reintroduce
"space-y-3" so sections, separators, and message bubbles regain their spacing
while the parent remains the single scrollable area.

---

Outside diff comments:
In `@frontend/src/Pages/Profile.tsx`:
- Around line 638-677: fetchFollowers and fetchFollowing currently treat non-ok
responses and network errors the same as an empty result; create per-list error
state variables (e.g., followersError, followingError via useState) and update
them: clear the corresponding error at start of each fetch, set the error when
response.ok is false (include response.status/text) or in the catch block, and
only setFollowers/setFollowing when the response was successful. Keep
setLoadingFollowers/setLoadingFollowing in finally but do not clear errors
there; ensure the UI uses followersError/followingError to show an error message
distinct from the empty-state copy.
- Around line 623-636: Move the FollowersFollowingSection component out of the
Profile component to the module/top-level scope so it is not recreated on every
Profile render; update FollowersFollowingSection to accept the minimal props it
needs (e.g., userId or user from useUser, and optionally baseURL) and reference
those props instead of closed-over Profile state, keep its internal hooks
fetchFollowers and fetchFollowing as-is but use the passed-in userId in the
useEffect dependency array, and update the Profile JSX to render
<FollowersFollowingSection userId={user?.id} /> (or pass user) so the component
remains stable across Profile re-renders.

---

Nitpick comments:
In `@frontend/src/Pages/Authentication.tsx`:
- Around line 32-33: The blockquote element in Authentication.tsx applies a
hover translation and transition that ignores reduced-motion preferences; update
the blockquote's Tailwind utilities (the className on the blockquote element) to
wrap the transform and transition utilities with the motion-safe variant (e.g.,
change hover:translate-y-[-5px] and transition-all duration-300 so they only
apply under motion-safe) so users with motion-reduce settings won't see the
animation.
🪄 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: 331dc246-a948-4f42-8ed6-cde8449ba4d4

📥 Commits

Reviewing files that changed from the base of the PR and between 09ef1bb and 6b53fb1.

⛔ Files ignored due to path filters (1)
  • frontend/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (6)
  • frontend/package.json
  • frontend/src/App.tsx
  • frontend/src/Pages/Authentication.tsx
  • frontend/src/Pages/Home.tsx
  • frontend/src/Pages/Profile.tsx
  • frontend/src/components/animations/FallAnimation.tsx

Comment thread frontend/src/App.tsx
Comment thread frontend/src/Pages/Authentication.tsx
Comment thread frontend/src/Pages/Home.tsx
Comment thread frontend/src/Pages/Profile.tsx

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
frontend/src/App.tsx (1)

88-91: ⚠️ Potential issue | 🟠 Major

/support-debateai is still a live nav target but no longer a route.

frontend/src/components/Header.tsx:334-340 still renders a NavItem to /support-debateai. With that path gone from this public route block, the click now falls through the wildcard redirect and silently lands on /. Please add a compatibility route/redirect here or update the header in the same PR.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/src/App.tsx` around lines 88 - 91, Header still renders a NavItem
linking to "/support-debateai" but App.tsx no longer defines that route, causing
clicks to fall through to the wildcard redirect; either add a compatibility
Route under the public Route element (the Route element wrapping <Layout />)
that redirects "/support-debateai" to the new target (or to "/") or update the
Header component to remove/replace the NavItem; locate Route and Layout in
App.tsx and the NavItem in Header.tsx (around the NavItem that links to
"/support-debateai") and implement one of those fixes so the link no longer
lands on the wildcard redirect.
🧹 Nitpick comments (1)
frontend/src/App.tsx (1)

62-69: Let one top-level wrapper own the initial fade.

MotionContainer already fades in frontend/src/components/animations/FallAnimation.tsx:31-39, so stacking it with the new route-level motion.div gives the first render two independent opacity animations. I'd keep the app-level fade in one place so the motion stays as subtle as intended.

Also applies to: 137-139

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/src/App.tsx` around lines 62 - 69, The route-level motion wrapper
(the motion.div keyed by location.pathname) duplicates the app-level fade
handled by MotionContainer / FallAnimation, causing two overlapping opacity
animations; remove the opacity animation from the route-level wrapper so the
top-level fade remains owned by MotionContainer/FallAnimation—i.e., in App.tsx
keep the motion.div keyed by location.pathname for route transitions but drop
initial/animate opacity properties (you can keep the y translate animation if
needed) and apply the same change to the other route-level motion.div at the
later occurrence (lines referenced 137-139).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@frontend/src/App.tsx`:
- Around line 63-71: Remove the key={location.pathname} from the <Routes>
wrapper so the router tree (and Layout/Header state such as isDrawerOpen,
notifications, unreadCount, isNotificationsOpen and its polling effects) isn't
remounted on every navigation; instead move the page-entry animation down into
the routed content—either wrap each route's page component or the Layout's
<Outlet/> with the motion animation (or use AnimatePresence with location.key)
so animations run per-page without re-creating the entire <Routes>/Header tree.

---

Duplicate comments:
In `@frontend/src/App.tsx`:
- Around line 88-91: Header still renders a NavItem linking to
"/support-debateai" but App.tsx no longer defines that route, causing clicks to
fall through to the wildcard redirect; either add a compatibility Route under
the public Route element (the Route element wrapping <Layout />) that redirects
"/support-debateai" to the new target (or to "/") or update the Header component
to remove/replace the NavItem; locate Route and Layout in App.tsx and the
NavItem in Header.tsx (around the NavItem that links to "/support-debateai") and
implement one of those fixes so the link no longer lands on the wildcard
redirect.

---

Nitpick comments:
In `@frontend/src/App.tsx`:
- Around line 62-69: The route-level motion wrapper (the motion.div keyed by
location.pathname) duplicates the app-level fade handled by MotionContainer /
FallAnimation, causing two overlapping opacity animations; remove the opacity
animation from the route-level wrapper so the top-level fade remains owned by
MotionContainer/FallAnimation—i.e., in App.tsx keep the motion.div keyed by
location.pathname for route transitions but drop initial/animate opacity
properties (you can keep the y translate animation if needed) and apply the same
change to the other route-level motion.div at the later occurrence (lines
referenced 137-139).
🪄 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: da09b839-fd82-44a0-9e72-1ffa8374cb23

📥 Commits

Reviewing files that changed from the base of the PR and between 6b53fb1 and d05a104.

📒 Files selected for processing (1)
  • frontend/src/App.tsx

Comment thread frontend/src/App.tsx Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@frontend/src/App.tsx`:
- Around line 60-115: The Header contains a nav link and breadcrumb handling for
"/support-debateai" but App.tsx lacks that route; add a Route for
"/support-debateai" (e.g., <Route path="/support-debateai"
element={<SupportDebateAI />} />) in the appropriate Routes block (public or
inside the <Route element={<Layout />}> group if it should use the site layout)
so the link resolves, or alternatively remove the Header/nav/breadcrumb
references to SupportDebateAI; locate the Header component and the missing
SupportDebateAI component reference and either add the Route in App.tsx or
delete the Header references to keep routing consistent.

In `@frontend/src/components/Layout.tsx`:
- Around line 17-27: The route transition always animates; respect user
reduced-motion preferences by importing framer-motion's useReducedMotion and
checking const prefersReducedMotion = useReducedMotion() in the Layout
component, then conditionally set motion.div props (e.g., if
prefersReducedMotion use initial={{opacity:1, y:0}} and animate={{opacity:1,
y:0}} or set transition={{duration:0}}) instead of the current animated values
tied to location.pathname; update the motion.div usage (the element keyed by
location.pathname that renders <Outlet />) so animations are disabled/simplified
when prefersReducedMotion is true.

In `@frontend/src/Pages/Home.tsx`:
- Around line 12-13: The delayed CTA flow can call setLoading after Home
unmounts; modify the component so handlePlayDebateClick and handlePlayBotClick
cancel or guard their pending delay: either add a mounted ref (e.g.,
isMountedRef) set to true on mount and false in a useEffect cleanup or use an
AbortController/flag to cancel the delay returned by delay(ms), then check the
flag before calling setLoading(null) (and perform setLoading(null) inside a
finally block) to ensure no state updates run after unmount and to clear any
pending timers/delays.
🪄 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: 61754a6f-a752-4ba5-85c5-2ea1a556bcae

📥 Commits

Reviewing files that changed from the base of the PR and between d05a104 and 8fde36c.

📒 Files selected for processing (3)
  • frontend/src/App.tsx
  • frontend/src/Pages/Home.tsx
  • frontend/src/components/Layout.tsx

Comment thread frontend/src/App.tsx
Comment thread frontend/src/components/Layout.tsx
Comment thread frontend/src/Pages/Home.tsx
… memory leaks

- Added missing /support-debateai route to prevent broken navigation
- Cleaned up duplicate and inconsistent route definitions in App.tsx
- Improved route transition accessibility using useReducedMotion from framer-motion
- Fixed async memory leak in Home component by preventing state updates after unmount
- Added proper cleanup logic using useRef and useEffect

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
frontend/src/Pages/Home.tsx (1)

94-94: ⚠️ Potential issue | 🔴 Critical

logoutHandler is undefined — this will crash at runtime.

The JSX references logoutHandler but it's never defined in this component. When an authenticated user views the Home page, React will throw a ReferenceError. The logout method is available from AuthContext (see frontend/src/context/authContext.tsx lines 23 and 350).

🐛 Proposed fix

Add the handler definition after loginHandler:

   const loginHandler = () => {
     navigate('/auth', { state: { isSignUp: false } });
   };
 
+  const logoutHandler = () => {
+    authContext?.logout();
+  };
+
   const handlePlayDebateClick = async () => {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/src/Pages/Home.tsx` at line 94, The Home component references an
undefined logoutHandler; define it (near the existing loginHandler) to call the
logout method from AuthContext and handle any post-logout navigation/state
cleanup. Specifically, use the same AuthContext value already used in this
component (the logout function from AuthContext), create a logoutHandler
function that calls logout() (and optionally redirects or clears local state),
and wire that function to the Button's onClick; place it adjacent to
loginHandler so it's easy to find.
🧹 Nitpick comments (3)
frontend/src/Pages/Home.tsx (1)

1-1: Minor: Consolidate React imports.

The React hooks are split across two import statements. Consider combining for cleaner imports.

✨ Suggested consolidation
-import React, { useContext, useState } from "react";
+import React, { useContext, useState, useRef, useEffect } from "react";
 import { Button } from "@/components/ui/button";
 import { useNavigate } from "react-router-dom";
 import { AuthContext } from "@/context/authContext";
 import DebateCover from "../assets/DebateCover4.svg";
 import { RiRobot2Fill } from "react-icons/ri";
 import { FaHandshakeSimpleSlash } from "react-icons/fa6";
 import AOSSIELogo from "@/assets/aossie.png";
-import {useRef, useEffect } from "react";

Also applies to: 9-9

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/src/Pages/Home.tsx` at line 1, The React import is split;
consolidate the default and named hook imports into a single statement so React,
useContext and useState are imported together (replace separate import lines
with one import that includes React and the named hooks, e.g., useContext and
useState). Update the import that currently references React and the separate
import on line 9 so all usages of React, useContext, and useState come from the
single combined import.
frontend/src/App.tsx (2)

32-35: Minor: Consolidate react-router-dom imports.

useLocation is imported separately from the other react-router-dom imports on line 2.

✨ Suggested consolidation
-import { Routes, Route, Navigate, Outlet } from 'react-router-dom';
+import { Routes, Route, Navigate, Outlet, useLocation } from 'react-router-dom';
 ...
-//framer motion
-import { useLocation } from "react-router-dom";
+
 import SupportDebateAI from './Pages/SupportDebateAI';
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/src/App.tsx` around lines 32 - 35, Consolidate duplicate
react-router-dom imports by combining useLocation with the existing
react-router-dom import into a single statement: replace the separate import of
useLocation with adding useLocation to the named imports already importing from
"react-router-dom" (so only one import from "react-router-dom" remains), and
remove the redundant import line; target the import that currently brings in
other router symbols and add useLocation to it.

87-105: Inconsistent path notation: mix of relative and absolute paths.

Within the same nested <Route path="/" element={<Layout />}>, some child routes use relative paths (e.g., startDebate, leaderboard) while others use absolute paths (e.g., /tournaments, /coach). This works in React Router v6 but creates inconsistency that may confuse future maintainers.

✨ Suggested: Use consistent relative paths
             <Route path="bot-selection" element={<BotSelection />} />
-            <Route path="/tournaments" element={<TournamentHub />} />
-            <Route path="/coach" element={<CoachPage />} />
+            <Route path="tournaments" element={<TournamentHub />} />
+            <Route path="coach" element={<CoachPage />} />
             <Route
-              path="/tournament/:id/bracket"
+              path="tournament/:id/bracket"
               element={<TournamentDetails />}
             />
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/src/App.tsx` around lines 87 - 105, Child routes under the Layout
Route are inconsistently declared with a mix of relative and absolute paths;
change the absolute child paths to relative by removing leading slashes so all
children are nested consistently. Specifically update the Route path strings
that start with "/" (the ones rendering TournamentHub, CoachPage, and
TournamentDetails) to use relative paths (e.g., "tournaments", "coach",
"tournament/:id/bracket") so they match the other children like "startDebate"
and "leaderboard" and remain nested under the Layout element.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@frontend/src/App.tsx`:
- Line 117: The /support-debateai Route is currently defined outside the public
Layout and thus renders without the app Header; move the Route element for
SupportDebateAI so it is a child of the existing <Route element={<Layout />}>
group (alongside other public routes like the About route) so the
SupportDebateAI component is rendered within Layout and shows the
Header/navigation consistently.

---

Outside diff comments:
In `@frontend/src/Pages/Home.tsx`:
- Line 94: The Home component references an undefined logoutHandler; define it
(near the existing loginHandler) to call the logout method from AuthContext and
handle any post-logout navigation/state cleanup. Specifically, use the same
AuthContext value already used in this component (the logout function from
AuthContext), create a logoutHandler function that calls logout() (and
optionally redirects or clears local state), and wire that function to the
Button's onClick; place it adjacent to loginHandler so it's easy to find.

---

Nitpick comments:
In `@frontend/src/App.tsx`:
- Around line 32-35: Consolidate duplicate react-router-dom imports by combining
useLocation with the existing react-router-dom import into a single statement:
replace the separate import of useLocation with adding useLocation to the named
imports already importing from "react-router-dom" (so only one import from
"react-router-dom" remains), and remove the redundant import line; target the
import that currently brings in other router symbols and add useLocation to it.
- Around line 87-105: Child routes under the Layout Route are inconsistently
declared with a mix of relative and absolute paths; change the absolute child
paths to relative by removing leading slashes so all children are nested
consistently. Specifically update the Route path strings that start with "/"
(the ones rendering TournamentHub, CoachPage, and TournamentDetails) to use
relative paths (e.g., "tournaments", "coach", "tournament/:id/bracket") so they
match the other children like "startDebate" and "leaderboard" and remain nested
under the Layout element.

In `@frontend/src/Pages/Home.tsx`:
- Line 1: The React import is split; consolidate the default and named hook
imports into a single statement so React, useContext and useState are imported
together (replace separate import lines with one import that includes React and
the named hooks, e.g., useContext and useState). Update the import that
currently references React and the separate import on line 9 so all usages of
React, useContext, and useState come from the single combined import.
🪄 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: 07d76a8d-a63d-4881-b251-b9fa2bb7f7b7

📥 Commits

Reviewing files that changed from the base of the PR and between 8fde36c and 2b0d318.

📒 Files selected for processing (4)
  • frontend/src/App.tsx
  • frontend/src/Pages/Home.tsx
  • frontend/src/Pages/SupportDebateAI.tsx
  • frontend/src/components/Layout.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/src/components/Layout.tsx

Comment thread frontend/src/App.tsx
</Route>

{/* Fallback */}
<Route path="/support-debateai" element={<SupportDebateAI />} />

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 | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check how /support-debateai is referenced in Header to understand expected behavior
rg -n "support-debateai" frontend/src/components/Header.tsx -A2 -B2

Repository: AOSSIE-Org/DebateAI

Length of output: 902


🏁 Script executed:

# First, let's see the routing structure in App.tsx around line 117
sed -n '100,135p' frontend/src/App.tsx

Repository: AOSSIE-Org/DebateAI

Length of output: 1193


🏁 Script executed:

# Check if SupportDebateAI component exists and examine it
find frontend/src -name "*Support*" -o -name "*support*" | head -20

Repository: AOSSIE-Org/DebateAI

Length of output: 101


🏁 Script executed:

# Also check the full routing context to understand Layout nesting
sed -n '1,150p' frontend/src/App.tsx | head -80

Repository: AOSSIE-Org/DebateAI

Length of output: 2928


🏁 Script executed:

# Let's examine the SupportDebateAI component to see if it has its own layout
cat frontend/src/Pages/SupportDebateAI.tsx

Repository: AOSSIE-Org/DebateAI

Length of output: 167


🏁 Script executed:

# Let's see the full routing structure to understand the Layout boundaries better
sed -n '70,130p' frontend/src/App.tsx

Repository: AOSSIE-Org/DebateAI

Length of output: 2493


Move /support-debateai under the public Layout route for consistent navigation.

The Header links to this route, but it currently renders outside Layout as a fallback, meaning users will see a bare page without the Header/navigation. This creates a UX inconsistency. Place it alongside other public routes:

{/* Public routes with layout */}
<Route element={<Layout />}>
  <Route path="about" element={<About />} />
  <Route path="support-debateai" element={<SupportDebateAI />} />
</Route>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/src/App.tsx` at line 117, The /support-debateai Route is currently
defined outside the public Layout and thus renders without the app Header; move
the Route element for SupportDebateAI so it is a child of the existing <Route
element={<Layout />}> group (alongside other public routes like the About route)
so the SupportDebateAI component is rendered within Layout and shows the
Header/navigation consistently.

@Abhishek2005-ard

Copy link
Copy Markdown
Contributor Author
Screen.Recording.2026-03-30.212436.mp4

@Abhishek2005-ard

Abhishek2005-ard commented Mar 30, 2026

Copy link
Copy Markdown
Contributor Author

Hey @bhavik-mangla, I have resolved all the major issues highlighted by CodeRabbit.

  1. Fixed missing /support-debateai route
  2. Cleaned up duplicate and inconsistent routes
  3. Added reduced-motion support for accessibility
  4. Fixed async memory leak in Home component

All checks should now pass.

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