The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import type { RefObject } from "react"; |
| 2 | import { msg } from "gt-react"; |
| 3 | |
| 4 | import { m } from "~/i18n/messages"; |
| 5 | import { anchoredToastManager } from "./toast"; |
| 6 | |
| 7 | export const ANCHORED_COPY_TOAST_TIMEOUT_MS = 1000; |
| 8 | |
| 9 | export function showAnchoredCopyErrorToast(ref: RefObject<HTMLButtonElement | null>, error: Error) { |
| 10 | if (!ref.current) return; |
| 11 | anchoredToastManager.add({ |
| 12 | type: "error", |
| 13 | positionerProps: { |
| 14 | anchor: ref.current, |
| 15 | }, |
| 16 | title: m(msg("Failed to copy")), |
| 17 | description: error.message, |
| 18 | }); |
| 19 | } |