Skip to content

Conversation

@Vaibhav-Vanjani
Copy link

@Vaibhav-Vanjani Vaibhav-Vanjani commented Dec 3, 2025

What does this PR do?

The copy button on the blog post was not working (earlier).Added visual feedback tooltip displaying "Copied!" confirmation when users copy shared content to clipboard.

Earlier
before-fix

Test Plan

After-fix-1 After-fix-2

Related PRs and Issues

#2605

Have you read the [Contributing Guidelines on issues]

Yes

Summary by CodeRabbit

  • New Features
    • Improved copy button with dynamic tooltip feedback displaying "Copied!" confirmation when the URL is successfully copied.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 3, 2025

Walkthrough

The pull request enhances the copy functionality in the blog post metadata component by replacing a basic copy button with a tooltip-enabled version. The change wraps the copy button in a Melt UI Tooltip component that displays dynamic text—"Copied!" when the URL is successfully copied and "Copy" otherwise. This requires adding a copied state, updating imports, and binding the copy action to the button's click handler.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Single component file affected with straightforward UI enhancement
  • State management for copied status is minimal and follows a common pattern
  • Tooltip integration uses existing library (Melt UI), reducing implementation risk
  • No complex logic or conditional branching beyond standard copy-on-click behavior
  • Verify that the tooltip timing and state reset logic work correctly across user interactions

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: fixing a non-functional copy button on the blog page, which matches the primary objective of implementing a working copy function with visual feedback.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Comment @coderabbitai help to get the list of available commands and usage tips.

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

🧹 Nitpick comments (2)
src/lib/components/blog/post-meta.svelte (2)

6-8: Copy helper integration looks correct

Importing Tooltip/melt and switching to const { copied, copy } = handleCopy(currentURL); cleanly fixes the “copy button not working” issue by using the helper as a hook and wiring a dedicated copy handler plus copied state.

One thing to keep in mind: if currentURL were ever to change during the lifetime of this component, handleCopy would not be re-run. For the current blog-post use case (URL is effectively static per render) this is fine, but if you later reuse this component in a more dynamic context, consider making the handleCopy call reactive to currentURL.

Also applies to: 31-31


93-107: Tooltip-wrapped copy button is wired and accessible

The tooltip integration around the non-link share action looks solid: the button uses onclick={copy} and use:melt={trigger}, keeps the existing aria-label, and surfaces clear feedback via $copied ? 'Copied!' : 'Copy'. This both restores the copy functionality and adds a nice UX touch.

If handleCopy does not already reset copied after a short delay, consider adding that behavior so the tooltip text returns to “Copy” automatically instead of staying on “Copied!” for the rest of the session.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9537107 and 8fe66d0.

📒 Files selected for processing (1)
  • src/lib/components/blog/post-meta.svelte (3 hunks)

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.

3 participants