document.addEventListener('DOMContentLoaded', () => { // Check if user is logged in (simulated with localStorage) const isLoggedIn = localStorage.getItem('eveLoggedIn') === 'true'; if (isLoggedIn || window.location.pathname.includes('login.html')) { if (!window.location.pathname.includes('login.html')) { // Show main content document.getElementById('main-content').style.display = 'block'; // Initialize Gradio app for HuggingFace Spaces const app = document.createElement('gradio-app'); app.src = "https://huggingface.co/spaces/kirikir13/eve-2-d-syre-ai-companion-hub"; document.getElementById('gradio-app').appendChild(app); document.getElementById('gradio-app').classList.remove('hidden'); // Hide our UI elements since we're using Gradio const chatInterface = document.querySelector('.bg-gray-800\\/80'); if (chatInterface) chatInterface.classList.add('hidden'); } } else { // Redirect to login if not logged in and not on login page if (!window.location.pathname.includes('login.html')) { window.location.href = '/login.html'; } } }); // Simple login simulation (would be replaced with real auth) if (window.location.pathname.includes('login.html')) { const loginForm = document.querySelector('form'); if (loginForm) { loginForm.addEventListener('submit', (e) => { e.preventDefault(); localStorage.setItem('eveLoggedIn', 'true'); window.location.href = '/'; }); } } // Initialize RAM monitor component document.addEventListener('DOMContentLoaded', () => { const ramMonitor = document.createElement('ram-monitor'); document.querySelector('.status-bar').appendChild(ramMonitor); });