From d8fb93edcf9c83edc29af8f4aba0d00ef757f7ab Mon Sep 17 00:00:00 2001 From: Dotta Date: Thu, 5 Mar 2026 12:00:38 -0600 Subject: [PATCH] Auto-copy invite link on creation and replace Copy button with inline icon - Invite link is now automatically copied to clipboard when created - "Copied" badge appears next to the share link header for 2s - Standalone "Copy link" button replaced with a small copy icon next to the link - Icon toggles to a green checkmark while "copied" feedback is shown Co-Authored-By: Claude Opus 4.6 --- ui/src/pages/CompanySettings.tsx | 57 +++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 20 deletions(-) diff --git a/ui/src/pages/CompanySettings.tsx b/ui/src/pages/CompanySettings.tsx index c510c35f..003be3e8 100644 --- a/ui/src/pages/CompanySettings.tsx +++ b/ui/src/pages/CompanySettings.tsx @@ -6,7 +6,7 @@ import { companiesApi } from "../api/companies"; import { accessApi } from "../api/access"; import { queryKeys } from "../lib/queryKeys"; import { Button } from "@/components/ui/button"; -import { Settings } from "lucide-react"; +import { Settings, Check, Copy } from "lucide-react"; import { CompanyPatternIcon } from "../components/CompanyPatternIcon"; import { Field, ToggleField, HintIcon } from "../components/agent-config-primitives"; @@ -30,6 +30,7 @@ export function CompanySettings() { const [inviteLink, setInviteLink] = useState(null); const [inviteError, setInviteError] = useState(null); + const [copied, setCopied] = useState(false); const generalDirty = !!selectedCompany && @@ -61,13 +62,18 @@ export function CompanySettings() { allowedJoinTypes: "both", expiresInHours: 72, }), - onSuccess: (invite) => { + onSuccess: async (invite) => { setInviteError(null); const base = window.location.origin.replace(/\/+$/, ""); const absoluteUrl = invite.inviteUrl.startsWith("http") ? invite.inviteUrl : `${base}${invite.inviteUrl}`; setInviteLink(absoluteUrl); + try { + await navigator.clipboard.writeText(absoluteUrl); + setCopied(true); + setTimeout(() => setCopied(false), 2000); + } catch { /* clipboard may not be available */ } queryClient.invalidateQueries({ queryKey: queryKeys.sidebarBadges(selectedCompanyId!) }); }, onError: (err) => { @@ -247,27 +253,38 @@ export function CompanySettings() { Generate a link to invite humans or agents to this company. -
- - {inviteLink && ( - - )} -
+ {inviteError &&

{inviteError}

} {inviteLink && (
-
Share link
-
{inviteLink}
+
+
Share link
+ {copied && ( + + + Copied + + )} +
+
+
{inviteLink}
+ +
)}