```react import React, { useState, useRef, useEffect } from 'react'; import { Send, User, Trash2, Plus, Signal, Wifi, Battery, Moon, Sun, Smartphone, Download, Camera } from 'lucide-react'; // Importation de html2canvas via CDN pour la capture d'écran const loadHtml2Canvas = () => { return new Promise((resolve) => { if (window.html2canvas) return resolve(window.html2canvas); const script = document.createElement('script'); script.src = 'https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js'; script.onload = () => resolve(window.html2canvas); document.head.appendChild(script); }); }; const App = () => { const [appType, setAppType] = useState('imessage'); const [theme, setTheme] = useState('dark'); const [contactName, setContactName] = useState('Mon Contact'); const [status, setStatus] = useState('En ligne'); const [messages, setMessages] = useState([ { id: 1, text: "Salut Lenzo ! Tu as fini le code ?", sender: 'other', time: '14:02' }, { id: 2, text: "Ouais, l'exportation d'image marche enfin ! 📸", sender: 'me', time: '14:03' } ]); const [inputText, setInputText] = useState(''); const [currentTime, setCurrentTime] = useState('14:05'); const [isDownloading, setIsDownloading] = useState(false); const phoneRef = useRef(null); const addMessage = (sender) => { if (!inputText.trim()) return; const newMessage = { id: Date.now(), text: inputText, sender: sender, time: new Date().toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }) }; setMessages([...messages, newMessage]); setInputText(''); }; const deleteMessage = (id) => { setMessages(messages.filter(m => m.id !== id)); }; const downloadImage = async () => { if (!phoneRef.current) return; setIsDownloading(true); try { const html2canvas = await loadHtml2Canvas(); const canvas = await html2canvas(phoneRef.current, { backgroundColor: theme === 'dark' ? '#000000' : '#ffffff', scale: 2, // Haute qualité pour TikTok useCORS: true, logging: false, borderRadius: 40 }); const link = document.createElement('a'); link.download = `fake-sms-${contactName.toLowerCase().replace(/\s+/g, '-')}.png`; link.href = canvas.toDataURL('image/png'); link.click(); } catch (err) { console.error("Erreur lors du téléchargement :", err); } finally { setIsDownloading(false); } }; const getAppStyles = () => { const isDark = theme === 'dark'; switch (appType) { case 'whatsapp': return { bg: isDark ? 'bg-[#0b141a]' : 'bg-[#e5ddd5]', header: isDark ? 'bg-[#202c33]' : 'bg-[#075e54]', bubbleMe: isDark ? 'bg-[#005c4b] text-[#e9edef]' : 'bg-[#dcf8c6] text-[#303030]', bubbleOther: isDark ? 'bg-[#202c33] text-[#e9edef]' : 'bg-white text-[#303030]', input: isDark ? 'bg-[#2a3942]' : 'bg-white', accent: 'text-[#00a884]' }; case 'messenger': return { bg: isDark ? 'bg-black' : 'bg-white', header: isDark ? 'bg-black/80' : 'bg-white/80', bubbleMe: 'bg-[#0084ff] text-white', bubbleOther: isDark ? 'bg-[#3e4042] text-white' : 'bg-[#e4e6eb] text-black', input: isDark ? 'bg-[#3e4042]' : 'bg-[#f0f2f5]', accent: 'text-[#0084ff]' }; default: return { bg: isDark ? 'bg-black' : 'bg-white', header: isDark ? 'bg-black/50' : 'bg-white/50', bubbleMe: 'bg-[#34b7f1] text-white', bubbleOther: isDark ? 'bg-[#262628] text-white' : 'bg-[#e9e9eb] text-black', input: isDark ? 'bg-[#1c1c1e]' : 'bg-[#f2f2f7]', accent: 'text-[#34b7f1]' }; } }; const styles = getAppStyles(); return (
{msg.text}