scholarplug / index.html
Only1bigX's picture
undefined - Initial Deployment
56d9978 verified
Raw History Blame Contribute Delete
74.8 kB
<!DOCTYPE html> <html lang="en" class="h-full"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>StudyZen - Smart Study Assistant</title> <script src="https://cdn.tailwindcss.com"></script> <script src="https://www.gstatic.com/firebasejs/10.1.0/firebase-app-compat.js"></script> <script src="https://www.gstatic.com/firebasejs/10.1.0/firebase-auth-compat.js"></script> <script src="https://www.gstatic.com/firebasejs/10.1.0/firebase-firestore-compat.js"></script> <script src="https://www.gstatic.com/firebasejs/10.1.0/firebase-storage-compat.js"></script> <script src="https://www.gstatic.com/firebasejs/10.1.0/firebase-messaging-compat.js"></script> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> <style> :root { --primary: #3b82f6; --primary-dark: #2563eb; } body { font-family: 'Inter', sans-serif; transition: background-color 0.3s ease; } .card { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); transition: transform 0.2s ease, box-shadow 0.2s ease; } .card:hover { transform: translateY(-2px); box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); } .flashcard { perspective: 1000px; } .flashcard-inner { transition: transform 0.6s; transform-style: preserve-3d; } .flashcard.flipped .flashcard-inner { transform: rotateY(180deg); } .flashcard-front, .flashcard-back { backface-visibility: hidden; } .flashcard-back { transform: rotateY(180deg); } .loading-spinner { animation: spin 1s linear infinite; } @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } .dark { background-color: #1a202c; color: #f7fafc; } .dark .card { background-color: #2d3748; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.12); } .progress-ring__circle { transition: stroke-dashoffset 0.35s; transform: rotate(-90deg); transform-origin: 50% 50%; } </style> </head> <body class="h-full bg-gray-50 dark:bg-gray-900"> <!-- Auth Modal --> <div id="authModal" class="fixed inset-0 z-50 hidden flex items-center justify-center bg-black bg-opacity-50"> <div class="bg-white dark:bg-gray-800 rounded-xl p-6 w-full max-w-md"> <div class="flex justify-between items-center mb-4"> <h3 class="text-xl font-semibold text-gray-900 dark:text-white">Welcome to StudyZen</h3> <button id="closeAuthModal" class="text-gray-500 hover:text-gray-700 dark:hover:text-gray-300"> <i class="fas fa-times"></i> </button> </div> <div id="authTabs" class="flex border-b border-gray-200 dark:border-gray-700 mb-4"> <button id="loginTab" class="py-2 px-4 font-medium text-blue-600 dark:text-blue-400 border-b-2 border-blue-600 dark:border-blue-400">Login</button> <button id="signupTab" class="py-2 px-4 font-medium text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300">Sign Up</button> </div> <div id="loginForm"> <div class="mb-4"> <label for="loginEmail" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Email</label> <input type="email" id="loginEmail" class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white"> </div> <div class="mb-4"> <label for="loginPassword" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Password</label> <input type="password" id="loginPassword" class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white"> </div> <button id="loginBtn" class="w-full bg-blue-600 hover:bg-blue-700 text-white py-2 px-4 rounded-md font-medium transition duration-150 ease-in-out">Login</button> <div class="mt-4 text-center"> <button id="googleLoginBtn" class="w-full bg-white hover:bg-gray-50 text-gray-700 py-2 px-4 rounded-md font-medium border border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:hover:bg-gray-600 transition duration-150 ease-in-out flex items-center justify-center"> <img src="https://upload.wikimedia.org/wikipedia/commons/5/53/Google_%22G%22_Logo.svg" alt="Google logo" class="h-4 w-4 mr-2"> Continue with Google </button> </div> </div> <div id="signupForm" class="hidden"> <div class="mb-4"> <label for="signupEmail" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Email</label> <input type="email" id="signupEmail" class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white"> </div> <div class="mb-4"> <label for="signupPassword" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Password</label> <input type="password" id="signupPassword" class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white"> </div> <div class="mb-4"> <label for="confirmPassword" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Confirm Password</label> <input type="password" id="confirmPassword" class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white"> </div> <button id="signupBtn" class="w-full bg-blue-600 hover:bg-blue-700 text-white py-2 px-4 rounded-md font-medium transition duration-150 ease-in-out">Sign Up</button> </div> </div> </div> <!-- Main App Container --> <div class="min-h-full"> <!-- Navigation --> <nav class="bg-white dark:bg-gray-800 shadow-sm"> <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8"> <div class="flex justify-between h-16"> <div class="flex items-center"> <div class="flex-shrink-0 flex items-center"> <i class="fas fa-brain text-blue-600 dark:text-blue-400 text-2xl mr-2"></i> <span class="text-xl font-semibold text-gray-900 dark:text-white">StudyZen</span> </div> <div class="hidden sm:ml-6 sm:flex sm:space-x-8"> <a href="#" id="dashboardNav" class="border-blue-500 text-gray-900 dark:text-white inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">Dashboard</a> <a href="#" id="summarizeNav" class="border-transparent text-gray-500 dark:text-gray-400 hover:border-gray-300 dark:hover:border-gray-600 hover:text-gray-700 dark:hover:text-gray-300 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">Summarize</a> <a href="#" id="flashcardsNav" class="border-transparent text-gray-500 dark:text-gray-400 hover:border-gray-300 dark:hover:border-gray-600 hover:text-gray-700 dark:hover:text-gray-300 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">Flashcards</a> <a href="#" id="scheduleNav" class="border-transparent text-gray-500 dark:text-gray-400 hover:border-gray-300 dark:hover:border-gray-600 hover:text-gray-700 dark:hover:text-gray-300 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">Schedule</a> </div> </div> <div class="hidden sm:ml-6 sm:flex sm:items-center"> <button id="themeToggle" class="p-1 rounded-full text-gray-400 hover:text-gray-500 dark:hover:text-gray-300 focus:outline-none"> <i class="fas fa-moon dark:hidden" id="darkModeIcon"></i> <i class="fas fa-sun hidden dark:inline-block" id="lightModeIcon"></i> </button> <div class="ml-3 relative"> <div> <button id="userMenuBtn" class="flex text-sm rounded-full focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"> <img id="userAvatar" class="h-8 w-8 rounded-full" src="https://ui-avatars.com/api/?background=3b82f6&color=fff" alt="User avatar"> </button> </div> <div id="userMenu" class="hidden origin-top-right absolute right-0 mt-2 w-48 rounded-md shadow-lg py-1 bg-white dark:bg-gray-800 ring-1 ring-black ring-opacity-5 focus:outline-none z-50"> <a href="#" class="block px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700">Your Profile</a> <a href="#" class="block px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700">Settings</a> <a href="#" id="signOutBtn" class="block px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700">Sign out</a> </div> </div> </div> <div class="-mr-2 flex items-center sm:hidden"> <button id="mobileMenuBtn" class="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-blue-500"> <span class="sr-only">Open main menu</span> <i class="fas fa-bars block h-6 w-6" id="mobileMenuOpenIcon"></i> <i class="fas fa-times hidden h-6 w-6" id="mobileMenuCloseIcon"></i> </button> </div> </div> </div> <!-- Mobile menu --> <div id="mobileMenu" class="hidden sm:hidden"> <div class="pt-2 pb-3 space-y-1"> <a href="#" id="mobileDashboardNav" class="bg-blue-50 dark:bg-gray-700 border-blue-500 text-blue-700 dark:text-blue-400 block pl-3 pr-4 py-2 border-l-4 text-base font-medium">Dashboard</a> <a href="#" id="mobileSummarizeNav" class="border-transparent text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-700 hover:border-gray-300 block pl-3 pr-4 py-2 border-l-4 text-base font-medium">Summarize</a> <a href="#" id="mobileFlashcardsNav" class="border-transparent text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-700 hover:border-gray-300 block pl-3 pr-4 py-2 border-l-4 text-base font-medium">Flashcards</a> <a href="#" id="mobileScheduleNav" class="border-transparent text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-700 hover:border-gray-300 block pl-3 pr-4 py-2 border-l-4 text-base font-medium">Schedule</a> </div> <div class="pt-4 pb-3 border-t border-gray-200 dark:border-gray-700"> <div class="flex items-center px-4"> <div class="flex-shrink-0"> <img id="mobileUserAvatar" class="h-10 w-10 rounded-full" src="https://ui-avatars.com/api/?background=3b82f6&color=fff" alt=""> </div> <div class="ml-3"> <div id="mobileUserName" class="text-base font-medium text-gray-800 dark:text-white"></div> <div id="mobileUserEmail" class="text-sm font-medium text-gray-500 dark:text-gray-400"></div> </div> <button id="mobileThemeToggle" class="ml-auto p-1 rounded-full text-gray-400 hover:text-gray-500 dark:hover:text-gray-300 focus:outline-none"> <i class="fas fa-moon dark:hidden" id="mobileDarkModeIcon"></i> <i class="fas fa-sun hidden dark:inline-block" id="mobileLightModeIcon"></i> </button> </div> <div class="mt-3 space-y-1"> <a href="#" class="block px-4 py-2 text-base font-medium text-gray-500 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700">Your Profile</a> <a href="#" class="block px-4 py-2 text-base font-medium text-gray-500 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700">Settings</a> <a href="#" id="mobileSignOutBtn" class="block px-4 py-2 text-base font-medium text-gray-500 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700">Sign out</a> </div> </div> </div> </nav> <!-- Main Content --> <main class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6"> <!-- Dashboard Section --> <div id="dashboardSection"> <div class="mb-6 flex justify-between items-center"> <h2 class="text-2xl font-bold text-gray-900 dark:text-white">Dashboard</h2> <div class="text-sm text-gray-500 dark:text-gray-400"> <span id="greetingTime"></span>, <span id="userDisplayName"></span> </div> </div> <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 mb-6"> <div class="card bg-white dark:bg-gray-800 rounded-lg p-6"> <div class="flex items-center justify-between mb-4"> <h3 class="text-lg font-medium text-gray-900 dark:text-white">Recent Summaries</h3> <a href="#" class="text-sm text-blue-600 dark:text-blue-400 hover:underline">View all</a> </div> <div id="recentSummaries" class="space-y-4"> <!-- Filled dynamically --> <div class="animate-pulse flex space-x-4"> <div class="flex-1 space-y-4 py-1"> <div class="h-4 bg-gray-200 dark:bg-gray-700 rounded w-3/4"></div> <div class="space-y-2"> <div class="h-4 bg-gray-200 dark:bg-gray-700 rounded"></div> <div class="h-4 bg-gray-200 dark:bg-gray-700 rounded w-5/6"></div> </div> </div> </div> </div> </div> <div class="card bg-white dark:bg-gray-800 rounded-lg p-6"> <div class="flex items-center justify-between mb-4"> <h3 class="text-lg font-medium text-gray-900 dark:text-white">Upcoming Reviews</h3> <a href="#" class="text-sm text-blue-600 dark:text-blue-400 hover:underline">View all</a> </div> <div id="upcomingReviews" class="space-y-4"> <!-- Filled dynamically --> <div class="animate-pulse flex space-x-4"> <div class="flex-1 space-y-4 py-1"> <div class="h-4 bg-gray-200 dark:bg-gray-700 rounded w-3/4"></div> <div class="space-y-2"> <div class="h-4 bg-gray-200 dark:bg-gray-700 rounded"></div> <div class="h-4 bg-gray-200 dark:bg-gray-700 rounded w-5/6"></div> </div> </div> </div> </div> </div> <div class="card bg-white dark:bg-gray-800 rounded-lg p-6"> <div class="flex items-center justify-between mb-4"> <h3 class="text-lg font-medium text-gray-900 dark:text-white">Study Progress</h3> </div> <div class="flex items-center justify-center"> <div class="relative w-32 h-32"> <svg class="w-full h-full" viewBox="0 0 100 100"> <circle class="text-gray-200 dark:text-gray-700" stroke-width="8" stroke="currentColor" fill="transparent" r="40" cx="50" cy="50" /> <circle class="text-blue-600" stroke-width="8" stroke-dasharray="251.2" stroke-dashoffset="75.36" stroke-linecap="round" stroke="currentColor" fill="transparent" r="40" cx="50" cy="50" /> </svg> <div class="absolute top-0 left-0 w-full h-full flex items-center justify-center flex-col"> <span class="text-2xl font-bold text-gray-900 dark:text-white">70%</span> <span class="text-sm text-gray-500 dark:text-gray-400">Completion</span> </div> </div> </div> </div> </div> <div class="card bg-white dark:bg-gray-800 rounded-lg p-6 mb-6"> <div class="flex items-center justify-between mb-4"> <h3 class="text-lg font-medium text-gray-900 dark:text-white">Recent Flashcards</h3> <a href="#" class="text-sm text-blue-600 dark:text-blue-400 hover:underline">View all</a> </div> <div id="recentFlashcards" class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4"> <!-- Filled dynamically --> <div class="animate-pulse h-32 bg-gray-200 dark:bg-gray-700 rounded-lg"></div> <div class="animate-pulse h-32 bg-gray-200 dark:bg-gray-700 rounded-lg"></div> <div class="animate-pulse h-32 bg-gray-200 dark:bg-gray-700 rounded-lg"></div> </div> </div> </div> <!-- Summarize Section --> <div id="summarizeSection" class="hidden"> <div class="mb-6 flex justify-between items-center"> <h2 class="text-2xl font-bold text-gray-900 dark:text-white">Summarize Content</h2> </div> <div class="grid grid-cols-1 lg:grid-cols-3 gap-6"> <div class="card bg-white dark:bg-gray-800 rounded-lg p-6 lg:col-span-2"> <div class="mb-4"> <label for="contentInput" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">Enter text or upload a PDF</label> <div class="flex rounded-md shadow-sm"> <div class="relative flex-grow focus-within:z-10"> <textarea id="contentInput" rows="10" class="block w-full rounded-l-md border-gray-300 dark:border-gray-600 focus:border-blue-500 focus:ring-blue-500 dark:bg-gray-700 dark:text-white sm:text-sm" placeholder="Paste your text here..."></textarea> </div> <button id="uploadPdfBtn" class="-ml-px relative inline-flex items-center space-x-2 px-4 py-2 border border-gray-300 dark:border-gray-600 text-sm font-medium rounded-r-md text-gray-700 dark:text-gray-300 bg-gray-50 dark:bg-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600"> <i class="fas fa-file-pdf text-red-500"></i> <span>Upload PDF</span> <input type="file" id="pdfUpload" accept=".pdf" class="hidden"> </button> </div> </div> <div class="flex justify-end"> <button id="summarizeBtn" class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50" disabled> <span id="summarizeBtnText">Summarize</span> <span id="summarizeLoading" class="ml-2 hidden"> <i class="fas fa-circle-notch loading-spinner"></i> </span> </button> </div> </div> <div class="card bg-white dark:bg-gray-800 rounded-lg p-6"> <h3 class="text-lg font-medium text-gray-900 dark:text-white mb-4">Previous Summaries</h3> <div id="summaryHistory" class="space-y-3 max-h-[500px] overflow-y-auto"> <!-- Filled dynamically --> <div class="animate-pulse flex space-x-4"> <div class="flex-1 space-y-4 py-1"> <div class="h-4 bg-gray-200 dark:bg-gray-700 rounded w-3/4"></div> <div class="space-y-2"> <div class="h-4 bg-gray-200 dark:bg-gray-700 rounded"></div> <div class="h-4 bg-gray-200 dark:bg-gray-700 rounded w-5/6"></div> </div> </div> </div> </div> </div> </div> <div id="summaryResults" class="hidden mt-6"> <div class="card bg-white dark:bg-gray-800 rounded-lg p-6 mb-6"> <div class="flex items-center justify-between mb-4"> <h3 class="text-lg font-medium text-gray-900 dark:text-white">Summary</h3> <div class="flex space-x-2"> <button id="saveSummaryBtn" class="inline-flex items-center px-3 py-1 border border-transparent text-xs font-medium rounded shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"> <i class="fas fa-save mr-1"></i> Save </button> <button id="copySummaryBtn" class="inline-flex items-center px-3 py-1 border border-gray-300 dark:border-gray-600 text-xs font-medium rounded shadow-sm text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"> <i class="fas fa-copy mr-1"></i> Copy </button> </div> </div> <div id="generatedSummary" class="prose dark:prose-invert max-w-none"> <!-- Filled dynamically --> </div> </div> <div class="grid grid-cols-1 lg:grid-cols-2 gap-6"> <div class="card bg-white dark:bg-gray-800 rounded-lg p-6"> <div class="flex items-center justify-between mb-4"> <h3 class="text-lg font-medium text-gray-900 dark:text-white">Key Points</h3> <button id="copyKeyPointsBtn" class="inline-flex items-center px-3 py-1 border border-gray-300 dark:border-gray-600 text-xs font-medium rounded shadow-sm text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"> <i class="fas fa-copy mr-1"></i> Copy </button> </div> <div id="generatedKeyPoints" class="space-y-2"> <!-- Filled dynamically --> </div> </div> <div class="card bg-white dark:bg-gray-800 rounded-lg p-6"> <div class="flex items-center justify-between mb-4"> <h3 class="text-lg font-medium text-gray-900 dark:text-white">Generated Flashcards</h3> <div class="flex space-x-2"> <button id="saveFlashcardsBtn" class="inline-flex items-center px-3 py-1 border border-transparent text-xs font-medium rounded shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"> <i class="fas fa-save mr-1"></i> Save All </button> <button id="copyFlashcardsBtn" class="inline-flex items-center px-3 py-1 border border-gray-300 dark:border-gray-600 text-xs font-medium rounded shadow-sm text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"> <i class="fas fa-copy mr-1"></i> Copy All </button> </div> </div> <div id="generatedFlashcards" class="space-y-3 max-h-[400px] overflow-y-auto"> <!-- Filled dynamically --> </div> </div> </div> </div> </div> <!-- Flashcards Section --> <div id="flashcardsSection" class="hidden"> <div class="mb-6 flex justify-between items-center"> <h2 class="text-2xl font-bold text-gray-900 dark:text-white">Flashcards Review</h2> <div class="flex items-center space-x-2"> <span class="text-sm text-gray-500 dark:text-gray-400">Sort by:</span> <select id="flashcardSort" class="block w-full pl-3 pr-10 py-2 text-base border-gray-300 dark:border-gray-600 focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm rounded-md bg-white dark:bg-gray-700"> <option value="due">Due Date</option> <option value="ease">Ease</option> <option value="newest">Newest First</option> <option value="oldest">Oldest First</option> </select> </div> </div> <div class="flex flex-col items-center"> <div id="flashcardContainer" class="w-full max-w-2xl mb-6"> <div class="flashcard cursor-pointer w-full h-64" id="currentFlashcard"> <div class="flashcard-inner relative w-full h-full"> <div class="flashcard-front absolute w-full h-full bg-white dark:bg-gray-800 rounded-lg shadow-md p-6 flex flex-col"> <div class="flex justify-between items-start mb-4"> <span class="text-sm font-medium text-gray-500 dark:text-gray-400">Question</span> <span id="cardProgress" class="text-xs text-gray-500 dark:text-gray-400">1/10</span> </div> <div id="flashcardQuestion" class="flex-grow flex items-center justify-center text-xl text-center text-gray-900 dark:text-white"> Click "Start Review" to begin </div> <div class="mt-4 text-sm text-gray-500 dark:text-gray-400 text-center"> Click to flip </div> </div> <div class="flashcard-back absolute w-full h-full bg-blue-50 dark:bg-gray-700 rounded-lg shadow-md p-6 flex flex-col"> <div class="flex justify-between items-start mb-4"> <span class="text-sm font-medium text-gray-500 dark:text-gray-400">Answer</span> <span id="cardStats" class="text-xs text-gray-500 dark:text-gray-400">New card</span> </div> <div id="flashcardAnswer" class="flex-grow flex items-center justify-center text-xl text-center text-gray-900 dark:text-white"> <!-- Filled dynamically --> </div> <div class="mt-4 grid grid-cols-3 gap-2"> <button class="difficultyBtn bg-red-100 dark:bg-red-900 hover:bg-red-200 dark:hover:bg-red-800 text-red-800 dark:text-red-100 px-3 py-2 rounded text-sm font-medium" data-difficulty="1">Hard</button> <button class="difficultyBtn bg-yellow-100 dark:bg-yellow-900 hover:bg-yellow-200 dark:hover:bg-yellow-800 text-yellow-800 dark:text-yellow-100 px-3 py-2 rounded text-sm font-medium" data-difficulty="2">Good</button> <button class="difficultyBtn bg-green-100 dark:bg-green-900 hover:bg-green-200 dark:hover:bg-green-800 text-green-800 dark:text-green-100 px-3 py-2 rounded text-sm font-medium" data-difficulty="3">Easy</button> </div> </div> </div> </div> </div> <div class="flex space-x-4"> <button id="startReviewBtn" class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"> Start Review </button> <button id="endReviewBtn" class="hidden inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-gray-600 hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500"> End Review </button> </div> </div> <div class="mt-8"> <div class="flex items-center justify-between mb-4"> <h3 class="text-lg font-medium text-gray-900 dark:text-white">Your Flashcard Decks</h3> <button id="createDeckBtn" class="inline-flex items-center px-3 py-1 border border-transparent text-xs font-medium rounded shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"> <i class="fas fa-plus mr-1"></i> New Deck </button> </div> <div id="flashcardDecks" class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4"> <!-- Filled dynamically --> <div class="animate-pulse h-32 bg-gray-200 dark:bg-gray-700 rounded-lg"></div> <div class="animate-pulse h-32 bg-gray-200 dark:bg-gray-700 rounded-lg"></div> <div class="animate-pulse h-32 bg-gray-200 dark:bg-gray-700 rounded-lg"></div> </div> </div> </div> <!-- Schedule Section --> <div id="scheduleSection" class="hidden"> <div class="mb-6 flex justify-between items-center"> <h2 class="text-2xl font-bold text-gray-900 dark:text-white">Study Schedule</h2> <button id="addTaskBtn" class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"> <i class="fas fa-plus mr-2"></i> Add Task </button> </div> <div class="grid grid-cols-1 lg:grid-cols-3 gap-6"> <div class="card bg-white dark:bg-gray-800 rounded-lg p-6 lg:col-span-2"> <div id="calendar"></div> </div> <div class="card bg-white dark:bg-gray-800 rounded-lg p-6"> <div class="flex items-center justify-between mb-4"> <h3 class="text-lg font-medium text-gray-900 dark:text-white">Upcoming Tasks</h3> <div class="flex items-center space-x-2"> <span class="text-sm text-gray-500 dark:text-gray-400">Filter:</span> <select id="taskFilter" class="block w-full pl-3 pr-10 py-2 text-base border-gray-300 dark:border-gray-600 focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm rounded-md bg-white dark:bg-gray-700"> <option value="all">All</option> <option value="today">Today</option> <option value="week">This Week</option> <option value="overdue">Overdue</option> </select> </div> </div> <div id="taskList" class="space-y-3 max-h-[500px] overflow-y-auto"> <!-- Filled dynamically --> <div class="animate-pulse flex space-x-4"> <div class="flex-1 space-y-4 py-1"> <div class="h-4 bg-gray-200 dark:bg-gray-700 rounded w-3/4"></div> <div class="space-y-2"> <div class="h-4 bg-gray-200 dark:bg-gray-700 rounded"></div> <div class="h-4 bg-gray-200 dark:bg-gray-700 rounded w-5/6"></div> </div> </div> </div> </div> </div> </div> </div> </main> </div> <!-- Add Task Modal --> <div id="taskModal" class="fixed inset-0 z-50 hidden flex items-center justify-center bg-black bg-opacity-50"> <div class="bg-white dark:bg-gray-800 rounded-xl p-6 w-full max-w-md"> <div class="flex justify-between items-center mb-4"> <h3 class="text-xl font-semibold text-gray-900 dark:text-white">Add New Task</h3> <button id="closeTaskModal" class="text-gray-500 hover:text-gray-700 dark:hover:text-gray-300"> <i class="fas fa-times"></i> </button> </div> <div class="space-y-4"> <div> <label for="taskTitle" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Title</label> <input type="text" id="taskTitle" class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white"> </div> <div> <label for="taskDescription" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Description</label> <textarea id="taskDescription" rows="3" class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white"></textarea> </div> <div> <label for="taskDueDate" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Due Date</label> <input type="date" id="taskDueDate" class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white"> </div> <div> <label for="taskPriority" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Priority</label> <select id="taskPriority" class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white"> <option value="low">Low</option> <option value="medium">Medium</option> <option value="high">High</option> </select> </div> <div> <label for="taskReminder" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Reminder</label> <select id="taskReminder" class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white"> <option value="none">None</option> <option value="15min">15 minutes before</option> <option value="1hour">1 hour before</option> <option value="1day">1 day before</option> </select> </div> </div> <div class="mt-6 flex justify-end space-x-3"> <button id="cancelTaskBtn" class="px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"> Cancel </button> <button id="saveTaskBtn" class="px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"> Save Task </button> </div> </div> </div> <!-- Create Deck Modal --> <div id="deckModal" class="fixed inset-0 z-50 hidden flex items-center justify-center bg-black bg-opacity-50"> <div class="bg-white dark:bg-gray-800 rounded-xl p-6 w-full max-w-md"> <div class="flex justify-between items-center mb-4"> <h3 class="text-xl font-semibold text-gray-900 dark:text-white">Create New Deck</h3> <button id="closeDeckModal" class="text-gray-500 hover:text-gray-700 dark:hover:text-gray-300"> <i class="fas fa-times"></i> </button> </div> <div class="space-y-4"> <div> <label for="deckTitle" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Title</label> <input type="text" id="deckTitle" class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white"> </div> <div> <label for="deckDescription" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Description</label> <textarea id="deckDescription" rows="3" class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white"></textarea> </div> <div> <label for="deckColor" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Color</label> <div class="flex space-x-2"> <button class="colorOption w-8 h-8 rounded-full bg-blue-500 border-2 border-transparent focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500" data-color="blue"></button> <button class="colorOption w-8 h-8 rounded-full bg-green-500 border-2 border-transparent focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500" data-color="green"></button> <button class="colorOption w-8 h-8 rounded-full bg-red-500 border-2 border-transparent focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500" data-color="red"></button> <button class="colorOption w-8 h-8 rounded-full bg-yellow-500 border-2 border-transparent focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500" data-color="yellow"></button> <button class="colorOption w-8 h-8 rounded-full bg-purple-500 border-2 border-transparent focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500" data-color="purple"></button> </div> </div> </div> <div class="mt-6 flex justify-end space-x-3"> <button id="cancelDeckBtn" class="px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"> Cancel </button> <button id="saveDeckBtn" class="px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"> Create Deck </button> </div> </div> </div> <!-- Toast Notification --> <div id="toast" class="fixed bottom-4 right-4 hidden"> <div class="bg-gray-800 text-white px-4 py-3 rounded-md shadow-lg flex items-start"> <div class="flex-shrink-0"> <i id="toastIcon" class="fas fa-check-circle"></i> </div> <div class="ml-3"> <p id="toastMessage" class="text-sm"></p> </div> <button id="closeToast" class="ml-4 text-gray-300 hover:text-white"> <i class="fas fa-times"></i> </button> </div> </div> <script> // Firebase configuration const firebaseConfig = { apiKey: "AIzaSyDEXAMPLEEXAMPLEEXAMPLEEXAMPLE", authDomain: "studyzen-app.firebaseapp.com", projectId: "studyzen-app", storageBucket: "studyzen-app.appspot.com", messagingSenderId: "123456789012", appId: "1:123456789012:web:abcd1234abcd1234abcd12" }; // Initialize Firebase firebase.initializeApp(firebaseConfig); const auth = firebase.auth(); const db = firebase.firestore(); const storage = firebase.storage(); const messaging = firebase.messaging(); // Cloudflare Worker API endpoint const API_ENDPOINT = "https://studyzen-api.workers.dev"; // DOM Elements const elements = { // Auth authModal: document.getElementById('authModal'), closeAuthModal: document.getElementById('closeAuthModal'), loginTab: document.getElementById('loginTab'), signupTab: document.getElementById('signupTab'), loginForm: document.getElementById('loginForm'), signupForm: document.getElementById('signupForm'), loginBtn: document.getElementById('loginBtn'), signupBtn: document.getElementById('signupBtn'), googleLoginBtn: document.getElementById('googleLoginBtn'), loginEmail: document.getElementById('loginEmail'), loginPassword: document.getElementById('loginPassword'), signupEmail: document.getElementById('signupEmail'), signupPassword: document.getElementById('signupPassword'), confirmPassword: document.getElementById('confirmPassword'), // Navigation dashboardNav: document.getElementById('dashboardNav'), summarizeNav: document.getElementById('summarizeNav'), flashcardsNav: document.getElementById('flashcardsNav'), scheduleNav: document.getElementById('scheduleNav'), mobileDashboardNav: document.getElementById('mobileDashboardNav'), mobileSummarizeNav: document.getElementById('mobileSummarizeNav'), mobileFlashcardsNav: document.getElementById('mobileFlashcardsNav'), mobileScheduleNav: document.getElementById('mobileScheduleNav'), // Sections dashboardSection: document.getElementById('dashboardSection'), summarizeSection: document.getElementById('summarizeSection'), flashcardsSection: document.getElementById('flashcardsSection'), scheduleSection: document.getElementById('scheduleSection'), // User menu userMenuBtn: document.getElementById('userMenuBtn'), userMenu: document.getElementById('userMenu'), userAvatar: document.getElementById('userAvatar'), userDisplayName: document.getElementById('userDisplayName'), signOutBtn: document.getElementById('signOutBtn'), mobileSignOutBtn: document.getElementById('mobileSignOutBtn'), mobileUserName: document.getElementById('mobileUserName'), mobileUserEmail: document.getElementById('mobileUserEmail'), mobileUserAvatar: document.getElementById('mobileUserAvatar'), // Theme themeToggle: document.getElementById('themeToggle'), darkModeIcon: document.getElementById('darkModeIcon'), lightModeIcon: document.getElementById('lightModeIcon'), mobileThemeToggle: document.getElementById('mobileThemeToggle'), mobileDarkModeIcon: document.getElementById('mobileDarkModeIcon'), mobileLightModeIcon: document.getElementById('mobileLightModeIcon'), // Mobile menu mobileMenuBtn: document.getElementById('mobileMenuBtn'), mobileMenuOpenIcon: document.getElementById('mobileMenuOpenIcon'), mobileMenuCloseIcon: document.getElementById('mobileMenuCloseIcon'), mobileMenu: document.getElementById('mobileMenu'), // Dashboard greetingTime: document.getElementById('greetingTime'), recentSummaries: document.getElementById('recentSummaries'), upcomingReviews: document.getElementById('upcomingReviews'), recentFlashcards: document.getElementById('recentFlashcards'), // Summarize contentInput: document.getElementById('contentInput'), uploadPdfBtn: document.getElementById('uploadPdfBtn'), pdfUpload: document.getElementById('pdfUpload'), summarizeBtn: document.getElementById('summarizeBtn'), summarizeBtnText: document.getElementById('summarizeBtnText'), summarizeLoading: document.getElementById('summarizeLoading'), summaryHistory: document.getElementById('summaryHistory'), summaryResults: document.getElementById('summaryResults'), generatedSummary: document.getElementById('generatedSummary'), generatedKeyPoints: document.getElementById('generatedKeyPoints'), generatedFlashcards: document.getElementById('generatedFlashcards'), saveSummaryBtn: document.getElementById('saveSummaryBtn'), copySummaryBtn: document.getElementById('copySummaryBtn'), copyKeyPointsBtn: document.getElementById('copyKeyPointsBtn'), saveFlashcardsBtn: document.getElementById('saveFlashcardsBtn'), copyFlashcardsBtn: document.getElementById('copyFlashcardsBtn'), // Flashcards flashcardSort: document.getElementById('flashcardSort'), startReviewBtn: document.getElementById('startReviewBtn'), endReviewBtn: document.getElementById('endReviewBtn'), currentFlashcard: document.getElementById('currentFlashcard'), flashcardQuestion: document.getElementById('flashcardQuestion'), flashcardAnswer: document.getElementById('flashcardAnswer'), cardProgress: document.getElementById('cardProgress'), cardStats: document.getElementById('cardStats'), difficultyBtns: document.querySelectorAll('.difficultyBtn'), flashcardDecks: document.getElementById('flashcardDecks'), createDeckBtn: document.getElementById('createDeckBtn'), // Schedule addTaskBtn: document.getElementById('addTaskBtn'), taskFilter: document.getElementById('taskFilter'), taskList: document.getElementById('taskList'), calendar: document.getElementById('calendar'), // Modals taskModal: document.getElementById('taskModal'), closeTaskModal: document.getElementById('closeTaskModal'), taskTitle: document.getElementById('taskTitle'), taskDescription: document.getElementById('taskDescription'), taskDueDate: document.getElementById('taskDueDate'), taskPriority: document.getElementById('taskPriority'), taskReminder: document.getElementById('taskReminder'), cancelTaskBtn: document.getElementById('cancelTaskBtn'), saveTaskBtn: document.getElementById('saveTaskBtn'), deckModal: document.getElementById('deckModal'), closeDeckModal: document.getElementById('closeDeckModal'), deckTitle: document.getElementById('deckTitle'), deckDescription: document.getElementById('deckDescription'), colorOptions: document.querySelectorAll('.colorOption'), cancelDeckBtn: document.getElementById('cancelDeckBtn'), saveDeckBtn: document.getElementById('saveDeckBtn'), // Toast toast: document.getElementById('toast'), toastIcon: document.getElementById('toastIcon'), toastMessage: document.getElementById('toastMessage'), closeToast: document.getElementById('closeToast') }; // App State let state = { currentUser: null, currentSection: 'dashboard', darkMode: localStorage.getItem('darkMode') === 'true', flashcardQueue: [], currentFlashcardIndex: 0, currentDeck: null, selectedColor: 'blue', currentSummary: null, tasks: [] }; // Initialize the app function init() { setupEventListeners(); checkAuthState(); updateGreeting(); setupTheme(); // Check for service worker support if ('serviceWorker' in navigator) { navigator.serviceWorker.register('/sw.js') .then(registration => { console.log('ServiceWorker registration successful with scope: ', registration.scope); initializeMessaging(); }) .catch(err => { console.log('ServiceWorker registration failed: ', err); }); } } // Set up all event listeners function setupEventListeners() { // Auth elements.closeAuthModal.addEventListener('click', () => toggleAuthModal(false)); elements.loginTab.addEventListener('click', () => showAuthForm('login')); elements.signupTab.addEventListener('click', () => showAuthForm('signup')); elements.loginBtn.addEventListener('click', handleLogin); elements.signupBtn.addEventListener('click', handleSignup); elements.googleLoginBtn.addEventListener('click', handleGoogleLogin); elements.signOutBtn.addEventListener('click', handleSignOut); elements.mobileSignOutBtn.addEventListener('click', handleSignOut); // Navigation elements.dashboardNav.addEventListener('click', () => showSection('dashboard')); elements.summarizeNav.addEventListener('click', () => showSection('summarize')); elements.flashcardsNav.addEventListener('click', () => showSection('flashcards')); elements.scheduleNav.addEventListener('click', () => showSection('schedule')); elements.mobileDashboardNav.addEventListener('click', () => { showSection('dashboard'); toggleMobileMenu(false); }); elements.mobileSummarizeNav.addEventListener('click', () => { showSection('summarize'); toggleMobileMenu(false); }); elements.mobileFlashcardsNav.addEventListener('click', () => { showSection('flashcards'); toggleMobileMenu(false); }); elements.mobileScheduleNav.addEventListener('click', () => { showSection('schedule'); toggleMobileMenu(false); }); // User menu elements.userMenuBtn.addEventListener('click', () => toggleUserMenu()); document.addEventListener('click', (e) => { if (!elements.userMenuBtn.contains(e.target) && !elements.userMenu.contains(e.target)) { elements.userMenu.classList.add('hidden'); } }); // Theme elements.themeToggle.addEventListener('click', toggleTheme); elements.mobileThemeToggle.addEventListener('click', toggleTheme); // Mobile menu elements.mobileMenuBtn.addEventListener('click', () => toggleMobileMenu()); // Summarize elements.contentInput.addEventListener('input', () => { elements.summarizeBtn.disabled = elements.contentInput.value.trim() === ''; }); elements.uploadPdfBtn.addEventListener('click', () => elements.pdfUpload.click()); elements.pdfUpload.addEventListener('change', handlePdfUpload); elements.summarizeBtn.addEventListener('click', handleSummarize); elements.saveSummaryBtn.addEventListener('click', saveSummary); elements.copySummaryBtn.addEventListener('click', copySummary); elements.copyKeyPointsBtn.addEventListener('click', copyKeyPoints); elements.saveFlashcardsBtn.addEventListener('click', saveFlashcards); elements.copyFlashcardsBtn.addEventListener('click', copyFlashcards); // Flashcards elements.startReviewBtn.addEventListener('click', startFlashcardReview); elements.endReviewBtn.addEventListener('click', endFlashcardReview); elements.currentFlashcard.addEventListener('click', flipFlashcard); elements.difficultyBtns.forEach(btn => { btn.addEventListener('click', () => rateFlashcard(parseInt(btn.dataset.difficulty))); }); elements.flashcardSort.addEventListener('change', loadFlashcards); elements.createDeckBtn.addEventListener('click', () => toggleDeckModal(true)); elements.saveDeckBtn.addEventListener('click', createDeck); elements.cancelDeckBtn.addEventListener('click', () => toggleDeckModal(false)); elements.closeDeckModal.addEventListener('click', () => toggleDeckModal(false)); elements.colorOptions.forEach(option => { option.addEventListener('click', () => { state.selectedColor = option.dataset.color; elements.colorOptions.forEach(opt => opt.classList.remove('border-blue-500')); option.classList.add('border-blue-500'); }); }); // Schedule elements.addTaskBtn.addEventListener('click', () => toggleTaskModal(true)); elements.taskFilter.addEventListener('change', loadTasks); elements.saveTaskBtn.addEventListener('click', saveTask); elements.cancelTaskBtn.addEventListener('click', () => toggleTaskModal(false)); elements.closeTaskModal.addEventListener('click', () => toggleTaskModal(false)); // Toast elements.closeToast.addEventListener('click', () => toggleToast(false)); } // Check auth state and update UI function checkAuthState() { auth.onAuthStateChanged(user => { state.currentUser = user; if (user) { // User is signed in updateUserUI(user); loadDashboardData(); showSection(state.currentSection); toggleAuthModal(false); } else { // No user is signed in toggleAuthModal(true); showSection('dashboard'); } }); } // Update user UI elements function updateUserUI(user) { const displayName = user.displayName || 'User'; const email = user.email || ''; const photoURL = user.photoURL || `https://ui-avatars.com/api/?name=${encodeURIComponent(displayName)}&background=3b82f6&color=fff`; elements.userAvatar.src = photoURL; elements.mobileUserAvatar.src = photoURL; elements.mobileUserName.textContent = displayName; elements.mobileUserEmail.textContent = email; elements.userDisplayName.textContent = displayName; } // Toggle auth modal function toggleAuthModal(show) { elements.authModal.classList.toggle('hidden', !show); if (show) { showAuthForm('login'); } } // Show login or signup form function showAuthForm(form) { const isLogin = form === 'login'; elements.loginForm.classList.toggle('hidden', !isLogin); elements.signupForm.classList.toggle('hidden', isLogin); elements.loginTab.classList.toggle('text-blue-600', isLogin); elements.loginTab.classList.toggle('dark:text-blue-400', isLogin); elements.loginTab.classList.toggle('border-blue-600', isLogin); elements.loginTab.classList.toggle('dark:border-blue-400', isLogin); elements.loginTab.classList.toggle('text-gray-500', !isLogin); elements.loginTab.classList.toggle('dark:text-gray-400', !isLogin); elements.signupTab.classList.toggle('text-blue-600', !isLogin); elements.signupTab.classList.toggle('dark:text-blue-400', !isLogin); elements.signupTab.classList.toggle('border-blue-600', !isLogin); elements.signupTab.classList.toggle('dark:border-blue-400', !isLogin); elements.signupTab.classList.toggle('text-gray-500', isLogin); elements.signupTab.classList.toggle('dark:text-gray-400', isLogin); } // Handle email/password login async function handleLogin() { const email = elements.loginEmail.value.trim(); const password = elements.loginPassword.value.trim(); if (!email || !password) { showToast('Please enter both email and password', 'error'); return; } try { await auth.signInWithEmailAndPassword(email, password); showToast('Logged in successfully', 'success'); } catch (error) { console.error('Login error:', error); showToast(error.message, 'error'); } } // Handle email/password signup async function handleSignup() { const email = elements.signupEmail.value.trim(); const password = elements.signupPassword.value.trim(); const confirmPassword = elements.confirmPassword.value.trim(); if (!email || !password || !confirmPassword) { showToast('Please fill in all fields', 'error'); return; } if (password !== confirmPassword) { showToast('Passwords do not match', 'error'); return; } if (password.length < 6) { showToast('Password should be at least 6 characters', 'error'); return; } try { await auth.createUserWithEmailAndPassword(email, password); showToast('Account created successfully', 'success'); } catch (error) { console.error('Signup error:', error); showToast(error.message, 'error'); } } // Handle Google login async function handleGoogleLogin() { const provider = new firebase.auth.GoogleAuthProvider(); try { await auth.signInWithPopup(provider); showToast('Logged in with Google', 'success'); } catch (error) { console.error('Google login error:', error); showToast(error.message, 'error'); } } // Handle sign out async function handleSignOut() { try { await auth.signOut(); showToast('Logged out successfully', 'success'); } catch (error) { console.error('Sign out error:', error); showToast(error.message, 'error'); } } // Toggle user menu function toggleUserMenu() { elements.userMenu.classList.toggle('hidden'); } // Toggle mobile menu function toggleMobileMenu(show) { if (typeof show === 'undefined') { show = elements.mobileMenu.classList.contains('hidden'); } elements.mobileMenu.classList.toggle('hidden', !show); elements.mobileMenuOpenIcon.classList.toggle('hidden', show); elements.mobileMenuCloseIcon.classList.toggle('hidden', !show); } // Show specific section function showSection(section) { state.currentSection = section; // Hide all sections elements.dashboardSection.classList.add('hidden'); elements.summarizeSection.classList.add('hidden'); elements.flashcardsSection.classList.add('hidden'); elements.scheduleSection.classList.add('hidden'); // Update nav highlights elements.dashboardNav.classList.remove('border-blue-500', 'text-gray-900', 'dark:text-white'); elements.dashboardNav.classList.add('border-transparent', 'text-gray-500', 'dark:text-gray-400'); elements.summarizeNav.classList.remove('border-blue-500', 'text-gray-900', 'dark:text-white'); elements.summarizeNav.classList.add('border-transparent', 'text-gray-500', 'dark:text-gray-400'); elements.flashcardsNav.classList.remove('border-blue-500', 'text-gray-900', 'dark:text-white'); elements.flashcardsNav.classList.add('border-transparent', 'text-gray-500', 'dark:text-gray-400'); elements.scheduleNav.classList.remove('border-blue-500', 'text-gray-900', 'dark:text-white'); elements.scheduleNav.classList.add('border-transparent', 'text-gray-500', 'dark:text-gray-400'); elements.mobileDashboardNav.classList.remove('bg-blue-50', 'dark:bg-gray-700', 'border-blue-500', 'text-blue-700', 'dark:text-blue-400'); elements.mobileDashboardNav.classList.add('border-transparent', 'text-gray-600', 'dark:text-gray-400'); elements.mobileSummarizeNav.classList.remove('bg-blue-50', 'dark:bg-gray-700', 'border-blue-500', 'text-blue-700', 'dark:text-blue-400'); elements.mobileSummarizeNav.classList.add('border-transparent', 'text-gray-600', 'dark:text-gray-400'); elements.mobileFlashcardsNav.classList.remove('bg-blue-50', 'dark:bg-gray-700', 'border-blue-500', 'text-blue-700', 'dark:text-blue-400'); elements.mobileFlashcardsNav.classList.add('border-transparent', 'text-gray-600', 'dark:text-gray-400'); elements.mobileScheduleNav.classList.remove('bg-blue-50', 'dark:bg-gray-700', 'border-blue-500', 'text-blue-700', 'dark:text-blue-400'); elements.mobileScheduleNav.classList.add('border-transparent', 'text-gray-600', 'dark:text-gray-400'); // Show selected section and update nav switch (section) { case 'dashboard': elements.dashboardSection.classList.remove('hidden'); elements.dashboardNav.classList.remove('border-transparent', 'text-gray-500', 'dark:text-gray-400'); elements.dashboardNav.classList.add('border-blue-500', 'text-gray-900', 'dark:text-white'); elements.mobileDashboardNav.classList.remove('border-transparent', 'text-gray-600', 'dark:text-gray-400'); elements.mobileDashboardNav.classList.add('bg-blue-50', 'dark:bg-gray-700', 'border-blue-500', 'text-blue-700', 'dark:text-blue-400'); loadDashboardData(); break; case 'summarize': elements.summarizeSection.classList.remove('hidden'); elements.summarizeNav.classList.remove('border-transparent', 'text-gray-500', 'dark:text-gray-400'); elements.summarizeNav.classList.add('border-blue-500', 'text-gray-900', 'dark:text-white'); elements.mobileSummarizeNav.classList.remove('border-transparent', 'text-gray-600', 'dark:text-gray-400'); elements.mobileSummarizeNav.classList.add('bg-blue-50', 'dark:bg-gray-700', 'border-blue-500', 'text-blue-700', 'dark:text-blue-400'); loadSummaryHistory(); break; case 'flashcards': elements.flashcardsSection.classList.remove('hidden'); elements.flashcardsNav.classList.remove('border-transparent', 'text-gray-500', 'dark:text-gray-400'); elements.flashcardsNav.classList.add('border-blue-500', 'text-gray-900', 'dark:text-white'); elements.mobileFlashcardsNav.classList.remove('border-transparent', 'text-gray-600', 'dark:text-gray-400'); elements.mobileFlashcardsNav.classList.add('bg-blue-50', 'dark:bg-gray-700', 'border-blue-500', 'text-blue-700', 'dark:text-blue-400'); loadFlashcards(); loadFlashcardDecks(); break; case 'schedule': elements.scheduleSection.classList.remove('hidden'); elements.scheduleNav.classList.remove('border-transparent', 'text-gray-500', 'dark:text-gray-400'); elements.scheduleNav.classList.add('border-blue-500', 'text-gray-900', 'dark:text-white'); elements.mobileScheduleNav.classList.remove('border-transparent', 'text-gray-600', 'dark:text-gray-400'); elements.mobileScheduleNav.classList.add('bg-blue-50', 'dark:bg-gray-700', 'border-blue-500', 'text-blue-700', 'dark:text-blue-400'); loadTasks(); break; } } // Load dashboard data function loadDashboardData() { if (!state.currentUser) return; // Recent summaries db.collection('summaries') .where('userId', '==', state.currentUser.uid) .orderBy('createdAt', 'desc') .limit(3) .get() .then(querySnapshot => { elements.recentSummaries.innerHTML = ''; if (querySnapshot.empty) { elements.recentSummaries.innerHTML = '<p class="text-gray-500 dark:text-gray-400 text-center">No recent summaries found</p>'; return; } querySnapshot.forEach(doc => { const data = doc.data(); const summaryEl = document.createElement('div'); summaryEl.className = 'border-b border-gray-200 dark:border-gray-700 pb-3 last:border-0 last:pb-0'; summaryEl.innerHTML = ` <h4 class="font-medium text-gray-900 dark:text-white truncate">${data.title || 'Untitled Summary'}</h4> <p class="text-sm text-gray-600 dark:text-gray-300 mt-1 line-clamp-2">${data.summary || ''}</p> <div class="mt-2 flex justify-between items-center"> <span class="text-xs text-gray-500 dark:text-gray-400">${formatDate(data.createdAt?.toDate())}</span> <a href="#" class="text-xs text-blue-600 dark:text-blue-400 hover:underline" data-id="${doc.id}">View</a> </div> `; elements.recentSummaries.appendChild(summaryEl); // Add click event to view summary summaryEl.querySelector('a').addEventListener('click', (e) => { e.preventDefault(); showSection('summarize'); // In a real app, we would load the full summary here }); }); }) .catch(error => { console.error('Error loading recent summaries:', error); elements.recentSummaries.innerHTML = '<p class="text-red-500 dark:text-red-400">Error loading summaries</p>'; }); // Upcoming reviews const now = new Date(); const nextWeek = new Date(now.getTime() + 7 * 24 * 60 * 60 * 1000); db.collection('flashcards') .where('userId', '==', state.currentUser.uid) .where('nextReviewTs', '>=', now) .where('nextReviewTs', '<=', nextWeek) .orderBy('nextReviewTs') .limit(5) .get() .then(querySnapshot => { elements.upcomingReviews.innerHTML = ''; if (querySnapshot.empty) { elements.upcomingReviews.innerHTML = '<p class="text-gray-500 dark:text-gray-400 text-center">No upcoming reviews</p>'; return; } query <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Only1bigX/scholarplug" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> </html>
<!DOCTYPE html>
<html lang="en" class="h-full">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>StudyZen - Smart Study Assistant</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://www.gstatic.com/firebasejs/10.1.0/firebase-app-compat.js"></script>
<script src="https://www.gstatic.com/firebasejs/10.1.0/firebase-auth-compat.js"></script>
<script src="https://www.gstatic.com/firebasejs/10.1.0/firebase-firestore-compat.js"></script>
<script src="https://www.gstatic.com/firebasejs/10.1.0/firebase-storage-compat.js"></script>
<script src="https://www.gstatic.com/firebasejs/10.1.0/firebase-messaging-compat.js"></script>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
:root {
--primary: #3b82f6;
--primary-dark: #2563eb;
}
body {
font-family: 'Inter', sans-serif;
transition: background-color 0.3s ease;
}
.card {
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
transform: translateY(-2px);
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}
.flashcard {
perspective: 1000px;
}
.flashcard-inner {
transition: transform 0.6s;
transform-style: preserve-3d;
}
.flashcard.flipped .flashcard-inner {
transform: rotateY(180deg);
}
.flashcard-front, .flashcard-back {
backface-visibility: hidden;
}
.flashcard-back {
transform: rotateY(180deg);
}
.loading-spinner {
animation: spin 1s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.dark {
background-color: #1a202c;
color: #f7fafc;
}
.dark .card {
background-color: #2d3748;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.12);
}
.progress-ring__circle {
transition: stroke-dashoffset 0.35s;
transform: rotate(-90deg);
transform-origin: 50% 50%;
}
</style>
</head>
<body class="h-full bg-gray-50 dark:bg-gray-900">
<!-- Auth Modal -->
<div id="authModal" class="fixed inset-0 z-50 hidden flex items-center justify-center bg-black bg-opacity-50">
<div class="bg-white dark:bg-gray-800 rounded-xl p-6 w-full max-w-md">
<div class="flex justify-between items-center mb-4">
<h3 class="text-xl font-semibold text-gray-900 dark:text-white">Welcome to StudyZen</h3>
<button id="closeAuthModal" class="text-gray-500 hover:text-gray-700 dark:hover:text-gray-300">
<i class="fas fa-times"></i>
</button>
</div>
<div id="authTabs" class="flex border-b border-gray-200 dark:border-gray-700 mb-4">
<button id="loginTab" class="py-2 px-4 font-medium text-blue-600 dark:text-blue-400 border-b-2 border-blue-600 dark:border-blue-400">Login</button>
<button id="signupTab" class="py-2 px-4 font-medium text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300">Sign Up</button>
</div>
<div id="loginForm">
<div class="mb-4">
<label for="loginEmail" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Email</label>
<input type="email" id="loginEmail" class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white">
</div>
<div class="mb-4">
<label for="loginPassword" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Password</label>
<input type="password" id="loginPassword" class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white">
</div>
<button id="loginBtn" class="w-full bg-blue-600 hover:bg-blue-700 text-white py-2 px-4 rounded-md font-medium transition duration-150 ease-in-out">Login</button>
<div class="mt-4 text-center">
<button id="googleLoginBtn" class="w-full bg-white hover:bg-gray-50 text-gray-700 py-2 px-4 rounded-md font-medium border border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:hover:bg-gray-600 transition duration-150 ease-in-out flex items-center justify-center">
<img src="https://upload.wikimedia.org/wikipedia/commons/5/53/Google_%22G%22_Logo.svg" alt="Google logo" class="h-4 w-4 mr-2">
Continue with Google
</button>
</div>
</div>