diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 9f70aa6c..288b15d5 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -18,6 +18,8 @@ import SignUpPage from './components/pages/SignUpPage'; import { supabase } from './lib/supabaseClient'; import ForgotPasswordPage from './components/pages/ForgotPasswordPage'; import ResetPasswordPage from './components/pages/ResetPasswordPage'; +import { useLocation } from 'react-router-dom'; + // Define proper TypeScript interfaces interface RepositoryData { @@ -101,26 +103,46 @@ function App() { setRepoData(null); }; - const ProtectedLayout = () => ( -
- -
-
- - - -
-
-
- ); + const ProtectedLayout = () => { + const location = useLocation(); + + const landingAllowedRoutes = [ + '/dashboard', + '/contributors', + '/analytics', + '/prs', + ]; + + const shouldShowLanding = + !repoData && landingAllowedRoutes.includes(location.pathname); + + return ( +
+ + +
+
+ {/* Conditional Landing Page */} + {shouldShowLanding && ( + + )} + + + + +
+
+
+ ); + }; + return ( diff --git a/frontend/src/components/contributors/ContributorsPage.tsx b/frontend/src/components/contributors/ContributorsPage.tsx index d0ee0e2f..f07c7208 100644 --- a/frontend/src/components/contributors/ContributorsPage.tsx +++ b/frontend/src/components/contributors/ContributorsPage.tsx @@ -27,7 +27,7 @@ const ContributorsPage: React.FC = ({ repoData }) => { }; if (!repoData) { - return
No data available. Please analyze a repository first.
; + return
No data available. Please analyze a repository first.
; } if (loading) { @@ -50,7 +50,7 @@ const ContributorsPage: React.FC = ({ repoData }) => {

Manage and track contributor activity

- = ({ repoData }) => { > Export Report - = ({ repoData }) => { {/* Contributors Grid */}
{contributors.map((contributor) => ( - = ({ repoData }) => { >

Dashboard Overview

- = ({ repoData }) => { {/* Stats Section */}
- } title="Active Contributors" value={repoData.contributors?.length || 0} trend={12} /> - } title="Open PRs" value={repoData.pull_requests?.open || 0} trend={repoData.pull_requests?.open || 0} /> - } title="Community Posts" value="892" // Placeholder, replace with dynamic if available trend={8} /> - } title="Response Rate" value="94%" // Placeholder, replace with dynamic if available @@ -67,21 +67,21 @@ const Dashboard: React.FC = ({ repoData }) => { {/* Quick Actions */}

Quick Actions

- } connected={true} description="Automate your GitHub workflow" features={['Issue triage', 'PR reviews', 'Welcome messages']} /> - } connected={false} description="Engage with your community" features={['Support channels', 'Role management', 'Event notifications']} /> - } connected={true}