|
<!DOCTYPE html> |
|
<html lang="en"> |
|
<head> |
|
<meta charset="UTF-8"> |
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|
<title>WhatsApp Clone</title> |
|
<script src="https://cdn.tailwindcss.com"></script> |
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> |
|
<style> |
|
.chat-container { |
|
height: calc(100vh - 128px); |
|
} |
|
.sidebar { |
|
height: calc(100vh - 64px); |
|
} |
|
.message-input { |
|
resize: none; |
|
} |
|
.typing-indicator::after { |
|
content: '...'; |
|
animation: typing 1.5s infinite; |
|
} |
|
@keyframes typing { |
|
0% { content: '.'; } |
|
33% { content: '..'; } |
|
66% { content: '...'; } |
|
} |
|
.unread-badge { |
|
animation: pulse 2s infinite; |
|
} |
|
@keyframes pulse { |
|
0% { opacity: 1; } |
|
50% { opacity: 0.5; } |
|
100% { opacity: 1; } |
|
} |
|
</style> |
|
</head> |
|
<body class="bg-gray-100"> |
|
|
|
<nav class="bg-emerald-700 text-white p-4 shadow-md"> |
|
<div class="container mx-auto flex justify-between items-center"> |
|
<div class="flex items-center space-x-4"> |
|
<i class="fab fa-whatsapp text-2xl"></i> |
|
<span class="text-xl font-semibold">WhatsApp</span> |
|
</div> |
|
<div class="flex items-center space-x-4"> |
|
<button class="p-2 rounded-full hover:bg-emerald-600"> |
|
<i class="fas fa-search"></i> |
|
</button> |
|
<button class="p-2 rounded-full hover:bg-emerald-600"> |
|
<i class="fas fa-ellipsis-vertical"></i> |
|
</button> |
|
</div> |
|
</div> |
|
</nav> |
|
|
|
<div class="container mx-auto flex"> |
|
|
|
<div class="w-1/3 sidebar bg-white border-r border-gray-200 hidden md:block"> |
|
|
|
<div class="p-3 bg-gray-50 flex items-center space-x-3"> |
|
<div class="relative"> |
|
<img src="https://randomuser.me/api/portraits/men/1.jpg" alt="Profile" class="w-10 h-10 rounded-full"> |
|
<div class="absolute bottom-0 right-0 w-3 h-3 bg-green-500 rounded-full border-2 border-white"></div> |
|
</div> |
|
<div> |
|
<p class="font-semibold">John Doe</p> |
|
<p class="text-xs text-gray-500">Online</p> |
|
</div> |
|
</div> |
|
|
|
|
|
<div class="overflow-y-auto h-full"> |
|
<div class="p-3 border-b border-gray-100 flex items-center space-x-3 hover:bg-gray-50 cursor-pointer bg-gray-100"> |
|
<div class="relative"> |
|
<img src="https://randomuser.me/api/portraits/women/2.jpg" alt="Profile" class="w-12 h-12 rounded-full"> |
|
<div class="absolute bottom-0 right-0 w-3 h-3 bg-green-500 rounded-full border-2 border-white"></div> |
|
</div> |
|
<div class="flex-1"> |
|
<div class="flex justify-between items-center"> |
|
<p class="font-semibold">Sarah Smith</p> |
|
<span class="text-xs text-gray-500">10:30 AM</span> |
|
</div> |
|
<div class="flex justify-between items-center"> |
|
<p class="text-sm text-gray-600 truncate">Hey, how are you doing?</p> |
|
<span class="bg-green-500 text-white text-xs rounded-full h-5 w-5 flex items-center justify-center unread-badge">2</span> |
|
</div> |
|
</div> |
|
</div> |
|
|
|
<div class="p-3 border-b border-gray-100 flex items-center space-x-3 hover:bg-gray-50 cursor-pointer"> |
|
<div class="relative"> |
|
<img src="https://randomuser.me/api/portraits/men/3.jpg" alt="Profile" class="w-12 h-12 rounded-full"> |
|
<div class="absolute bottom-0 right-0 w-3 h-3 bg-gray-400 rounded-full border-2 border-white"></div> |
|
</div> |
|
<div class="flex-1"> |
|
<div class="flex justify-between items-center"> |
|
<p class="font-semibold">Work Group</p> |
|
<span class="text-xs text-gray-500">Yesterday</span> |
|
</div> |
|
<div class="flex justify-between items-center"> |
|
<p class="text-sm text-gray-600 truncate">Mike: The meeting is at 3pm</p> |
|
<i class="fas fa-check-double text-gray-400"></i> |
|
</div> |
|
</div> |
|
</div> |
|
|
|
<div class="p-3 border-b border-gray-100 flex items-center space-x-3 hover:bg-gray-50 cursor-pointer"> |
|
<div class="relative"> |
|
<img src="https://randomuser.me/api/portraits/women/4.jpg" alt="Profile" class="w-12 h-12 rounded-full"> |
|
<div class="absolute bottom-0 right-0 w-3 h-3 bg-green-500 rounded-full border-2 border-white"></div> |
|
</div> |
|
<div class="flex-1"> |
|
<div class="flex justify-between items-center"> |
|
<p class="font-semibold">Emma Johnson</p> |
|
<span class="text-xs text-gray-500">Yesterday</span> |
|
</div> |
|
<div class="flex justify-between items-center"> |
|
<p class="text-sm text-gray-600 truncate typing-indicator">Emma is typing</p> |
|
<i class="fas fa-check-double text-blue-500"></i> |
|
</div> |
|
</div> |
|
</div> |
|
|
|
|
|
</div> |
|
</div> |
|
|
|
|
|
<div class="flex-1 flex flex-col bg-gray-50"> |
|
|
|
<div class="p-3 bg-gray-100 border-b border-gray-200 flex items-center justify-between"> |
|
<div class="flex items-center space-x-3"> |
|
<button id="backButton" class="p-2 rounded-full hover:bg-gray-200 md:hidden"> |
|
<i class="fas fa-arrow-left"></i> |
|
</button> |
|
<div class="relative"> |
|
<img src="https://randomuser.me/api/portraits/women/2.jpg" alt="Profile" class="w-10 h-10 rounded-full"> |
|
<div class="absolute bottom-0 right-0 w-3 h-3 bg-green-500 rounded-full border-2 border-white"></div> |
|
</div> |
|
<div> |
|
<p class="font-semibold">Sarah Smith</p> |
|
<p class="text-xs text-gray-500">Online</p> |
|
</div> |
|
</div> |
|
<div class="flex items-center space-x-4"> |
|
<button class="p-2 rounded-full hover:bg-gray-200"> |
|
<i class="fas fa-phone"></i> |
|
</button> |
|
<button class="p-2 rounded-full hover:bg-gray-200"> |
|
<i class="fas fa-video"></i> |
|
</button> |
|
<button class="p-2 rounded-full hover:bg-gray-200"> |
|
<i class="fas fa-search"></i> |
|
</button> |
|
<button class="p-2 rounded-full hover:bg-gray-200"> |
|
<i class="fas fa-ellipsis-vertical"></i> |
|
</button> |
|
</div> |
|
</div> |
|
|
|
|
|
<div class="flex-1 chat-container overflow-y-auto p-4 space-y-3"> |
|
|
|
<div class="flex justify-center"> |
|
<span class="bg-gray-200 text-xs text-gray-600 px-2 py-1 rounded-full">TODAY</span> |
|
</div> |
|
|
|
|
|
<div class="flex items-start space-x-2"> |
|
<img src="https://randomuser.me/api/portraits/women/2.jpg" alt="Profile" class="w-8 h-8 rounded-full mt-1"> |
|
<div class="max-w-xs md:max-w-md"> |
|
<div class="bg-white p-3 rounded-lg rounded-tl-none shadow"> |
|
<p>Hey there! How are you doing?</p> |
|
</div> |
|
<span class="text-xs text-gray-500 mt-1">10:30 AM</span> |
|
</div> |
|
</div> |
|
|
|
|
|
<div class="flex justify-end"> |
|
<div class="max-w-xs md:max-w-md"> |
|
<div class="bg-emerald-100 p-3 rounded-lg rounded-tr-none shadow"> |
|
<p>I'm good, thanks! Just working on some projects.</p> |
|
</div> |
|
<div class="flex justify-end items-center space-x-1"> |
|
<span class="text-xs text-gray-500">10:32 AM</span> |
|
<i class="fas fa-check-double text-blue-500 text-xs"></i> |
|
</div> |
|
</div> |
|
</div> |
|
|
|
|
|
<div class="flex items-start space-x-2"> |
|
<img src="https://randomuser.me/api/portraits/women/2.jpg" alt="Profile" class="w-8 h-8 rounded-full mt-1"> |
|
<div class="max-w-xs md:max-w-md"> |
|
<div class="bg-white p-3 rounded-lg rounded-tl-none shadow"> |
|
<p>That's great! Would you like to meet for coffee this weekend?</p> |
|
</div> |
|
<span class="text-xs text-gray-500 mt-1">10:33 AM</span> |
|
</div> |
|
</div> |
|
|
|
|
|
<div class="flex justify-end"> |
|
<div class="max-w-xs md:max-w-md"> |
|
<div class="bg-emerald-100 p-3 rounded-lg rounded-tr-none shadow"> |
|
<p>Sure, that sounds good. How about Saturday at 2pm?</p> |
|
</div> |
|
<div class="flex justify-end items-center space-x-1"> |
|
<span class="text-xs text-gray-500">10:35 AM</span> |
|
<i class="fas fa-check-double text-blue-500 text-xs"></i> |
|
</div> |
|
</div> |
|
</div> |
|
|
|
|
|
<div class="flex items-start space-x-2"> |
|
<img src="https://randomuser.me/api/portraits/women/2.jpg" alt="Profile" class="w-8 h-8 rounded-full mt-1"> |
|
<div class="max-w-xs md:max-w-md"> |
|
<div class="bg-white p-3 rounded-lg rounded-tl-none shadow"> |
|
<p>Perfect! See you then at the usual place.</p> |
|
</div> |
|
<span class="text-xs text-gray-500 mt-1">10:36 AM</span> |
|
</div> |
|
</div> |
|
|
|
|
|
<div class="flex items-start space-x-2"> |
|
<img src="https://randomuser.me/api/portraits/women/2.jpg" alt="Profile" class="w-8 h-8 rounded-full mt-1"> |
|
<div class="max-w-xs md:max-w-md"> |
|
<div class="bg-white p-3 rounded-lg rounded-tl-none shadow"> |
|
<p class="typing-indicator"></p> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
|
|
|
|
<div class="p-3 bg-gray-100 border-t border-gray-200"> |
|
<div class="flex items-center space-x-2"> |
|
<button class="p-2 rounded-full hover:bg-gray-200"> |
|
<i class="far fa-face-smile text-gray-600"></i> |
|
</button> |
|
<button class="p-2 rounded-full hover:bg-gray-200"> |
|
<i class="fas fa-paperclip text-gray-600"></i> |
|
</button> |
|
<div class="flex-1"> |
|
<textarea id="messageInput" class="w-full message-input p-2 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-emerald-500 focus:border-transparent" rows="1" placeholder="Type a message"></textarea> |
|
</div> |
|
<button id="sendButton" class="p-2 rounded-full bg-emerald-600 text-white hover:bg-emerald-700"> |
|
<i class="fas fa-paper-plane"></i> |
|
</button> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
|
|
|
|
<div class="md:hidden fixed bottom-0 left-0 right-0 bg-white border-t border-gray-200"> |
|
<div class="flex justify-around items-center p-2"> |
|
<button class="p-3 text-gray-600"> |
|
<i class="fas fa-comment text-xl"></i> |
|
</button> |
|
<button class="p-3 text-gray-600"> |
|
<i class="fas fa-users text-xl"></i> |
|
</button> |
|
<button class="p-3 text-gray-600"> |
|
<i class="fas fa-phone text-xl"></i> |
|
</button> |
|
<button class="p-3 text-gray-600"> |
|
<i class="fas fa-gear text-xl"></i> |
|
</button> |
|
</div> |
|
</div> |
|
|
|
<script> |
|
|
|
const backButton = document.getElementById('backButton'); |
|
const sidebar = document.querySelector('.sidebar'); |
|
const chatArea = document.querySelector('.flex-1.flex.flex-col'); |
|
|
|
if (backButton) { |
|
backButton.addEventListener('click', () => { |
|
chatArea.classList.add('hidden'); |
|
sidebar.classList.remove('hidden'); |
|
}); |
|
} |
|
|
|
|
|
const messageInput = document.getElementById('messageInput'); |
|
const sendButton = document.getElementById('sendButton'); |
|
const messagesContainer = document.querySelector('.chat-container'); |
|
|
|
function sendMessage() { |
|
const message = messageInput.value.trim(); |
|
if (message) { |
|
|
|
const messageElement = document.createElement('div'); |
|
messageElement.className = 'flex justify-end'; |
|
messageElement.innerHTML = ` |
|
<div class="max-w-xs md:max-w-md"> |
|
<div class="bg-emerald-100 p-3 rounded-lg rounded-tr-none shadow"> |
|
<p>${message}</p> |
|
</div> |
|
<div class="flex justify-end items-center space-x-1"> |
|
<span class="text-xs text-gray-500">${new Date().toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'})}</span> |
|
<i class="fas fa-check-double text-gray-400 text-xs"></i> |
|
</div> |
|
</div> |
|
`; |
|
|
|
|
|
messagesContainer.appendChild(messageElement); |
|
|
|
|
|
messageInput.value = ''; |
|
|
|
|
|
messagesContainer.scrollTop = messagesContainer.scrollHeight; |
|
|
|
|
|
setTimeout(() => { |
|
const replies = [ |
|
"Sounds good!", |
|
"I'll get back to you on that.", |
|
"Thanks for letting me know.", |
|
"Can we talk about this later?", |
|
"👍", |
|
"Interesting! Tell me more." |
|
]; |
|
const randomReply = replies[Math.floor(Math.random() * replies.length)]; |
|
|
|
const replyElement = document.createElement('div'); |
|
replyElement.className = 'flex items-start space-x-2'; |
|
replyElement.innerHTML = ` |
|
<img src="https://randomuser.me/api/portraits/women/2.jpg" alt="Profile" class="w-8 h-8 rounded-full mt-1"> |
|
<div class="max-w-xs md:max-w-md"> |
|
<div class="bg-white p-3 rounded-lg rounded-tl-none shadow"> |
|
<p>${randomReply}</p> |
|
</div> |
|
<span class="text-xs text-gray-500 mt-1">${new Date().toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'})}</span> |
|
</div> |
|
`; |
|
|
|
messagesContainer.appendChild(replyElement); |
|
messagesContainer.scrollTop = messagesContainer.scrollHeight; |
|
}, 1000 + Math.random() * 2000); |
|
} |
|
} |
|
|
|
sendButton.addEventListener('click', sendMessage); |
|
|
|
messageInput.addEventListener('keypress', (e) => { |
|
if (e.key === 'Enter' && !e.shiftKey) { |
|
e.preventDefault(); |
|
sendMessage(); |
|
} |
|
}); |
|
|
|
|
|
messageInput.addEventListener('input', function() { |
|
this.style.height = 'auto'; |
|
this.style.height = (this.scrollHeight) + 'px'; |
|
}); |
|
|
|
|
|
setTimeout(() => { |
|
const notificationSound = new Audio('https://assets.mixkit.co/sfx/preview/mixkit-alarm-digital-clock-beep-989.mp3'); |
|
notificationSound.play().catch(e => console.log("Audio play failed:", e)); |
|
|
|
|
|
if (Notification.permission === "granted") { |
|
new Notification("New Message", { |
|
body: "Sarah: Can we talk about the project?", |
|
icon: "https://randomuser.me/api/portraits/women/2.jpg" |
|
}); |
|
} |
|
}, 5000); |
|
</script> |
|
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=ALIMHGFY/whatsapp" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> |
|
</html> |