"use client"; import React from "react"; import { useTranslation } from "react-i18next"; import { toast } from "sonner"; import { SaveToast } from "~/components/notifications/SaveToast"; import { COPY_TOAST_DURATION_MS } from "~/hooks/use-copy-toast"; import { CopyToClipboardButton as CopyToClipboardButtonComponent } from "./CopyToClipboardButton"; /** * Add wrapper components and business logic here. * If you modify this file, disable Subframe sync for it to prevent overwrites. * Learn more: https://docs.subframe.com/concepts/syncing-components#wrapping-components */ type GeneratedProps = React.ComponentProps; export type CopyToClipboardButtonProps = Omit & { successKey?: string; errorKey?: string; onCopy?: (copied: boolean) => void; }; export const CopyToClipboardButton = React.forwardRef(function CopyToClipboardButton( { successKey, errorKey, onCopy, ...props }, ref ) { const { t } = useTranslation(); return ( { onCopy?.(copied); if (copied) { toast.custom( () => ( ), { duration: COPY_TOAST_DURATION_MS } ); return; } toast.custom( () => ( ), { duration: COPY_TOAST_DURATION_MS } ); }} /> ); });