anycoder-70d45f77 / index.html
samirerty's picture
Upload folder using huggingface_hub
b170f30 verified
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>GlassChat iOS</title>
<!-- Google Fonts: Vazirmatn (for Persian support) and Inter -->
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Vazirmatn:wght@300;400;500;700&display=swap" rel="stylesheet">
<!-- FontAwesome CDN (Replacing truncated base64 to ensure icons work) -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
/* =========================================
USER PROVIDED CSS & UTILITIES
========================================= */
/* Tailwind Base Reset */
*, ::before, ::after {
box-sizing: border-box;
border-width: 0;
border-style: solid;
border-color: #e5e7eb;
}
body {
font-family: 'Inter', 'Vazirmatn', 'Tahoma', sans-serif;
background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #1e1b4b 100%);
background-attachment: fixed;
-webkit-tap-highlight-color: transparent;
margin: 0;
padding: 0;
color: white;
height: 100vh;
overflow: hidden;
}
/* Glassmorphism Core */
.glass-panel {
background: rgba(255, 255, 255, 0.08);
backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
border: 1px solid rgba(255, 255, 255, 0.15);
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}
.input-minimal {
background: rgba(0, 0, 0, 0.2);
border: 1px solid rgba(255, 255, 255, 0.1);
color: white;
transition: all 0.3s;
}
.input-minimal:focus {
background: rgba(0, 0, 0, 0.3);
border-color: rgba(255, 255, 255, 0.4);
outline: none;
box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
}
.input-minimal::placeholder {
color: rgba(255, 255, 255, 0.5);
}
/* Message Bubbles */
.message-bubble-me {
background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
border-radius: 18px 18px 4px 18px;
box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
border: 1px solid rgba(255, 255, 255, 0.1);
}
.message-bubble-other {
background: rgba(255, 255, 255, 0.12);
border-radius: 18px 18px 18px 4px;
border: 1px solid rgba(255, 255, 255, 0.05);
}
/* Animations */
.fade-in { animation: fadeIn 0.4s ease-out forwards; }
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.message-enter {
animation: messagePop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes messagePop {
0% { opacity: 0; transform: scale(0.85) translateY(20px); }
100% { opacity: 1; transform: scale(1) translateY(0); }
}
/* Utility Classes Mapping */
.hidden { display: none !important; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.h-screen { height: 100vh; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.m-0 { margin: 0; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-2xl { border-radius: 1rem; }
.rounded-full { border-radius: 9999px; }
.text-center { text-align: center; }
.text-white { color: white; }
.text-gray-300 { color: rgba(255,255,255, 0.7); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.font-bold { font-weight: bold; }
.font-medium { font-weight: 500; }
.cursor-pointer { cursor: pointer; }
.transition-all { transition: all 0.3s ease; }
.absolute { position: absolute; }
.relative { position: relative; }
.fixed { position: fixed; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.top-0 { top: 0; }
.bottom-0 { bottom: 0; }
.left-0 { left: 0; }
.right-0 { right: 0; }
.z-50 { z-index: 50; }
.z-40 { z-index: 40; }
.z-30 { z-index: 30; }
.bg-white { background-color: white; }
.bg-blue-600 { background-color: #2563eb; }
.bg-slate-900 { background-color: #0f172a; }
.bg-white\/10 { background-color: rgba(255, 255, 255, 0.1); }
.border { border-width: 1px; }
.border-t { border-top-width: 1px; }
.border-b { border-bottom-width: 1px; }
.border-white\/10 { border-color: rgba(255, 255, 255, 0.1); }
.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
/* Custom Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.4); }
/* =========================================
LAYOUT & RESPONSIVE
========================================= */
.app-container {
display: flex;
height: 100vh;
width: 100vw;
overflow: hidden;
}
/* Sidebar Styles */
.sidebar {
width: 320px;
display: flex;
flex-direction: column;
border-right: 1px solid rgba(255, 255, 255, 0.1);
background: rgba(20, 20, 40, 0.4);
backdrop-filter: blur(20px);
z-index: 20;
transition: transform 0.3s ease;
}
.chat-list-item {
padding: 1rem;
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
cursor: pointer;
transition: background 0.2s;
display: flex;
align-items: center;
gap: 1rem;
}
.chat-list-item:hover, .chat-list-item.active {
background: rgba(255, 255, 255, 0.1);
}
.avatar {
width: 48px;
height: 48px;
border-radius: 50%;
object-fit: cover;
border: 2px solid rgba(255, 255, 255, 0.2);
}
.status-dot {
width: 12px;
height: 12px;
background-color: #10b981;
border: 2px solid #1e1b4b;
border-radius: 50%;
position: absolute;
bottom: 0;
right: 0;
}
.avatar-container {
position: relative;
}
/* Main Chat Area */
.main-chat {
flex: 1;
display: flex;
flex-direction: column;
position: relative;
background: rgba(0,0,0,0.2);
}
.chat-header {
padding: 1rem 1.5rem;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
background: rgba(30, 27, 75, 0.6);
backdrop-filter: blur(20px);
display: flex;
justify-content: space-between;
align-items: center;
}
.messages-container {
flex: 1;
padding: 1.5rem;
overflow-y: auto;
display: flex;
flex-direction: column;
gap: 1rem;
}
.input-area {
padding: 1rem;
background: rgba(30, 27, 75, 0.8);
backdrop-filter: blur(20px);
border-top: 1px solid rgba(255, 255, 255, 0.1);
}
/* Sticker Picker */
.sticker-picker {
position: absolute;
bottom: 90px;
left: 20px;
right: 20px;
background: rgba(20, 20, 35, 0.95);
backdrop-filter: blur(25px);
border-radius: 20px;
padding: 15px;
display: grid;
grid-template-columns: repeat(6, 1fr);
gap: 10px;
max-height: 220px;
overflow-y: auto;
border: 1px solid rgba(255, 255, 255, 0.1);
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
z-index: 30;
transform-origin: bottom left;
transition: all 0.2s ease;
}
.sticker-picker.hidden {
transform: scale(0.9) translateY(20px);
opacity: 0;
pointer-events: none;
}
.sticker-item {
font-size: 28px;
display: flex;
align-items: center;
justify-content: center;
padding: 8px;
border-radius: 12px;
cursor: pointer;
transition: transform 0.1s;
}
.sticker-item:active { transform: scale(0.9); }
/* Mobile Responsive Logic */
.mobile-menu-btn { display: none; }
.sidebar-overlay { display: none; }
@media (max-width: 768px) {
.sidebar {
position: fixed;
top: 0;
right: 0;
height: 100vh;
width: 85%;
max-width: 320px;
transform: translateX(100%);
box-shadow: -10px 0 30px rgba(0,0,0,0.5);
}
.sidebar.open {
transform: translateX(0);
}
.sidebar-overlay {
display: block;
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.6);
backdrop-filter: blur(4px);
z-index: 15;
opacity: 0;
pointer-events: none;
transition: opacity 0.3s;
}
.sidebar-overlay.active {
opacity: 1;
pointer-events: auto;
}
.mobile-menu-btn {
display: flex;
align-items: center;
justify-content: center;
width: 40px;
height: 40px;
border-radius: 50%;
background: rgba(255,255,255,0.1);
cursor: pointer;
}
.main-chat { width: 100%; }
}
/* Link Style */
.anycoder-link {
color: rgba(255,255,255,0.5);
text-decoration: none;
font-size: 0.75rem;
transition: color 0.3s;
}
.anycoder-link:hover { color: white; }
</style>
</head>
<body>
<div class="app-container">
<!-- Mobile Sidebar Overlay -->
<div class="sidebar-overlay" id="sidebarOverlay" onclick="toggleSidebar()"></div>
<!-- Sidebar -->
<aside class="sidebar glass-panel" id="sidebar">
<!-- Sidebar Header -->
<div class="p-4 border-b border-white/10 flex justify-between items-center">
<div class="flex items-center gap-2">
<i class="fa-solid fa-comments text-blue-400 text-xl"></i>
<h2 class="text-lg font-bold">Messages</h2>
</div>
<div class="flex gap-3 text-gray-300">
<i class="fa-solid fa-pen-to-square cursor-pointer hover:text-white transition-all"></i>
<i class="fa-solid fa-gear cursor-pointer hover:text-white transition-all"></i>
</div>
</div>
<!-- Search -->
<div class="p-4">
<div class="relative">
<i class="fa-solid fa-magnifying-glass absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 text-sm"></i>
<input type="text" placeholder="Search" class="w-full bg-white/5 border border-white/10 rounded-full py-2 pl-9 pr-4 text-sm text-white focus:outline-none focus:border-blue-400/50 transition-all">
</div>
</div>
<!-- Chat List -->
<div class="flex-1 overflow-y-auto" id="chatList">
<!-- Chat Item 1 -->
<div class="chat-list-item active" onclick="selectChat(0)">
<div class="avatar-container">
<img src="https://picsum.photos/seed/sarah/100/100" class="avatar" alt="User">
<div class="status-dot"></div>
</div>
<div class="flex-1 overflow-hidden">
<div class="flex justify-between items-center mb-1">
<h3 class="font-medium text-sm truncate">Sarah Connor</h3>
<span class="text-xs text-gray-400">10:42 AM</span>
</div>
<p class="text-xs text-gray-400 truncate">Are we still meeting for coffee?</p>
</div>
</div>
<!-- Chat Item 2 -->
<div class="chat-list-item" onclick="selectChat(1)">
<div class="avatar-container">
<img src="https://picsum.photos/seed/john/100/100" class="avatar" alt="User">
</div>
<div class="flex-1 overflow-hidden">
<div class="flex justify-between items-center mb-1">
<h3 class="font-medium text-sm truncate">John Wick</h3>
<span class="text-xs text-gray-400">Yesterday</span>
</div>
<p class="text-xs text-gray-400 truncate">I'll be back.</p>
</div>
</div>
<!-- Chat Item 3 -->
<div class="chat-list-item" onclick="selectChat(2)">
<div class="avatar-container">
<img src="https://picsum.photos/seed/ellon/100/100" class="avatar" alt="User">
<div class="status-dot" style="background-color: #f59e0b;"></div>
</div>
<div class="flex-1 overflow-hidden">
<div class="flex justify-between items-center mb-1">
<h3 class="font-medium text-sm truncate">Ellon Musk</h3>
<span class="text-xs text-gray-400">Mon</span>
</div>
<p class="text-xs text-gray-400 truncate">Sending you the designs now.</p>
</div>
</div>
<!-- Chat Item 4 -->
<div class="chat-list-item" onclick="selectChat(3)">
<div class="avatar-container">
<img src="https://picsum.photos/seed/alex/100/100" class="avatar" alt="User">
<div class="status-dot"></div>
</div>
<div class="flex-1 overflow-hidden">
<div class="flex justify-between items-center mb-1">
<h3 class="font-medium text-sm truncate">Alex Designer</h3>
<span class="text-xs text-gray-400">Sun</span>
</div>
<p class="text-xs text-gray-400 truncate">Check out this new glass effect!</p>
</div>
</div>
</div>
<!-- User Profile (Bottom Sidebar) -->
<div class="p-4 border-t border-white/10 flex items-center gap-3 cursor-pointer hover:bg-white/5 transition-all">
<img src="https://picsum.photos/seed/me/100/100" class="w-10 h-10 rounded-full border border-white/20">
<div class="flex-1">
<h4 class="text-sm font-medium">My Account</h4>
<p class="text-xs text-gray-400">Online</p>
</div>
<a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" class="anycoder-link">
Built with anycoder
</a>
</div>
</aside>
<!-- Main Chat Area -->
<main class="main-chat">
<!-- Chat Header -->
<header class="chat-header">
<div class="flex items-center gap-3">
<div class="mobile-menu-btn" onclick="toggleSidebar()">
<i class="fa-solid fa-bars text-white"></i>
</div>
<div class="relative">
<img src="https://picsum.photos/seed/sarah/100/100" id="currentChatAvatar" class="w-10 h-10 rounded-full border border-white/20">
<div class="status-dot" id="currentChatStatus"></div>
</div>
<div>
<h2 class="font-bold text-base leading-tight" id="currentChatName">Sarah Connor</h2>
<p class="text-xs text-gray-400">Typing...</p>
</div>
</div>
<div class="flex gap-4 text-gray-300">
<i class="fa-solid fa-phone cursor-pointer hover:text-white transition-all"></i>
<i class="fa-solid fa-video cursor-pointer hover:text-white transition-all"></i>
<i class="fa-solid fa-circle-info cursor-pointer hover:text-white transition-all"></i>
</div>
</header>
<!-- Messages List -->
<div class="messages-container" id="messagesContainer">
<div class="text-center text-xs text-gray-500 my-4">Today</div>
<!-- Message Received -->
<div class="flex items-end gap-2 message-enter">
<img src="https://picsum.photos/seed/sarah/100/100" class="w-8 h-8 rounded-full mb-1">
<div class="message-bubble-other p-4 max-w-[75%]">
<p class="text-sm">Hey! Have you seen the new designs?</p>
</div>
</div>
<!-- Message Sent -->
<div class="flex items-end gap-2 justify-end message-enter" style="animation-delay: 0.1s;">
<div class="message-bubble-me p-4 max-w-[75%]">
<p class="text-sm">Yes, they look amazing! I love the glassmorphism style.</p>
</div>
</div>
<!-- Message Received -->
<div class="flex items-end gap-2 message-enter" style="animation-delay: 0.2s;">
<img src="https://picsum.photos/seed/sarah/100/100" class="w-8 h-8 rounded-full mb-1">
<div class="message-bubble-other p-4 max-w-[75%]">
<p class="text-sm">Great! Are we still meeting for coffee? ☕️</p>
</div>
</div>
</div>
<!-- Sticker Picker Overlay -->
<div class="sticker-picker hidden" id="stickerPicker">
<div class="sticker-item" onclick="sendSticker('😀')">😀</div>
<div class="sticker-item" onclick="sendSticker('😂')">😂</div>
<div class="sticker-item" onclick="sendSticker('😍')">😍</div>
<div class="sticker-item" onclick="sendSticker('🤔')">🤔</div>
<div class="sticker-item" onclick="sendSticker('👍')">👍</div>
<div class="sticker-item" onclick="sendSticker('🔥')">🔥</div>
<div class="sticker-item" onclick="sendSticker('❤️')">❤️</div>
<div class="sticker-item" onclick="sendSticker('🎉')">🎉</div>
<div class="sticker-item" onclick="sendSticker('🚀')">🚀</div>
<div class="sticker-item" onclick="sendSticker('💯')">💯</div>
<div class="sticker-item" onclick="sendSticker('🤖')">🤖</div>
<div class="sticker-item" onclick="sendSticker('💤')">💤</div>
</div>
<!-- Input Area -->
<div class="input-area">
<div class="flex items-center gap-3">
<div class="cursor-pointer text-gray-400 hover:text-yellow-400 transition-all text-xl" onclick="toggleStickers()">
<i class="fa-regular fa-face-smile"></i>
</div>
<div class="flex-1 relative">
<input type="text" id="messageInput" class="input-minimal w-full rounded-full py-3 px-5 text-sm" placeholder="Type a message..." autocomplete="off">
<i class="fa-solid fa-paperclip absolute right-4 top-1/2 transform -translate-y-1/2 text-gray-400 cursor-pointer hover:text-white"></i>
</div>
<button id="sendBtn" class="bg-blue-600 hover:bg-blue-500 text-white rounded-full w-12 h-12 flex items-center justify-center transition-all shadow-lg shadow-blue-600/30">
<i class="fa-solid fa-paper-plane text-sm"></i>
</button>
</div>
</div>
</main>
</div>
<script>
// DOM Elements
const messageInput = document.getElementById('messageInput');
const sendBtn = document.getElementById('sendBtn');
const messagesContainer = document.getElementById('messagesContainer');
const stickerPicker = document.getElementById('stickerPicker');
const sidebar = document.getElementById('sidebar');
const sidebarOverlay = document.getElementById('sidebarOverlay');
const chatListItems = document.querySelectorAll('.chat-list-item');
const currentChatName = document.getElementById('currentChatName');
const currentChatAvatar = document.getElementById('currentChatAvatar');
// Chat Data
const chats = [
{ name: "Sarah Connor", avatar: "https://picsum.photos/seed/sarah/100/100" },
{ name: "John Wick", avatar: "https://picsum.photos/seed/john/100/100" },
{ name: "Ellon Musk", avatar: "https://picsum.photos/seed/ellon/100/100" },
{ name: "Alex Designer", avatar: "https://picsum.photos/seed/alex/100/100" }
];
// Functions
function toggleSidebar() {
sidebar.classList.toggle('open');
sidebarOverlay.classList.toggle('active');
}
function toggleStickers() {
stickerPicker.classList.toggle('hidden');
}
function scrollToBottom() {
messagesContainer.scrollTop = messagesContainer.scrollHeight;
}
function createMessageElement(content, isMe = true, isSticker = false) {
const wrapper = document.createElement('div');
wrapper.className = `flex items-end gap-2 message-enter ${isMe ? 'justify-end' : ''}`;
let innerHTML = '';
if (isMe) {
innerHTML = `
<div class="message-bubble-me p-4 max-w-[75%] ${isSticker ? 'bg-transparent !border-0 !shadow-none !bg-none' : ''}">
${isSticker ? `<span style="font-size: 3rem;">${content}</span>` : `<p class="text-sm">${content}</p>`}
</div>
`;
} else {
innerHTML = `
<img src="${currentChatAvatar.src}" class="w-8 h-8 rounded-full mb-1">
<div class="message-bubble-other p-4 max-w-[75%] ${isSticker ? 'bg-transparent !border-0 !shadow-none' : ''}">
${isSticker ? `<span style="font-size: 3rem;">${content}</span>` : `<p class="text-sm">${content}</p>`}
</div>
`;
}
wrapper.innerHTML = innerHTML;
return wrapper;
}
function sendMessage() {
const text = messageInput.value.trim();
if (text) {
const msgEl = createMessageElement(text, true);
messagesContainer.appendChild(msgEl);
messageInput.value = '';
scrollToBottom();
// Simulate Reply
setTimeout(() => {
const replyEl = createMessageElement("That sounds great! 👍", false);
messagesContainer.appendChild(replyEl);
scrollToBottom();
}, 1500);
}
}
function sendSticker(emoji) {
const msgEl = createMessageElement(emoji, true, true);
messagesContainer.appendChild(msgEl);
stickerPicker.classList.add('hidden');
scrollToBottom();
}
function selectChat(index) {
// Update UI Active State
chatListItems.forEach(item => item.classList.remove('active'));
chatListItems[index].classList.add('active');
// Update Header Info
currentChatName.textContent = chats[index].name;
currentChatAvatar.src = chats[index].avatar;
// Clear current messages (simulation)
messagesContainer.innerHTML = `
<div class="text-center text-xs text-gray-500 my-4">Today</div>
<div class="flex items-center gap-2 justify-center opacity-50 my-10">
<img src="${chats[index].avatar}" class="w-16 h-16 rounded-full border-2 border-white/10">
</div>
<div class="text-center text-sm text-gray-300 mb-4">
Start of conversation with <br> <strong>${chats[index].name}</strong>
</div>
`;
// Close sidebar on mobile after selection
if (window.innerWidth <= 768) {
toggleSidebar();
}
}
// Event Listeners
sendBtn.addEventListener('click', sendMessage);
messageInput.addEventListener('keypress', (e) => {
if (e.key === 'Enter') {
sendMessage();
}
});
// Close sticker picker if clicking outside
document.addEventListener('click', (e) => {
if (!stickerPicker.contains(e.target) && !e.target.closest('.fa-face-smile')) {
stickerPicker.classList.add('hidden');
}
});
// Initial Scroll
scrollToBottom();
</script>
</body>
</html>