Skip to content

Conversation

@Divine-P-77777
Copy link

@Divine-P-77777 Divine-P-77777 commented Dec 27, 2025

What changed

  • Updated ProtectedLayout to conditionally render the LandingPage
  • LandingPage now remains visible on Dashboard, Contributors, Analytics, and PRs
    until a repository is initialized

Why

Previously, switching routes before initializing a repository caused the
LandingPage to disappear with no way to re-initialize.

How it works

  • Visibility is controlled using repoData and current route
  • No changes were made to individual pages or routing structure

Screenshots / Demo

2025-12-27.23-12-05.mp4

Fixes #189

Summary by CodeRabbit

  • New Features
    • Landing page now displays conditionally based on the current route and repository data availability, enabling route-specific welcome screens when repository data is not present.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 27, 2025

📝 Walkthrough

Walkthrough

The changes address a landing page persistence issue by modifying App.tsx to conditionally render a LandingPage component on specific routes when no repository data is present. Additionally, minor formatting adjustments were applied to related components.

Changes

Cohort / File(s) Summary
Routing & Conditional Rendering
frontend/src/App.tsx
Adds useLocation hook and introduces landingAllowedRoutes array. Implements dynamic conditional logic to render LandingPage above Outlet when on allowed routes and repoData is absent. Preserves existing Sidebar, Logout, and animation behavior.
Formatting Adjustments
frontend/src/components/contributors/ContributorsPage.tsx, frontend/src/components/dashboard/Dashboard.tsx
Whitespace and line-break normalization in JSX tags (e.g., removal of trailing spaces). No functional or logical changes to component behavior, props, or state handling.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Possibly related PRs

Suggested reviewers

  • smokeyScraper
  • chandansgowda

Poem

🐰 A hop, a skip, the route now knows,
When landing stays where repo data flows,
No vanishing acts on page-switch day,
The Landing Page is here to stay!

Pre-merge checks and finishing touches

❌ 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%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately summarizes the main change: conditionally keeping LandingPage visible on core pages until repository initialization.
Linked Issues check ✅ Passed The PR fully addresses issue #189 by implementing conditional LandingPage rendering that keeps it visible on core pages (Dashboard, Contributors, Analytics, PRs) until repo initialization.
Out of Scope Changes check ✅ Passed All changes are in scope: App.tsx modifications implement the core fix, while formatting adjustments in ContributorsPage.tsx and Dashboard.tsx maintain consistency with the changes.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
Contributor

@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: 2

🧹 Nitpick comments (2)
frontend/src/components/contributors/ContributorsPage.tsx (1)

30-30: Unusual JSX formatting: remove trailing spaces before closing brackets.

Lines 30, 53, 61, and 75 have extra spaces before the closing > in JSX tags (e.g., <div >, <motion.button). This is inconsistent with standard JSX formatting conventions and may have been introduced accidentally by an IDE or formatter.

🔎 Proposed formatting fix
-    return <div >No data available. Please analyze a repository first.</div>;
+    return <div>No data available. Please analyze a repository first.</div>;
-          <motion.button
+          <motion.button
             whileHover={{ scale: 1.05 }}
-          <motion.button
+          <motion.button
             whileHover={{ scale: 1.05 }}
-          <ContributorCard
+          <ContributorCard
             key={contributor.login}

Also applies to: 53-53, 61-61, 75-75

frontend/src/components/dashboard/Dashboard.tsx (1)

29-29: Unusual JSX formatting: remove trailing spaces before closing brackets.

Lines 29, 41, 47, 53, 59, 70, 77, and 84 have extra spaces before the closing > in JSX tags (e.g., <motion.button, <StatCard, <BotIntegration). This formatting pattern is inconsistent with standard JSX conventions and appears across multiple files in this PR.

Also applies to: 41-41, 47-47, 53-53, 59-59, 70-70, 77-77, 84-84

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8eeacad and 0bf90e8.

📒 Files selected for processing (3)
  • frontend/src/App.tsx
  • frontend/src/components/contributors/ContributorsPage.tsx
  • frontend/src/components/dashboard/Dashboard.tsx
🧰 Additional context used
🧬 Code graph analysis (1)
frontend/src/components/dashboard/Dashboard.tsx (1)
frontend/src/components/dashboard/StatCard.tsx (1)
  • StatCard (11-43)

import { supabase } from './lib/supabaseClient';
import ForgotPasswordPage from './components/pages/ForgotPasswordPage';
import ResetPasswordPage from './components/pages/ResetPasswordPage';
import { useLocation } from 'react-router-dom';
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Consolidate duplicate import from 'react-router-dom'.

The useLocation import on line 21 creates a second import statement from 'react-router-dom', when it should be added to the existing import on line 2.

🔎 Proposed fix
-import { BrowserRouter as Router, Routes, Route, Navigate, Outlet } from 'react-router-dom';
+import { BrowserRouter as Router, Routes, Route, Navigate, Outlet, useLocation } from 'react-router-dom';

Remove line 21:

-import { useLocation } from 'react-router-dom';
-
📝 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
import { useLocation } from 'react-router-dom';
import { BrowserRouter as Router, Routes, Route, Navigate, Outlet, useLocation } from 'react-router-dom';
🤖 Prompt for AI Agents
In frontend/src/App.tsx around line 21, there's a duplicate import from
'react-router-dom' for useLocation; remove the separate import on line 21 and
add useLocation to the existing import declaration at the top of the file (line
2) so all react-router-dom imports are consolidated into a single import
statement.

@smokeyScraper
Copy link
Contributor

Thanks @Divine-P-77777, I'm sorry, but this isn't required, as it soon will be changed after merging a few other PRs.

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.

BUG: The landingPage component disappears when switching between pages

2 participants