import { CheckCircle, Copy, Facebook, Linkedin, Twitter } from 'lucide-react'; import { useCopyText } from '../../hooks/use-copy-text'; import { cn } from '../../lib/classname'; import type { AllowedRoadmapVisibility } from '../CustomRoadmap/CreateRoadmap/CreateRoadmapModal'; type ShareSuccessProps = { roadmapId: string; onClose: () => void; visibility: AllowedRoadmapVisibility; description?: string; isSharingWithOthers?: boolean; }; export function ShareSuccess(props: ShareSuccessProps) { const { roadmapId, onClose, description, visibility, isSharingWithOthers = false, } = props; const baseUrl = import.meta.env.DEV ? 'http://localhost:3000' : 'https://roadmap.sh'; const shareLink = `${baseUrl}/r?id=${roadmapId}`; const { copyText, isCopied } = useCopyText(); const socialShareLinks = [ { title: 'Twitter', href: `https://twitter.com/intent/tweet?text=${description}&url=${shareLink}`, icon: Twitter, }, { title: 'Facebook', href: `https://www.facebook.com/sharer/sharer.php?quote=${description}&u=${shareLink}`, icon: Facebook, }, { title: 'Linkedin', href: `https://www.linkedin.com/sharing/share-offsite/?url=${shareLink}`, icon: Linkedin, }, ]; const embedHtml = ``; return (
{isSharingWithOthers ? (

Sharing with Others

) : (

Sharing Settings Updated

)}
{ e.currentTarget.select(); copyText(shareLink); }} /> {isSharingWithOthers ? (

You can share the above link with anyone

) : (

You can share the above link with anyone who has access

)}

You can also embed this roadmap on your website.

{ e.currentTarget.select(); copyText(embedHtml); }} readOnly={true} className="w-full resize-none rounded-md border bg-gray-50 p-2 text-sm" value={embedHtml} />
{visibility === 'public' && ( <>
Or
Share with others on
)}
); }