Skip to content

Enhance PR section with type badges, state, merged status, and merged…#162

Closed
gargivermaa wants to merge 2 commits intoGitMetricsLab:mainfrom
gargivermaa:enhance-pr-section
Closed

Enhance PR section with type badges, state, merged status, and merged…#162
gargivermaa wants to merge 2 commits intoGitMetricsLab:mainfrom
gargivermaa:enhance-pr-section

Conversation

@gargivermaa
Copy link
Contributor

@gargivermaa gargivermaa commented Jul 31, 2025

Related Issue


Description

This PR improves the visual presentation and clarity of the Pull Requests section on the dashboard. It adds informative tags and highlights merge status, enhancing the contributor's experience.


How Has This Been Tested?

Ran the app locally and verified:

All columns display correctly

Badges are styled and labeled as expected

State and merged statuses reflect actual values

Manually cross-checked edge cases (e.g., unmerged or open PRs)


Screenshots

473037935-af85d269-ec15-4ede-ab22-d7a1142c8f48

Type of Change

-- [ ] New feature

  • Code style update

Summary by CodeRabbit

  • Chores
    • Removed the Home page interface for viewing GitHub issues and pull requests, including all related filters and authentication inputs.

@netlify
Copy link

netlify bot commented Jul 31, 2025

Deploy Preview for github-spy failed.

Name Link
🔨 Latest commit 43d2d3f
🔍 Latest deploy log https://app.netlify.com/projects/github-spy/deploys/688b844d3f886d00085c0b73

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 31, 2025

Walkthrough

The entire Home.tsx React component was removed. This component provided a user interface for fetching and displaying GitHub issues and pull requests with various filters, pagination, and state management. It included authentication inputs, data fetching logic, and UI elements built with Material-UI.

Changes

Cohort / File(s) Change Summary
Removal of Home Page Component
src/pages/Home/Home.tsx
Complete removal of the Home React component that handled GitHub issues and pull requests UI, data fetching, filtering, and pagination.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Assessment against linked issues

Objective Addressed Explanation
Add proper design labels & metrics for PRs in dashboard (#28) The entire dashboard component was removed, so no labels or metrics were added.
Use Tailwind CSS for PR labels and display PR type/status (#28) No implementation of Tailwind CSS or PR type/status display present due to removal of the component.

Poem

The Home page hops away from sight,
No tabs or badges shining bright.
Though code once fetched with flair and grace,
Now vanished from its rightful place.
🐇💨
A leap into the unknown wide—
What next adventures will abide?

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 37a27eb and 43d2d3f.

📒 Files selected for processing (1)
  • src/pages/Home/Home.tsx (0 hunks)
💤 Files with no reviewable changes (1)
  • src/pages/Home/Home.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Redirect rules - github-spy
  • GitHub Check: Header rules - github-spy
  • GitHub Check: Pages changed - github-spy
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

🎉 Thank you @gargivermaa for your contribution. Please make sure your PR follows https://github.com/GitMetricsLab/github_tracker/blob/main/CONTRIBUTING.md#-pull-request-guidelines

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: 1

🧹 Nitpick comments (2)
src/pages/Home/Home.tsx (2)

28-37: Improve type detection robustness and consider internationalization.

The current implementation uses simple substring matching which may produce false positives. Consider these improvements:

  1. Use word boundaries to avoid partial matches
  2. Handle multiple keywords in titles
  3. Consider case variations and common abbreviations
-function getPRType(title: string): string {
-  const lower = title.toLowerCase();
-  if (lower.includes("feature")) return "Feature";
-  if (lower.includes("fix")) return "Fix";
-  if (lower.includes("cleanup") || lower.includes("refactor")) return "Cleanup";
-  if (lower.includes("docs")) return "Docs";
-  if (lower.includes("test")) return "Test";
-  return "Other";
-}
+function getPRType(title: string): string {
+  const lower = title.toLowerCase();
+  
+  // Use word boundaries for more accurate matching
+  const hasKeyword = (keywords: string[]) => 
+    keywords.some(keyword => new RegExp(`\\b${keyword}\\b`).test(lower));
+  
+  if (hasKeyword(['feature', 'feat', 'enhancement', 'add'])) return "Feature";
+  if (hasKeyword(['fix', 'bug', 'hotfix', 'patch'])) return "Fix";
+  if (hasKeyword(['cleanup', 'refactor', 'refactoring', 'clean'])) return "Cleanup";
+  if (hasKeyword(['docs', 'documentation', 'readme'])) return "Docs";
+  if (hasKeyword(['test', 'testing', 'spec', 'e2e'])) return "Test";
+  return "Other";
+}

83-83: Remove commented code.

The commented octokit declaration should be removed to keep the codebase clean.

-  //const octokit = getOctokit();
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9fa26a8 and 37a27eb.

📒 Files selected for processing (1)
  • src/pages/Home/Home.tsx (4 hunks)
🔇 Additional comments (3)
src/pages/Home/Home.tsx (3)

39-55: LGTM! Well-structured badge styling with good color choices.

The badge styling function provides clear visual distinction between PR types using appropriate color schemes. The switch statement is clean and the fallback to gray for unknown types is sensible.


294-297: Consistent table structure with proper conditional rendering.

The new column headers are properly structured and the conditional rendering for PR-specific columns (Merged and Merged Date) is correctly implemented using the tab state.


332-343: LGTM! Proper conditional rendering with good UX considerations.

The conditional rendering of Merged and Merged Date columns is well-implemented:

  • Uses consistent conditional logic with the header
  • Provides clear "Yes"/"No" values for merged status
  • Shows formatted date or dash placeholder appropriately
  • Maintains good alignment with center/left positioning

Comment on lines 322 to 328

{/* 🆕 PR Type Label */}
<TableCell>
<span className={`px-2 py-1 rounded-full text-xs font-semibold ${getBadgeStyle(getPRType(item.title))}`}>
{getPRType(item.title)}
</span>
</TableCell>
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Consider extracting badge rendering logic and verify Tailwind CSS integration.

The inline badge implementation works but could be improved for maintainability and consistency with the Material-UI theme system.

+// Helper component for type badges
+const TypeBadge: React.FC<{ title: string }> = ({ title }) => {
+  const type = getPRType(title);
+  const badgeClass = getBadgeStyle(type);
+  
+  return (
+    <span className={`px-2 py-1 rounded-full text-xs font-semibold ${badgeClass}`}>
+      {type}
+    </span>
+  );
+};

 <TableCell>
-  <span className={`px-2 py-1 rounded-full text-xs font-semibold ${getBadgeStyle(getPRType(item.title))}`}>
-    {getPRType(item.title)}
-  </span>
+  <TypeBadge title={item.title} />
 </TableCell>

Please verify that Tailwind CSS is properly configured in this project and that the badge styles render correctly:


🏁 Script executed:

#!/bin/bash
# Check if Tailwind CSS is configured
fd -e json -e js -e ts "tailwind.config" --max-depth 2

# Check for Tailwind imports in CSS files
fd -e css | xargs grep -l "tailwind\|@apply" 2>/dev/null || echo "No Tailwind CSS imports found"

# Look for any existing Tailwind usage in the codebase
rg "className.*bg-" --type tsx --type ts -A 1 -B 1

Length of output: 215


🏁 Script executed:

#!/bin/bash
# Verify Tailwind directives in the main CSS entry
echo "==> First 20 lines of src/index.css:"
head -n 20 src/index.css || echo "❌ src/index.css not found"

# Look for Tailwind background utilities in .tsx components
echo "==> Searching for bg- utility classes in .tsx files:"
rg "bg-[a-z]" -g "*.tsx" -n -C1 || echo "⚠️ No bg- utility classes found in .tsx files"

Length of output: 17577


Extract badge into a reusable TypeBadge component

Tailwind CSS is properly set up—tailwind.config.js is present, src/index.css includes @tailwind directives, and bg-* utilities are used throughout your .tsx files—so the new badge styles will render correctly.

• src/pages/Home/Home.tsx: replace the inline <span> with a TypeBadge call
• Create a TypeBadge component (e.g. in src/components/TypeBadge.tsx) to encapsulate getPRType and getBadgeStyle logic

Proposed diff:

+// src/components/TypeBadge.tsx
+import React from 'react';
+import { getPRType, getBadgeStyle } from '../pages/Home/Home'; // adjust path as needed
+
+export const TypeBadge: React.FC<{ title: string }> = ({ title }) => {
+  const type = getPRType(title);
+  const badgeClass = getBadgeStyle(type);
+  return (
+    <span className={`px-2 py-1 rounded-full text-xs font-semibold ${badgeClass}`}>
+      {type}
+    </span>
+  );
+};

--- a/src/pages/Home/Home.tsx
+++ b/src/pages/Home/Home.tsx
@@ Lines 322-328
-  <TableCell>
-    <span className={`px-2 py-1 rounded-full text-xs font-semibold ${getBadgeStyle(getPRType(item.title))}`}>
-      {getPRType(item.title)}
-    </span>
-  </TableCell>
+  <TableCell>
+    <TypeBadge title={item.title} />
+  </TableCell>

This extraction improves readability and keeps styling consistent across your app.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In src/pages/Home/Home.tsx around lines 322 to 328, replace the inline span
element used for the PR type badge with a reusable TypeBadge component. Create a
new TypeBadge component in src/components/TypeBadge.tsx that encapsulates the
logic for calling getPRType and getBadgeStyle and renders the styled badge. Then
import and use this TypeBadge component in Home.tsx to improve code readability
and maintain consistent styling.

@gargivermaa gargivermaa deleted the enhance-pr-section branch July 31, 2025 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🚀 Feature: Add proper design labels for the PRs in dashboard

2 participants