skeletons, tournament stats, polish, bug fixes
This commit is contained in:
@@ -11,10 +11,30 @@ const EnrolledFreeAgent: React.FC<{ tournamentId: string }> = ({
|
||||
|
||||
const copyToClipboard = async (phone: string) => {
|
||||
try {
|
||||
await navigator.clipboard.writeText(phone);
|
||||
toast.success("Phone number copied!");
|
||||
if (navigator.clipboard && window.isSecureContext) {
|
||||
await navigator.clipboard.writeText(phone);
|
||||
toast.success("Phone number copied!");
|
||||
return;
|
||||
}
|
||||
|
||||
const textArea = document.createElement("textarea");
|
||||
textArea.value = phone;
|
||||
textArea.style.display = "hidden";
|
||||
document.body.appendChild(textArea);
|
||||
textArea.focus();
|
||||
textArea.select();
|
||||
|
||||
const successful = document.execCommand('copy');
|
||||
document.body.removeChild(textArea);
|
||||
|
||||
if (successful) {
|
||||
toast.success("Phone number copied!");
|
||||
} else {
|
||||
throw new Error("Copy command failed");
|
||||
}
|
||||
} catch (err) {
|
||||
toast.success("Failed to copy");
|
||||
console.error("Failed to copy:", err);
|
||||
toast.error("Failed to copy");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user