Skip to content

style: Adjust copy button position in APITabsComponent#8801

Merged
Cristhianzl merged 1 commit into
mainfrom
cz/fix-scroll-position
Jul 1, 2025
Merged

style: Adjust copy button position in APITabsComponent#8801
Cristhianzl merged 1 commit into
mainfrom
cz/fix-scroll-position

Conversation

@Cristhianzl
Copy link
Copy Markdown
Member

@Cristhianzl Cristhianzl commented Jul 1, 2025

This pull request includes a minor adjustment to the APITabsComponent in code-tabs.tsx. The change modifies the className property of the copy button to adjust its position slightly, moving it further to the right.

image

Copy button isn't overlapping the scroll bar anymore on Firefox.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 1, 2025

Walkthrough

The change updates the horizontal positioning of the copy-to-clipboard button in the API code tabs component by adjusting its CSS class, specifically increasing the right offset. There are no alterations to functionality, event handlers, or exported entities.

Changes

File(s) Change Summary
src/frontend/src/modals/apiModal/codeTabs/code-tabs.tsx Adjusted the copy-to-clipboard button's CSS class to increase the right offset (from right-2 to right-4).

Sequence Diagram(s)

No sequence diagram generated as the change is limited to UI styling and does not affect control flow or component interactions.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Post Copyable Unit Tests in Comment
  • Commit Unit Tests in branch cz/fix-scroll-position

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

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.

@github-actions github-actions Bot added the style Maintenance tasks and housekeeping label Jul 1, 2025
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jul 1, 2025
@github-actions github-actions Bot added style Maintenance tasks and housekeeping and removed style Maintenance tasks and housekeeping labels Jul 1, 2025
Copy link
Copy Markdown
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

🧹 Nitpick comments (2)
src/frontend/src/modals/apiModal/codeTabs/code-tabs.tsx (2)

23-23: Prefer the boolean primitive over the Boolean object wrapper

useState<Boolean> uses the boxed Boolean type, which is rarely desirable and can introduce subtle issues when comparing values. The primitive boolean is the idiomatic choice in TypeScript for state variables.

- const [isCopied, setIsCopied] = useState<Boolean>(false);
+ const [isCopied, setIsCopied] = useState<boolean>(false);

147-153: Add an accessible label to the copy button and remove the unused group utility class

The positional tweak looks fine, but the button currently lacks an aria-label/title, so screen-readers provide no context. The group class is also unused because there are no child selectors relying on it. Streamline the markup and improve accessibility:

- <Button
-   variant="ghost"
-   size="icon"
-   onClick={copyToClipboard}
-   data-testid="btn-copy-code"
-   className="!hover:bg-foreground group absolute right-4 top-2"
- >
+ <Button
+   aria-label={isCopied ? "Code copied to clipboard" : "Copy code to clipboard"}
+   title={isCopied ? "Copied!" : "Copy"}
+   variant="ghost"
+   size="icon"
+   onClick={copyToClipboard}
+   data-testid="btn-copy-code"
+   className="!hover:bg-foreground absolute right-4 top-2"
+ >
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 087fa34 and df42939.

📒 Files selected for processing (1)
  • src/frontend/src/modals/apiModal/codeTabs/code-tabs.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
`src/frontend/**/*.{ts,tsx}`: Use React 18 with TypeScript for all UI components and frontend logic.

src/frontend/**/*.{ts,tsx}: Use React 18 with TypeScript for all UI components and frontend logic.

📄 Source: CodeRabbit Inference Engine (.cursor/rules/frontend_development.mdc)

List of files the instruction was applied to:

  • src/frontend/src/modals/apiModal/codeTabs/code-tabs.tsx
`src/frontend/**/*.{ts,tsx,js,jsx,css,scss}`: Use Tailwind CSS for styling all frontend components.

src/frontend/**/*.{ts,tsx,js,jsx,css,scss}: Use Tailwind CSS for styling all frontend components.

📄 Source: CodeRabbit Inference Engine (.cursor/rules/frontend_development.mdc)

List of files the instruction was applied to:

  • src/frontend/src/modals/apiModal/codeTabs/code-tabs.tsx
🧠 Learnings (1)
src/frontend/src/modals/apiModal/codeTabs/code-tabs.tsx (1)
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/frontend_development.mdc:0-0
Timestamp: 2025-06-30T14:40:29.494Z
Learning: Applies to src/frontend/src/{components,hooks}/**/*.{ts,tsx} : Implement dark mode support in components and hooks where needed.
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Validate PR
  • GitHub Check: Validate PR
  • GitHub Check: autofix

@github-actions github-actions Bot added style Maintenance tasks and housekeeping and removed style Maintenance tasks and housekeeping labels Jul 1, 2025
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jul 1, 2025
@Cristhianzl Cristhianzl added this pull request to the merge queue Jul 1, 2025
Merged via the queue into main with commit b7af3d5 Jul 1, 2025
119 of 122 checks passed
@Cristhianzl Cristhianzl deleted the cz/fix-scroll-position branch July 1, 2025 17:22
lucaseduoli pushed a commit that referenced this pull request Jul 1, 2025
🐛 (code-tabs.tsx): fix button positioning by adjusting right margin to 4px instead of 2px
ogabrielluiz pushed a commit that referenced this pull request Jul 2, 2025
🐛 (code-tabs.tsx): fix button positioning by adjusting right margin to 4px instead of 2px
jordanrfrazier pushed a commit that referenced this pull request Jul 3, 2025
🐛 (code-tabs.tsx): fix button positioning by adjusting right margin to 4px instead of 2px
ogabrielluiz pushed a commit that referenced this pull request Jul 3, 2025
🐛 (code-tabs.tsx): fix button positioning by adjusting right margin to 4px instead of 2px
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files. style Maintenance tasks and housekeeping

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants