import { useEffect, useState } from 'react'; import { Box, Button, Card, CardContent, Snackbar, Typography } from '@mui/material'; import CheckCircleOutlineIcon from '@mui/icons-material/CheckCircleOutline'; import ContentCopyIcon from '@mui/icons-material/ContentCopy'; import ShareIcon from '@mui/icons-material/Share'; // ← Replace this with the deployed Fly.io URL before sharing const STUDY_URL = 'https://stvident-colorization.hf.space'; export default function Done() { const [copied, setCopied] = useState(false); useEffect(() => { localStorage.removeItem('session_id'); localStorage.removeItem('trials'); localStorage.removeItem('current_index'); }, []); const handleCopy = async () => { try { await navigator.clipboard.writeText(STUDY_URL); setCopied(true); } catch { // Fallback for older browsers const el = document.createElement('textarea'); el.value = STUDY_URL; document.body.appendChild(el); el.select(); document.execCommand('copy'); document.body.removeChild(el); setCopied(true); } }; const handleShare = async () => { if (navigator.share) { await navigator.share({ title: 'Color Turing Test', text: 'Can you spot AI colorization? Take the test!', url: STUDY_URL, }).catch(() => {}); } else { handleCopy(); } }; return ( All done! Thank you. Your responses have been recorded. You completed 50 trials. This study examines how well AI colorization techniques fool human perception. {/* Share section */} Know someone who'd like to try? Share the study: {STUDY_URL} setCopied(false)} message="Link copied to clipboard" anchorOrigin={{ vertical: 'bottom', horizontal: 'center' }} /> ); }