From 1530837f0082c3c91d5240500092c4536ef9f85e Mon Sep 17 00:00:00 2001 From: sebastjanartic <45803536-sebastjanartic@users.noreply.replit.com> Date: Mon, 4 Aug 2025 20:52:21 +0000 Subject: [PATCH] Improve how users share videos and copy links on social media platforms Enhance video sharing with react-share, adds a custom share menu, and improves the copy link feature with visual feedback. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 11420304-80a9-4ef2-adff-cbdaa418ffa8 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/11420304-80a9-4ef2-adff-cbdaa418ffa8/3TqKTBe --- client/src/components/video-modal.tsx | 60 +++++++++++++++++++-------- replit.md | 3 ++ 2 files changed, 46 insertions(+), 17 deletions(-) diff --git a/client/src/components/video-modal.tsx b/client/src/components/video-modal.tsx index 9b2e4f6..f0eb639 100644 --- a/client/src/components/video-modal.tsx +++ b/client/src/components/video-modal.tsx @@ -225,9 +225,26 @@ export default function VideoModal({ video, isOpen, onClose }: VideoModalProps) const copyToClipboard = async () => { try { await navigator.clipboard.writeText(getShareUrl()); - alert('Link copied to clipboard!'); + // Simple notification instead of alert + const notification = document.createElement('div'); + notification.textContent = 'Link copied!'; + notification.className = 'fixed top-4 right-4 bg-green-500 text-white px-4 py-2 rounded-lg z-50 transition-opacity duration-300'; + document.body.appendChild(notification); + setTimeout(() => { + notification.style.opacity = '0'; + setTimeout(() => document.body.removeChild(notification), 300); + }, 2000); + setShowShareMenu(false); } catch (error) { console.error('Failed to copy link:', error); + // Fallback for older browsers + const textArea = document.createElement('textarea'); + textArea.value = getShareUrl(); + document.body.appendChild(textArea); + textArea.select(); + document.execCommand('copy'); + document.body.removeChild(textArea); + setShowShareMenu(false); } }; @@ -288,41 +305,50 @@ export default function VideoModal({ video, isOpen, onClose }: VideoModalProps) {/* Share Menu */} {showShareMenu && (