web / index.html
upreti's picture
undefined - Initial Deployment
8a9759f verified
Raw History Blame Contribute Delete
20.7 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>FocusMate - Study Focus App</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');
body {
font-family: 'Poppins', sans-serif;
transition: background-color 0.3s, color 0.3s;
}
.progress-ring__circle {
transition: stroke-dashoffset 0.35s;
transform: rotate(-90deg);
transform-origin: 50% 50%;
}
.glass-effect {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.2);
}
.neumorphism {
border-radius: 16px;
box-shadow: 8px 8px 16px #d1d9e6,
-8px -8px 16px #ffffff;
}
.neumorphism-dark {
border-radius: 16px;
box-shadow: 8px 8px 16px #1a1a1a,
-8px -8px 16px #2a2a2a;
}
.chat-message {
animation: fadeIn 0.3s ease-in-out;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
</style>
</head>
<body class="bg-gradient-to-br from-indigo-50 to-purple-50 dark:from-gray-900 dark:to-gray-800 min-h-screen text-gray-800 dark:text-gray-200">
<div class="container mx-auto px-4 py-8 max-w-md">
<!-- Header -->
<header class="flex justify-between items-center mb-8">
<div>
<h1 class="text-2xl font-bold">FocusMate</h1>
<p class="text-sm opacity-70">Study smarter, not harder</p>
</div>
<button id="theme-toggle" class="p-2 rounded-full bg-white dark:bg-gray-700 shadow-md">
<i class="fas fa-moon dark:hidden"></i>
<i class="fas fa-sun hidden dark:block"></i>
</button>
</header>
<!-- Main Content -->
<main class="space-y-8">
<!-- Clock Section -->
<section class="glass-effect p-6 rounded-2xl">
<div class="flex justify-between items-center mb-4">
<h2 class="text-lg font-semibold">Study Clock</h2>
<button id="toggle-format" class="text-sm bg-indigo-100 dark:bg-gray-700 px-3 py-1 rounded-full">24h</button>
</div>
<div class="text-center">
<div id="clock" class="text-5xl font-bold mb-2">00:00:00</div>
<div id="date" class="text-sm opacity-70">Monday, January 1</div>
</div>
</section>
<!-- Timer Section -->
<section class="glass-effect p-6 rounded-2xl">
<h2 class="text-lg font-semibold mb-4">Focus Timer</h2>
<div class="flex justify-center mb-6">
<svg id="progress-ring" width="200" height="200" class="transform -rotate-90">
<circle class="text-gray-200 dark:text-gray-700" stroke-width="8" stroke="currentColor" fill="transparent" r="90" cx="100" cy="100"/>
<circle id="progress-ring-circle" class="progress-ring__circle text-indigo-500 dark:text-purple-400" stroke-width="8" stroke-linecap="round" stroke="currentColor" fill="transparent" r="90" cx="100" cy="100"/>
</svg>
<div class="absolute flex flex-col items-center justify-center w-40 h-40">
<div id="timer-display" class="text-4xl font-bold">25:00</div>
<div id="timer-state" class="text-sm opacity-70">Ready</div>
</div>
</div>
<div class="flex justify-between mb-4">
<button class="timer-preset px-4 py-2 rounded-lg bg-indigo-100 dark:bg-gray-700" data-minutes="25">25 min</button>
<button class="timer-preset px-4 py-2 rounded-lg bg-indigo-100 dark:bg-gray-700" data-minutes="45">45 min</button>
<button class="timer-preset px-4 py-2 rounded-lg bg-indigo-100 dark:bg-gray-700" data-minutes="60">60 min</button>
</div>
<div class="flex justify-center space-x-4">
<button id="timer-start" class="px-6 py-2 bg-indigo-500 text-white rounded-full font-medium flex items-center">
<i class="fas fa-play mr-2"></i> Start
</button>
<button id="timer-reset" class="px-6 py-2 bg-gray-200 dark:bg-gray-700 rounded-full font-medium opacity-50" disabled>
Reset
</button>
</div>
</section>
<!-- AI Chat Section -->
<section class="glass-effect p-6 rounded-2xl">
<h2 class="text-lg font-semibold mb-4">Study Assistant</h2>
<div class="relative mb-4">
<input id="chat-input" type="text" placeholder="Ask ChatGPT anything..."
class="w-full px-4 py-3 bg-white dark:bg-gray-700 rounded-full focus:outline-none focus:ring-2 focus:ring-indigo-500 pr-12">
<button id="chat-send" class="absolute right-3 top-3 text-indigo-500 dark:text-purple-400">
<i class="fas fa-paper-plane"></i>
</button>
</div>
<div id="chat-container" class="hidden max-h-60 overflow-y-auto mb-4 space-y-3">
<div class="chat-message bg-indigo-100 dark:bg-gray-700 p-3 rounded-lg">
<div class="font-semibold text-indigo-600 dark:text-purple-400">You</div>
<div id="user-question">Sample question</div>
</div>
<div class="chat-message bg-white dark:bg-gray-800 p-3 rounded-lg border border-gray-200 dark:border-gray-700">
<div class="font-semibold">FocusMate AI</div>
<div id="ai-response">Sample response from the AI assistant...</div>
</div>
</div>
</section>
<!-- Music Player Section -->
<section class="glass-effect p-6 rounded-2xl">
<h2 class="text-lg font-semibold mb-4">Focus Music</h2>
<div class="flex items-center mb-4">
<img src="https://via.placeholder.com/60" alt="Album cover" class="w-16 h-16 rounded-lg mr-4">
<div class="flex-1">
<div class="font-medium">Lo-Fi Beats</div>
<div class="text-sm opacity-70">Chill Study Vibes</div>
</div>
<button id="play-pause" class="p-3 bg-indigo-500 text-white rounded-full">
<i class="fas fa-play"></i>
</button>
</div>
<div class="flex justify-between text-xs mb-2">
<span>0:00</span>
<span>3:45</span>
</div>
<input type="range" class="w-full mb-4 accent-indigo-500" value="30">
<div class="grid grid-cols-4 gap-2">
<button class="music-genre p-2 rounded-lg bg-indigo-100 dark:bg-gray-700 text-center" data-genre="lofi">
<i class="fas fa-headphones mb-1"></i>
<div class="text-xs">Lo-Fi</div>
</button>
<button class="music-genre p-2 rounded-lg bg-indigo-100 dark:bg-gray-700 text-center" data-genre="nature">
<i class="fas fa-tree mb-1"></i>
<div class="text-xs">Nature</div>
</button>
<button class="music-genre p-2 rounded-lg bg-indigo-100 dark:bg-gray-700 text-center" data-genre="piano">
<i class="fas fa-music mb-1"></i>
<div class="text-xs">Piano</div>
</button>
<button class="music-genre p-2 rounded-lg bg-indigo-100 dark:bg-gray-700 text-center" data-genre="chill">
<i class="fas fa-wind mb-1"></i>
<div class="text-xs">Chill</div>
</button>
</div>
</section>
</main>
<!-- Bottom Navigation -->
<nav class="fixed bottom-0 left-0 right-0 bg-white dark:bg-gray-800 shadow-lg flex justify-around py-3">
<button class="nav-item active p-2 text-indigo-500 dark:text-purple-400" data-section="home">
<i class="fas fa-home text-xl"></i>
</button>
<button class="nav-item p-2 text-gray-500 dark:text-gray-400" data-section="timer">
<i class="fas fa-clock text-xl"></i>
</button>
<button class="nav-item p-2 text-gray-500 dark:text-gray-400" data-section="chat">
<i class="fas fa-comment text-xl"></i>
</button>
<button class="nav-item p-2 text-gray-500 dark:text-gray-400" data-section="music">
<i class="fas fa-music text-xl"></i>
</button>
</nav>
</div>
<script>
// Theme Toggle
const themeToggle = document.getElementById('theme-toggle');
themeToggle.addEventListener('click', () => {
document.documentElement.classList.toggle('dark');
localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light');
});
// Set initial theme
if (localStorage.getItem('theme') === 'dark' || (!localStorage.getItem('theme') && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
document.documentElement.classList.add('dark');
}
// Clock Functionality
function updateClock() {
const now = new Date();
const is24Hour = document.getElementById('toggle-format').textContent === '24h';
let hours = now.getHours();
const minutes = String(now.getMinutes()).padStart(2, '0');
const seconds = String(now.getSeconds()).padStart(2, '0');
if (!is24Hour) {
const ampm = hours >= 12 ? 'PM' : 'AM';
hours = hours % 12;
hours = hours ? hours : 12; // Convert 0 to 12
document.getElementById('clock').textContent = `${hours}:${minutes}:${seconds} ${ampm}`;
} else {
document.getElementById('clock').textContent = `${String(hours).padStart(2, '0')}:${minutes}:${seconds}`;
}
const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
document.getElementById('date').textContent = now.toLocaleDateString(undefined, options);
}
document.getElementById('toggle-format').addEventListener('click', function() {
this.textContent = this.textContent === '12h' ? '24h' : '12h';
updateClock();
});
setInterval(updateClock, 1000);
updateClock();
// Timer Functionality
let timerInterval;
let timeLeft = 25 * 60; // 25 minutes in seconds
let isRunning = false;
const circle = document.getElementById('progress-ring-circle');
const circumference = 2 * Math.PI * 90;
circle.style.strokeDasharray = circumference;
circle.style.strokeDashoffset = circumference;
function updateTimerDisplay() {
const minutes = Math.floor(timeLeft / 60);
const seconds = timeLeft % 60;
document.getElementById('timer-display').textContent = `${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`;
// Update progress ring
const progress = (timeLeft / (parseInt(document.getElementById('timer-display').dataset.duration) * 60)) * circumference;
circle.style.strokeDashoffset = progress;
}
function startTimer() {
if (isRunning) return;
isRunning = true;
document.getElementById('timer-state').textContent = 'Focusing...';
document.getElementById('timer-start').innerHTML = '<i class="fas fa-pause mr-2"></i> Pause';
document.getElementById('timer-reset').disabled = false;
timerInterval = setInterval(() => {
timeLeft--;
updateTimerDisplay();
if (timeLeft <= 0) {
clearInterval(timerInterval);
isRunning = false;
document.getElementById('timer-state').textContent = 'Completed!';
document.getElementById('timer-start').innerHTML = '<i class="fas fa-play mr-2"></i> Start';
// Play alarm sound or show notification
alert('Timer completed! Take a short break.');
}
}, 1000);
}
function pauseTimer() {
clearInterval(timerInterval);
isRunning = false;
document.getElementById('timer-state').textContent = 'Paused';
document.getElementById('timer-start').innerHTML = '<i class="fas fa-play mr-2"></i> Resume';
}
function resetTimer() {
clearInterval(timerInterval);
isRunning = false;
timeLeft = parseInt(document.getElementById('timer-display').dataset.duration) * 60;
updateTimerDisplay();
document.getElementById('timer-state').textContent = 'Ready';
document.getElementById('timer-start').innerHTML = '<i class="fas fa-play mr-2"></i> Start';
document.getElementById('timer-reset').disabled = true;
circle.style.strokeDashoffset = circumference;
}
document.getElementById('timer-start').addEventListener('click', function() {
if (isRunning) {
pauseTimer();
} else {
startTimer();
}
});
document.getElementById('timer-reset').addEventListener('click', resetTimer);
// Timer presets
document.querySelectorAll('.timer-preset').forEach(button => {
button.addEventListener('click', function() {
const minutes = parseInt(this.dataset.minutes);
timeLeft = minutes * 60;
document.getElementById('timer-display').textContent = `${String(minutes).padStart(2, '0')}:00`;
document.getElementById('timer-display').dataset.duration = minutes;
document.getElementById('timer-state').textContent = 'Ready';
circle.style.strokeDashoffset = circumference;
if (isRunning) {
clearInterval(timerInterval);
isRunning = false;
document.getElementById('timer-start').innerHTML = '<i class="fas fa-play mr-2"></i> Start';
}
});
});
// Initialize with 25 minutes
document.getElementById('timer-display').dataset.duration = 25;
updateTimerDisplay();
// AI Chat Functionality
const chatInput = document.getElementById('chat-input');
const chatSend = document.getElementById('chat-send');
const chatContainer = document.getElementById('chat-container');
function sendMessage() {
const question = chatInput.value.trim();
if (!question) return;
// Show chat container if hidden
chatContainer.classList.remove('hidden');
// Display user question
document.getElementById('user-question').textContent = question;
// Simulate AI response (in a real app, this would call an API)
document.getElementById('ai-response').textContent = "I'm analyzing your question about \"" + question + "\". Here's what I found: Studying effectively requires focused attention. Try using the Pomodoro technique (25 minutes of focused work followed by a 5-minute break) to improve your concentration.";
// Clear input
chatInput.value = '';
// Scroll to bottom
chatContainer.scrollTop = chatContainer.scrollHeight;
}
chatSend.addEventListener('click', sendMessage);
chatInput.addEventListener('keypress', function(e) {
if (e.key === 'Enter') sendMessage();
});
// Music Player Functionality
const playPause = document.getElementById('play-pause');
let isPlaying = false;
playPause.addEventListener('click', function() {
isPlaying = !isPlaying;
if (isPlaying) {
this.innerHTML = '<i class="fas fa-pause"></i>';
// In a real app, this would play audio
} else {
this.innerHTML = '<i class="fas fa-play"></i>';
}
});
// Music genre selection
document.querySelectorAll('.music-genre').forEach(button => {
button.addEventListener('click', function() {
const genre = this.dataset.genre;
// Update player UI based on genre
const playerText = document.querySelector('#music-player-section div:first-child');
const playerSubtext = document.querySelector('#music-player-section div:nth-child(2)');
switch(genre) {
case 'lofi':
playerText.textContent = 'Lo-Fi Beats';
playerSubtext.textContent = 'Chill Study Vibes';
break;
case 'nature':
playerText.textContent = 'Nature Sounds';
playerSubtext.textContent = 'Forest & Rain';
break;
case 'piano':
playerText.textContent = 'Piano Study';
playerSubtext.textContent = 'Classical Focus';
break;
case 'chill':
playerText.textContent = 'Chill Vibes';
playerSubtext.textContent = 'Relaxing Music';
break;
}
// In a real app, this would change the audio track
});
});
// Navigation
document.querySelectorAll('.nav-item').forEach(item => {
item.addEventListener('click', function() {
document.querySelectorAll('.nav-item').forEach(nav => nav.classList.remove('active', 'text-indigo-500', 'dark:text-purple-400'));
this.classList.add('active', 'text-indigo-500', 'dark:text-purple-400');
// In a full app, this would navigate to different sections
// For this demo, we'll just scroll to the relevant section
const section = this.dataset.section;
if (section === 'home') {
window.scrollTo({ top: 0, behavior: 'smooth' });
} else {
document.querySelector(`#${section}-section`).scrollIntoView({ behavior: 'smooth' });
}
});
});
</script>
<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=upreti/web" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>