Skip to content

Conversation

@Ishtiyaque-Alam
Copy link

@Ishtiyaque-Alam Ishtiyaque-Alam commented Dec 14, 2025

Closes # 189

📝 Description

The LandingPage would disappear initially when switching between pages, and there is no option for the user to analyze their repository.

Also, when switching between pages, an "uninitialized" message appears, but there is no option to go back and index the repository.
I changed the properties of the LandingPage props so that, unless the data is available, the page displays the landingPage instead of just showing a simple message.

Please look at the video shown

🔧 Changes Made

Files changed

LandingPage.tsx props
PullRequest.tsx
App.tsx
Contribution.tsx
Analytics.tsx
Dashboard.tsx

📷 Screenshots or Visual Changes (if applicable)

Before
https://github.com/user-attachments/assets/6afe0652-d1f0-4989-bd50-1ece538a9b51

After
https://github.com/user-attachments/assets/731bfa8d-8d7e-423c-b41e-f1405796c7bf

🤝 Collaboration

✅ Checklist

  • I have read the contributing guidelines.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added necessary documentation (if applicable).
  • Any dependent changes have been merged and published in downstream modules.

Summary by CodeRabbit

  • Bug Fixes

    • Pages now show the repository selection/landing experience when no data exists instead of generic placeholders.
    • More specific guidance when pull-request or contributor data is missing.
  • Refactor

    • Multiple pages can now initiate or update the selected repository, improving empty-state flows and reducing dead-ends.
  • New Features

    • Landing flow accepts contextual messages so empty states present tailored instructions to the user.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 14, 2025

Walkthrough

Propagate an optional setRepoData callback through routes and page components; pages now render LandingPage (which gained a required message prop and optional setRepoData) when repoData is absent. Analytics and PullRequests pages show more specific messaging for missing PR data.

Changes

Cohort / File(s) Summary
App-level routing
frontend/src/App.tsx
Passes setRepoData (in addition to repoData) and a message prop into routed pages and the public LandingPage route.
LandingPage
frontend/src/components/landing/LandingPage.tsx
setRepoData made optional; added required message: string prop; introduced safeSetRepoData fallback and use it when invoking repo-data updates; UI displays provided message.
Dashboard
frontend/src/components/dashboard/Dashboard.tsx
Added optional setRepoData prop; when repoData is falsy render LandingPage (with setRepoData or no-op) and a message instead of a static inline placeholder.
Contributors page
frontend/src/components/contributors/ContributorsPage.tsx
Added optional setRepoData prop; when repoData is falsy render LandingPage (with setRepoData or no-op) and a message instead of the previous static "No data available" text.
Analytics page
frontend/src/components/pages/AnalyticsPage.tsx
Added optional setRepoData prop; render LandingPage when repoData is absent; if repoData exists but lacks pull_requests, show a specific missing-PRs message.
Pull Requests page
frontend/src/components/pages/PullRequestsPage.tsx
Added optional setRepoData prop; render LandingPage when repoData is absent; if repoData exists but lacks pull_requests, show an explicit message requesting repository analysis.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant App as App (Router)
participant Page as Page Component
participant Landing as LandingPage
participant State as App State (repoData / setRepoData)

App->>Page: render with props (repoData?, setRepoData)
alt repoData present
    Page->>Page: render page UI using repoData
else repoData missing
    Page->>Landing: render LandingPage(message, setRepoData?)
    Landing->>State: call setRepoData(newData) (uses safeSetRepoData)
    State-->>App: repoData updated
    App->>Page: re-render with repoData

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Areas needing attention:
    • Ensure every App route supplies a message when rendering LandingPage.
    • Verify safeSetRepoData no-op fallback doesn't hide errors or cause silent failures.
    • Confirm navigation/state flow after LandingPage submits data still behaves as expected.

Possibly related PRs

Suggested reviewers

  • smokeyScraper
  • chandansgowda

Poem

🐰 I hopped through props both near and far,
I carried setRepoData like a tiny star,
When data's gone I softly land,
LandingPage cupped in my little hand,
Hooray — pages sing, the UI's unmarred. ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
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.
Title check ❓ Inconclusive The title 'landing page UI fix' is vague and generic, lacking specific details about what UI issue was addressed or how it was fixed. Consider a more descriptive title such as 'Display LandingPage fallback on missing repository data' or 'Fix LandingPage disappearing when switching pages' to clearly convey the main change.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ 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: 6

Caution

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

⚠️ Outside diff range comments (2)
frontend/src/components/pages/AnalyticsPage.tsx (1)

41-113: Analytics data is hardcoded and not derived from repository data.

All the analytics cards, charts, and visualizations use placeholder/mock data (analyticsCards, areaData, lineData, radarData, pieData) rather than actual repository statistics from repoData. This means the Analytics page displays static data regardless of which repository is analyzed.

Would you like me to help generate code that derives analytics from the actual repoData object, or should this be tracked as a separate issue for future implementation?

frontend/src/App.tsx (1)

22-38: RepositoryData interface is incomplete.

The RepositoryData interface doesn't include pull_requests or contributors fields that are accessed in Dashboard.tsx (line 46, 52), ContributorsPage.tsx (line 18), AnalyticsPage.tsx (line 126), and PullRequestsPage.tsx (line 28). This creates a type mismatch.

 interface RepositoryData {
   id: string;
   name: string;
   full_name: string;
   description?: string;
   html_url: string;
   stargazers_count: number;
   forks_count: number;
   language?: string;
   created_at: string;
   updated_at: string;
   owner: {
     login: string;
     avatar_url: string;
   };
+  contributors?: Array<{
+    login: string;
+    avatar_url: string;
+    contributions: number;
+  }>;
+  pull_requests?: {
+    open?: number;
+    details: Array<{
+      number: number;
+      title: string;
+      author: {
+        login: string;
+        avatar_url: string;
+        profile_url: string;
+      };
+      state: string;
+      url: string;
+      comments?: number;
+      created_at?: string;
+    }>;
+  };
 }
🧹 Nitpick comments (3)
frontend/src/components/pages/AnalyticsPage.tsx (1)

118-119: Use proper TypeScript types instead of any.

The repoData prop is typed as any, which defeats TypeScript's type safety. Consider defining a proper interface or type for repository data.

+interface RepositoryData {
+  pull_requests?: {
+    details: any[];
+    open?: number;
+  };
+  contributors?: any[];
+  // ... other fields
+}
+
 interface Props {
-    repoData: any;
+    repoData: RepositoryData | null;
     setRepoData?: (data: any) => void;
 }
frontend/src/components/dashboard/Dashboard.tsx (1)

9-12: Use proper TypeScript types instead of any.

Similar to other pages, repoData should have a proper type definition.

frontend/src/components/contributors/ContributorsPage.tsx (1)

7-10: Use proper TypeScript types instead of any.

Consider defining a proper interface for repoData to improve type safety.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

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

📒 Files selected for processing (6)
  • frontend/src/App.tsx (1 hunks)
  • frontend/src/components/contributors/ContributorsPage.tsx (2 hunks)
  • frontend/src/components/dashboard/Dashboard.tsx (1 hunks)
  • frontend/src/components/landing/LandingPage.tsx (2 hunks)
  • frontend/src/components/pages/AnalyticsPage.tsx (3 hunks)
  • frontend/src/components/pages/PullRequestsPage.tsx (2 hunks)
🔇 Additional comments (3)
frontend/src/components/landing/LandingPage.tsx (1)

13-13: Consider using nullish coalescing for consistency.

The safeSetRepoData fallback is correctly implemented, but using the nullish coalescing operator (??) is more idiomatic for this pattern.

frontend/src/components/pages/PullRequestsPage.tsx (1)

5-22: Good use of TypeScript interfaces.

This file demonstrates better type safety with the PullRequest interface and a more specific type for the Props interface. This pattern should be applied consistently across other pages.

frontend/src/App.tsx (1)

163-168: setRepoData propagation looks correct.

The propagation of setRepoData to all protected routes is implemented consistently and allows child components to update the parent state.

@Ishtiyaque-Alam Ishtiyaque-Alam changed the title Ishtiyaque alam landing page UI fix Fix : Ishtiyaque alam - landing page UI fix Dec 14, 2025
@Ishtiyaque-Alam Ishtiyaque-Alam changed the title Fix : Ishtiyaque alam - landing page UI fix Ishtiyaque Alam- landing page UI fix Dec 14, 2025
Ishtiyaque-Alam and others added 2 commits December 14, 2025 15:09
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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: 0

♻️ Duplicate comments (4)
frontend/src/components/contributors/ContributorsPage.tsx (1)

31-33: Past review comment addressed - implementation looks good.

The required message prop is now correctly provided to LandingPage, resolving the previous critical issue. The fallback pattern for setRepoData is appropriate given the optional prop.

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

15-17: Past review comment addressed - LGTM.

The message prop is now correctly provided, resolving the previous critical issue. The implementation is clean and consistent with other pages.

frontend/src/components/pages/AnalyticsPage.tsx (1)

123-125: Past review comment addressed - implementation correct.

The message prop is now provided to LandingPage, resolving the previous critical issue.

frontend/src/components/pages/PullRequestsPage.tsx (1)

25-27: Past review comment addressed - implementation correct.

The message prop is now properly provided to LandingPage, resolving the previous critical issue.

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

9-9: Consider replacing any with a proper interface.

For better type safety, consider defining an interface for the repository data structure instead of using any.

Example:

interface RepositoryData {
  contributors?: Array<{
    login: string;
    avatar_url: string;
    contributions: number;
  }>;
  // ... other fields
}

interface Props {
  repoData: RepositoryData | null;
  setRepoData?: (data: RepositoryData | null) => void;
}
frontend/src/components/dashboard/Dashboard.tsx (1)

11-11: Consider replacing any with a typed interface.

For improved type safety and better IDE support, define an interface for the repository data structure.

frontend/src/components/pages/AnalyticsPage.tsx (1)

118-119: Consider stronger typing for repository data.

Replace any with a proper interface to improve type safety and catch potential data structure issues at compile time.

frontend/src/components/pages/PullRequestsPage.tsx (1)

21-21: Consider aligning setRepoData type with repoData interface.

The repoData prop has a specific interface, but setRepoData accepts any. Consider matching the types for consistency.

-  setRepoData?: (data: any) => void;
+  setRepoData?: (data: { pull_requests: { details: PullRequest[] } } | null) => void;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2d3ee19 and 41d5a6c.

📒 Files selected for processing (5)
  • frontend/src/components/contributors/ContributorsPage.tsx (2 hunks)
  • frontend/src/components/dashboard/Dashboard.tsx (1 hunks)
  • frontend/src/components/landing/LandingPage.tsx (3 hunks)
  • frontend/src/components/pages/AnalyticsPage.tsx (3 hunks)
  • frontend/src/components/pages/PullRequestsPage.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/src/components/landing/LandingPage.tsx
🔇 Additional comments (2)
frontend/src/components/pages/AnalyticsPage.tsx (1)

126-133: Dual-condition handling provides specific user feedback.

The separate check for missing pull_requests data provides more granular feedback when repository data exists but PR-specific data is unavailable. This is appropriate for the analytics context.

frontend/src/components/pages/PullRequestsPage.tsx (1)

28-30: Dual-condition handling appropriate for PR-specific context.

The separate check for missing pull_requests provides targeted feedback when repository data exists but lacks PR information. This aligns with the page's purpose.

@smokeyScraper
Copy link
Contributor

I don't think this is very essential as of now, as it'll be removed/changed once I merge the PR that enables Analyze Repository functionality.
Thanks

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.

2 participants