mirror of
https://github.com/th30d4y/OpenLearnX.git
synced 2026-05-26 11:25:49 +00:00
5c416361b4
Signed-off-by: 5t4l1n <stalin78830@gmail.com>
643 lines
19 KiB
HTML
643 lines
19 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>BlockChat Login</title>
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
|
|
<style>
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
font-family: 'Segoe UI', sans-serif;
|
|
min-height: 100vh;
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
|
|
position: relative;
|
|
}
|
|
|
|
/* Animated background elements */
|
|
.bg-animation {
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
overflow: hidden;
|
|
z-index: 0;
|
|
pointer-events: none;
|
|
}
|
|
|
|
.floating-shape {
|
|
position: absolute;
|
|
opacity: 0.1;
|
|
animation: float 6s ease-in-out infinite;
|
|
}
|
|
|
|
.floating-shape:nth-child(1) {
|
|
top: 10%;
|
|
left: 10%;
|
|
font-size: 60px;
|
|
animation-delay: 0s;
|
|
}
|
|
|
|
.floating-shape:nth-child(2) {
|
|
top: 20%;
|
|
right: 20%;
|
|
font-size: 80px;
|
|
animation-delay: 1s;
|
|
}
|
|
|
|
.floating-shape:nth-child(3) {
|
|
bottom: 30%;
|
|
left: 20%;
|
|
font-size: 70px;
|
|
animation-delay: 2s;
|
|
}
|
|
|
|
.floating-shape:nth-child(4) {
|
|
bottom: 20%;
|
|
right: 10%;
|
|
font-size: 50px;
|
|
animation-delay: 3s;
|
|
}
|
|
|
|
@keyframes float {
|
|
0%, 100% {
|
|
transform: translateY(0px) rotate(0deg);
|
|
}
|
|
50% {
|
|
transform: translateY(-20px) rotate(180deg);
|
|
}
|
|
}
|
|
|
|
.login-container {
|
|
display: flex;
|
|
min-height: 100vh;
|
|
position: relative;
|
|
z-index: 1;
|
|
}
|
|
|
|
.left-panel {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: center;
|
|
align-items: center;
|
|
color: white;
|
|
padding: 60px;
|
|
text-align: center;
|
|
background: rgba(255, 255, 255, 0.1);
|
|
backdrop-filter: blur(20px);
|
|
min-height: 100vh;
|
|
}
|
|
|
|
.app-logo {
|
|
font-size: 120px;
|
|
margin-bottom: 30px;
|
|
background: linear-gradient(45deg, #fff, #f0f8ff);
|
|
-webkit-background-clip: text;
|
|
-webkit-text-fill-color: transparent;
|
|
text-shadow: 0 0 50px rgba(255,255,255,0.3);
|
|
animation: pulse 3s ease-in-out infinite;
|
|
}
|
|
|
|
@keyframes pulse {
|
|
0%, 100% {
|
|
transform: scale(1);
|
|
}
|
|
50% {
|
|
transform: scale(1.05);
|
|
}
|
|
}
|
|
|
|
.app-title {
|
|
font-size: 48px;
|
|
font-weight: 700;
|
|
margin-bottom: 20px;
|
|
text-shadow: 0 4px 20px rgba(0,0,0,0.3);
|
|
letter-spacing: 2px;
|
|
}
|
|
|
|
.app-subtitle {
|
|
font-size: 18px;
|
|
opacity: 0.9;
|
|
margin-bottom: 40px;
|
|
max-width: 500px;
|
|
line-height: 1.6;
|
|
}
|
|
|
|
.features-list {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 20px;
|
|
margin-top: 40px;
|
|
}
|
|
|
|
.feature-item {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 15px;
|
|
font-size: 16px;
|
|
opacity: 0.9;
|
|
}
|
|
|
|
.feature-item i {
|
|
font-size: 20px;
|
|
width: 30px;
|
|
}
|
|
|
|
.right-panel {
|
|
flex: 1;
|
|
background: rgba(255, 255, 255, 0.95);
|
|
backdrop-filter: blur(10px);
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: center;
|
|
align-items: center;
|
|
padding: 40px;
|
|
box-shadow: -10px 0 30px rgba(0,0,0,0.1);
|
|
min-height: 100vh;
|
|
}
|
|
|
|
.login-form {
|
|
width: 100%;
|
|
max-width: 500px;
|
|
}
|
|
|
|
.form-header {
|
|
text-align: center;
|
|
margin-bottom: 30px;
|
|
}
|
|
|
|
.form-title {
|
|
font-size: 32px;
|
|
color: #333;
|
|
margin-bottom: 15px;
|
|
font-weight: 700;
|
|
}
|
|
|
|
.form-subtitle {
|
|
color: #666;
|
|
font-size: 16px;
|
|
margin-bottom: 30px;
|
|
}
|
|
|
|
.status-box {
|
|
background: #f8f9fa;
|
|
border: 1px solid #e9ecef;
|
|
border-radius: 15px;
|
|
padding: 20px;
|
|
margin: 25px 0;
|
|
text-align: center;
|
|
font-size: 16px;
|
|
transition: all 0.3s ease;
|
|
}
|
|
|
|
.status-box.connected {
|
|
background: linear-gradient(135deg, #d1ecf1, #bee5eb);
|
|
border-color: #17a2b8;
|
|
color: #0c5460;
|
|
animation: success-pulse 2s ease-in-out;
|
|
}
|
|
|
|
.status-box.error {
|
|
background: linear-gradient(135deg, #f8d7da, #f5c6cb);
|
|
border-color: #dc3545;
|
|
color: #721c24;
|
|
}
|
|
|
|
@keyframes success-pulse {
|
|
0%, 100% {
|
|
transform: scale(1);
|
|
}
|
|
50% {
|
|
transform: scale(1.02);
|
|
}
|
|
}
|
|
|
|
.accounts-section {
|
|
margin: 20px 0;
|
|
max-height: 400px;
|
|
overflow-y: auto;
|
|
}
|
|
|
|
.accounts-title {
|
|
font-size: 20px;
|
|
color: #333;
|
|
margin-bottom: 20px;
|
|
font-weight: 600;
|
|
text-align: center;
|
|
}
|
|
|
|
.account-card {
|
|
background: linear-gradient(135deg, #f8f9fa, #e9ecef);
|
|
border: 2px solid #dee2e6;
|
|
border-radius: 20px;
|
|
padding: 20px;
|
|
margin: 15px 0;
|
|
cursor: pointer;
|
|
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.account-card::before {
|
|
content: '';
|
|
position: absolute;
|
|
top: 0;
|
|
left: -100%;
|
|
width: 100%;
|
|
height: 100%;
|
|
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
|
|
transition: left 0.6s ease;
|
|
}
|
|
|
|
.account-card:hover::before {
|
|
left: 100%;
|
|
}
|
|
|
|
.account-card:hover {
|
|
border-color: #667eea;
|
|
background: linear-gradient(135deg, #e3f2fd, #bbdefb);
|
|
transform: translateY(-3px) scale(1.01);
|
|
box-shadow: 0 10px 25px rgba(102, 126, 234, 0.2);
|
|
}
|
|
|
|
.account-card.selected {
|
|
background: linear-gradient(135deg, #667eea, #764ba2);
|
|
border-color: #667eea;
|
|
color: white;
|
|
transform: translateY(-3px) scale(1.01);
|
|
box-shadow: 0 15px 30px rgba(102, 126, 234, 0.4);
|
|
}
|
|
|
|
.account-header {
|
|
display: flex;
|
|
align-items: center;
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.account-icon {
|
|
width: 50px;
|
|
height: 50px;
|
|
background: linear-gradient(135deg, #667eea, #764ba2);
|
|
border-radius: 12px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
margin-right: 15px;
|
|
font-size: 20px;
|
|
color: white;
|
|
transition: transform 0.3s ease;
|
|
}
|
|
|
|
.account-card:hover .account-icon {
|
|
transform: rotate(5deg);
|
|
}
|
|
|
|
.account-card.selected .account-icon {
|
|
background: rgba(255,255,255,0.2);
|
|
}
|
|
|
|
.account-name {
|
|
font-size: 18px;
|
|
font-weight: 600;
|
|
margin-bottom: 5px;
|
|
}
|
|
|
|
.account-balance {
|
|
font-size: 12px;
|
|
opacity: 0.8;
|
|
}
|
|
|
|
.account-address {
|
|
font-family: 'Courier New', monospace;
|
|
font-size: 12px;
|
|
opacity: 0.8;
|
|
word-break: break-all;
|
|
line-height: 1.4;
|
|
margin-top: 8px;
|
|
padding: 8px;
|
|
background: rgba(0,0,0,0.05);
|
|
border-radius: 8px;
|
|
}
|
|
|
|
.account-card.selected .account-address {
|
|
background: rgba(255,255,255,0.1);
|
|
}
|
|
|
|
.login-btn {
|
|
background: linear-gradient(135deg, #667eea, #764ba2);
|
|
color: white;
|
|
border: none;
|
|
border-radius: 50px;
|
|
padding: 18px 35px;
|
|
font-size: 16px;
|
|
font-weight: 600;
|
|
width: 100%;
|
|
margin-top: 30px;
|
|
cursor: pointer;
|
|
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
|
|
text-transform: uppercase;
|
|
letter-spacing: 1px;
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.login-btn::before {
|
|
content: '';
|
|
position: absolute;
|
|
top: 0;
|
|
left: -100%;
|
|
width: 100%;
|
|
height: 100%;
|
|
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
|
|
transition: left 0.6s ease;
|
|
}
|
|
|
|
.login-btn:hover::before {
|
|
left: 100%;
|
|
}
|
|
|
|
.login-btn:hover:not(:disabled) {
|
|
background: linear-gradient(135deg, #5a67d8, #6b46c1);
|
|
transform: translateY(-3px);
|
|
box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
|
|
}
|
|
|
|
.login-btn:disabled {
|
|
background: #ccc;
|
|
cursor: not-allowed;
|
|
transform: none;
|
|
box-shadow: none;
|
|
}
|
|
|
|
/* Mobile responsiveness */
|
|
@media (max-width: 768px) {
|
|
.login-container {
|
|
flex-direction: column;
|
|
}
|
|
|
|
.left-panel {
|
|
flex: 0 0 auto;
|
|
min-height: 50vh;
|
|
padding: 30px;
|
|
}
|
|
|
|
.app-logo {
|
|
font-size: 80px;
|
|
}
|
|
|
|
.app-title {
|
|
font-size: 32px;
|
|
}
|
|
|
|
.app-subtitle {
|
|
font-size: 14px;
|
|
}
|
|
|
|
.right-panel {
|
|
flex: 1;
|
|
min-height: auto;
|
|
padding: 30px;
|
|
}
|
|
|
|
.form-title {
|
|
font-size: 24px;
|
|
}
|
|
|
|
.accounts-section {
|
|
max-height: 300px;
|
|
}
|
|
}
|
|
|
|
.spinner {
|
|
display: inline-block;
|
|
width: 20px;
|
|
height: 20px;
|
|
border: 3px solid #f3f3f3;
|
|
border-top: 3px solid #667eea;
|
|
border-radius: 50%;
|
|
animation: spin 1s linear infinite;
|
|
}
|
|
|
|
@keyframes spin {
|
|
0% { transform: rotate(0deg); }
|
|
100% { transform: rotate(360deg); }
|
|
}
|
|
|
|
/* Scrollbar styling */
|
|
.accounts-section::-webkit-scrollbar {
|
|
width: 8px;
|
|
}
|
|
|
|
.accounts-section::-webkit-scrollbar-track {
|
|
background: #f1f1f1;
|
|
border-radius: 10px;
|
|
}
|
|
|
|
.accounts-section::-webkit-scrollbar-thumb {
|
|
background: #667eea;
|
|
border-radius: 10px;
|
|
}
|
|
|
|
.accounts-section::-webkit-scrollbar-thumb:hover {
|
|
background: #5a67d8;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<!-- Animated background -->
|
|
<div class="bg-animation">
|
|
<div class="floating-shape">
|
|
<i class="fas fa-comments"></i>
|
|
</div>
|
|
<div class="floating-shape">
|
|
<i class="fas fa-lock"></i>
|
|
</div>
|
|
<div class="floating-shape">
|
|
<i class="fas fa-shield-alt"></i>
|
|
</div>
|
|
<div class="floating-shape">
|
|
<i class="fas fa-globe"></i>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="login-container">
|
|
<!-- Left Panel -->
|
|
<div class="left-panel">
|
|
<div class="app-logo">
|
|
<i class="fas fa-comments"></i>
|
|
</div>
|
|
<h1 class="app-title">BlockChat</h1>
|
|
<p class="app-subtitle">
|
|
Experience the future of secure messaging with blockchain technology.
|
|
Connect, communicate, and collaborate with complete privacy and transparency.
|
|
</p>
|
|
|
|
<div class="features-list">
|
|
<div class="feature-item">
|
|
<i class="fas fa-shield-alt"></i>
|
|
<span>End-to-end encrypted messaging</span>
|
|
</div>
|
|
<div class="feature-item">
|
|
<i class="fas fa-globe"></i>
|
|
<span>Decentralized blockchain network</span>
|
|
</div>
|
|
<div class="feature-item">
|
|
<i class="fas fa-infinity"></i>
|
|
<span>Permanent message history</span>
|
|
</div>
|
|
<div class="feature-item">
|
|
<i class="fas fa-bolt"></i>
|
|
<span>Lightning-fast message delivery</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Right Panel -->
|
|
<div class="right-panel">
|
|
<div class="login-form">
|
|
<div class="form-header">
|
|
<h2 class="form-title">Welcome Back</h2>
|
|
<p class="form-subtitle">Choose your blockchain account to continue</p>
|
|
</div>
|
|
|
|
<div class="status-box error" id="statusBox">
|
|
<div class="spinner"></div>
|
|
<span style="margin-left: 10px;">Connecting to blockchain network...</span>
|
|
</div>
|
|
|
|
<div class="accounts-section" id="accountsSection" style="display: none;">
|
|
<h3 class="accounts-title">Select Your Account</h3>
|
|
<div id="accountsList"></div>
|
|
</div>
|
|
|
|
<button class="login-btn" id="loginBtn" onclick="startChat()" disabled>
|
|
<i class="fas fa-rocket" style="margin-right: 10px;"></i>
|
|
Launch BlockChat
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/web3/1.7.4/web3.min.js"></script>
|
|
<script>
|
|
let web3;
|
|
let selectedAccount = null;
|
|
let accounts = [];
|
|
|
|
// Start when page loads
|
|
window.addEventListener('load', function() {
|
|
console.log('🚀 Starting BlockChat login...');
|
|
connectToBlockchain();
|
|
});
|
|
|
|
async function connectToBlockchain() {
|
|
try {
|
|
console.log('🔗 Connecting to Anvil blockchain...');
|
|
|
|
// Connect to Anvil
|
|
web3 = new Web3('http://127.0.0.1:8545');
|
|
|
|
// Test connection
|
|
const isListening = await web3.eth.net.isListening();
|
|
if (!isListening) {
|
|
throw new Error('Cannot connect to Anvil');
|
|
}
|
|
|
|
// Get accounts
|
|
accounts = await web3.eth.getAccounts();
|
|
console.log('✅ Found', accounts.length, 'accounts');
|
|
|
|
if (accounts.length === 0) {
|
|
throw new Error('No accounts found');
|
|
}
|
|
|
|
// Update status
|
|
updateStatus(true, `✅ Connected successfully! Found ${accounts.length} accounts`);
|
|
|
|
// Show accounts
|
|
showAccounts();
|
|
|
|
} catch (error) {
|
|
console.error('❌ Connection failed:', error);
|
|
updateStatus(false, '❌ Connection failed - Make sure Anvil is running');
|
|
}
|
|
}
|
|
|
|
function updateStatus(connected, message) {
|
|
const statusBox = document.getElementById('statusBox');
|
|
|
|
if (connected) {
|
|
statusBox.className = 'status-box connected';
|
|
statusBox.innerHTML = `<i class="fas fa-check-circle" style="margin-right: 10px;"></i><span>${message}</span>`;
|
|
} else {
|
|
statusBox.className = 'status-box error';
|
|
statusBox.innerHTML = `<i class="fas fa-exclamation-triangle" style="margin-right: 10px;"></i><span>${message}</span>`;
|
|
}
|
|
}
|
|
|
|
function showAccounts() {
|
|
const accountsSection = document.getElementById('accountsSection');
|
|
const accountsList = document.getElementById('accountsList');
|
|
|
|
let html = '';
|
|
accounts.forEach((account, index) => {
|
|
html += `
|
|
<div class="account-card" onclick="selectAccount('${account}', ${index})">
|
|
<div class="account-header">
|
|
<div class="account-icon">
|
|
<i class="fas fa-wallet"></i>
|
|
</div>
|
|
<div>
|
|
<div class="account-name">Account ${index + 1}</div>
|
|
<div class="account-balance">10,000 ETH Available</div>
|
|
</div>
|
|
</div>
|
|
<div class="account-address">${account}</div>
|
|
</div>
|
|
`;
|
|
});
|
|
|
|
accountsList.innerHTML = html;
|
|
accountsSection.style.display = 'block';
|
|
}
|
|
|
|
function selectAccount(account, index) {
|
|
selectedAccount = account;
|
|
console.log('📝 Selected account:', account);
|
|
|
|
// Update visual selection
|
|
document.querySelectorAll('.account-card').forEach(card => {
|
|
card.classList.remove('selected');
|
|
});
|
|
document.querySelectorAll('.account-card')[index].classList.add('selected');
|
|
|
|
// Enable login button
|
|
document.getElementById('loginBtn').disabled = false;
|
|
}
|
|
|
|
function startChat() {
|
|
if (!selectedAccount) {
|
|
alert('Please select an account first!');
|
|
return;
|
|
}
|
|
|
|
console.log('🚀 Starting chat with account:', selectedAccount);
|
|
|
|
// Store selected account
|
|
localStorage.setItem('myaddress', selectedAccount);
|
|
|
|
// Navigate to chat
|
|
window.location.href = 'account.html';
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|