feat: copy server IP to clipboard#4264
Open
vytenisstaugaitis wants to merge 2 commits intoDokploy:canaryfrom
Open
feat: copy server IP to clipboard#4264vytenisstaugaitis wants to merge 2 commits intoDokploy:canaryfrom
vytenisstaugaitis wants to merge 2 commits intoDokploy:canaryfrom
Conversation
Comment on lines
+29
to
33
| }; | ||
|
|
||
| return ( | ||
| <div className="w-full"> | ||
| {/* <Card className={cn("rounded-lg w-full bg-transparent p-0", className)}></Card> */} |
Contributor
There was a problem hiding this comment.
Unhandled clipboard API rejection
navigator.clipboard.writeText() will reject (e.g., on HTTP pages, in browsers without Clipboard API support, or when permission is denied), but the async function is called from onClick without a .catch() handler, so the error silently disappears and setCopied(true) is never reached. Wrapping in a try/catch lets you surface the failure.
Suggested change
| }; | |
| return ( | |
| <div className="w-full"> | |
| {/* <Card className={cn("rounded-lg w-full bg-transparent p-0", className)}></Card> */} | |
| const handleCopy = async () => { | |
| try { | |
| await navigator.clipboard.writeText(webServerSettings?.serverIp || ""); | |
| setCopied(true); | |
| setTimeout(() => setCopied(false), 2000); | |
| } catch { | |
| // clipboard write failed (no HTTPS, permission denied, etc.) | |
| } | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this PR about?
Added a copy to clipboard button next to the Server IP field in the Web Server settings.
Checklist
Before submitting this PR, please make sure that:
canarybranch.Issues related (if applicable)
closes #3982
Screenshots (if applicable)
Greptile Summary
This PR adds a copy-to-clipboard button next to the Server IP field in the Web Server settings card, using the browser Clipboard API with a 2-second visual toggle between
CopyandCheckicons. The implementation is straightforward and isolated to a single component with no state-management or API changes.Confidence Score: 5/5
Safe to merge — the change is small, self-contained, and all remaining findings are P2 style suggestions.
No P0 or P1 issues. The two comments flag an unhandled async rejection (best-practice hardening) and a minor import style preference, neither of which blocks correct operation.
No files require special attention.
Comments Outside Diff (1)
apps/dokploy/components/dashboard/settings/web-server.tsx, line 13 (link)The default
Reactimport is only used forReact.useState. With the modern JSX transform already in use across this codebase, you can use the named import instead, which is the pattern used in sibling components.Then replace
React.useStatewithuseStateon line 27.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Reviews (1): Last reviewed commit: "[autofix.ci] apply automated fixes" | Re-trigger Greptile