feat(ui): add quick copy for package version#3056
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
|
Hello! Thank you for opening your first PR to npmx, @xusnitdinov! 🚀 Here’s what will happen next:
|
Lunaria Status Overview🌕 This pull request will trigger status changes. Learn moreBy default, every PR changing files present in the Lunaria configuration's You can change this by adding one of the keywords present in the Tracked Files
Warnings reference
|
📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds resolved package version copying through the command palette and a header button, with clipboard state and ChangesPackage version copy
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment Warning |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/components/Package/Header.vue`:
- Around line 336-345: Update the quick-copy button’s click handling around
copyVersion() to also call the announce() method exposed by useCommandPalette(),
using the same clipboard-success feedback as the command palette action.
Preserve the existing copyVersion behavior and button state updates.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 45418cad-0d0e-4b59-a839-a2cb7c20f4b3
📒 Files selected for processing (3)
app/components/Package/Header.vuei18n/locales/en.jsoni18n/schema.json
| <!-- Quick copy version --> | ||
| <ButtonBase | ||
| v-if="resolvedVersion" | ||
| size="sm" | ||
| variant="secondary" | ||
| :aria-label="copiedVersion ? $t('common.copied') : $t('package.copy_version')" | ||
| :classicon="copiedVersion ? 'i-lucide:check' : 'i-lucide:copy'" | ||
| :class="copiedVersion ? 'text-accent' : ''" | ||
| @click="copyVersion()" | ||
| /> |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Add screen-reader announcement for clipboard action.
The quick-copy button calls copyVersion() but omits the screen-reader announcement, whereas the command palette correctly announces the action. Based on learnings, clipboard copy feedback should be announced using the announce() method exposed by useCommandPalette().
♿ Proposed fix
<!-- Quick copy version -->
<ButtonBase
v-if="resolvedVersion"
size="sm"
variant="secondary"
:aria-label="copiedVersion ? $t('common.copied') : $t('package.copy_version')"
:classicon="copiedVersion ? 'i-lucide:check' : 'i-lucide:copy'"
:class="copiedVersion ? 'text-accent' : ''"
- `@click`="copyVersion()"
+ `@click`="copyVersion(); announce($t('command_palette.announcements.copied_to_clipboard'))"
/>(Note: You could also extract this combined copy and announce logic into a shared helper function in the <script setup> block to avoid duplication with the command palette action.)
📝 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.
| <!-- Quick copy version --> | |
| <ButtonBase | |
| v-if="resolvedVersion" | |
| size="sm" | |
| variant="secondary" | |
| :aria-label="copiedVersion ? $t('common.copied') : $t('package.copy_version')" | |
| :classicon="copiedVersion ? 'i-lucide:check' : 'i-lucide:copy'" | |
| :class="copiedVersion ? 'text-accent' : ''" | |
| @click="copyVersion()" | |
| /> | |
| <!-- Quick copy version --> | |
| <ButtonBase | |
| v-if="resolvedVersion" | |
| size="sm" | |
| variant="secondary" | |
| :aria-label="copiedVersion ? $t('common.copied') : $t('package.copy_version')" | |
| :classicon="copiedVersion ? 'i-lucide:check' : 'i-lucide:copy'" | |
| :class="copiedVersion ? 'text-accent' : ''" | |
| `@click`="copyVersion(); announce($t('command_palette.announcements.copied_to_clipboard'))" | |
| /> |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@app/components/Package/Header.vue` around lines 336 - 345, Update the
quick-copy button’s click handling around copyVersion() to also call the
announce() method exposed by useCommandPalette(), using the same
clipboard-success feedback as the command palette action. Preserve the existing
copyVersion behavior and button state updates.
Source: Learnings
Closes #2646
What
Adds a quick way to copy the current package version, mirroring the existing
Copy package nameaffordance.Changes
ButtonBase, shows a check + accent color on success).package-copy-version(grouped underpackage), mirroringpackage-copy-name, so it is keyboard-accessible and announcesCopied to clipboard.package.copy_version(Copy version) added toen.json(source of truth) andi18n/schema.json.Notes
useClipboardpattern withresolvedVersionas the source.