Skip to content

[search/browse] link repo name to file browser; link code image to external #340

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

Conversation

drew-u410
Copy link
Contributor

@drew-u410 drew-u410 commented Jun 6, 2025

  • [Change] Updates repository name to use the file browser / tree by default instead of the external repository.
  • [New] Adds a link to the external repository on the source code logo.

Summary by CodeRabbit

  • New Features
    • Repository icon now links directly to the repository if a link is available.
  • Refactor
    • Repository name is always styled as clickable and navigates to the repository root path on click, replacing the previous external link behavior.

Copy link

coderabbitai bot commented Jun 6, 2025

Walkthrough

The update refactors the repository icon and name rendering logic within the path header component. The icon is now conditionally wrapped in an anchor tag if a repository link exists. The repository name is always styled as clickable and navigates to the repository root path on click, removing previous conditional link logic.

Changes

File(s) Change Summary
packages/web/src/app/[domain]/components/pathHeader.tsx Refactored repository icon to conditionally use anchor tag; repository name now always styled clickable with navigation; removed conditional Link usage and href logic.
CHANGELOG.md Added unreleased changelog entry documenting repository link update pointing to file tree and moved external link to code host logo.

Suggested reviewers

  • brendan-kellam

Poem

The header’s path now shines anew,
With icons wrapped if links are true.
The repo’s name, a clickable delight,
Guides you home with every byte.
A hop, a skip, a rabbit’s cheer—
For tidy paths and code sincere! 🐇✨


📜 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 d6f83e1 and 13f03c0.

📒 Files selected for processing (2)
  • CHANGELOG.md (1 hunks)
  • packages/web/src/app/[domain]/components/pathHeader.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • CHANGELOG.md
  • packages/web/src/app/[domain]/components/pathHeader.tsx
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build
✨ 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: 0

🧹 Nitpick comments (1)
packages/web/src/lib/utils.ts (1)

178-179: Consider consolidating redundant properties.

The implementation correctly propagates webUrl across all code host types. However, both repoLink and webUrl are now set to the same value, which creates redundancy.

Since the component now uses webUrl for the icon link and constructs its own path for the repository name link, consider removing the repoLink property in a future refactor to simplify the interface:

- repoLink: webUrl,

Also applies to: 190-191, 202-203, 215-216, 227-228, 239-240, 251-252

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between d5dc26c and 2dc8e01.

📒 Files selected for processing (2)
  • packages/web/src/app/[domain]/components/pathHeader.tsx (3 hunks)
  • packages/web/src/lib/utils.ts (8 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: build
  • GitHub Check: build
  • GitHub Check: build
🔇 Additional comments (5)
packages/web/src/lib/utils.ts (1)

157-157: LGTM: Well-designed type extension.

The addition of the optional webUrl property maintains backward compatibility while enabling the new linking behavior described in the PR objectives.

packages/web/src/app/[domain]/components/pathHeader.tsx (4)

20-20: LGTM: Proper domain context integration.

The addition of the useDomain hook enables dynamic path construction for the internal file browser navigation.

Also applies to: 64-64


228-242: Excellent implementation of conditional icon linking.

The conditional rendering properly implements the PR objective of linking the repository icon to the external repository when available, with appropriate security attributes for external links.


248-248: Verify the styling change is intentional.

The condition changed from a conditional expression to always true. This might be intentional since repository names should always be clickable now, but please confirm this change is deliberate.


250-250: Verify branch context handling in path construction.

The hard-coded HEAD/-/blob/ pattern might not preserve the user's current branch context. If a user is browsing a specific branch, clicking the repository name should ideally maintain that branch context.

Consider whether the path should use the current branch instead of always defaulting to HEAD:

- href={`/${domain}/browse/${repo.name}@HEAD/-/blob/`}
+ href={`/${domain}/browse/${repo.name}@${branchDisplayName || 'HEAD'}/-/blob/`}

Also verify if the path type should always be blob or if it should be tree when browsing directories.

@brendan-kellam
Copy link
Contributor

Also if you could add a changelog entry 🙏

@drew-u410 drew-u410 force-pushed the drew/repo_filebrowse_default branch 3 times, most recently from 5e29bf4 to d6f83e1 Compare June 6, 2025 23:12
@drew-u410
Copy link
Contributor Author

Also if you could add a changelog entry 🙏

Added!

I think all good now if you want to give it a local test.

@drew-u410 drew-u410 force-pushed the drew/repo_filebrowse_default branch from d6f83e1 to 13f03c0 Compare June 7, 2025 00:11
Copy link
Contributor

@brendan-kellam brendan-kellam left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@brendan-kellam brendan-kellam merged commit eb6d58d into sourcebot-dev:main Jun 7, 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