Download index.html from Jeanic/focustime: direct link, hf CLI and curl.
- Browser
- Download file 54.7 kB
-
https://huggingface.co/spaces/Jeanic/focustime/resolve/main/index.html
- Command line
-
hf download hf://spaces/Jeanic/focustime/index.html
-
curl -L -o index.html https://huggingface.co/spaces/Jeanic/focustime/resolve/main/index.html
54.7 kB
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>FocusTime - Gestion du temps et productivité</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>
.pomodoro-progress {
background: conic-gradient(#4ade80 var(--progress), #e2e8f0 0deg);
}
.task-checkbox:checked + .task-label {
text-decoration: line-through;
color: #94a3b8;
}
.fade-in {
animation: fadeIn 0.3s ease-in-out;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.slide-in {
animation: slideIn 0.3s ease-out;
}
@keyframes slideIn {
from { transform: translateX(100%); }
to { transform: translateX(0); }
}
</style>
</head>
<body class="bg-gray-50 text-gray-800 font-sans min-h-screen">
<div class="max-w-md mx-auto bg-white min-h-screen shadow-lg flex flex-col">
<!-- Header -->
<header class="bg-indigo-700 text-white p-4 shadow-md">
<div class="flex items-center justify-between">
<div class="flex items-center space-x-2">
<i class="fas fa-clock text-2xl"></i>
<h1 class="text-xl font-bold">FocusTime</h1>
</div>
<button id="theme-toggle" class="p-2 rounded-full hover:bg-indigo-600">
<i class="fas fa-moon"></i>
</button>
</div>
</header>
<!-- Main Content -->
<main class="flex-1 overflow-y-auto pb-16" id="main-content">
<!-- Home Screen (default) -->
<section id="home-screen" class="p-4 fade-in">
<div class="text-center mb-6">
<h2 class="text-xl font-semibold mb-2">Prêt à rester concentré ?</h2>
<p class="text-gray-600" id="motivational-quote">"La discipline est la clé de la liberté."</p>
</div>
<!-- Quick Actions -->
<div class="grid grid-cols-2 gap-4 mb-6">
<button onclick="showScreen('pomodoro-screen')" class="bg-green-100 hover:bg-green-200 text-green-800 p-4 rounded-lg flex flex-col items-center transition">
<i class="fas fa-hourglass-start text-2xl mb-2"></i>
<span>Démarrer Pomodoro</span>
</button>
<button onclick="showScreen('tasks-screen')" class="bg-blue-100 hover:bg-blue-200 text-blue-800 p-4 rounded-lg flex flex-col items-center transition">
<i class="fas fa-tasks text-2xl mb-2"></i>
<span>Mes tâches</span>
</button>
<button onclick="showScreen('focus-mode-screen')" class="bg-purple-100 hover:bg-purple-200 text-purple-800 p-4 rounded-lg flex flex-col items-center transition">
<i class="fas fa-brain text-2xl mb-2"></i>
<span>Mode Focus</span>
</button>
<button onclick="showScreen('stats-screen')" class="bg-yellow-100 hover:bg-yellow-200 text-yellow-800 p-4 rounded-lg flex flex-col items-center transition">
<i class="fas fa-chart-line text-2xl mb-2"></i>
<span>Statistiques</span>
</button>
</div>
<!-- Today's Summary -->
<div class="bg-gray-100 p-4 rounded-lg mb-6">
<h3 class="font-medium mb-2">Résumé du jour</h3>
<div class="flex justify-between text-sm">
<div class="text-center">
<div class="text-2xl font-bold" id="today-sessions">0</div>
<div class="text-gray-600">Sessions</div>
</div>
<div class="text-center">
<div class="text-2xl font-bold" id="today-minutes">0</div>
<div class="text-gray-600">Minutes</div>
</div>
<div class="text-center">
<div class="text-2xl font-bold" id="today-tasks">0</div>
<div class="text-gray-600">Tâches</div>
</div>
</div>
</div>
<!-- Recent Tasks -->
<div>
<h3 class="font-medium mb-2">Tâches récentes</h3>
<div id="recent-tasks" class="space-y-2">
<!-- Tasks will be added here dynamically -->
</div>
</div>
</section>
<!-- Pomodoro Screen -->
<section id="pomodoro-screen" class="p-4 hidden">
<div class="flex justify-between items-center mb-6">
<button onclick="showScreen('home-screen')" class="p-2 rounded-full hover:bg-gray-100">
<i class="fas fa-arrow-left"></i>
</button>
<h2 class="text-xl font-semibold">Pomodoro</h2>
<div class="w-8"></div> <!-- Spacer for alignment -->
</div>
<div class="text-center mb-8">
<div class="relative w-48 h-48 mx-auto mb-6">
<div class="absolute inset-0 rounded-full pomodoro-progress flex items-center justify-center"
style="--progress: 0%">
<div class="absolute inset-4 bg-white rounded-full flex items-center justify-center">
<div class="text-center">
<div id="timer-display" class="text-3xl font-bold">25:00</div>
<div id="timer-state" class="text-gray-600">Prêt</div>
</div>
</div>
</div>
</div>
<div class="flex justify-center space-x-4 mb-6">
<button id="start-pomodoro" class="bg-green-500 hover:bg-green-600 text-white px-6 py-2 rounded-full font-medium">
Démarrer
</button>
<button id="reset-pomodoro" class="bg-gray-200 hover:bg-gray-300 text-gray-800 px-6 py-2 rounded-full font-medium">
Réinitialiser
</button>
</div>
</div>
<div class="bg-gray-100 p-4 rounded-lg">
<h3 class="font-medium mb-2">Paramètres Pomodoro</h3>
<div class="space-y-4">
<div>
<label class="block text-sm text-gray-600 mb-1">Temps de travail (minutes)</label>
<input type="number" id="work-time" value="25" min="1" max="60" class="w-full p-2 border rounded">
</div>
<div>
<label class="block text-sm text-gray-600 mb-1">Pause courte (minutes)</label>
<input type="number" id="short-break" value="5" min="1" max="15" class="w-full p-2 border rounded">
</div>
<div>
<label class="block text-sm text-gray-600 mb-1">Pause longue (minutes)</label>
<input type="number" id="long-break" value="15" min="5" max="30" class="w-full p-2 border rounded">
</div>
<div>
<label class="flex items-center space-x-2">
<input type="checkbox" id="auto-start" class="rounded text-indigo-600">
<span class="text-sm text-gray-600">Démarrer automatiquement les pauses</span>
</label>
</div>
</div>
</div>
</section>
<!-- Tasks Screen -->
<section id="tasks-screen" class="p-4 hidden">
<div class="flex justify-between items-center mb-6">
<button onclick="showScreen('home-screen')" class="p-2 rounded-full hover:bg-gray-100">
<i class="fas fa-arrow-left"></i>
</button>
<h2 class="text-xl font-semibold">Mes tâches</h2>
<button onclick="showAddTaskModal()" class="p-2 rounded-full hover:bg-gray-100">
<i class="fas fa-plus"></i>
</button>
</div>
<div class="flex mb-4 overflow-x-auto pb-2">
<button data-filter="all" class="filter-btn active px-4 py-1 bg-indigo-600 text-white rounded-full mr-2 text-sm">
Toutes
</button>
<button data-filter="today" class="filter-btn px-4 py-1 bg-gray-200 hover:bg-gray-300 rounded-full mr-2 text-sm">
Aujourd'hui
</button>
<button data-filter="week" class="filter-btn px-4 py-1 bg-gray-200 hover:bg-gray-300 rounded-full mr-2 text-sm">
Cette semaine
</button>
<button data-filter="high" class="filter-btn px-4 py-1 bg-gray-200 hover:bg-gray-300 rounded-full text-sm">
Priorité haute
</button>
</div>
<div id="tasks-list" class="space-y-2">
<!-- Tasks will be added here dynamically -->
</div>
</section>
<!-- Add Task Modal -->
<div id="add-task-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 hidden z-50">
<div class="bg-white rounded-lg w-full max-w-md p-6 slide-in">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-semibold">Ajouter une tâche</h3>
<button onclick="hideAddTaskModal()" class="p-2 rounded-full hover:bg-gray-100">
<i class="fas fa-times"></i>
</button>
</div>
<form id="task-form" class="space-y-4">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Titre</label>
<input type="text" id="task-title" required class="w-full p-2 border rounded focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Description (optionnel)</label>
<textarea id="task-description" rows="2" class="w-full p-2 border rounded focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"></textarea>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Date d'échéance</label>
<input type="date" id="task-due" class="w-full p-2 border rounded focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Priorité</label>
<select id="task-priority" class="w-full p-2 border rounded focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500">
<option value="low">Basse</option>
<option value="medium" selected>Moyenne</option>
<option value="high">Haute</option>
</select>
</div>
<div class="flex justify-end space-x-3 pt-2">
<button type="button" onclick="hideAddTaskModal()" class="px-4 py-2 bg-gray-200 hover:bg-gray-300 rounded-md font-medium">
Annuler
</button>
<button type="submit" class="px-4 py-2 bg-indigo-600 hover:bg-indigo-700 text-white rounded-md font-medium">
Ajouter
</button>
</div>
</form>
</div>
</div>
<!-- Focus Mode Screen -->
<section id="focus-mode-screen" class="p-4 hidden">
<div class="flex justify-between items-center mb-6">
<button onclick="showScreen('home-screen')" class="p-2 rounded-full hover:bg-gray-100">
<i class="fas fa-arrow-left"></i>
</button>
<h2 class="text-xl font-semibold">Mode Focus</h2>
<div class="w-8"></div> <!-- Spacer for alignment -->
</div>
<div class="bg-gray-100 p-4 rounded-lg mb-6">
<h3 class="font-medium mb-4">Choisissez votre mode de concentration</h3>
<div class="space-y-4">
<div class="flex items-start">
<input type="radio" id="custom-mode" name="focus-mode" value="custom" class="mt-1" checked>
<label for="custom-mode" class="ml-2">
<div class="font-medium">Mode personnalisé</div>
<div class="text-sm text-gray-600">Sélectionnez les applications à bloquer pendant votre session</div>
</label>
</div>
<div class="flex items-start">
<input type="radio" id="total-mode" name="focus-mode" value="total" class="mt-1">
<label for="total-mode" class="ml-2">
<div class="font-medium">Mode total</div>
<div class="text-sm text-gray-600">Bloque toutes les applications sauf FocusTime</div>
</label>
</div>
</div>
</div>
<div id="custom-apps-section" class="bg-gray-100 p-4 rounded-lg mb-6">
<h3 class="font-medium mb-3">Applications à bloquer</h3>
<div class="space-y-3">
<div class="flex items-center justify-between p-2 bg-white rounded">
<div class="flex items-center">
<i class="fas fa-comment text-blue-500 mr-3"></i>
<span>WhatsApp</span>
</div>
<label class="relative inline-flex items-center cursor-pointer">
<input type="checkbox" class="sr-only peer" checked>
<div class="w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-indigo-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-indigo-600"></div>
</label>
</div>
<div class="flex items-center justify-between p-2 bg-white rounded">
<div class="flex items-center">
<i class="fab fa-facebook text-blue-600 mr-3"></i>
<span>Facebook</span>
</div>
<label class="relative inline-flex items-center cursor-pointer">
<input type="checkbox" class="sr-only peer" checked>
<div class="w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-indigo-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-indigo-600"></div>
</label>
</div>
<div class="flex items-center justify-between p-2 bg-white rounded">
<div class="flex items-center">
<i class="fab fa-instagram text-pink-500 mr-3"></i>
<span>Instagram</span>
</div>
<label class="relative inline-flex items-center cursor-pointer">
<input type="checkbox" class="sr-only peer" checked>
<div class="w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-indigo-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-indigo-600"></div>
</label>
</div>
<div class="flex items-center justify-between p-2 bg-white rounded">
<div class="flex items-center">
<i class="fab fa-twitter text-blue-400 mr-3"></i>
<span>Twitter</span>
</div>
<label class="relative inline-flex items-center cursor-pointer">
<input type="checkbox" class="sr-only peer">
<div class="w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-indigo-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-indigo-600"></div>
</label>
</div>
<div class="flex items-center justify-between p-2 bg-white rounded">
<div class="flex items-center">
<i class="fab fa-tiktok text-black mr-3"></i>
<span>TikTok</span>
</div>
<label class="relative inline-flex items-center cursor-pointer">
<input type="checkbox" class="sr-only peer" checked>
<div class="w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-indigo-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-indigo-600"></div>
</label>
</div>
</div>
<button class="mt-4 w-full py-2 bg-indigo-100 hover:bg-indigo-200 text-indigo-700 rounded-lg font-medium">
<i class="fas fa-plus mr-2"></i> Ajouter une application
</button>
</div>
<div class="bg-gray-100 p-4 rounded-lg mb-6">
<h3 class="font-medium mb-3">Paramètres du mode Focus</h3>
<div class="space-y-4">
<div class="flex items-center justify-between">
<div>
<div class="font-medium">Activer le mode Ne pas déranger</div>
<div class="text-sm text-gray-600">Silencie toutes les notifications</div>
</div>
<label class="relative inline-flex items-center cursor-pointer">
<input type="checkbox" class="sr-only peer" checked>
<div class="w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-indigo-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-indigo-600"></div>
</label>
</div>
<div class="flex items-center justify-between">
<div>
<div class="font-medium">Bloquer les appels entrants</div>
<div class="text-sm text-gray-600">Autorise uniquement les appels favoris</div>
</div>
<label class="relative inline-flex items-center cursor-pointer">
<input type="checkbox" class="sr-only peer">
<div class="w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-indigo-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-indigo-600"></div>
</label>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Durée de la session (minutes)</label>
<input type="number" value="60" min="5" max="240" class="w-full p-2 border rounded">
</div>
</div>
</div>
<button id="start-focus" class="w-full py-3 bg-indigo-600 hover:bg-indigo-700 text-white rounded-lg font-medium text-lg">
<i class="fas fa-play mr-2"></i> Démarrer la session
</button>
</section>
<!-- Stats Screen -->
<section id="stats-screen" class="p-4 hidden">
<div class="flex justify-between items-center mb-6">
<button onclick="showScreen('home-screen')" class="p-2 rounded-full hover:bg-gray-100">
<i class="fas fa-arrow-left"></i>
</button>
<h2 class="text-xl font-semibold">Statistiques</h2>
<div class="w-8"></div> <!-- Spacer for alignment -->
</div>
<div class="bg-gray-100 p-4 rounded-lg mb-6">
<h3 class="font-medium mb-4">Votre productivité</h3>
<div class="flex justify-between mb-6">
<div class="text-center">
<div class="text-3xl font-bold" id="total-sessions">24</div>
<div class="text-gray-600">Sessions</div>
</div>
<div class="text-center">
<div class="text-3xl font-bold" id="total-hours">12.5</div>
<div class="text-gray-600">Heures</div>
</div>
<div class="text-center">
<div class="text-3xl font-bold" id="completed-tasks">36</div>
<div class="text-gray-600">Tâches</div>
</div>
</div>
<div class="text-center mb-2">
<p class="text-gray-600 italic">"Ce qui se mesure s'améliore."</p>
</div>
</div>
<div class="bg-white p-4 rounded-lg shadow mb-6">
<h3 class="font-medium mb-4">Temps de focus</h3>
<div class="h-40 mb-4">
<!-- Chart placeholder -->
<div class="w-full h-full bg-gray-100 rounded flex items-center justify-center text-gray-400">
Graphique des sessions
</div>
</div>
<div class="flex justify-between text-sm">
<button class="px-3 py-1 bg-indigo-600 text-white rounded-full">Jour</button>
<button class="px-3 py-1 bg-gray-200 hover:bg-gray-300 rounded-full">Semaine</button>
<button class="px-3 py-1 bg-gray-200 hover:bg-gray-300 rounded-full">Mois</button>
<button class="px-3 py-1 bg-gray-200 hover:bg-gray-300 rounded-full">Année</button>
</div>
</div>
<div class="bg-white p-4 rounded-lg shadow">
<h3 class="font-medium mb-4">Tâches accomplies</h3>
<div class="h-40 mb-4">
<!-- Chart placeholder -->
<div class="w-full h-full bg-gray-100 rounded flex items-center justify-center text-gray-400">
Graphique des tâches
</div>
</div>
<div class="flex justify-between text-sm">
<div class="text-center">
<div class="text-xl font-bold" id="high-priority-tasks">8</div>
<div class="text-gray-600">Haute priorité</div>
</div>
<div class="text-center">
<div class="text-xl font-bold" id="medium-priority-tasks">18</div>
<div class="text-gray-600">Moyenne</div>
</div>
<div class="text-center">
<div class="text-xl font-bold" id="low-priority-tasks">10</div>
<div class="text-gray-600">Basse</div>
</div>
</div>
</div>
</section>
<!-- Active Focus Session Screen -->
<section id="active-focus-screen" class="p-4 hidden">
<div class="flex flex-col items-center justify-center h-full text-center">
<div class="mb-8">
<div class="relative w-48 h-48 mx-auto mb-6">
<div class="absolute inset-0 rounded-full bg-indigo-100 flex items-center justify-center">
<div class="text-center">
<div id="focus-timer" class="text-4xl font-bold">59:45</div>
<div class="text-gray-600">Temps restant</div>
</div>
</div>
</div>
<h2 class="text-xl font-semibold mb-2">Mode Focus activé</h2>
<p class="text-gray-600 mb-6">Restez concentré, vous y arrivez !</p>
</div>
<button id="end-focus" class="w-full py-3 bg-red-500 hover:bg-red-600 text-white rounded-lg font-medium text-lg">
<i class="fas fa-stop mr-2"></i> Terminer la session
</button>
</div>
</section>
</main>
<!-- Bottom Navigation -->
<nav class="bg-white border-t border-gray-200 fixed bottom-0 w-full max-w-md flex justify-around py-2">
<button onclick="showScreen('home-screen')" class="p-3 text-indigo-600 flex flex-col items-center">
<i class="fas fa-home text-xl"></i>
<span class="text-xs mt-1">Accueil</span>
</button>
<button onclick="showScreen('tasks-screen')" class="p-3 text-gray-500 hover:text-indigo-600 flex flex-col items-center">
<i class="fas fa-tasks text-xl"></i>
<span class="text-xs mt-1">Tâches</span>
</button>
<button onclick="showScreen('pomodoro-screen')" class="p-3 text-gray-500 hover:text-indigo-600 flex flex-col items-center">
<i class="fas fa-hourglass-half text-xl"></i>
<span class="text-xs mt-1">Pomodoro</span>
</button>
<button onclick="showScreen('stats-screen')" class="p-3 text-gray-500 hover:text-indigo-600 flex flex-col items-center">
<i class="fas fa-chart-line text-xl"></i>
<span class="text-xs mt-1">Stats</span>
</button>
</nav>
</div>
<script>
// Sample data
let tasks = [
{ id: 1, title: "Finir le rapport", description: "Rapport trimestriel pour le client", due: "2023-06-15", priority: "high", completed: false, createdAt: new Date() },
{ id: 2, title: "Réunion d'équipe", description: "Préparer l'ordre du jour", due: "2023-06-14", priority: "medium", completed: true, createdAt: new Date() },
{ id: 3, title: "Faire les courses", description: "Acheter des fruits et légumes", due: "2023-06-16", priority: "low", completed: false, createdAt: new Date() },
{ id: 4, title: "Réviser pour l'examen", description: "Chapitres 5 à 8", due: "2023-06-20", priority: "high", completed: false, createdAt: new Date() },
{ id: 5, title: "Appeler le médecin", description: "Prendre rendez-vous", due: "2023-06-12", priority: "medium", completed: true, createdAt: new Date() }
];
let pomodoroSessions = [
{ date: "2023-06-10", duration: 25, type: "work" },
{ date: "2023-06-10", duration: 5, type: "break" },
{ date: "2023-06-10", duration: 25, type: "work" },
{ date: "2023-06-11", duration: 25, type: "work" },
{ date: "2023-06-11", duration: 15, type: "break" },
{ date: "2023-06-12", duration: 25, type: "work" }
];
// Motivational quotes
const quotes = [
"La discipline est la clé de la liberté.",
"Le succès est la somme de petits efforts répétés jour après jour.",
"Ne reporte pas à demain ce que tu peux faire aujourd'hui.",
"La concentration est la racine de toute force.",
"La productivité n'est jamais un accident.",
"Faites chaque jour quelque chose qui vous rapproche de votre but."
];
// DOM elements
const mainContent = document.getElementById('main-content');
const themeToggle = document.getElementById('theme-toggle');
const taskForm = document.getElementById('task-form');
const filterButtons = document.querySelectorAll('.filter-btn');
// Initialize the app
document.addEventListener('DOMContentLoaded', function() {
// Set random motivational quote
document.getElementById('motivational-quote').textContent = quotes[Math.floor(Math.random() * quotes.length)];
// Load tasks
renderTasks();
renderRecentTasks();
updateTodaySummary();
// Initialize Pomodoro timer
initPomodoro();
// Initialize theme toggle
initThemeToggle();
// Event listeners
taskForm.addEventListener('submit', handleTaskSubmit);
filterButtons.forEach(button => {
button.addEventListener('click', function() {
filterButtons.forEach(btn => btn.classList.remove('active', 'bg-indigo-600', 'text-white'));
this.classList.add('active', 'bg-indigo-600', 'text-white');
renderTasks(this.dataset.filter);
});
});
// Focus mode toggle
document.querySelectorAll('input[name="focus-mode"]').forEach(radio => {
radio.addEventListener('change', function() {
const customAppsSection = document.getElementById('custom-apps-section');
if (this.value === 'custom') {
customAppsSection.classList.remove('hidden');
} else {
customAppsSection.classList.add('hidden');
}
});
});
// Start focus session
document.getElementById('start-focus').addEventListener('click', function() {
showScreen('active-focus-screen');
startFocusTimer();
});
// End focus session
document.getElementById('end-focus').addEventListener('click', function() {
showScreen('home-screen');
stopFocusTimer();
// Add session to stats
const today = new Date().toISOString().split('T')[0];
pomodoroSessions.push({ date: today, duration: 60, type: "work" });
updateTodaySummary();
});
});
// Functions
function showScreen(screenId) {
document.querySelectorAll('section').forEach(section => {
section.classList.add('hidden');
section.classList.remove('fade-in');
});
const screen = document.getElementById(screenId);
screen.classList.remove('hidden');
screen.classList.add('fade-in');
// Update active tab in bottom nav
if (screenId === 'home-screen') {
document.querySelector('nav button:nth-child(1)').classList.add('text-indigo-600');
document.querySelector('nav button:nth-child(1)').classList.remove('text-gray-500');
} else if (screenId === 'tasks-screen') {
document.querySelector('nav button:nth-child(2)').classList.add('text-indigo-600');
document.querySelector('nav button:nth-child(2)').classList.remove('text-gray-500');
} else if (screenId === 'pomodoro-screen') {
document.querySelector('nav button:nth-child(3)').classList.add('text-indigo-600');
document.querySelector('nav button:nth-child(3)').classList.remove('text-gray-500');
} else if (screenId === 'stats-screen') {
document.querySelector('nav button:nth-child(4)').classList.add('text-indigo-600');
document.querySelector('nav button:nth-child(4)').classList.remove('text-gray-500');
}
}
function showAddTaskModal() {
document.getElementById('add-task-modal').classList.remove('hidden');
document.getElementById('task-title').focus();
}
function hideAddTaskModal() {
document.getElementById('add-task-modal').classList.add('hidden');
document.getElementById('task-form').reset();
}
function renderTasks(filter = 'all') {
const tasksList = document.getElementById('tasks-list');
tasksList.innerHTML = '';
let filteredTasks = [...tasks];
// Apply filters
if (filter === 'today') {
const today = new Date().toISOString().split('T')[0];
filteredTasks = filteredTasks.filter(task => task.due === today);
} else if (filter === 'week') {
// This week filter logic would be more complex in a real app
filteredTasks = filteredTasks.filter(task => {
const taskDate = new Date(task.due);
const today = new Date();
const nextWeek = new Date(today);
nextWeek.setDate(today.getDate() + 7);
return taskDate >= today && taskDate <= nextWeek;
});
} else if (filter === 'high') {
filteredTasks = filteredTasks.filter(task => task.priority === 'high');
}
// Sort by priority (high > medium > low) and then by due date
filteredTasks.sort((a, b) => {
const priorityOrder = { high: 1, medium: 2, low: 3 };
if (priorityOrder[a.priority] !== priorityOrder[b.priority]) {
return priorityOrder[a.priority] - priorityOrder[b.priority];
}
return new Date(a.due) - new Date(b.due);
});
if (filteredTasks.length === 0) {
tasksList.innerHTML = '<p class="text-center text-gray-500 py-4">Aucune tâche à afficher</p>';
return;
}
filteredTasks.forEach(task => {
const taskElement = document.createElement('div');
taskElement.className = `p-3 bg-white rounded-lg shadow-sm flex items-start ${task.completed ? 'opacity-70' : ''}`;
const priorityColors = {
high: 'bg-red-500',
medium: 'bg-yellow-500',
low: 'bg-green-500'
};
taskElement.innerHTML = `
<div class="flex items-start w-full">
<div class="mr-3 mt-1">
<input type="checkbox" id="task-${task.id}" ${task.completed ? 'checked' : ''}
class="task-checkbox h-5 w-5 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500"
onclick="toggleTaskCompletion(${task.id})">
</div>
<div class="flex-1">
<label for="task-${task.id}" class="task-label block font-medium ${task.completed ? 'line-through text-gray-400' : 'text-gray-800'}">
${task.title}
</label>
${task.description ? `<p class="text-sm text-gray-600 mt-1">${task.description}</p>` : ''}
${task.due ? `<p class="text-xs text-gray-500 mt-2"><i class="far fa-calendar-alt mr-1"></i> ${formatDate(task.due)}</p>` : ''}
</div>
<div class="flex items-center ml-2">
<div class="h-3 w-3 rounded-full ${priorityColors[task.priority]} mr-2"></div>
<button onclick="deleteTask(${task.id})" class="text-gray-400 hover:text-red-500">
<i class="far fa-trash-alt"></i>
</button>
</div>
</div>
`;
tasksList.appendChild(taskElement);
});
}
function renderRecentTasks() {
const recentTasksContainer = document.getElementById('recent-tasks');
recentTasksContainer.innerHTML = '';
// Sort tasks by creation date (newest first)
const sortedTasks = [...tasks].sort((a, b) => new Date(b.createdAt) - new Date(a.createdAt));
// Show only the 3 most recent tasks
const recentTasks = sortedTasks.slice(0, 3);
if (recentTasks.length === 0) {
recentTasksContainer.innerHTML = '<p class="text-center text-gray-500 py-2">Aucune tâche récente</p>';
return;
}
recentTasks.forEach(task => {
const taskElement = document.createElement('div');
taskElement.className = `p-3 bg-white rounded-lg shadow-sm flex items-start ${task.completed ? 'opacity-70' : ''}`;
taskElement.innerHTML = `
<div class="flex items-center w-full">
<input type="checkbox" id="recent-task-${task.id}" ${task.completed ? 'checked' : ''}
class="task-checkbox h-5 w-5 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500 mr-3"
onclick="toggleTaskCompletion(${task.id})">
<label for="recent-task-${task.id}" class="task-label flex-1 text-sm ${task.completed ? 'line-through text-gray-400' : 'text-gray-800'}">
${task.title}
</label>
</div>
`;
recentTasksContainer.appendChild(taskElement);
});
}
function handleTaskSubmit(e) {
e.preventDefault();
const title = document.getElementById('task-title').value;
const description = document.getElementById('task-description').value;
const due = document.getElementById('task-due').value;
const priority = document.getElementById('task-priority').value;
const newTask = {
id: tasks.length > 0 ? Math.max(...tasks.map(t => t.id)) + 1 : 1,
title,
description,
due,
priority,
completed: false,
createdAt: new Date()
};
tasks.push(newTask);
renderTasks();
renderRecentTasks();
updateTodaySummary();
hideAddTaskModal();
}
function toggleTaskCompletion(taskId) {
const taskIndex = tasks.findIndex(task => task.id === taskId);
if (taskIndex !== -1) {
tasks[taskIndex].completed = !tasks[taskIndex].completed;
renderTasks();
renderRecentTasks();
updateTodaySummary();
}
}
function deleteTask(taskId) {
if (confirm("Supprimer cette tâche ?")) {
tasks = tasks.filter(task => task.id !== taskId);
renderTasks();
renderRecentTasks();
updateTodaySummary();
}
}
function updateTodaySummary() {
const today = new Date().toISOString().split('T')[0];
// Today's completed tasks
const todayTasks = tasks.filter(task => {
return task.due === today && task.completed;
}).length;
// Today's pomodoro sessions
const todaySessions = pomodoroSessions.filter(session => session.date === today).length;
// Today's focus minutes
const todayMinutes = pomodoroSessions.filter(session => session.date === today)
.reduce((total, session) => total + session.duration, 0);
document.getElementById('today-tasks').textContent = todayTasks;
document.getElementById('today-sessions').textContent = todaySessions;
document.getElementById('today-minutes').textContent = todayMinutes;
// Update stats screen
document.getElementById('total-sessions').textContent = pomodoroSessions.length;
document.getElementById('total-hours').textContent = (pomodoroSessions.reduce((total, session) => total + session.duration, 0) / 60).toFixed(1);
document.getElementById('completed-tasks').textContent = tasks.filter(task => task.completed).length;
// Priority tasks
document.getElementById('high-priority-tasks').textContent = tasks.filter(task => task.priority === 'high' && task.completed).length;
document.getElementById('medium-priority-tasks').textContent = tasks.filter(task => task.priority === 'medium' && task.completed).length;
document.getElementById('low-priority-tasks').textContent = tasks.filter(task => task.priority === 'low' && task.completed).length;
}
function formatDate(dateString) {
const options = { weekday: 'short', day: 'numeric', month: 'short' };
return new Date(dateString).toLocaleDateString('fr-FR', options);
}
function initThemeToggle() {
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
if (prefersDark) {
document.documentElement.classList.add('dark');
themeToggle.innerHTML = '<i class="fas fa-sun"></i>';
} else {
document.documentElement.classList.remove('dark');
themeToggle.innerHTML = '<i class="fas fa-moon"></i>';
}
themeToggle.addEventListener('click', function() {
document.documentElement.classList.toggle('dark');
if (document.documentElement.classList.contains('dark')) {
themeToggle.innerHTML = '<i class="fas fa-sun"></i>';
} else {
themeToggle.innerHTML = '<i class="fas fa-moon"></i>';
}
});
}
function initPomodoro() {
const timerDisplay = document.getElementById('timer-display');
const timerState = document.getElementById('timer-state');
const startButton = document.getElementById('start-pomodoro');
const resetButton = document.getElementById('reset-pomodoro');
const progressCircle = document.querySelector('.pomodoro-progress');
let workTime = 25 * 60; // 25 minutes in seconds
let shortBreak = 5 * 60;
let longBreak = 15 * 60;
let timeLeft = workTime;
let timerInterval;
let isRunning = false;
let isWorkTime = true;
let sessionCount = 0;
// Update timer display
function updateDisplay() {
const minutes = Math.floor(timeLeft / 60);
const seconds = timeLeft % 60;
timerDisplay.textContent = `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
// Update progress circle
const totalTime = isWorkTime ? workTime : (sessionCount % 4 === 0 ? longBreak : shortBreak);
const progress = ((totalTime - timeLeft) / totalTime) * 100;
progressCircle.style.setProperty('--progress', `${progress}%`);
}
// Start timer
function startTimer() {
if (timerInterval) clearInterval(timerInterval);
isRunning = true;
startButton.textContent = 'Pause';
timerState.textContent = isWorkTime ? 'Travail en cours' : 'Pause';
timerInterval = setInterval(() => {
timeLeft--;
updateDisplay();
if (timeLeft <= 0) {
clearInterval(timerInterval);
timerFinished();
}
}, 1000);
}
// Pause timer
function pauseTimer() {
clearInterval(timerInterval);
isRunning = false;
startButton.textContent = 'Reprendre';
timerState.textContent = 'En pause';
}
// Timer finished
function timerFinished() {
// Play sound
const audio = new Audio('https://assets.mixkit.co/sfx/preview/mixkit-alarm-digital-clock-beep-989.mp3');
audio.play();
if (isWorkTime) {
sessionCount++;
// Add to stats
const today = new Date().toISOString().split('T')[0];
pomodoroSessions.push({ date: today, duration: workTime / 60, type: "work" });
updateTodaySummary();
// Check if it's time for a long break
if (sessionCount % 4 === 0) {
timeLeft = longBreak;
alert('Bonne session ! Prenez une longue pause de 15 minutes.');
} else {
timeLeft = shortBreak;
alert('Bonne session ! Prenez une courte pause de 5 minutes.');
}
} else {
timeLeft = workTime;
alert('La pause est terminée ! Retour au travail.');
}
isWorkTime = !isWorkTime;
updateDisplay();
// Auto-start next session if enabled
if (document.getElementById('auto-start').checked) {
startTimer();
} else {
isRunning = false;
startButton.textContent = 'Démarrer';
timerState.textContent = isWorkTime ? 'Prêt à travailler' : 'Prêt pour une pause';
}
}
// Reset timer
function resetTimer() {
clearInterval(timerInterval);
isRunning = false;
isWorkTime = true;
timeLeft = workTime;
updateDisplay();
startButton.textContent = 'Démarrer';
timerState.textContent = 'Prêt';
}
// Update timer settings
function updateSettings() {
workTime = parseInt(document.getElementById('work-time').value) * 60;
shortBreak = parseInt(document.getElementById('short-break').value) * 60;
longBreak = parseInt(document.getElementById('long-break').value) * 60;
if (!isRunning && isWorkTime) {
timeLeft = workTime;
updateDisplay();
}
}
// Event listeners
startButton.addEventListener('click', function() {
if (isRunning) {
pauseTimer();
} else {
startTimer();
}
});
resetButton.addEventListener('click', resetTimer);
// Update settings when inputs change
document.getElementById('work-time').addEventListener('change', updateSettings);
document.getElementById('short-break').addEventListener('change', updateSettings);
document.getElementById('long-break').addEventListener('change', updateSettings);
// Initialize display
updateDisplay();
}
function startFocusTimer() {
const focusTimer = document.getElementById('focus-timer');
let minutes = 59;
let seconds = 59;
focusTimer.textContent = `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
const timerInterval = setInterval(() => {
seconds--;
if (seconds < 0) {
minutes--;
seconds = 59;
}
focusTimer.textContent = `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
if (minutes === 0 && seconds === 0) {
clearInterval(timerInterval);
// Play sound
const audio = new Audio('https://assets.mixkit.co/sfx/preview/mixkit-alarm-digital-clock-beep-989.mp3');
audio.play();
alert('Session de focus terminée !');
showScreen('home-screen');
}
}, 1000);
// Store interval ID to clear it later
document.getElementById('active-focus-screen').dataset.timerInterval = timerInterval;
}
function stopFocusTimer() {
const timerInterval = document.getElementById('active-focus-screen').dataset.timerInterval;
if (timerInterval) {
clearInterval(timerInterval);
}
}
</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=Jeanic/focustime" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>FocusTime - Gestion du temps et productivité</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>
.pomodoro-progress {
background: conic-gradient(#4ade80 var(--progress), #e2e8f0 0deg);
}
.task-checkbox:checked + .task-label {
text-decoration: line-through;
color: #94a3b8;
}
.fade-in {
animation: fadeIn 0.3s ease-in-out;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.slide-in {
animation: slideIn 0.3s ease-out;
}
@keyframes slideIn {
from { transform: translateX(100%); }
to { transform: translateX(0); }
}
</style>
</head>
<body class="bg-gray-50 text-gray-800 font-sans min-h-screen">
<div class="max-w-md mx-auto bg-white min-h-screen shadow-lg flex flex-col">
<!-- Header -->
<header class="bg-indigo-700 text-white p-4 shadow-md">
<div class="flex items-center justify-between">
<div class="flex items-center space-x-2">
<i class="fas fa-clock text-2xl"></i>
<h1 class="text-xl font-bold">FocusTime</h1>
</div>
<button id="theme-toggle" class="p-2 rounded-full hover:bg-indigo-600">
<i class="fas fa-moon"></i>
</button>
</div>
</header>
<!-- Main Content -->
<main class="flex-1 overflow-y-auto pb-16" id="main-content">
<!-- Home Screen (default) -->
<section id="home-screen" class="p-4 fade-in">
<div class="text-center mb-6">
<h2 class="text-xl font-semibold mb-2">Prêt à rester concentré ?</h2>
<p class="text-gray-600" id="motivational-quote">"La discipline est la clé de la liberté."</p>
</div>
<!-- Quick Actions -->
<div class="grid grid-cols-2 gap-4 mb-6">
<button onclick="showScreen('pomodoro-screen')" class="bg-green-100 hover:bg-green-200 text-green-800 p-4 rounded-lg flex flex-col items-center transition">
<i class="fas fa-hourglass-start text-2xl mb-2"></i>
<span>Démarrer Pomodoro</span>
</button>
<button onclick="showScreen('tasks-screen')" class="bg-blue-100 hover:bg-blue-200 text-blue-800 p-4 rounded-lg flex flex-col items-center transition">
<i class="fas fa-tasks text-2xl mb-2"></i>
<span>Mes tâches</span>
</button>
<button onclick="showScreen('focus-mode-screen')" class="bg-purple-100 hover:bg-purple-200 text-purple-800 p-4 rounded-lg flex flex-col items-center transition">
<i class="fas fa-brain text-2xl mb-2"></i>
<span>Mode Focus</span>
</button>
<button onclick="showScreen('stats-screen')" class="bg-yellow-100 hover:bg-yellow-200 text-yellow-800 p-4 rounded-lg flex flex-col items-center transition">
<i class="fas fa-chart-line text-2xl mb-2"></i>
<span>Statistiques</span>
</button>
</div>
<!-- Today's Summary -->
<div class="bg-gray-100 p-4 rounded-lg mb-6">
<h3 class="font-medium mb-2">Résumé du jour</h3>
<div class="flex justify-between text-sm">
<div class="text-center">
<div class="text-2xl font-bold" id="today-sessions">0</div>
<div class="text-gray-600">Sessions</div>
</div>
<div class="text-center">
<div class="text-2xl font-bold" id="today-minutes">0</div>
<div class="text-gray-600">Minutes</div>
</div>
<div class="text-center">
<div class="text-2xl font-bold" id="today-tasks">0</div>
<div class="text-gray-600">Tâches</div>
</div>
</div>
</div>
<!-- Recent Tasks -->
<div>
<h3 class="font-medium mb-2">Tâches récentes</h3>
<div id="recent-tasks" class="space-y-2">
<!-- Tasks will be added here dynamically -->