Transaltor / index.html
Aichatbot12321's picture
Update index.html
17cce64 verified
Raw History Blame Contribute Delete
16.8 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AI Pro Suite - Dashboard</title>
<link rel="manifest" href="/manifest.json">
<meta name="theme-color" content="#0f172a">
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
<link rel="stylesheet" href="style.css">
<style>
/* Featured Hero Card for Lens Studio */
.featured-hero {
background: linear-gradient(135deg, #007aff, #a855f7);
border-radius: 20px;
padding: 24px;
margin-bottom: 25px;
display: flex;
align-items: center;
gap: 20px;
cursor: pointer;
box-shadow: 0 10px 30px rgba(59, 130, 246, 0.3);
transition: transform 0.3s ease, box-shadow 0.3s ease;
color: white;
position: relative;
overflow: hidden;
}
.featured-hero:hover {
transform: translateY(-5px);
box-shadow: 0 15px 35px rgba(168, 85, 247, 0.4);
}
.featured-hero::after {
content: '';
position: absolute;
top: -50%; right: -20%;
width: 150px; height: 150px;
background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 70%);
border-radius: 50%;
}
.hero-icon {
font-size: 42px;
background: rgba(255, 255, 255, 0.2);
width: 70px; height: 70px;
display: flex;
justify-content: center;
align-items: center;
border-radius: 18px;
backdrop-filter: blur(10px);
flex-shrink: 0;
}
.hero-text h2 {
margin: 0 0 4px 0;
font-size: 22px;
font-weight: 700;
letter-spacing: 0.5px;
}
.hero-text p {
margin: 0;
font-size: 14px;
opacity: 0.9;
font-weight: 400;
}
.pin-badge {
position: absolute;
top: 12px; right: 15px;
background: rgba(255,255,255,0.25);
padding: 4px 10px;
border-radius: 12px;
font-size: 11px;
font-weight: 700;
text-transform: uppercase;
backdrop-filter: blur(5px);
}
</style>
</head>
<body>
<div id="appLoader">
<div class="loader-logo">AI Pro Suite</div>
<div class="loader-bar-container">
<div class="loader-bar" id="loaderBar"></div>
</div>
<div class="loader-text" id="loaderText">Initializing Engine...</div>
</div>
<div class="overlay" id="overlay"></div>
<div class="topbar">
<div class="menuBtn" onclick="toggleSidebar()">☰</div>
<div class="appTitle">AI Pro Suite</div>
</div>
<div class="sidebar" id="sidebar" style="overflow-y:auto;">
<button class="sidebar-close-btn" onclick="toggleSidebar()">✖ Close Menu</button>
<button onclick="window.location.href='index.html'" style="border-left: 4px solid var(--primary); color: var(--primary); background: var(--border-light);">🏠 Dashboard</button>
<button onclick="window.location.href='lens.html'">✨ Lens Studio</button>
<button onclick="window.location.href='books.html'">📚 Book Deep Study</button>
<button onclick="window.location.href='maths.html'">🧮 Math Solver</button>
<button onclick="window.location.href='search.html'">🔎 Deep Search</button>
<button onclick="window.location.href='downloader.html'">📥 Video Downloader</button>
<button onclick="window.location.href='browser-agent.html'">🤖 AI Browser</button>
<button onclick="window.location.href='board.html'">📋 Whiteboard</button>
<button onclick="window.location.href='clone.html'">📑 Website Cloner</button>
<button onclick="window.location.href='runhtml.html'">🌐 Write HTML</button>
<button onclick="window.location.href='youtube.html'">▶️ YouTube Search</button>
<button onclick="window.location.href='managequiz.html'">⚙️ Manage Quiz</button>
<button onclick="window.location.href='tutor.html'">👨‍🏫 AI Tutor</button>
<button onclick="window.location.href='quiz.html'">📝 Take a Quiz!</button>
<button onclick="window.location.href='book_quiz.html'">📝 Take a Book Quiz!</button>
<button onclick="window.location.href='tables.html'">🔢 Maths Table</button>
<button onclick="window.location.href='coding.html'">💻 AI Coding</button>
<button onclick="window.location.href='chess.html'">♟️ Chess AI</button>
<button onclick="window.location.href='translator.html'">🎙️ Text Translator</button>
<button onclick="window.location.href='image.html'">🖼️ Image Translator</button>
<button onclick="window.location.href='create.html'">🎨 Image Creator</button>
<button onclick="window.location.href='qa.html'">📚 Document Q&A</button>
<button onclick="window.location.href='history.html'">🕒 History & Downloads</button>
<button onclick="window.location.href='storage.html'">📂 Storage</button>
<button onclick="window.location.href='hub.html'">🛰️ HF Command Center</button>
<button onclick="window.location.href='live.html'">🗣️ Gemini Live</button>
</div>
<div class="page active" id="homePage" style="top: 70px;">
<div style="text-align: center; margin-bottom: 30px; margin-top: 20px;">
<h1 style="font-size: 28px; background: linear-gradient(90deg, #3b82f6, #a855f7); -webkit-background-clip: text; -webkit-text-fill-color: transparent;">Welcome to AI Pro Suite</h1>
<p style="color: var(--muted); margin-top: 10px;">Select a tool below to get started</p>
</div>
<div class="card" style="margin-bottom: 25px; border-top: 3px solid #3b82f6;">
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px;">
<div>
<div class="cardTitle" style="margin: 0;">📊 Live API Usage</div>
<div id="apiResetTimer" style="font-size: 13px; color: #f59e0b; font-weight: 600; margin-top: 4px; letter-spacing: 0.5px;">
⏳ Quota Reset: Calculating...
</div>
</div>
<button class="actionBtnSmall blue" onclick="fetchApiUsage()" title="Refresh Stats">🔄</button>
</div>
<div id="apiUsageContainer" style="display: flex; flex-wrap: wrap; gap: 10px;">
<div style="color: var(--muted); font-size: 14px;">Loading server stats...</div>
</div>
</div>
<div class="featured-hero" onclick="window.location.href='lens.html'">
<div class="pin-badge">📌 Top Tool</div>
<div class="hero-icon">✨</div>
<div class="hero-text">
<h2>Lens Studio</h2>
<p>Advanced AI Vision, OCR Text Selection & Translation.</p>
</div>
</div>
<div class="dashboard-grid">
<div class="dash-card" onclick="window.location.href='books.html'">
<div class="dash-icon">📚</div>
<div class="dash-title">Book Deep Study</div>
</div>
<div class="dash-card" onclick="window.location.href='search.html'">
<div class="dash-icon">🔎</div>
<div class="dash-title">Deep Search</div>
</div>
<div class="dash-card" onclick="window.location.href='downloader.html'">
<div class="dash-icon">📥</div>
<div class="dash-title">Video Downloader</div>
</div>
<div class="dash-card" onclick="window.location.href='board.html'">
<div class="dash-icon">📋</div>
<div class="dash-title">Whiteboard</div>
</div>
<div class="dash-card" onclick="window.location.href='clone.html'">
<div class="dash-icon">📑</div>
<div class="dash-title">Website Cloner</div>
</div>
<div class="dash-card" onclick="window.location.href='runhtml.html'">
<div class="dash-icon">🌐</div>
<div class="dash-title">Write HTML</div>
</div>
<div class="dash-card" onclick="window.location.href='youtube.html'">
<div class="dash-icon">▶️</div>
<div class="dash-title">YouTube Search</div>
</div>
<div class="dash-card" onclick="window.location.href='browser-agent.html'">
<div class="dash-icon">🤖</div>
<div class="dash-title">AI Browser</div>
</div>
<div class="dash-card" onclick="window.location.href='managequiz.html'">
<div class="dash-icon">⚙️</div>
<div class="dash-title">Manage Quiz</div>
</div>
<div class="dash-card" onclick="window.location.href='tutor.html'">
<div class="dash-icon">👨‍🏫 </div>
<div class="dash-title">AI Tutor</div>
</div>
<div class="dash-card" onclick="window.location.href='quiz.html'">
<div class="dash-icon">📝</div>
<div class="dash-title">Take a Quiz!</div>
</div>
<div class="dash-card" onclick="window.location.href='book_quiz.html'">
<div class="dash-icon">📝</div>
<div class="dash-title">Take a Book Quiz!</div>
</div>
<div class="dash-card" onclick="window.location.href='tables.html'">
<div class="dash-icon">🔢</div>
<div class="dash-title">Maths Table</div>
</div>
<div class="dash-card" onclick="window.location.href='translator.html'">
<div class="dash-icon">🎙️</div>
<div class="dash-title">Text & Voice</div>
</div>
<div class="dash-card" onclick="window.location.href='coding.html'">
<div class="dash-icon">💻</div>
<div class="dash-title">Ai coding</div>
</div>
<div class="dash-card" onclick="window.location.href='image.html'">
<div class="dash-icon">🖼️</div>
<div class="dash-title">Image Translate</div>
</div>
<div class="dash-card" onclick="window.location.href='create.html'">
<div class="dash-icon">🎨</div>
<div class="dash-title">Image Creator</div>
</div>
<div class="dash-card" onclick="window.location.href='qa.html'">
<div class="dash-icon">📚</div>
<div class="dash-title">Document Q&A</div>
</div>
<div class="dash-card" onclick="window.location.href='chess.html'">
<div class="dash-icon">♟️</div>
<div class="dash-title">Chess AI</div>
</div>
<div class="dash-card" onclick="window.location.href='history.html'">
<div class="dash-icon">🕒</div>
<div class="dash-title">History</div>
</div>
<div class="dash-card" onclick="window.location.href='storage.html'">
<div class="dash-icon">📂</div>
<div class="dash-title">Storage</div>
</div>
</div>
</div>
<script>
// Simple logic to open and close the side menu
function toggleSidebar() {
const sidebar = document.getElementById("sidebar");
const overlay = document.getElementById("overlay");
const active = !sidebar.classList.contains("active");
sidebar.classList.toggle("active", active);
overlay.classList.toggle("active", active);
document.body.classList.toggle("sidebar-open", active);
}
document.getElementById("overlay").onclick = () => {
document.getElementById("sidebar").classList.remove("active");
document.getElementById("overlay").classList.remove("active");
document.body.classList.remove("sidebar-open");
};
// --- 🛑 TIMER LOGIC FOR GOOGLE API RESET (PACIFIC TIME) 🛑 ---
function updateResetTimer() {
const now = new Date();
const laTimeStr = now.toLocaleString("en-US", { timeZone: "America/Los_Angeles" });
const laTime = new Date(laTimeStr);
const nextMidnight = new Date(laTime);
nextMidnight.setHours(24, 0, 0, 0);
const diffMs = nextMidnight - laTime;
const h = Math.floor(diffMs / (1000 * 60 * 60));
const m = Math.floor((diffMs % (1000 * 60 * 60)) / (1000 * 60));
const s = Math.floor((diffMs % (1000 * 60)) / 1000);
const pad = (num) => num.toString().padStart(2, '0');
const timerElement = document.getElementById("apiResetTimer");
if (timerElement) {
timerElement.innerText = `⏳ Quota resets in: ${pad(h)}h ${pad(m)}m ${pad(s)}s`;
}
}
updateResetTimer();
setInterval(updateResetTimer, 1000);
// ----------------------------------------------
// Fetch and render API usage
async function fetchApiUsage() {
const container = document.getElementById("apiUsageContainer");
if (!container) return;
container.innerHTML = '<div class="spinner"></div> <span style="font-size:14px; color:var(--muted);">Syncing with server...</span>';
try {
const res = await fetch('/api/usage');
const data = await res.json();
if (Object.keys(data).length === 0) {
container.innerHTML = '<div style="color: var(--muted); font-size: 14px; width: 100%; text-align: center; padding: 10px;">No API requests made yet since last server restart.</div>';
return;
}
container.innerHTML = Object.entries(data).map(([apiName, count]) => `
<div style="background: rgba(0,0,0,0.4); border: 1px solid rgba(255,255,255,0.05); padding: 15px; border-radius: 16px; flex: 1; min-width: 110px; text-align: center; box-shadow: inset 0 2px 10px rgba(0,0,0,0.2);">
<div style="font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 5px;">${apiName}</div>
<div style="font-size: 24px; font-weight: 800; color: #60a5fa;">${count} <span style="font-size:10px; color:#64748b; font-weight:500;">reqs</span></div>
</div>
`).join('');
} catch(e) {
container.innerHTML = '<div style="color: var(--red); font-size: 14px;">⚠️ Failed to connect to server.</div>';
}
}
document.addEventListener("DOMContentLoaded", fetchApiUsage);
</script>
<script>
document.addEventListener("DOMContentLoaded", () => {
// 1. The exact texts you requested
const loadingTexts = [
"solve math question...",
"search using ai...",
"search youtube...",
"get quiz...",
"solve answers..."
];
let textIndex = 0;
const loaderText = document.getElementById("loaderText");
const loaderBar = document.getElementById("loaderBar");
const appLoader = document.getElementById("appLoader");
// 2. Start the text loop (Changes every 2 seconds)
loaderText.innerText = loadingTexts[0];
const textInterval = setInterval(() => {
textIndex = (textIndex + 1) % loadingTexts.length;
loaderText.innerText = loadingTexts[textIndex];
}, 2000);
// 3. Fake a smooth progress bar while the browser thinks
let progress = 0;
const progressInterval = setInterval(() => {
progress += Math.random() * 15;
// Cap at 90% so it doesn't finish until the actual window.onload fires
if (progress > 90) progress = 90;
loaderBar.style.width = progress + "%";
}, 250);
// 4. Wait for ALL styles, scripts, and images to finish loading
window.addEventListener('load', () => {
// Force it to show for at least a minimum of 2.5 seconds so it looks premium
// even if the page loads instantly from browser cache.
const timeElapsed = performance.now();
const minLoadTime = 2500;
const remainingDelay = Math.max(0, minLoadTime - timeElapsed);
setTimeout(() => {
clearInterval(textInterval);
clearInterval(progressInterval);
// Snap progress to 100% and say Ready
loaderBar.style.width = "100%";
loaderText.innerText = "system ready.";
// Wait 0.4s for the user to see 100%, then fade it out smoothly
setTimeout(() => {
appLoader.classList.add("hidden");
}, 400);
}, remainingDelay);
});
});
</script>
<script src="ui-controls.js" defer></script>
</body>
</html>