import React, { useState } from 'react'; import { __ } from '@wordpress/i18n'; import { windowService } from '../../services/window.service'; import { AppIcon } from '../app-icon'; interface CopyButtonProps { text: string; buttonRef?: React.Ref; } export function CopyButton({ text, buttonRef }: CopyButtonProps): JSX.Element { const [isCopied, setIsCopied] = useState(false); const handleCopyClick = async (): Promise => { try { await windowService.copyToClipboard(text); setIsCopied(true); setTimeout(() => { setIsCopied(false); }, 2000); } catch (err) { alert(__('Failed to copy. Please copy manually.', 'timetailor-salon-booking')); } }; return ( ); }