Spaces:
Running

undefined / external-chat.html
moazelgen's picture
عايزو يبقا من بره وجهت محادثه عشان اكلمه
f9746fe verified
Raw History Blame Contribute Delete
7.49 kB
<!DOCTYPE html>
<html lang="en" class="scroll-smooth">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>External Chat | Cosmic Canvas</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/feather-icons"></script>
<script src="https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.globe.min.js"></script>
<style>
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&display=swap');
body {
font-family: 'Space Grotesk', sans-serif;
}
#vanta-bg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -1;
}
.gradient-text {
background: linear-gradient(90deg, #0ea5e9 0%, #8b5cf6 100%);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}
.chat-container {
height: calc(100vh - 200px);
}
</style>
</head>
<body class="bg-gray-900 text-white min-h-screen">
<div id="vanta-bg"></div>
<nav class="fixed w-full z-50 bg-gray-900/80 backdrop-blur-md">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between h-16 items-center">
<div class="flex items-center">
<span class="text-2xl font-bold gradient-text">Cosmic Canvas</span>
</div>
<div class="hidden md:flex space-x-8">
<a href="index.html" class="text-white hover:text-primary-400 transition">Home</a>
<a href="gallery.html" class="text-white hover:text-primary-400 transition">Gallery</a>
<a href="ai-lab.html" class="text-white hover:text-primary-400 transition">AI Lab</a>
<a href="about.html" class="text-white hover:text-primary-400 transition">About</a>
<a href="chat.html" class="text-white hover:text-primary-400 transition">Chat</a>
<a href="external-chat.html" class="text-white hover:text-primary-400 transition font-bold">External Chat</a>
<a href="tech-stack.html" class="text-white hover:text-primary-400 transition">Tech Stack</a>
<a href="tasks.html" class="text-white hover:text-primary-400 transition">Tasks</a>
</div>
<button class="md:hidden text-white">
<i data-feather="menu"></i>
</button>
</div>
</div>
</nav>
<main class="pt-24 pb-16 px-4 sm:px-6 lg:px-8">
<section class="max-w-7xl mx-auto">
<h1 class="text-5xl md:text-7xl font-bold mb-6 text-center">
<span class="gradient-text">External</span> Chat
</h1>
<div class="bg-gray-800/50 backdrop-blur-md rounded-xl border border-gray-700 p-6 chat-container">
<div class="flex flex-col h-full">
<div id="chat-messages" class="flex-1 overflow-y-auto mb-4 space-y-4">
<div class="flex justify-start">
<div class="max-w-xs md:max-w-md bg-gray-700 rounded-lg p-3">
<p>Welcome to external chat! Here you can connect with various chat services.</p>
</div>
</div>
</div>
<div class="flex flex-col space-y-4">
<div class="flex space-x-4">
<select id="chat-service" class="flex-1 bg-gray-700 text-white px-4 py-2 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500">
<option value="whatsapp">WhatsApp</option>
<option value="telegram">Telegram</option>
<option value="messenger">Messenger</option>
<option value="discord">Discord</option>
</select>
<button id="connect-btn" class="bg-primary-600 hover:bg-primary-700 text-white px-6 py-2 rounded-lg">
Connect
</button>
</div>
<div class="flex">
<input type="text" id="chat-input" class="flex-1 bg-gray-700 text-white px-4 py-2 rounded-l-lg focus:outline-none focus:ring-2 focus:ring-primary-500" placeholder="Type your message...">
<button id="send-btn" class="bg-secondary-600 hover:bg-secondary-700 text-white px-4 py-2 rounded-r-lg">
Send
</button>
</div>
</div>
</div>
</div>
</section>
</main>
<script>
feather.replace();
// Initialize Vanta.js background
VANTA.GLOBE({
el: "#vanta-bg",
mouseControls: true,
touchControls: true,
gyroControls: false,
minHeight: 200.00,
minWidth: 200.00,
scale: 1.00,
scaleMobile: 1.00,
color: 0x3b82f6,
backgroundColor: 0x111827
});
// Chat functionality
const chatMessages = document.getElementById('chat-messages');
const chatInput = document.getElementById('chat-input');
const sendBtn = document.getElementById('send-btn');
const connectBtn = document.getElementById('connect-btn');
const chatService = document.getElementById('chat-service');
function addMessage(text, isUser = false) {
const messageDiv = document.createElement('div');
messageDiv.className = `flex ${isUser ? 'justify-end' : 'justify-start'}`;
const bubbleDiv = document.createElement('div');
bubbleDiv.className = `max-w-xs md:max-w-md rounded-lg p-3 ${isUser ? 'bg-primary-600' : 'bg-gray-700'}`;
bubbleDiv.innerHTML = `<p>${text}</p>`;
messageDiv.appendChild(bubbleDiv);
chatMessages.appendChild(messageDiv);
chatMessages.scrollTop = chatMessages.scrollHeight;
}
connectBtn.addEventListener('click', function() {
const service = chatService.value;
addMessage(`Connecting to ${service}...`);
// Simulate connection
setTimeout(() => {
addMessage(`Connected to ${service}! You can now send messages.`);
}, 1500);
});
sendBtn.addEventListener('click', function() {
const message = chatInput.value.trim();
if (message) {
addMessage(message, true);
chatInput.value = '';
// Simulate response
setTimeout(() => {
addMessage(`This is a simulated response from the external chat service.`);
}, 1000);
}
});
chatInput.addEventListener('keypress', function(e) {
if (e.key === 'Enter') {
sendBtn.click();
}
});
</script>
</body>
</html>