feat(auth): protect Collab, Community Q&A, and Leetcode routes behind Google Sign-In
Some checks failed
Deploy RIT Freshers Hub to VPS / Deploy to Live VPS (push) Has been cancelled

This commit is contained in:
Shanmuga Krishnan S M
2026-08-06 13:39:08 +05:30
parent 1b698d7cca
commit b852018f24
2 changed files with 137 additions and 3 deletions

View File

@@ -2,6 +2,7 @@ import { useEffect } from 'react';
import { BrowserRouter, Routes, Route, useLocation } from 'react-router-dom';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { AuthProvider } from '@/context/AuthContext';
import ProtectedRoute from '@/components/Auth/ProtectedRoute';
import MainLayout from '@/layouts/MainLayout';
import Home from '@/pages/Home/Home';
import Notes from '@/pages/Notes/Notes';
@@ -48,9 +49,42 @@ function App() {
<Route path="/bus-routes" element={<BusRoutes />} />
<Route path="/faculty" element={<Faculty />} />
<Route path="/events" element={<Events />} />
<Route path="/community" element={<Community />} />
<Route path="/collab" element={<DevCollab />} />
<Route path="/leetcode" element={<LeetcodeLeaderboard />} />
{/* Protected Routes — Require Google Sign-In */}
<Route
path="/community"
element={
<ProtectedRoute
title="RIT Q&A Community"
description="Connect with fellow RIT students and ask senior helpers any question about campus life and academics."
>
<Community />
</ProtectedRoute>
}
/>
<Route
path="/collab"
element={
<ProtectedRoute
title="Developer Collab Hub"
description="Post open-source projects, search for co-developers, and connect with fellow programmers."
requireVerifiedStudent={true}
>
<DevCollab />
</ProtectedRoute>
}
/>
<Route
path="/leetcode"
element={
<ProtectedRoute
title="RIT LeetCode Leaderboard"
description="Track campus competitive programming rankings and see top RIT coders."
>
<LeetcodeLeaderboard />
</ProtectedRoute>
}
/>
</Route>
</Routes>
</AuthProvider>