Spaces:
Running

gmail / index.html
MEDAMJAD's picture
I'm looking for a program that allows me to enter an unlimited number of email addresses and receive all messages. The program's interface is divided into three sections: the first is reserved for the email address, and the second section is for the messages I receive, and the third section is for the message content. Generally I want it like an edisonmail program - Initial Deployment
2b327c4 verified
Raw History Blame Contribute Delete
19.3 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Unified Email Client</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/feather-icons"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<style>
.email-list-item:hover {
background-color: #f3f4f6;
}
.email-list-item.active {
background-color: #e5e7eb;
}
.custom-scrollbar::-webkit-scrollbar {
width: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
background: #f1f1f1;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
background: #c1c1c1;
border-radius: 3px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
background: #a8a8a8;
}
</style>
</head>
<body class="font-inter bg-gray-50 h-screen flex flex-col">
<!-- Header -->
<header class="bg-white shadow-sm py-3 px-6 flex items-center justify-between">
<div class="flex items-center space-x-2">
<i data-feather="mail" class="text-blue-500"></i>
<h1 class="text-xl font-semibold text-gray-800">Unified Mail</h1>
</div>
<div class="flex items-center space-x-4">
<button class="p-2 rounded-full hover:bg-gray-100">
<i data-feather="settings"></i>
</button>
<div class="w-8 h-8 rounded-full bg-blue-500 flex items-center justify-center text-white font-medium">
U
</div>
</div>
</header>
<div class="flex flex-1 overflow-hidden">
<!-- Sidebar - Email Accounts -->
<div class="w-64 bg-white border-r border-gray-200 flex flex-col">
<div class="p-4 border-b border-gray-200">
<button id="add-account-btn" class="w-full bg-blue-500 hover:bg-blue-600 text-white py-2 px-4 rounded-md flex items-center justify-center space-x-2 transition-colors">
<i data-feather="plus" class="w-4 h-4"></i>
<span>Add Account</span>
</button>
</div>
<div class="flex-1 overflow-y-auto custom-scrollbar">
<div class="p-4">
<h2 class="text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2">Email Accounts</h2>
<ul id="email-accounts-list" class="space-y-1">
<!-- Accounts will be added here dynamically -->
</ul>
</div>
</div>
</div>
<!-- Email List -->
<div class="w-96 bg-white border-r border-gray-200 flex flex-col">
<div class="p-3 border-b border-gray-200 flex items-center space-x-2">
<div class="flex-1 relative">
<i data-feather="search" class="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400"></i>
<input type="text" placeholder="Search emails..." class="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
</div>
<button class="p-2 rounded-md hover:bg-gray-100">
<i data-feather="filter"></i>
</button>
</div>
<div class="flex-1 overflow-y-auto custom-scrollbar">
<div id="email-list" class="divide-y divide-gray-200">
<!-- Emails will be added here dynamically -->
</div>
</div>
</div>
<!-- Email Content -->
<div class="flex-1 bg-white flex flex-col">
<div class="p-4 border-b border-gray-200 flex items-center justify-between">
<div class="flex items-center space-x-4">
<button id="back-to-list" class="md:hidden p-2 rounded-md hover:bg-gray-100">
<i data-feather="arrow-left"></i>
</button>
<h2 class="text-lg font-medium text-gray-800">Message</h2>
</div>
<div class="flex items-center space-x-2">
<button class="p-2 rounded-md hover:bg-gray-100">
<i data-feather="archive"></i>
</button>
<button class="p-2 rounded-md hover:bg-gray-100">
<i data-feather="trash-2"></i>
</button>
<button class="p-2 rounded-md hover:bg-gray-100">
<i data-feather="more-vertical"></i>
</button>
</div>
</div>
<div id="email-content" class="flex-1 overflow-y-auto custom-scrollbar p-6">
<div class="max-w-3xl mx-auto">
<!-- Email content will be displayed here -->
<div class="text-center py-20 text-gray-400">
<i data-feather="mail" class="w-12 h-12 mx-auto mb-4"></i>
<p>Select an email to read</p>
</div>
</div>
</div>
</div>
</div>
<!-- Add Account Modal -->
<div id="add-account-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
<div class="bg-white rounded-lg shadow-xl w-full max-w-md">
<div class="p-6">
<div class="flex items-center justify-between mb-4">
<h3 class="text-lg font-medium text-gray-900">Add Email Account</h3>
<button id="close-modal" class="text-gray-400 hover:text-gray-500">
<i data-feather="x"></i>
</button>
</div>
<div class="space-y-4">
<div>
<label for="email-address" class="block text-sm font-medium text-gray-700 mb-1">Email Address</label>
<input type="email" id="email-address" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="your@email.com">
</div>
<div>
<label for="email-password" class="block text-sm font-medium text-gray-700 mb-1">Password</label>
<input type="password" id="email-password" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="••••••••">
</div>
<div class="flex items-center">
<input type="checkbox" id="remember-me" class="h-4 w-4 text-blue-500 focus:ring-blue-500 border-gray-300 rounded">
<label for="remember-me" class="ml-2 block text-sm text-gray-700">Remember this account</label>
</div>
</div>
</div>
<div class="bg-gray-50 px-6 py-3 flex justify-end space-x-3 rounded-b-lg">
<button id="cancel-add-account" class="px-4 py-2 border border-gray-300 rounded-md text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
Cancel
</button>
<button id="confirm-add-account" class="px-4 py-2 bg-blue-500 border border-transparent rounded-md text-sm font-medium text-white hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
Add Account
</button>
</div>
</div>
</div>
<script>
feather.replace();
// Sample data for demonstration
const sampleEmails = [
{
id: 1,
from: "support@company.com",
subject: "Your subscription is expiring soon",
preview: "Your premium subscription will expire in 7 days. Renew now to avoid interruption...",
date: "10:30 AM",
read: false,
content: `<div>
<div class="flex items-center justify-between mb-6">
<div class="flex items-center space-x-4">
<div class="w-10 h-10 rounded-full bg-purple-500 flex items-center justify-center text-white font-medium">
S
</div>
<div>
<p class="font-medium">Support Team</p>
<p class="text-sm text-gray-500">support@company.com</p>
</div>
</div>
<div class="text-sm text-gray-500">10:30 AM, May 15</div>
</div>
<h1 class="text-2xl font-bold mb-4">Your subscription is expiring soon</h1>
<div class="prose max-w-none">
<p>Dear Valued Customer,</p>
<p>Your premium subscription will expire in 7 days. Renew now to avoid interruption of service.</p>
<p>We're offering a special 15% discount if you renew before the expiration date. Use code <strong>RENEW15</strong> at checkout.</p>
<p>To renew your subscription, simply click the button below:</p>
<div class="my-6">
<a href="#" class="inline-block bg-blue-500 hover:bg-blue-600 text-white font-medium py-2 px-6 rounded-md">Renew Subscription</a>
</div>
<p>If you have any questions about your subscription, please don't hesitate to contact our support team.</p>
<p>Best regards,<br>The Company Team</p>
</div>
</div>`
},
{
id: 2,
from: "newsletter@tech.com",
subject: "This Week in Tech: Latest Updates",
preview: "Here are the biggest tech stories of the week: Apple announces new products...",
date: "Yesterday",
read: true,
content: `<div>
<div class="flex items-center justify-between mb-6">
<div class="flex items-center space-x-4">
<div class="w-10 h-10 rounded-full bg-blue-500 flex items-center justify-center text-white font-medium">
T
</div>
<div>
<p class="font-medium">Tech Newsletter</p>
<p class="text-sm text-gray-500">newsletter@tech.com</p>
</div>
</div>
<div class="text-sm text-gray-500">May 14</div>
</div>
<h1 class="text-2xl font-bold mb-4">This Week in Tech: Latest Updates</h1>
<div class="prose max-w-none">
<p>Here are the biggest tech stories of the week:</p>
<h2 class="text-xl font-semibold mt-6">Apple Announces New Products</h2>
<p>Apple unveiled its latest lineup of products at the annual developer conference, including...</p>
<h2 class="text-xl font-semibold mt-6">Google's AI Breakthrough</h2>
<p>Google researchers have developed a new AI model that can...</p>
<h2 class="text-xl font-semibold mt-6">Microsoft's Cloud Expansion</h2>
<p>Microsoft announced plans to build three new data centers in Europe to...</p>
<p>Stay tuned for more updates next week!</p>
<p class="mt-8">- The Tech Newsletter Team</p>
</div>
</div>`
},
{
id: 3,
from: "jane.doe@example.com",
subject: "Meeting tomorrow at 2 PM",
preview: "Hi there, just a reminder about our meeting tomorrow at 2 PM in conference room B...",
date: "May 12",
read: true,
content: `<div>
<div class="flex items-center justify-between mb-6">
<div class="flex items-center space-x-4">
<div class="w-10 h-10 rounded-full bg-green-500 flex items-center justify-center text-white font-medium">
J
</div>
<div>
<p class="font-medium">Jane Doe</p>
<p class="text-sm text-gray-500">jane.doe@example.com</p>
</div>
</div>
<div class="text-sm text-gray-500">May 12</div>
</div>
<h1 class="text-2xl font-bold mb-4">Meeting tomorrow at 2 PM</h1>
<div class="prose max-w-none">
<p>Hi there,</p>
<p>Just a reminder about our meeting tomorrow at 2 PM in conference room B.</p>
<p>We'll be discussing:</p>
<ul class="list-disc pl-5">
<li>Q2 project updates</li>
<li>Budget review</li>
<li>Team expansion plans</li>
</ul>
<p>Please bring your reports and any materials you'd like to share with the team.</p>
<p>Looking forward to seeing everyone there!</p>
<p>Best,<br>Jane</p>
</div>
</div>`
}
];
// DOM elements
const addAccountBtn = document.getElementById('add-account-btn');
const addAccountModal = document.getElementById('add-account-modal');
const closeModalBtn = document.getElementById('close-modal');
const cancelAddAccountBtn = document.getElementById('cancel-add-account');
const confirmAddAccountBtn = document.getElementById('confirm-add-account');
const emailAccountsList = document.getElementById('email-accounts-list');
const emailList = document.getElementById('email-list');
const emailContent = document.getElementById('email-content');
const backToListBtn = document.getElementById('back-to-list');
// Event listeners
addAccountBtn.addEventListener('click', () => {
addAccountModal.classList.remove('hidden');
});
closeModalBtn.addEventListener('click', () => {
addAccountModal.classList.add('hidden');
});
cancelAddAccountBtn.addEventListener('click', () => {
addAccountModal.classList.add('hidden');
});
confirmAddAccountBtn.addEventListener('click', () => {
const email = document.getElementById('email-address').value;
if (email) {
addEmailAccount(email);
document.getElementById('email-address').value = '';
document.getElementById('email-password').value = '';
addAccountModal.classList.add('hidden');
}
});
backToListBtn.addEventListener('click', () => {
document.querySelector('.md\\:hidden').classList.add('hidden');
document.querySelector('.w-96').classList.remove('hidden');
});
// Functions
function addEmailAccount(email) {
const accountItem = document.createElement('li');
accountItem.className = 'flex items-center justify-between p-2 rounded-md hover:bg-gray-100 cursor-pointer';
accountItem.innerHTML = `
<div class="flex items-center space-x-3">
<div class="w-8 h-8 rounded-full bg-blue-500 flex items-center justify-center text-white text-xs font-medium">
${email.charAt(0).toUpperCase()}
</div>
<span class="text-sm font-medium truncate">${email}</span>
</div>
<i data-feather="chevron-right" class="w-4 h-4 text-gray-400"></i>
`;
accountItem.addEventListener('click', () => {
loadEmailsForAccount(email);
});
emailAccountsList.appendChild(accountItem);
feather.replace();
}
function loadEmailsForAccount(account) {
// Clear existing emails
emailList.innerHTML = '';
// Add sample emails
sampleEmails.forEach(email => {
const emailItem = document.createElement('div');
emailItem.className = `email-list-item p-4 cursor-pointer ${email.read ? '' : 'bg-blue-50'}`;
emailItem.innerHTML = `
<div class="flex items-center justify-between mb-1">
<span class="font-medium ${email.read ? 'text-gray-700' : 'text-gray-900'}">${email.from}</span>
<span class="text-xs text-gray-500">${email.date}</span>
</div>
<h3 class="font-medium ${email.read ? 'text-gray-700' : 'text-gray-900'} mb-1">${email.subject}</h3>
<p class="text-sm text-gray-500 truncate">${email.preview}</p>
`;
emailItem.addEventListener('click', () => {
// Mark as read
email.read = true;
emailItem.classList.remove('bg-blue-50');
emailItem.querySelectorAll('.font-medium').forEach(el => {
el.classList.remove('text-gray-900');
el.classList.add('text-gray-700');
});
// Show email content
emailContent.innerHTML = email.content;
feather.replace();
// On mobile, hide list and show content
if (window.innerWidth < 768) {
document.querySelector('.w-96').classList.add('hidden');
document.querySelector('.md\\:hidden').classList.remove('hidden');
}
});
emailList.appendChild(emailItem);
});
}
// Initialize with sample data
addEmailAccount('user@example.com');
loadEmailsForAccount('user@example.com');
// Responsive behavior
window.addEventListener('resize', () => {
if (window.innerWidth >= 768) {
document.querySelector('.w-96').classList.remove('hidden');
}
});
</script>
</body>
</html>