Spaces:
Sleeping
Sleeping
Download templates/index.html from Presight-AI/app: direct link, hf CLI and curl.
- Browser
- Download file 14.5 kB
-
https://huggingface.co/spaces/Presight-AI/app/resolve/main/templates/index.html
- Command line
-
hf download hf://spaces/Presight-AI/app/templates/index.html
-
curl -L -o index.html https://huggingface.co/spaces/Presight-AI/app/resolve/main/templates/index.html
14.5 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Presight-ai - Understand Your Meds</title> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
| <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet"> | |
| <link rel="stylesheet" href="/static/css/landing.css"> | |
| </head> | |
| <body> | |
| <!-- Background Shapes --> | |
| <div class="floating-shape shape-1"></div> | |
| <div class="floating-shape shape-2"></div> | |
| <!-- Toast Notification --> | |
| <div id="error-toast" class="error-toast"> | |
| <div class="error-icon"><i class="fas fa-exclamation-circle"></i></div> | |
| <div id="error-toast-msg">Something went wrong</div> | |
| </div> | |
| <header> | |
| <a href="/" class="logo"> | |
| <i class="fas fa-robot"></i> Presight-ai | |
| </a> | |
| <nav class="nav-links"> | |
| <button onclick="openModal('login')" class="btn btn-ghost">Log in</button> | |
| <button onclick="openModal('signup')" class="btn btn-primary">Get started</button> | |
| </nav> | |
| </header> | |
| <main> | |
| <h1>Understand your prescriptions with <span class="brand-highlight">Presight-ai</span></h1> | |
| <p class="subtitle">Instant AI analysis for drug interactions, safety checks, and dosage clarity. Just drop your | |
| file to get started.</p> | |
| <!-- Fake Upload Interaction --> | |
| <div class="upload-trigger" id="upload-trigger"> | |
| <span class="upload-text">Ask Presight to analyze your prescription...</span> | |
| <div class="upload-footer"> | |
| <div class="upload-tools-left"> | |
| <div class="action-icon"><i class="fas fa-plus"></i></div> | |
| <div class="action-icon"><i class="fas fa-paperclip"></i></div> | |
| </div> | |
| <div class="upload-tools-right"> | |
| <div class="action-icon"><i class="fas fa-image"></i></div> | |
| <div class="action-icon"><i class="fas fa-file-pdf"></i></div> | |
| <div class="action-icon send-btn"><i class="fas fa-arrow-up"></i></div> | |
| </div> | |
| </div> | |
| <input type="file" id="file-upload" accept=".jpg, .jpeg" hidden> | |
| </div> | |
| </main> | |
| <!-- Unified Auth Modal --> | |
| <div class="modal-overlay" id="auth-modal"> | |
| <div class="modal-card"> | |
| <button class="close-btn" id="close-modal"><i class="fas fa-times"></i></button> | |
| <div class="modal-brand-icon"> | |
| <i class="fas fa-heart"></i> <!-- Using heart as placeholder for Lovable logo style, or robot --> | |
| </div> | |
| <h2 class="modal-title" id="modal-title">Start Analyzing.</h2> | |
| <p class="modal-subtitle" id="modal-subtitle">Log in to your account</p> | |
| <!-- Social Buttons View --> | |
| <div id="social-view" class="auth-btn-stack"> | |
| <button id="google-login" class="social-btn"> | |
| <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="20px" height="20px"> | |
| <path fill="#FFC107" | |
| d="M43.611,20.083H42V20H24v8h11.303c-1.649,4.657-6.08,8-11.303,8c-6.627,0-12-5.373-12-12c0-6.627,5.373-12,12-12c3.059,0,5.842,1.154,7.961,3.039l5.657-5.657C34.046,6.053,29.268,4,24,4C12.955,4,4,12.955,4,24c0,11.045,8.955,20,20,20c11.045,0,20-8.955,20-20C44,22.659,43.862,21.35,43.611,20.083z" /> | |
| <path fill="#FF3D00" | |
| d="M6.306,14.691l6.571,4.819C14.655,15.108,18.961,12,24,12c3.059,0,5.842,1.154,7.961,3.039l5.657-5.657C34.046,6.053,29.268,4,24,4C16.318,4,9.656,8.337,6.306,14.691z" /> | |
| <path fill="#4CAF50" | |
| d="M24,44c5.166,0,9.86-1.977,13.409-5.192l-6.19-5.238C29.211,35.091,26.715,36,24,36c-5.202,0-9.619-3.317-11.283-7.946l-6.522,5.025C9.505,39.556,16.227,44,24,44z" /> | |
| <path fill="#1976D2" | |
| d="M43.611,20.083H42V20H24v8h11.303c-0.792,2.237-2.231,4.166-4.087,5.571c0.001-0.001,0.002-0.001,0.003-0.002l6.19,5.238C36.971,39.205,44,34,44,24C44,22.659,43.862,21.35,43.611,20.083z" /> | |
| </svg> Continue with Google | |
| </button> | |
| <button class="social-btn"> | |
| <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20px" height="20px" fill="white"> | |
| <path | |
| d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" /> | |
| </svg> Continue with GitHub | |
| </button> | |
| <div class="divider">OR</div> | |
| <button id="email-btn" class="social-btn email-btn"> | |
| Continue with email | |
| </button> | |
| </div> | |
| <!-- Email Form View --> | |
| <form id="email-form" class="email-form"> | |
| <button type="button" id="back-to-social" class="back-btn"> | |
| <i class="fas fa-arrow-left"></i> Back | |
| </button> | |
| <input type="email" id="email" class="form-input" placeholder="Email address" required> | |
| <input type="password" id="password" class="form-input" placeholder="Password" required> | |
| <input type="password" id="confirm-password" class="form-input" placeholder="Confirm Password" | |
| style="display: none;"> | |
| <button type="submit" class="social-btn email-btn" id="submit-btn">Log in</button> | |
| </form> | |
| <div class="toggle-auth-mode"> | |
| <span id="toggle-text">Don't have an account?</span> | |
| <a id="toggle-link">Sign up</a> | |
| </div> | |
| </div> | |
| </div> | |
| <script type="module"> | |
| import { loginUser, registerUser, googleLogin, initAuthObserver } from '/static/js/auth.js'; | |
| // Initialize Auth Observer | |
| initAuthObserver(); | |
| // DOM Elements | |
| const modal = document.getElementById('auth-modal'); | |
| const closeBtn = document.getElementById('close-modal'); | |
| const uploadTrigger = document.getElementById('upload-trigger'); | |
| const socialView = document.getElementById('social-view'); | |
| const emailForm = document.getElementById('email-form'); | |
| const emailBtn = document.getElementById('email-btn'); | |
| const backToSocialBtn = document.getElementById('back-to-social'); | |
| const modalTitle = document.getElementById('modal-title'); | |
| const modalSubtitle = document.getElementById('modal-subtitle'); | |
| const toggleText = document.getElementById('toggle-text'); | |
| const toggleLink = document.getElementById('toggle-link'); | |
| const submitBtn = document.getElementById('submit-btn'); | |
| const confirmPasswordInput = document.getElementById('confirm-password'); | |
| let isSignup = false; | |
| // Modal Logic | |
| window.openModal = (mode = 'login') => { | |
| isSignup = mode === 'signup'; | |
| updateModalState(); | |
| modal.classList.add('active'); | |
| resetForm(); | |
| }; | |
| function closeModal() { | |
| modal.classList.remove('active'); | |
| } | |
| closeBtn.addEventListener('click', closeModal); | |
| modal.addEventListener('click', (e) => { | |
| if (e.target === modal) closeModal(); | |
| }); | |
| uploadTrigger.addEventListener('click', () => openModal('signup')); | |
| // Toggle Login/Signup | |
| toggleLink.addEventListener('click', () => { | |
| isSignup = !isSignup; | |
| updateModalState(); | |
| }); | |
| function updateModalState() { | |
| if (isSignup) { | |
| modalTitle.textContent = "Start Analyzing."; | |
| modalSubtitle.textContent = "Create free account"; | |
| toggleText.textContent = "Already have an account?"; | |
| toggleLink.textContent = "Log in"; | |
| submitBtn.textContent = "Create account"; | |
| confirmPasswordInput.style.display = 'block'; | |
| confirmPasswordInput.required = true; | |
| } else { | |
| modalTitle.textContent = "Welcome back."; | |
| modalSubtitle.textContent = "Log in to your account"; | |
| toggleText.textContent = "Don't have an account?"; | |
| toggleLink.textContent = "Sign up"; | |
| submitBtn.textContent = "Log in"; | |
| confirmPasswordInput.style.display = 'none'; | |
| confirmPasswordInput.required = false; | |
| } | |
| } | |
| // View Switching | |
| emailBtn.addEventListener('click', () => { | |
| socialView.style.display = 'none'; | |
| emailForm.classList.add('active'); | |
| }); | |
| backToSocialBtn.addEventListener('click', () => { | |
| emailForm.classList.remove('active'); | |
| socialView.style.display = 'flex'; | |
| }); | |
| function resetForm() { | |
| socialView.style.display = 'flex'; | |
| emailForm.classList.remove('active'); | |
| document.getElementById('email').value = ''; | |
| document.getElementById('password').value = ''; | |
| document.getElementById('confirm-password').value = ''; | |
| } | |
| // Auth Logic | |
| const googleLoginBtn = document.getElementById('google-login'); | |
| googleLoginBtn.addEventListener('click', async () => { | |
| try { | |
| await googleLogin(); | |
| } catch (error) { | |
| showError(error); | |
| } | |
| }); | |
| emailForm.addEventListener('submit', async (e) => { | |
| e.preventDefault(); | |
| const email = document.getElementById('email').value; | |
| const password = document.getElementById('password').value; | |
| try { | |
| if (isSignup) { | |
| const confirm = document.getElementById('confirm-password').value; | |
| if (password !== confirm) { | |
| throw new Error("Passwords do not match"); | |
| } | |
| await registerUser(email, password); | |
| } else { | |
| await loginUser(email, password); | |
| } | |
| } catch (error) { | |
| showError(error); | |
| } | |
| }); | |
| function getFriendlyErrorMessage(error) { | |
| // Log the full error for debugging | |
| console.error("Auth Error:", error); | |
| const errorCode = error.code; | |
| const errorMessage = error.message; | |
| switch (errorCode) { | |
| case 'auth/weak-password': | |
| return "Password is too weak. Please use at least 6 characters."; | |
| case 'auth/email-already-in-use': | |
| return "This email is already registered. Please log in instead."; | |
| case 'auth/user-not-found': | |
| return "No account found with this email. Please sign up."; | |
| case 'auth/wrong-password': | |
| return "Incorrect password. Please try again."; | |
| case 'auth/invalid-email': | |
| return "Please enter a valid email address."; | |
| case 'auth/network-request-failed': | |
| return "Network error. Please check your connection."; | |
| case 'auth/too-many-requests': | |
| return "Too many attempts. Please try again later."; | |
| case 'auth/popup-closed-by-user': | |
| return "Sign-in popup was closed."; | |
| case 'auth/internal-error': | |
| return "An internal error occurred. Please try again."; | |
| case 'auth/requires-recent-login': | |
| return "Please log in again to continue."; | |
| case 'auth/credential-already-in-use': | |
| return "This account is already linked to another user."; | |
| case 'auth/account-exists-with-different-credential': | |
| return "An account with this email already exists. Please use the login method you originally used (e.g., Email or Google)."; | |
| default: | |
| // Fallback to a clean message if possible, or the raw message if it's not a Firebase error | |
| // DEBUG: Showing full error message | |
| return errorMessage || "An unexpected error occurred."; | |
| } | |
| } | |
| let errorTimeout; | |
| function showError(error) { | |
| const msg = getFriendlyErrorMessage(error); | |
| const toast = document.getElementById('error-toast'); | |
| const toastMsg = document.getElementById('error-toast-msg'); | |
| toastMsg.textContent = msg; | |
| toast.classList.add('show'); | |
| // Clear previous timeout if exists | |
| if (errorTimeout) clearTimeout(errorTimeout); | |
| // Auto-hide after 5 seconds | |
| errorTimeout = setTimeout(() => { | |
| toast.classList.remove('show'); | |
| }, 5000); | |
| } | |
| // Drag and Drop | |
| uploadTrigger.addEventListener('dragover', (e) => { | |
| e.preventDefault(); | |
| uploadTrigger.style.borderColor = '#10a37f'; | |
| uploadTrigger.style.transform = 'scale(1.02)'; | |
| }); | |
| uploadTrigger.addEventListener('dragleave', (e) => { | |
| e.preventDefault(); | |
| uploadTrigger.style.borderColor = 'rgba(0,0,0,0.05)'; | |
| uploadTrigger.style.transform = 'scale(1)'; | |
| }); | |
| uploadTrigger.addEventListener('drop', (e) => { | |
| e.preventDefault(); | |
| openModal('signup'); | |
| }); | |
| </script> | |
| </body> | |
| </html> |