Skip to content
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

Fixes issue #1027 Clickalbe languages/topics #1087

Closed
wants to merge 0 commits into from

Conversation

KaranNegi20Feb
Copy link
Contributor

@KaranNegi20Feb KaranNegi20Feb commented Mar 12, 2025

Improves the UX and makes languages/topics clickable. The click event should redirect user to the search page with the relevant query.

1.mov
2.1.mov

Copy link
Contributor

coderabbitai bot commented Mar 12, 2025

Summary by CodeRabbit

  • New Features
    • Updated list items to be clickable, allowing users to directly perform a Google search using the item text.
    • Added a hover effect that underlines the links to enhance interactivity and visual feedback.

Walkthrough

This pull request updates the ToggleableList component in the frontend. The component now renders its list items as clickable <a> elements instead of <span> elements. The <a> element includes an href attribute that constructs a Google search URL using the item text. Additionally, a hover:underline class is applied for styling purposes. The change affects the semantic structure of the list items, while the underlying logic for item display and toggle functionality remains intact.

Changes

File Summary
frontend/src/components/ToggleableList.tsx Modified list item rendering from <span> to <a> with dynamic Google search URL generation and added hover:underline styling.

Suggested reviewers

  • kasya
  • arkid15r

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fe619dc and 277e424.

📒 Files selected for processing (1)
  • frontend/src/components/ToggleableList.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/src/components/ToggleableList.tsx
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: CodeQL (python)
  • GitHub Check: CodeQL (javascript-typescript)
  • GitHub Check: Run frontend unit tests
  • GitHub Check: Run frontend e2e tests
  • GitHub Check: Run backend tests

🪧 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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

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
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 (1)
frontend/src/components/ToggleableList.tsx (1)

24-27: Good implementation of clickable items with search functionality.

The change from <span> to <a> elements is semantically correct for clickable items. The href attribute correctly constructs a Google search URL, and the hover:underline class provides appropriate visual feedback.

Consider these potential enhancements:

  1. Open links in a new tab with target="_blank" rel="noopener noreferrer" to maintain the user's context.
  2. Redirect to the application's internal search page instead of Google, as mentioned in the PR objectives.
<a
  key={index}
  href={`https://www.google.com/search?q=${item}`}
+ target="_blank"
+ rel="noopener noreferrer"
  className="rounded-lg border border-gray-400 px-2 py-1 text-sm hover:underline dark:border-gray-300"
>
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e6a44e6 and fe619dc.

📒 Files selected for processing (1)
  • frontend/src/components/ToggleableList.tsx (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: CodeQL (python)
  • GitHub Check: Run frontend e2e tests
  • GitHub Check: CodeQL (javascript-typescript)
  • GitHub Check: Run backend tests
  • GitHub Check: Run frontend unit tests

Comment on lines 24 to 30
<a
key={index}
className="rounded-lg border border-gray-400 px-2 py-1 text-sm dark:border-gray-300"
href={`https://www.google.com/search?q=${item}`}
className="rounded-lg border border-gray-400 px-2 py-1 text-sm hover:underline dark:border-gray-300"
>
{item}
</span>
</a>
Copy link
Contributor

@coderabbitai coderabbitai bot Mar 12, 2025

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider encoding the search query parameter for security.

The current implementation could have issues with special characters in the item text. URL-encoding the query parameter would prevent potential issues with items containing special characters.

<a
  key={index}
- href={`https://www.google.com/search?q=${item}`}
+ href={`https://www.google.com/search?q=${encodeURIComponent(item)}`}
  className="rounded-lg border border-gray-400 px-2 py-1 text-sm hover:underline dark:border-gray-300"
>
  {item}
</a>
📝 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
<a
key={index}
className="rounded-lg border border-gray-400 px-2 py-1 text-sm dark:border-gray-300"
href={`https://www.google.com/search?q=${item}`}
className="rounded-lg border border-gray-400 px-2 py-1 text-sm hover:underline dark:border-gray-300"
>
{item}
</span>
</a>
<a
key={index}
href={`https://www.google.com/search?q=${encodeURIComponent(item)}`}
className="rounded-lg border border-gray-400 px-2 py-1 text-sm hover:underline dark:border-gray-300"
>
{item}
</a>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolved!

Copy link
Contributor

Choose a reason for hiding this comment

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

@KaranNegi20Feb Great! I can see that you've implemented the URL encoding for the search query parameter using encodeURIComponent(). This is an important security practice that helps prevent issues with special characters in URLs. The PR looks good from this perspective.

@KaranNegi20Feb KaranNegi20Feb marked this pull request as draft March 12, 2025 16:27
@KaranNegi20Feb KaranNegi20Feb marked this pull request as ready for review March 12, 2025 16:33
@KaranNegi20Feb
Copy link
Contributor Author

Hey @arkid15r i have made the necessary change, please do review them, Thank you.

Copy link
Collaborator

@arkid15r arkid15r left a comment

Choose a reason for hiding this comment

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

Please keep the current look of the tags or improve it (just a link looks weird inside of a tag)

key={index}
className="rounded-lg border border-gray-400 px-2 py-1 text-sm dark:border-gray-300"
href={`https://www.google.com/search?q=${encodeURIComponent(item)}`}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
href={`https://www.google.com/search?q=${encodeURIComponent(item)}`}
href={`/projects?q=${encodeURIComponent(item)}`}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agreed

@KaranNegi20Feb KaranNegi20Feb marked this pull request as draft March 13, 2025 06:49
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.

2 participants