Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 16 additions & 23 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@tanstack/react-query-devtools": "^5.95.2",
"axios": "^1.13.6",
"firebase": "^12.10.0",
"lottie-react": "^2.4.1",
"react": "^19.2.0",
"react-dom": "^19.2.0",
"react-redux": "^9.2.0",
Expand Down
41 changes: 23 additions & 18 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { BrowserRouter, Routes, Route } from "react-router-dom";
import { MainLayout } from "./components/MainLayout";
import { Home } from "./pages/Home/Home";
import { Profile } from "./pages/Profile/Profile";
import { TournamentsPage } from "./pages/TournamentsPage/TournamentsPage";
Expand All @@ -7,33 +8,37 @@ import { Page404 } from "./pages/Page404/Page404";
import SignIn from "./pages/Auth/SignIn";
import SignUp from "./pages/Auth/SignUp";
import SignOut from "./pages/Auth/SignOut";
import { Header } from "./components/Header";
import { Footer } from "./components/Footer";
import ProtectedRoute from "./components/ProtectedRoute/ProtectedRoute";
import { GetOrganizerRole } from "./pages/GetOganizerRole/GetOganizerRole";

export const App = () => {
return (
<BrowserRouter>
<Header />
<main>
<Routes>
<Routes>
{/* Сторінки з Хедером та Футером */}
<Route element={<MainLayout />}>
<Route path="/" element={<Home />} />
<Route path="/profile" element={
<ProtectedRoute>
<Profile />
</ProtectedRoute>
} />
<Route
path="/profile"
element={
<ProtectedRoute>
<Profile />
</ProtectedRoute>
}
/>
<Route path="/tournaments" element={<TournamentsPage />} />
<Route path="/auth/" >
<Route path="sign-in" element={<SignIn />} />
<Route path="sign-up" element={<SignUp />} />
<Route path="sign-out" element={<SignOut />} />
</Route>
<Route path="/tournament/:id" element={<TournamentPage />} />
<Route path="/organizerRoleForm" element={<GetOrganizerRole/>} />
<Route path="*" element={<Page404 />} />
</Routes>
</main>
<Footer />
</Route>

{/* Без нього */}
<Route path="/auth">
<Route path="sign-in" element={<SignIn />} />
<Route path="sign-up" element={<SignUp />} />
<Route path="sign-out" element={<SignOut />} />
</Route>
Comment on lines +36 to +40

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:

# First, verify the file exists and read the relevant section
if [ -f "frontend/src/App.tsx" ]; then
  echo "=== App.tsx exists ==="
  wc -l frontend/src/App.tsx
  echo ""
  echo "=== Lines 30-45 (context around lines 36-40) ==="
  sed -n '30,45p' frontend/src/App.tsx
else
  echo "File not found"
fi

Repository: ugalaxy-team/Project

Length of output: 664


🏁 Script executed:

# Search for references to "/auth" in the codebase to see if it's ever targeted directly
echo "=== References to /auth (without path segments) ==="
rg '"/auth"' --type ts --type tsx --type js --type jsx

Repository: ugalaxy-team/Project

Length of output: 160


🏁 Script executed:

# Check for react-router-dom version and import details
echo "=== React Router imports in App.tsx ==="
head -20 frontend/src/App.tsx | grep -E "import.*react-router|from.*react-router"

Repository: ugalaxy-team/Project

Length of output: 168


🏁 Script executed:

# Search for Navigate imports or usage
echo "=== Navigate usage in the codebase ==="
rg 'Navigate' --type ts --type tsx --type js --type jsx -l

Repository: ugalaxy-team/Project

Length of output: 147


🏁 Script executed:

# Look for any existing index routes
echo "=== Index routes in the codebase ==="
rg '<Route\s+index' --type ts --type tsx --type js --type jsx

Repository: ugalaxy-team/Project

Length of output: 145


🏁 Script executed:

# Fix the file type issue - search without type filter or use different approach
echo "=== References to /auth in codebase ==="
rg "/auth" --glob "*.ts" --glob "*.tsx" --glob "*.js" --glob "*.jsx"

Repository: ugalaxy-team/Project

Length of output: 1181


🏁 Script executed:

# Check the full App.tsx file to understand the routing structure
echo "=== Full App.tsx ==="
cat -n frontend/src/App.tsx

Repository: ugalaxy-team/Project

Length of output: 2047


🏁 Script executed:

# Search for navigation/links that might target /auth
echo "=== Search for navigate calls and link patterns ==="
rg -i 'navigate|href|to=' --glob "*.ts" --glob "*.tsx" --glob "*.js" --glob "*.jsx" | grep -i auth

Repository: ugalaxy-team/Project

Length of output: 1400


🏁 Script executed:

# Check package.json for react-router-dom version
echo "=== React Router version ==="
cat package.json | grep -A2 -B2 "react-router"

Repository: ugalaxy-team/Project

Length of output: 154


🏁 Script executed:

# Check if there's a frontend package.json or root package.json
echo "=== Looking for package.json files ==="
find . -name "package.json" -type f | head -5

Repository: ugalaxy-team/Project

Length of output: 126


🏁 Script executed:

# Verify react-router-dom by checking import statements and potential version hints
echo "=== React Router DOM details in imports ==="
rg "react-router-dom" --glob "*.ts" --glob "*.tsx" --glob "*.js" --glob "*.jsx" -A1 | head -20

Repository: ugalaxy-team/Project

Length of output: 1163


🏁 Script executed:

# Double-check: does any code directly navigate to /auth without a child segment?
echo "=== All /auth navigation patterns ==="
rg "to=['\"]*/auth" --glob "*.ts" --glob "*.tsx" --glob "*.js" --glob "*.jsx" | grep -v "/auth/"

Repository: ugalaxy-team/Project

Length of output: 101


🏁 Script executed:

# Final check: confirm there are no indirect redirects or programmatic navigations to /auth
echo "=== Check for any navigate('/auth') patterns ==="
rg "navigate\(['\"]*/auth['\"]" --glob "*.ts" --glob "*.tsx" --glob "*.js" --glob "*.jsx"

Repository: ugalaxy-team/Project

Length of output: 112


🏁 Script executed:

# Verify frontend package.json for react-router-dom version
echo "=== React Router version in frontend ==="
grep -A1 -B1 "react-router-dom" frontend/package.json

Repository: ugalaxy-team/Project

Length of output: 196


Add an index route for /auth.

The parent /auth route has no element and no index child, so navigating directly to /auth renders a blank outlet. Add an index route that redirects to sign-in to prevent blank screens if users access /auth directly via URL or if redirect logic changes.

Suggested fix
-import { BrowserRouter, Routes, Route } from "react-router-dom";
+import { BrowserRouter, Routes, Route, Navigate } from "react-router-dom";
...
         <Route path="/auth">
+          <Route index element={<Navigate to="sign-in" replace />} />
           <Route path="sign-in" element={<SignIn />} />
           <Route path="sign-up" element={<SignUp />} />
           <Route path="sign-out" element={<SignOut />} />
         </Route>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/src/App.tsx` around lines 36 - 40, The /auth parent Route currently
has no index child, causing a blank Outlet; add an index Route inside the same
block that redirects to "sign-in" (e.g., use React Router's Navigate) so hitting
/auth navigates to sign-in; locate the Route block that wraps
SignIn/SignUp/SignOut and add a Route with index and element={<Navigate
to="sign-in" replace />} to perform the redirect.

</Routes>
</BrowserRouter>
);
};
15 changes: 15 additions & 0 deletions frontend/src/components/MainLayout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Outlet } from "react-router-dom";
import { Header } from "./Header";
import { Footer } from "./Footer";

export const MainLayout = () => {
return (
<div className="flex flex-col min-h-screen bg-bg-body">
<Header />
<main className="flex-grow w-full">
<Outlet />
</main>
<Footer />
</div>
);
};
Loading