@devries-cameron20 / t3code Mirror · read-only / commits / 5ef603df34
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 16:00 UTC

fix(web): remove routine success notifications (#36527)

Yash Singh committed Nov 14, 2026 at 01:07 UTC 5ef603df343c29c5c6fd1b8a8db0e705d2be9941
28 files changed +50 -236
apps/mobile/src/features/files/ZipArchiveView.tsx
-2
@@ -667,8 +667,6 @@ function ZipEntryView(props: {
667 () => {
668 if (controller.signal.aborted) return;
669 setBusy(null);
670 - if (kind === "attach")
671 - Dialog.alert("Added to chat", `${entry.name} is attached to your message.`);
670 },
671 (cause: unknown) => {
672 if (controller.signal.aborted) return;
apps/mobile/src/features/settings/SettingsNotificationsRouteScreen.tsx
+1 -3
@@ -202,9 +202,7 @@ function ConfiguredSettingsNotificationsRouteScreen() {
202 }
203 if (result.value.type === "granted") {
204 setNotificationStatus("enabled");
205 - if (agentAwarenessNotificationsReady()) {
206 - Dialog.alert("Notifications enabled", "Agent notifications are enabled for this device.");
207 - } else {
205 + if (!agentAwarenessNotificationsReady()) {
206 Dialog.alert(
207 "Couldn't finish enabling notifications",
208 "Notification access was granted, but this device could not be registered with T3 Connect. Notifications will start once registration succeeds.",
apps/web/src/components/BranchToolbar.tsx
+1 -9
@@ -117,15 +117,7 @@ function showWorkspaceContextMenu(event: ReactMouseEvent, workspacePath: string)
117 if (action !== "copy-path") return;
118 const clipboardPath = formatFilePathForClipboard(workspacePath);
119 void writeTextToClipboard(clipboardPath, "workspace path").then(
120 - (didCopy) => {
121 - if (didCopy) {
122 - toastManager.add({
123 - type: "success",
124 - title: "Path copied",
125 - description: clipboardPath,
126 - });
127 - }
128 - },
120 + undefined,
121 (error: unknown) => {
122 toastManager.add(
123 stackedThreadToast({
apps/web/src/components/BranchToolbarBranchSelector.tsx
+9 -19
@@ -364,25 +364,15 @@ export function BranchToolbarBranchSelector({
364 : null;
365
366 const copyBranchName = (branchName: string) => {
367 - void writeTextToClipboard(branchName, "branch name").then(
368 - (didCopy) => {
369 - if (!didCopy) return;
370 - toastManager.add({
371 - type: "success",
372 - title: "Branch name copied",
373 - description: branchName,
374 - });
375 - },
376 - (error: unknown) => {
377 - toastManager.add(
378 - stackedThreadToast({
379 - type: "error",
380 - title: "Failed to copy branch name",
381 - description: toBranchActionErrorMessage(error),
382 - }),
383 - );
384 - },
385 - );
367 + void writeTextToClipboard(branchName, "branch name").then(undefined, (error: unknown) => {
368 + toastManager.add(
369 + stackedThreadToast({
370 + type: "error",
371 + title: "Failed to copy branch name",
372 + description: toBranchActionErrorMessage(error),
373 + }),
374 + );
375 + });
376 };
377
378 const handleBranchContextMenu = (event: ReactMouseEvent, branchName: string | null) => {
apps/web/src/components/DiffFilePathCopyButton.browser.test.tsx
+1 -1
@@ -24,7 +24,7 @@ it("explains a denied clipboard write and lets the same path be copied again", a
24 await page.getByRole("button", { name: "Dismiss notification" }).click();
25 await copy.click();
26
27 - await expect.element(page.getByText("Copied!", { exact: true })).toBeVisible();
27 + await expect.element(page.getByText("Copied!", { exact: true })).not.toBeInTheDocument();
28 expect(write).toHaveBeenCalledTimes(2);
29 expect(write).toHaveBeenLastCalledWith("apps/web/src/index.ts");
30 });
apps/web/src/components/DiffFilePathCopyButton.tsx
+1 -6
@@ -1,18 +1,13 @@
1 import { CheckIcon, CopyIcon } from "lucide-react";
2 import { useRef } from "react";
3 import { useCopyToClipboard } from "../hooks/useCopyToClipboard";
4 -import {
5 - ANCHORED_COPY_TOAST_TIMEOUT_MS,
6 - showAnchoredCopyErrorToast,
7 - showAnchoredCopySuccessToast,
8 -} from "./ui/anchoredCopyToast";
4 +import { ANCHORED_COPY_TOAST_TIMEOUT_MS, showAnchoredCopyErrorToast } from "./ui/anchoredCopyToast";
5 import { Button } from "./ui/button";
6 import { Tooltip, TooltipPopup, TooltipTrigger } from "./ui/tooltip";
7
8 export function DiffFilePathCopyButton({ filePath }: { filePath: string }) {
9 const ref = useRef<HTMLButtonElement>(null);
10 const { copyToClipboard, isCopied } = useCopyToClipboard<void>({
15 - onCopy: () => showAnchoredCopySuccessToast(ref),
11 onError: (error) => showAnchoredCopyErrorToast(ref, error),
12 timeout: ANCHORED_COPY_TOAST_TIMEOUT_MS,
13 });
apps/web/src/components/KeybindingsUpdateToast.test.ts
+1 -2
@@ -44,7 +44,7 @@ function keybindingsUpdated(issues: ReadonlyArray<unknown>): ServerConfigStreamE
44 }
45
46 describe("startKeybindingsUpdateToasts", () => {
47 - it("toasts reloads the server reports after start", () => {
47 + it("only toasts invalid reloads the server reports after start", () => {
48 const stop = startKeybindingsUpdateToasts();
49 try {
50 appAtomRegistry.set(mocks.state, { latestEvent: keybindingsUpdated([]) });
@@ -55,7 +55,6 @@ describe("startKeybindingsUpdateToasts", () => {
55 });
56
57 expect(mocks.addToast.mock.calls.map(([toast]) => toast.title)).toEqual([
58 - "Keybindings updated",
58 "Invalid keybindings configuration",
59 ]);
60 } finally {
apps/web/src/components/KeybindingsUpdateToast.tsx
+1 -9
@@ -5,21 +5,13 @@ import { KeybindingsConfigWarning } from "./KeybindingsConfigWarning";
5 import { createKeybindingsUpdateToastController } from "./KeybindingsUpdateToast.logic";
6 import { stackedThreadToast, toastManager } from "./ui/toast";
7
8 -/** Toasts each keybindings reload the primary server reports. */
8 export function startKeybindingsUpdateToasts(): () => void {
9 const controller = createKeybindingsUpdateToastController({});
10 return subscribeAtomChanges(primaryServerConfigEventAtom, (event) => {
11 const decision = controller.handle(event);
12 if (!decision) return;
13
15 - if (decision._tag === "Success") {
16 - toastManager.add({
17 - type: "success",
18 - title: "Keybindings updated",
19 - description: "Keybindings configuration reloaded successfully.",
20 - });
21 - return;
22 - }
14 + if (decision._tag === "Success") return;
15
16 const serverConfig = appAtomRegistry.get(primaryServerConfigAtom);
17 toastManager.add(
apps/web/src/components/Sidebar.tsx
-21
@@ -942,13 +942,6 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
942 reportFailure: false,
943 });
944 const { copyToClipboard: copyPathToClipboard } = useCopyToClipboard<{ path: string }>({
945 - onCopy: ({ path }) => {
946 - toastManager.add({
947 - type: "success",
948 - title: "Path copied",
949 - description: path,
950 - });
951 - },
945 onError: (error) => {
946 toastManager.add(
947 stackedThreadToast({
@@ -961,13 +954,6 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
954 });
955 const { copyToClipboard: copyBranchToClipboard } = useCopyToClipboard<{ branch: string }>({
956 target: "branch name",
964 - onCopy: ({ branch }) => {
965 - toastManager.add({
966 - type: "success",
967 - title: "Branch copied",
968 - description: branch,
969 - });
970 - },
957 onError: (error) => {
958 toastManager.add(
959 stackedThreadToast({
@@ -979,13 +965,6 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
965 },
966 });
967 const { copyToClipboard: copyThreadIdToClipboard } = useCopyToClipboard<{ threadId: ThreadId }>({
982 - onCopy: ({ threadId }) => {
983 - toastManager.add({
984 - type: "success",
985 - title: "Thread ID copied",
986 - description: threadId,
987 - });
988 - },
968 onError: (error) => {
969 toastManager.add(
970 stackedThreadToast({
apps/web/src/components/chat/MarkdownFileLink.tsx
+13 -22
@@ -220,28 +220,19 @@ export const MarkdownFileLink = memo(function MarkdownFileLink({
220 }),
221 ])
222 : value.then((text) => navigator.clipboard.writeText(text));
223 - void Promise.all([write, value]).then(
224 - ([, text]) => {
225 - toastManager.add({
226 - type: "success",
227 - title: `${title} copied`,
228 - description: text,
229 - });
230 - },
231 - (error) => {
232 - reportMarkdownActionFailure(
233 - { operation: "copy-file-path", target: targetPath, copyTarget: title },
234 - error,
235 - );
236 - toastManager.add(
237 - stackedThreadToast({
238 - type: "error",
239 - title: `Failed to copy ${title.toLowerCase()}`,
240 - description: error instanceof Error ? error.message : "An error occurred.",
241 - }),
242 - );
243 - },
244 - );
223 + void Promise.all([write, value]).catch((error) => {
224 + reportMarkdownActionFailure(
225 + { operation: "copy-file-path", target: targetPath, copyTarget: title },
226 + error,
227 + );
228 + toastManager.add(
229 + stackedThreadToast({
230 + type: "error",
231 + title: `Failed to copy ${title.toLowerCase()}`,
232 + description: error instanceof Error ? error.message : "An error occurred.",
233 + }),
234 + );
235 + });
236 };
237
238 const showFileContextMenu = async (position: { x: number; y: number }) => {
apps/web/src/components/chat/MessageCopyButton.browser.test.tsx
+1 -1
@@ -25,6 +25,6 @@ it("explains a denied clipboard write and lets the same message be copied again"
25 await page.getByRole("button", { name: "Dismiss notification" }).click();
26 await copy.click();
27
28 - await expect.element(page.getByText("Copied!", { exact: true })).toBeVisible();
28 + await expect.element(page.getByText("Copied!", { exact: true })).not.toBeInTheDocument();
29 await expect.element(copy).toBeDisabled();
30 });
apps/web/src/components/chat/MessageCopyButton.tsx
-2
@@ -5,7 +5,6 @@ import { useCopyToClipboard } from "~/hooks/useCopyToClipboard";
5 import {
6 ANCHORED_COPY_TOAST_TIMEOUT_MS,
7 showAnchoredCopyErrorToast,
8 - showAnchoredCopySuccessToast,
8 } from "../ui/anchoredCopyToast";
9 import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
10
@@ -28,7 +27,6 @@ export const MessageCopyButton = memo(function MessageCopyButton({
27 }) {
28 const ref = useRef<HTMLButtonElement>(null);
29 const { copyToClipboard, isCopied } = useCopyToClipboard<void>({
31 - onCopy: () => showAnchoredCopySuccessToast(ref),
30 onError: (error: Error) => showAnchoredCopyErrorToast(ref, error),
31 timeout: ANCHORED_COPY_TOAST_TIMEOUT_MS,
32 ...(extraFlavors ? { extraFlavors } : {}),
apps/web/src/components/chat/useRightPanelActions.ts
+9 -18
@@ -262,24 +262,15 @@ export function useRightPanelActions(input: RightPanelActionsInput) {
262 relativePath,
263 resolvePathLinkTarget(relativePath, gitCwd ?? activeProjectCwd ?? ""),
264 );
265 - void navigator.clipboard.writeText(clipboardPath).then(
266 - () => {
267 - toastManager.add({
268 - type: "success",
269 - title: "Path copied",
270 - description: clipboardPath,
271 - });
272 - },
273 - (error) => {
274 - toastManager.add(
275 - stackedThreadToast({
276 - type: "error",
277 - title: "Failed to copy path",
278 - description: error instanceof Error ? error.message : "An error occurred.",
279 - }),
280 - );
281 - },
282 - );
265 + void navigator.clipboard.writeText(clipboardPath).then(undefined, (error) => {
266 + toastManager.add(
267 + stackedThreadToast({
268 + type: "error",
269 + title: "Failed to copy path",
270 + description: error instanceof Error ? error.message : "An error occurred.",
271 + }),
272 + );
273 + });
274 };
275 const copyRightPanelFilePathStable = useStableCallback(copyRightPanelFilePath);
276 const addPullRequestSurface = () => {
apps/web/src/components/files/FileBrowserPanel.tsx
-5
@@ -228,11 +228,6 @@ export default function FileBrowserPanel({
228 if (clicked === "copy-mention") {
229 try {
230 await writeTextToClipboard(mention);
231 - toastManager.add({
232 - type: "success",
233 - title: "Mention copied",
234 - description: relativePath,
235 - });
231 } catch (error) {
232 toastManager.add({
233 type: "error",
apps/web/src/components/media/MediaActions.tsx
+1 -8
@@ -173,10 +173,6 @@ export function MediaActions({
173 const clipboardText =
174 reference?.kind === "file" ? formatFilePathForClipboard(text, reference.path) : text;
175 await writeTextToClipboard(clipboardText, reference?.kind === "file" ? "file path" : "URL");
176 - toastManager.add({
177 - type: "success",
178 - title: action === "copy-url" ? "URL copied" : "Path copied",
179 - });
176 } else if (action === "open-file") {
177 assertCanReadMedia();
178 source.onOpenFile?.();
@@ -186,10 +182,7 @@ export function MediaActions({
182 title: action === "save" ? `Preparing ${noun} download…` : "Copying image…",
183 });
184 await (action === "save" ? save() : copyImage());
189 - toastManager.update(progressToast, {
190 - type: "success",
191 - title: action === "save" ? "Download started" : "Image copied",
192 - });
185 + toastManager.close(progressToast);
186 }
187 });
188 if (AsyncResult.isFailure(result)) {
apps/web/src/components/promptLinks/copyPromptLink.ts
+1 -2
@@ -69,8 +69,7 @@ export function composerPromptLink(input: {
69
70 export async function copyPromptLink(link: string): Promise<void> {
71 try {
72 - if (!(await writeTextToClipboard(link))) return;
73 - toastManager.add({ type: "success", title: "Prompt link copied" });
72 + await writeTextToClipboard(link);
73 } catch (error) {
74 toastManager.add(
75 stackedThreadToast({
apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx
-1
@@ -535,7 +535,6 @@ export function PullRequestDetailPanel({
535 const keybindings = useAtomValue(primaryServerKeybindingsAtom);
536 const { copyToClipboard: copyReference } = useCopyToClipboard<string>({
537 target: `${terminology.singular} reference`,
538 - onCopy: (label) => toastManager.add({ type: "success", title: `${label} copied` }),
538 onError: (error, label) =>
539 toastManager.add({
540 type: "error",
apps/web/src/components/pullRequest/PullRequestsPage.tsx
+7 -17
@@ -1443,23 +1443,13 @@ export function PullRequestsPage() {
1443 const { shortLabel, singular } = (
1444 sourceControlClients.findByChangeRequestUrl(url) ?? sourceControlClients.get(undefined)
1445 ).changeRequest;
1446 - void writeTextToClipboard(url, `${singular} link`).then(
1447 - (didCopy) => {
1448 - if (didCopy)
1449 - toastManager.add({
1450 - type: "success",
1451 - title: `${shortLabel} link copied`,
1452 - description: url,
1453 - });
1454 - },
1455 - (error) => {
1456 - toastManager.add({
1457 - type: "error",
1458 - title: `Failed to copy ${shortLabel} link`,
1459 - description: error instanceof Error ? error.message : "An error occurred.",
1460 - });
1461 - },
1462 - );
1446 + void writeTextToClipboard(url, `${singular} link`).then(undefined, (error) => {
1447 + toastManager.add({
1448 + type: "error",
1449 + title: `Failed to copy ${shortLabel} link`,
1450 + description: error instanceof Error ? error.message : "An error occurred.",
1451 + });
1452 + });
1453 });
1454 const closeActiveSurfaceFromShortcut = useEffectEvent((event: KeyboardEvent) => {
1455 if (activePullRequestSurface === null) return;
apps/web/src/components/settings/AboutVersionTitle.browser.test.tsx
+2 -2
@@ -6,7 +6,7 @@ import { APP_VERSION } from "../../branding";
6 import { AnchoredToastProvider } from "../ui/toast";
7 import { AboutVersionTitle } from "./AboutVersionTitle";
8
9 -it("shows copy confirmation when the version is clicked without waiting for a hover tooltip", async () => {
9 +it("copies the version without a notification", async () => {
10 await using screen = await render(
11 <AnchoredToastProvider>
12 <AboutVersionTitle />
@@ -17,5 +17,5 @@ it("shows copy confirmation when the version is clicked without waiting for a ho
17 await screen.getByRole("button", { name: `Copy version ${APP_VERSION}` }).click();
18
19 expect(write).toHaveBeenCalledWith(APP_VERSION);
20 - await expect.element(page.getByText(/^Copied!?$/)).toBeVisible();
20 + await expect.element(page.getByText(/^Copied!?$/)).not.toBeInTheDocument();
21 });
apps/web/src/components/settings/AboutVersionTitle.tsx
-6
@@ -1,17 +1,12 @@
1 -import { useRef } from "react";
2 -
1 import { APP_VERSION } from "../../branding";
2 import { useCopyToClipboard } from "../../hooks/useCopyToClipboard";
5 -import { showAnchoredCopySuccessToast } from "../ui/anchoredCopyToast";
3 import { InlineButton } from "../ui/button";
4 import { stackedThreadToast, toastManager } from "../ui/toast";
5 import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
6
7 export function AboutVersionTitle() {
11 - const copyButtonRef = useRef<HTMLButtonElement>(null);
8 const { copyToClipboard } = useCopyToClipboard<void>({
9 target: "version",
14 - onCopy: () => showAnchoredCopySuccessToast(copyButtonRef),
10 onError: (error) => {
11 toastManager.add(
12 stackedThreadToast({
@@ -31,7 +26,6 @@ export function AboutVersionTitle() {
26 <TooltipTrigger
27 render={
28 <InlineButton
34 - ref={copyButtonRef}
29 tone="muted"
30 aria-label={`Copy version ${APP_VERSION}`}
31 onClick={() => copyToClipboard(APP_VERSION, undefined)}
apps/web/src/components/settings/AcpSessionManagementSection.tsx
-4
@@ -265,7 +265,6 @@ function InstanceSessionManagement(
265 setSessions((current) =>
266 current.filter((candidate) => candidate.sessionId !== session.sessionId),
267 );
268 - toastManager.add({ type: "success", title: "ACP session deleted" });
268 return;
269 }
270 reportFailure("Could not delete ACP session", result);
@@ -338,7 +337,6 @@ function InstanceSessionManagement(
337 if (generation !== projectGeneration.current) return;
338 setSavingProviderId(null);
339 if (result._tag === "Success") {
341 - toastManager.add({ type: "success", title: "ACP provider configured" });
340 await loadProviders(provider.providerId);
341 return;
342 }
@@ -367,7 +365,6 @@ function InstanceSessionManagement(
365 if (generation !== projectGeneration.current) return;
366 setSavingProviderId(null);
367 if (result._tag === "Success") {
370 - toastManager.add({ type: "success", title: "ACP provider disabled" });
368 await loadProviders(provider.providerId);
369 return;
370 }
@@ -385,7 +382,6 @@ function InstanceSessionManagement(
382 if (result._tag === "Success") {
383 setSessions([]);
384 setNextCursor(null);
388 - toastManager.add({ type: "success", title: "Logged out of ACP agent" });
385 return;
386 }
387 reportFailure("Could not log out of ACP agent", result);
apps/web/src/components/settings/AuthorizedClientsSettings.tsx
-17
@@ -216,23 +216,6 @@ const PairingLinkListRow = memo(function PairingLinkListRow({
216 value: string;
217 kind: "code" | "hosted-link" | "link";
218 }>({
219 - onCopy: ({ kind }) => {
220 - toastManager.add({
221 - type: "success",
222 - title:
223 - kind === "hosted-link"
224 - ? "Hosted app link copied"
225 - : kind === "link"
226 - ? "Pairing URL copied"
227 - : "Pairing code copied",
228 - description:
229 - kind === "hosted-link"
230 - ? "Open it in the browser on the device you want to connect."
231 - : kind === "link"
232 - ? "Open it in the client you want to pair to this environment."
233 - : "Paste it into another client to finish pairing.",
234 - });
235 - },
219 onError: (error, { value, kind }) => {
220 // Captured per attempt so concurrent copies cannot make the dialog
221 // reveal a different value than the one that failed.
apps/web/src/components/settings/ConnectionDiagnosisDetails.tsx
-1
@@ -129,7 +129,6 @@ export function ConnectionDiagnosisPanel({
129 }) {
130 const { copyToClipboard } = useCopyToClipboard({
131 target: "connection diagnostics",
132 - onCopy: () => toastManager.add({ type: "success", title: "Diagnostics copied" }),
132 onError: (error) =>
133 toastManager.add(
134 stackedThreadToast({
apps/web/src/components/settings/SavedEnvironmentRows.tsx
-7
@@ -131,13 +131,6 @@ export function SavedBackendListRow({
131 const errorTraceId = environment.connection.traceId;
132 const { copyToClipboard: copyTraceIdToClipboard } = useCopyToClipboard<{ traceId: string }>({
133 target: "trace ID",
134 - onCopy: ({ traceId }) => {
135 - toastManager.add({
136 - type: "success",
137 - title: "Trace ID copied",
138 - description: traceId,
139 - });
140 - },
134 onError: (error) => {
135 toastManager.add(
136 stackedThreadToast({
apps/web/src/components/settings/ThemeEditorHost.tsx
-21
@@ -44,13 +44,6 @@ export function ThemeEditorHost() {
44 );
45 return false;
46 }
47 - toastManager.add(
48 - stackedThreadToast({
49 - type: "success",
50 - title: `${savedTheme.label} updated`,
51 - description: `Its ${mergedAppearance} palette was added.`,
52 - }),
53 - );
47 return true;
48 }
49 if (!created) {
@@ -60,13 +53,6 @@ export function ThemeEditorHost() {
53 themeHalves?.light === savedTheme.id ||
54 themeHalves?.dark === savedTheme.id;
55 if (wasActive) refreshTheme();
63 - toastManager.add(
64 - stackedThreadToast({
65 - type: "success",
66 - title: `${savedTheme.label} saved`,
67 - description: wasActive ? "Your changes are now active." : "Your changes are saved.",
68 - }),
69 - );
56 return true;
57 }
58
@@ -80,13 +66,6 @@ export function ThemeEditorHost() {
66 );
67 return false;
68 }
83 - toastManager.add(
84 - stackedThreadToast({
85 - type: "success",
86 - title: `${savedTheme.label} created`,
87 - description: "It’s now active.",
88 - }),
89 - );
69 return true;
70 };
71
apps/web/src/components/ui/anchoredCopyToast.ts
-14
@@ -3,20 +3,6 @@ import { anchoredToastManager } from "./toast";
3
4 export const ANCHORED_COPY_TOAST_TIMEOUT_MS = 1000;
5
6 -export function showAnchoredCopySuccessToast(ref: RefObject<HTMLButtonElement | null>) {
7 - if (!ref.current) return;
8 - anchoredToastManager.add({
9 - data: {
10 - tooltipStyle: true,
11 - },
12 - positionerProps: {
13 - anchor: ref.current,
14 - },
15 - timeout: ANCHORED_COPY_TOAST_TIMEOUT_MS,
16 - title: "Copied!",
17 - });
18 -}
19 -
6 export function showAnchoredCopyErrorToast(ref: RefObject<HTMLButtonElement | null>, error: Error) {
7 if (!ref.current) return;
8 anchoredToastManager.add({
apps/web/src/hooks/useThreadActionMenu.ts
-9
@@ -97,22 +97,13 @@ export function useThreadActionMenu(input: {
97 const confirmThreadArchive = useClientSettings((s) => s.confirmThreadArchive);
98 const timestampFormat = useClientSettings((s) => s.timestampFormat);
99 const { copyToClipboard: copyPathToClipboard } = useCopyToClipboard<{ path: string }>({
100 - onCopy: ({ path }) => {
101 - toastManager.add({ type: "success", title: "Path copied", description: path });
102 - },
100 onError: (error) => failureToast("Failed to copy path", error),
101 });
102 const { copyToClipboard: copyBranchToClipboard } = useCopyToClipboard<{ branch: string }>({
103 target: "branch name",
107 - onCopy: ({ branch }) => {
108 - toastManager.add({ type: "success", title: "Branch copied", description: branch });
109 - },
104 onError: (error) => failureToast("Failed to copy branch", error),
105 });
106 const { copyToClipboard: copyThreadIdToClipboard } = useCopyToClipboard<{ threadId: ThreadId }>({
113 - onCopy: ({ threadId }) => {
114 - toastManager.add({ type: "success", title: "Thread ID copied", description: threadId });
115 - },
107 onError: (error) => failureToast("Failed to copy thread ID", error),
108 });
109
apps/web/src/lib/copyThreadReference.ts
+1 -7
@@ -10,17 +10,11 @@ import { writeTextToClipboard } from "../hooks/useCopyToClipboard";
10 export async function copyThreadReference(target: ThreadReferenceCopyTarget): Promise<void> {
11 const fragment = target.fragment ? encodeComposerContextFragment(target.fragment) : null;
12 try {
13 - const didCopy = await writeTextToClipboard(
13 + await writeTextToClipboard(
14 target.value,
15 target.clipboardTarget,
16 fragment ? { [COMPOSER_CONTEXT_CLIPBOARD_MIME]: fragment } : undefined,
17 );
18 - if (!didCopy) return;
19 - toastManager.add({
20 - type: "success",
21 - title: target.successTitle,
22 - description: target.description,
23 - });
18 } catch (error) {
19 console.error(error);
20 toastManager.add(