Skip to content

Added hover tooltip for long repo names in filter panel #338

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jun 6, 2025

Conversation

msukkari
Copy link
Contributor

@msukkari msukkari commented Jun 6, 2025

image

Summary by CodeRabbit

  • New Features

    • Improved display of repository names across the interface with intelligent truncation, formatting, and multiple display modes for better readability and usability.
    • Repository names in carousels and filter panels now use a consistent, structured component for enhanced visual presentation.
  • Bug Fixes

    • Improved handling of long repository names in the user interface to prevent layout issues and ensure names are displayed clearly.
  • Documentation

    • Updated changelog to document the improved handling of long repository names.

@msukkari msukkari requested a review from brendan-kellam June 6, 2025 19:14
Copy link

coderabbitai bot commented Jun 6, 2025

Warning

Rate limit exceeded

@msukkari has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 28 minutes and 13 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 9bfa0bc and c34fc85.

📒 Files selected for processing (2)
  • CHANGELOG.md (1 hunks)
  • packages/web/src/app/[domain]/search/components/filterPanel/entry.tsx (2 hunks)

Walkthrough

The changes introduce a new RepositoryName React component and supporting utility functions to improve the display and truncation of long repository names in the user interface. Existing components are updated to use this new component, and type definitions are adjusted to support flexible display options for repository names.

Changes

Files/Paths Change Summary
CHANGELOG.md Added entry under "Unreleased" for improved handling of long repository names in the UI.
packages/web/src/app/[domain]/components/repositoryCarousel.tsx
.../filterPanel/index.tsx
Replaced plain text repository name display with the new RepositoryName component and updated relevant props.
packages/web/src/app/[domain]/search/components/filterPanel/entry.tsx Changed displayName type to accept string or React.ReactNode, updated rendering logic and flexbox classes.
packages/web/src/components/ui/repositoryName.tsx Introduced new RepositoryName component with multiple display modes and tooltip support.
packages/web/src/lib/repositoryDisplayUtils.ts Added utility functions for formatting, truncating, and displaying repository names in various styles.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UIComponent
    participant RepositoryName
    participant RepositoryDisplayUtils

    User->>UIComponent: View repository list/filter
    UIComponent->>RepositoryName: Render repository name with props
    RepositoryName->>RepositoryDisplayUtils: Format/truncate repository name
    RepositoryDisplayUtils-->>RepositoryName: Return formatted name/parts
    RepositoryName-->>UIComponent: Render formatted/truncated name (with optional tooltip)
    UIComponent-->>User: Display improved repository name
Loading

Poem

🐇
A repo’s name once ran too long,
Now trimmed and neat, it sings its song.
Breadcrumbs, compacts, tooltips too—
All thanks to code both fresh and new.
With clever cuts and tidy flair,
Our UI’s names fit anywhere!

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 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 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

@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 (3)
packages/web/src/lib/repositoryDisplayUtils.ts (2)

162-164: Consider consistency in truncation direction.

The group path truncation here uses left-truncation (keeping the end), while the parent path truncation in createTruncatedRepoDisplay uses right-truncation (keeping the beginning). Consider standardizing the approach for consistency.

For group paths in compact display, left-truncation makes sense to show the immediate parent group. Document this intentional difference:

+    // Truncate from the left to show the most relevant (closest) group
     const truncatedGroup = groupPath.length > availableForGroup 
         ? '…' + groupPath.substring(groupPath.length - availableForGroup + 1)
         : groupPath;

24-83: Add unit tests for the utility functions.

These utility functions handle complex logic with multiple edge cases and would benefit from comprehensive unit tests to ensure correctness across different input scenarios.

Would you like me to generate unit test cases covering:

  • Empty/single-part repository names
  • Various length combinations
  • Edge cases with very short maxLength values
  • Unicode character handling
  • Proportional allocation edge cases

Also applies to: 91-118, 124-127, 133-183

packages/web/src/components/ui/repositoryName.tsx (1)

83-87: Remove redundant case clause.

The static analysis tool correctly identifies that the 'truncate' case is redundant since the default case handles the same logic.

-            case 'truncate':
-            default: {
+            default: {
                 const { displayText } = createTruncatedRepoDisplay(repoName, maxLength);
                 return <span className="font-mono text-sm">{displayText}</span>;
             }
🧰 Tools
🪛 Biome (1.9.4)

[error] 83-84: Useless case clause.

because the default clause is present:

Unsafe fix: Remove the useless case.

(lint/complexity/noUselessSwitchCase)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8dc41a2 and 9bfa0bc.

📒 Files selected for processing (6)
  • CHANGELOG.md (1 hunks)
  • packages/web/src/app/[domain]/components/repositoryCarousel.tsx (2 hunks)
  • packages/web/src/app/[domain]/search/components/filterPanel/entry.tsx (2 hunks)
  • packages/web/src/app/[domain]/search/components/filterPanel/index.tsx (2 hunks)
  • packages/web/src/components/ui/repositoryName.tsx (1 hunks)
  • packages/web/src/lib/repositoryDisplayUtils.ts (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/web/src/components/ui/repositoryName.tsx (1)
packages/web/src/lib/repositoryDisplayUtils.ts (4)
  • createBreadcrumbRepoDisplay (91-118)
  • getProjectName (124-127)
  • createCompactRepoDisplay (133-183)
  • createTruncatedRepoDisplay (24-83)
🪛 Biome (1.9.4)
packages/web/src/components/ui/repositoryName.tsx

[error] 83-84: Useless case clause.

because the default clause is present:

Unsafe fix: Remove the useless case.

(lint/complexity/noUselessSwitchCase)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build
🔇 Additional comments (13)
packages/web/src/lib/repositoryDisplayUtils.ts (2)

6-11: LGTM! Well-defined interface.

The TruncatedRepoDisplay interface clearly defines the contract for repository display utilities with appropriate optional properties.


53-54: ⚠️ Potential issue

Fix the reserved characters calculation.

The reservedChars = 3 calculation assumes only one slash and one ellipsis, but when both parent and project are truncated, you'll have two ellipses plus one slash, requiring 4 characters total.

-        // Reserve space for the slash and ellipsis characters
-        const reservedChars = 3; // "/" + "…" for each truncated part
+        // Reserve space for the slash and potential ellipsis characters
+        const reservedChars = 4; // "/" + "…" for parent + "…" for project

Likely an incorrect or invalid review comment.

CHANGELOG.md (1)

15-16: LGTM! Proper changelog documentation.

The changelog entry correctly documents the UI improvement for handling long repository names with appropriate PR reference.

packages/web/src/app/[domain]/components/repositoryCarousel.tsx (2)

14-14: LGTM! Proper import of the new component.

The import statement correctly brings in the RepositoryName component.


99-105: LGTM! Appropriate component configuration for carousel context.

The RepositoryName component is well-configured for the carousel:

  • displayMode="project-only" is appropriate for limited space
  • maxLength={25} fits carousel item constraints
  • showTooltip={false} prevents UI conflicts in carousel
  • Responsive classes ensure proper layout behavior
packages/web/src/app/[domain]/search/components/filterPanel/index.tsx (2)

14-14: LGTM! Proper import addition.

The import statement correctly adds the RepositoryName component.


80-88: LGTM! Well-configured component for filter panel context.

The RepositoryName component is appropriately configured:

  • displayMode="truncate" provides intelligent truncation for filter entries
  • maxLength={50} balances information visibility with space constraints
  • tooltipSide="right" prevents tooltip clipping in the panel
  • Proper fallback with info?.displayName ?? repository
  • Responsive layout classes ensure proper text overflow handling
packages/web/src/app/[domain]/search/components/filterPanel/entry.tsx (3)

8-8: LGTM! Type flexibility enables React component integration.

The type change from string to string | React.ReactNode maintains backward compatibility while enabling the integration of the new RepositoryName component.


47-57: Excellent layout improvements for text truncation.

The addition of min-w-0 classes and conditional rendering logic properly handles both string and React node display names. The flex layout ensures proper text truncation behavior for long repository names.


59-59: Good use of flex-shrink-0 to preserve count badge.

Preventing the count badge from shrinking ensures it remains visible and properly sized regardless of the displayName length.

packages/web/src/components/ui/repositoryName.tsx (3)

9-17: Well-designed component interface.

The props interface provides excellent flexibility with sensible defaults. The different display modes address various UI needs effectively.


19-28: Excellent documentation.

The JSDoc comments clearly explain the component's purpose and the different display modes, making it easy for other developers to understand and use correctly.


42-89: Solid implementation of display modes.

The switch statement cleanly handles different display modes, and the integration with utility functions from repositoryDisplayUtils promotes code reuse and maintainability.

🧰 Tools
🪛 Biome (1.9.4)

[error] 83-84: Useless case clause.

because the default clause is present:

Unsafe fix: Remove the useless case.

(lint/complexity/noUselessSwitchCase)

@msukkari msukkari changed the title Handle long repo names better in the UI Added hover tooltip for long repo names in filter panel Jun 6, 2025
brendan-kellam
brendan-kellam previously approved these changes Jun 6, 2025
@msukkari msukkari merged commit d29d3fc into main Jun 6, 2025
4 checks passed
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