-
Notifications
You must be signed in to change notification settings - Fork 3
fix: Refactor and fix clipboard #274
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
Conversation
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors clipboard functionality across the application by centralizing it into a reusable hook. The purpose is to standardize clipboard operations, error handling, and user feedback throughout the codebase.
- Introduces a new
useCopyToClipboard
hook that provides consistent clipboard functionality with proper error handling and toast notifications - Replaces inline clipboard implementations across multiple components with the centralized hook
- Consolidates translation keys for clipboard-related messages
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
src/hooks/useCopyToClipboard.ts | New hook providing centralized clipboard functionality with error handling and toast notifications |
src/components/Yaml/YamlViewer.tsx | Refactored to use the new clipboard hook instead of inline implementation |
src/components/Shared/CopyButton.tsx | Updated to use the centralized hook and standardized translation keys |
src/components/Dialogs/KubectlCommandInfo/KubectlTerminal.tsx | Simplified clipboard implementation using the new hook |
src/components/ControlPlanes/CopyKubeconfigButton.tsx | Replaced manual clipboard handling with the centralized hook |
public/locales/en.json | Consolidated clipboard-related translation keys into common section |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good job!
This PR fixes the issue where the UI indicated that text had been successfully copied to the clipboard when it had not.
It also refactors the clipboard functionality into a reusable hook.