'use client'; import { useState } from 'react'; interface ShareModalProps { roomSlug: string; onClose: () => void; } export default function ShareModal({ roomSlug, onClose }: ShareModalProps) { const [copied, setCopied] = useState(false); // In production, this would be .rmaps.online // For now, use path-based routing const shareUrl = typeof window !== 'undefined' ? `${window.location.origin}/room/${roomSlug}` : `https://rmaps.online/room/${roomSlug}`; const subdomainUrl = `https://${roomSlug}.rmaps.online`; const handleCopy = async () => { try { await navigator.clipboard.writeText(shareUrl); setCopied(true); setTimeout(() => setCopied(false), 2000); } catch (err) { console.error('Failed to copy:', err); } }; const handleShare = async () => { if (navigator.share) { try { await navigator.share({ title: `Join my rMaps room: ${roomSlug}`, text: 'Find me on rMaps!', url: shareUrl, }); } catch (err) { // User cancelled or share failed console.log('Share cancelled:', err); } } else { handleCopy(); } }; return (
{/* Backdrop */}
{/* Modal */}
{/* Close button */}

Share this Map

Invite friends to join your map. Anyone with this link can see your shared location.

{/* URL display */}
Room Link
{shareUrl}
{/* Subdomain preview */}
Coming soon
{subdomainUrl}
{/* Actions */}
{/* QR Code placeholder */}
Or scan QR code
QR Coming Soon
); }