Features — what to include
Browse filesCore features
Focus, Short Break, Long Break modes (default 25/5/15 but configurable).
Start / Pause / Resume / Stop.
Visual countdown (large digital timer).
Circular progress indicator with smooth animations.
Sound effects: start, pause, end, tick (optional).
Desktop/browser notifications (permission-based).
Session history / statistics (today, weekly, total pomodoros).
Settings page (durations, auto-start next interval, long-break every N cycles, sound on/off, volume).
Persist settings locally (localStorage) and server-side (user profile or anonymous id).
Advanced / nice-to-have
Animated, minimal clean UI (SVG + GSAP or anime.js).
Theme support (light/dark) and accent color picker.
Pomodoro “streaks” and achievements.
Export/import stats (CSV).
Optional account system (Flask-Login, OAuth).
Real-time multi-device sync using Flask-SocketIO (optional).
Offline support with a service worker (workbox) so the timer still runs when offline.
Accessibility: keyboard shortcuts, ARIA labels, contrast checks.
Multi-language support (i18n).
Frontend: UI & animation guidance
General style
Minimal, flat UI with rounded cards, large type for the timer, subtle shadows.
Accent color configurable. Use CSS variables for theme.
SVG circular progress indicator (stroke-dasharray animation) — animatable with JS.
Use GSAP or anime.js for more advanced, smooth easing animations (both are lightweight and great). Use CDN to keep things simple.
Timer UX
Big timer in center, circular ring that animates clockwise.
Buttons below: Start / Pause / Skip / Settings icon.
Small cycle indicator (e.g., 1/4 for long break cycle).
When a focus session completes: play sound, bounce animation, show modal or small confetti burst (use canvas-confetti).
Provide subtle ticking (optional) but allow user to disable.
Accessibility
Keyboard shortcuts: Space to start/pause, S to skip, T to toggle sound. Provide visible hints.
Screen reader friendly: announce timer updates at a reasonable interval (not every second; maybe every minute or significant change) using ARIA live region.
- README.md +9 -5
- index.html +456 -18
- stats.html +205 -0
|
@@ -1,10 +1,14 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: ChronoZen FlowMaster 🕰️
|
| 3 |
+
colorFrom: red
|
| 4 |
+
colorTo: green
|
| 5 |
+
emoji: 🐳
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite-v3
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# Welcome to your new DeepSite project!
|
| 13 |
+
This project was created with [DeepSite](https://deepsite.hf.co).
|
| 14 |
+
|
|
@@ -1,19 +1,457 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
</html>
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>ChronoZen FlowMaster | Pomodoro Timer</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
| 9 |
+
<script src="https://unpkg.com/feather-icons"></script>
|
| 10 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js"></script>
|
| 11 |
+
<script src="https://cdn.jsdelivr.net/npm/canvas-confetti@1.6.0/dist/confetti.browser.min.js"></script>
|
| 12 |
+
<style>
|
| 13 |
+
:root {
|
| 14 |
+
--primary: #6366f1;
|
| 15 |
+
--secondary: #f43f5e;
|
| 16 |
+
--bg-light: #ffffff;
|
| 17 |
+
--bg-dark: #1a1a1a;
|
| 18 |
+
--text-light: #1a1a1a;
|
| 19 |
+
--text-dark: #f8f9fa;
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
.progress-ring__circle {
|
| 23 |
+
transition: stroke-dashoffset 0.35s;
|
| 24 |
+
transform: rotate(-90deg);
|
| 25 |
+
transform-origin: 50% 50%;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
.tick-animation {
|
| 29 |
+
animation: tick 1s infinite;
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
@keyframes tick {
|
| 33 |
+
0%, 100% { transform: scale(1); }
|
| 34 |
+
50% { transform: scale(1.05); }
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
.bounce-animation {
|
| 38 |
+
animation: bounce 0.5s;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
@keyframes bounce {
|
| 42 |
+
0%, 100% { transform: scale(1); }
|
| 43 |
+
50% { transform: scale(1.1); }
|
| 44 |
+
}
|
| 45 |
+
</style>
|
| 46 |
+
</head>
|
| 47 |
+
<body class="bg-gray-50 dark:bg-gray-900 min-h-screen flex flex-col items-center justify-center p-4 font-sans transition-colors duration-300">
|
| 48 |
+
<div id="vanta-bg" class="fixed inset-0 -z-10 opacity-20"></div>
|
| 49 |
+
<main class="w-full max-w-md bg-white dark:bg-gray-800 rounded-2xl shadow-lg p-8 space-y-8">
|
| 50 |
+
<!-- Cycle Indicator -->
|
| 51 |
+
<div class="flex justify-center items-center space-x-2">
|
| 52 |
+
<span class="text-sm font-medium text-gray-500">Focus</span>
|
| 53 |
+
<span class="text-sm font-medium text-indigo-600">1/4</span>
|
| 54 |
+
</div>
|
| 55 |
+
|
| 56 |
+
<!-- Timer Display -->
|
| 57 |
+
<div class="relative flex justify-center items-center">
|
| 58 |
+
<svg class="w-64 h-64" viewBox="0 0 100 100">
|
| 59 |
+
<circle cx="50" cy="50" r="45" fill="none" stroke="#e5e7eb" stroke-width="8" />
|
| 60 |
+
<circle id="progress-ring" class="progress-ring__circle" cx="50" cy="50" r="45" fill="none" stroke="var(--primary)" stroke-width="8" stroke-linecap="round" stroke-dasharray="283" stroke-dashoffset="0" />
|
| 61 |
+
</svg>
|
| 62 |
+
<div id="timer-display" class="absolute text-5xl font-bold text-gray-800 dark:text-gray-100">25:00</div>
|
| 63 |
+
</div>
|
| 64 |
+
|
| 65 |
+
<!-- Controls -->
|
| 66 |
+
<div class="flex justify-center space-x-4">
|
| 67 |
+
<button id="skip-btn" class="p-3 rounded-full text-gray-500 hover:text-gray-700 transition-colors" aria-label="Skip">
|
| 68 |
+
<i data-feather="skip-forward"></i>
|
| 69 |
+
</button>
|
| 70 |
+
<button id="start-pause-btn" class="p-4 bg-indigo-600 text-white rounded-full hover:bg-indigo-700 transition-colors flex items-center justify-center">
|
| 71 |
+
<i data-feather="play" id="play-icon"></i>
|
| 72 |
+
</button>
|
| 73 |
+
<button id="sound-btn" class="p-3 rounded-full text-gray-500 hover:text-gray-700 transition-colors" aria-label="Toggle sound">
|
| 74 |
+
<i data-feather="volume-2"></i>
|
| 75 |
+
</button>
|
| 76 |
+
</div>
|
| 77 |
+
<!-- Theme Toggle -->
|
| 78 |
+
<button id="theme-toggle" class="absolute top-4 left-4 p-2 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 transition-colors" aria-label="Toggle theme">
|
| 79 |
+
<i data-feather="moon" id="theme-icon"></i>
|
| 80 |
+
</button>
|
| 81 |
+
|
| 82 |
+
<!-- Settings Button -->
|
| 83 |
+
<button id="settings-btn" class="absolute top-4 right-4 p-2 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 transition-colors" aria-label="Settings">
|
| 84 |
+
<i data-feather="settings"></i>
|
| 85 |
+
</button>
|
| 86 |
+
</main>
|
| 87 |
+
|
| 88 |
+
<!-- Settings Modal -->
|
| 89 |
+
<div id="settings-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center hidden">
|
| 90 |
+
<div class="bg-white rounded-2xl p-6 w-full max-w-md">
|
| 91 |
+
<div class="flex justify-between items-center mb-4">
|
| 92 |
+
<h2 class="text-xl font-bold text-gray-800">Settings</h2>
|
| 93 |
+
<button id="close-settings" class="text-gray-500 hover:text-gray-700">
|
| 94 |
+
<i data-feather="x"></i>
|
| 95 |
+
</button>
|
| 96 |
+
</div>
|
| 97 |
+
|
| 98 |
+
<div class="space-y-4">
|
| 99 |
+
<div>
|
| 100 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Focus Duration</label>
|
| 101 |
+
<input type="number" id="focus-duration" class="w-full p-2 border border-gray-300 rounded-lg" value="25" min="1" max="60">
|
| 102 |
+
</div>
|
| 103 |
+
|
| 104 |
+
<div>
|
| 105 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Short Break</label>
|
| 106 |
+
<input type="number" id="short-break" class="w-full p-2 border border-gray-300 rounded-lg" value="5" min="1" max="15">
|
| 107 |
+
</div>
|
| 108 |
+
|
| 109 |
+
<div>
|
| 110 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Long Break</label>
|
| 111 |
+
<input type="number" id="long-break" class="w-full p-2 border border-gray-300 rounded-lg" value="15" min="1" max="30">
|
| 112 |
+
</div>
|
| 113 |
+
|
| 114 |
+
<div class="flex items-center">
|
| 115 |
+
<input type="checkbox" id="tick-sound" class="mr-2">
|
| 116 |
+
<label for="tick-sound" class="text-sm text-gray-700">Enable tick sound</label>
|
| 117 |
+
</div>
|
| 118 |
+
|
| 119 |
+
<div class="pt-4">
|
| 120 |
+
<button id="save-settings" class="w-full py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition-colors">
|
| 121 |
+
Save Settings
|
| 122 |
+
</button>
|
| 123 |
+
</div>
|
| 124 |
+
</div>
|
| 125 |
+
</div>
|
| 126 |
+
</div>
|
| 127 |
+
|
| 128 |
+
<!-- ARIA Live Region for Accessibility -->
|
| 129 |
+
<div id="aria-live-region" aria-live="polite" class="sr-only"></div>
|
| 130 |
+
|
| 131 |
+
<!-- Audio Elements -->
|
| 132 |
+
<audio id="tick-sound" src="https://assets.mixkit.co/sfx/preview/mixkit-clock-countdown-bleeps-916.mp3" preload="auto"></audio>
|
| 133 |
+
<audio id="alarm-sound" src="https://assets.mixkit.co/sfx/preview/mixkit-alarm-digital-clock-beep-989.mp3" preload="auto"></audio>
|
| 134 |
+
|
| 135 |
+
<script>
|
| 136 |
+
// DOM Elements
|
| 137 |
+
const timerDisplay = document.getElementById('timer-display');
|
| 138 |
+
const themeToggle = document.getElementById('theme-toggle');
|
| 139 |
+
const themeIcon = document.getElementById('theme-icon');
|
| 140 |
+
|
| 141 |
+
// Theme toggle
|
| 142 |
+
themeToggle.addEventListener('click', () => {
|
| 143 |
+
if (document.documentElement.classList.contains('dark')) {
|
| 144 |
+
document.documentElement.classList.remove('dark');
|
| 145 |
+
localStorage.setItem('theme', 'light');
|
| 146 |
+
themeIcon.setAttribute('data-feather', 'moon');
|
| 147 |
+
} else {
|
| 148 |
+
document.documentElement.classList.add('dark');
|
| 149 |
+
localStorage.setItem('theme', 'dark');
|
| 150 |
+
themeIcon.setAttribute('data-feather', 'sun');
|
| 151 |
+
}
|
| 152 |
+
feather.replace();
|
| 153 |
+
});
|
| 154 |
+
|
| 155 |
+
// Check for saved theme preference
|
| 156 |
+
if (localStorage.getItem('theme') === 'dark' ||
|
| 157 |
+
(!localStorage.getItem('theme') && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
|
| 158 |
+
document.documentElement.classList.add('dark');
|
| 159 |
+
themeIcon.setAttribute('data-feather', 'sun');
|
| 160 |
+
} else {
|
| 161 |
+
themeIcon.setAttribute('data-feather', 'moon');
|
| 162 |
+
}
|
| 163 |
+
const progressRing = document.getElementById('progress-ring');
|
| 164 |
+
const startPauseBtn = document.getElementById('start-pause-btn');
|
| 165 |
+
const playIcon = document.getElementById('play-icon');
|
| 166 |
+
const skipBtn = document.getElementById('skip-btn');
|
| 167 |
+
const soundBtn = document.getElementById('sound-btn');
|
| 168 |
+
const settingsBtn = document.getElementById('settings-btn');
|
| 169 |
+
const settingsModal = document.getElementById('settings-modal');
|
| 170 |
+
const closeSettings = document.getElementById('close-settings');
|
| 171 |
+
const saveSettings = document.getElementById('save-settings');
|
| 172 |
+
const focusDurationInput = document.getElementById('focus-duration');
|
| 173 |
+
const shortBreakInput = document.getElementById('short-break');
|
| 174 |
+
const longBreakInput = document.getElementById('long-break');
|
| 175 |
+
const tickSoundCheckbox = document.getElementById('tick-sound');
|
| 176 |
+
const ariaLiveRegion = document.getElementById('aria-live-region');
|
| 177 |
+
const tickSound = document.getElementById('tick-sound');
|
| 178 |
+
const alarmSound = document.getElementById('alarm-sound');
|
| 179 |
+
|
| 180 |
+
// Timer Variables
|
| 181 |
+
let timer;
|
| 182 |
+
let isRunning = false;
|
| 183 |
+
let timeLeft = 25 * 60; // 25 minutes in seconds
|
| 184 |
+
let currentMode = 'focus'; // 'focus', 'shortBreak', 'longBreak'
|
| 185 |
+
let cyclesCompleted = 0;
|
| 186 |
+
let totalCycles = 4;
|
| 187 |
+
let enableTickSound = true;
|
| 188 |
+
let isDarkMode = false;
|
| 189 |
+
|
| 190 |
+
// Load settings from localStorage
|
| 191 |
+
if (localStorage.getItem('pomodoroSettings')) {
|
| 192 |
+
const settings = JSON.parse(localStorage.getItem('pomodoroSettings'));
|
| 193 |
+
focusDurationInput.value = settings.focusDuration || 25;
|
| 194 |
+
shortBreakInput.value = settings.shortBreak || 5;
|
| 195 |
+
longBreakInput.value = settings.longBreak || 15;
|
| 196 |
+
tickSoundCheckbox.checked = settings.enableTickSound !== false;
|
| 197 |
+
enableTickSound = settings.enableTickSound !== false;
|
| 198 |
+
|
| 199 |
+
// Apply loaded settings
|
| 200 |
+
if (currentMode === 'focus') {
|
| 201 |
+
timeLeft = settings.focusDuration * 60 || 25 * 60;
|
| 202 |
+
} else if (currentMode === 'shortBreak') {
|
| 203 |
+
timeLeft = settings.shortBreak * 60 || 5 * 60;
|
| 204 |
+
} else {
|
| 205 |
+
timeLeft = settings.longBreak * 60 || 15 * 60;
|
| 206 |
+
}
|
| 207 |
+
updateTimerDisplay();
|
| 208 |
+
updateProgressRing();
|
| 209 |
+
}
|
| 210 |
+
// Initialize
|
| 211 |
+
feather.replace();
|
| 212 |
+
updateTimerDisplay();
|
| 213 |
+
|
| 214 |
+
// Set up GSAP animations
|
| 215 |
+
const timerRingAnimation = gsap.to("#progress-ring", {
|
| 216 |
+
strokeDashoffset: 283,
|
| 217 |
+
duration: timeLeft,
|
| 218 |
+
ease: "linear",
|
| 219 |
+
paused: true
|
| 220 |
+
});
|
| 221 |
+
|
| 222 |
+
// Event Listeners
|
| 223 |
+
startPauseBtn.addEventListener('click', toggleTimer);
|
| 224 |
+
skipBtn.addEventListener('click', skipTimer);
|
| 225 |
+
soundBtn.addEventListener('click', toggleSound);
|
| 226 |
+
settingsBtn.addEventListener('click', () => settingsModal.classList.remove('hidden'));
|
| 227 |
+
closeSettings.addEventListener('click', () => settingsModal.classList.add('hidden'));
|
| 228 |
+
saveSettings.addEventListener('click', saveSettingsHandler);
|
| 229 |
+
// Keyboard Shortcuts
|
| 230 |
+
document.addEventListener('keydown', (e) => {
|
| 231 |
+
if (e.code === 'Space') {
|
| 232 |
+
e.preventDefault();
|
| 233 |
+
toggleTimer();
|
| 234 |
+
} else if (e.code === 'KeyS') {
|
| 235 |
+
e.preventDefault();
|
| 236 |
+
skipTimer();
|
| 237 |
+
} else if (e.code === 'KeyT') {
|
| 238 |
+
e.preventDefault();
|
| 239 |
+
toggleSound();
|
| 240 |
+
} else if (e.code === 'KeyD') {
|
| 241 |
+
e.preventDefault();
|
| 242 |
+
themeToggle.click();
|
| 243 |
+
}
|
| 244 |
+
});
|
| 245 |
+
// Functions
|
| 246 |
+
function toggleTimer() {
|
| 247 |
+
if (isRunning) {
|
| 248 |
+
pauseTimer();
|
| 249 |
+
} else {
|
| 250 |
+
startTimer();
|
| 251 |
+
}
|
| 252 |
+
}
|
| 253 |
+
|
| 254 |
+
function startTimer() {
|
| 255 |
+
isRunning = true;
|
| 256 |
+
playIcon.setAttribute('data-feather', 'pause');
|
| 257 |
+
feather.replace();
|
| 258 |
+
|
| 259 |
+
timerRingAnimation.play();
|
| 260 |
+
|
| 261 |
+
timer = setInterval(() => {
|
| 262 |
+
timeLeft--;
|
| 263 |
+
updateTimerDisplay();
|
| 264 |
+
|
| 265 |
+
// Play tick sound if enabled
|
| 266 |
+
if (enableTickSound && timeLeft % 60 === 0 && timeLeft > 0) {
|
| 267 |
+
tickSound.currentTime = 0;
|
| 268 |
+
tickSound.play();
|
| 269 |
+
}
|
| 270 |
+
|
| 271 |
+
if (timeLeft <= 0) {
|
| 272 |
+
clearInterval(timer);
|
| 273 |
+
timerComplete();
|
| 274 |
+
}
|
| 275 |
+
}, 1000);
|
| 276 |
+
|
| 277 |
+
// Update ARIA live region
|
| 278 |
+
if (timeLeft % 60 === 0 || timeLeft <= 10) {
|
| 279 |
+
updateAriaLive();
|
| 280 |
+
}
|
| 281 |
+
}
|
| 282 |
+
|
| 283 |
+
function pauseTimer() {
|
| 284 |
+
isRunning = false;
|
| 285 |
+
playIcon.setAttribute('data-feather', 'play');
|
| 286 |
+
feather.replace();
|
| 287 |
+
|
| 288 |
+
clearInterval(timer);
|
| 289 |
+
timerRingAnimation.pause();
|
| 290 |
+
}
|
| 291 |
+
|
| 292 |
+
function skipTimer() {
|
| 293 |
+
clearInterval(timer);
|
| 294 |
+
timerComplete();
|
| 295 |
+
}
|
| 296 |
+
|
| 297 |
+
function timerComplete() {
|
| 298 |
+
// Play alarm sound
|
| 299 |
+
alarmSound.play();
|
| 300 |
+
|
| 301 |
+
// Show confetti for focus sessions
|
| 302 |
+
if (currentMode === 'focus') {
|
| 303 |
+
confetti({
|
| 304 |
+
particleCount: 100,
|
| 305 |
+
spread: 70,
|
| 306 |
+
origin: { y: 0.6 }
|
| 307 |
+
});
|
| 308 |
+
}
|
| 309 |
+
|
| 310 |
+
// Bounce animation
|
| 311 |
+
timerDisplay.classList.add('bounce-animation');
|
| 312 |
+
setTimeout(() => {
|
| 313 |
+
timerDisplay.classList.remove('bounce-animation');
|
| 314 |
+
}, 500);
|
| 315 |
+
|
| 316 |
+
// Switch mode
|
| 317 |
+
switchMode();
|
| 318 |
+
}
|
| 319 |
+
|
| 320 |
+
function switchMode() {
|
| 321 |
+
if (currentMode === 'focus') {
|
| 322 |
+
cyclesCompleted++;
|
| 323 |
+
|
| 324 |
+
if (cyclesCompleted < totalCycles) {
|
| 325 |
+
currentMode = 'shortBreak';
|
| 326 |
+
timeLeft = 5 * 60;
|
| 327 |
+
} else {
|
| 328 |
+
currentMode = 'longBreak';
|
| 329 |
+
timeLeft = 15 * 60;
|
| 330 |
+
cyclesCompleted = 0;
|
| 331 |
+
}
|
| 332 |
+
} else {
|
| 333 |
+
currentMode = 'focus';
|
| 334 |
+
timeLeft = 25 * 60;
|
| 335 |
+
}
|
| 336 |
+
|
| 337 |
+
// Update UI for new mode
|
| 338 |
+
updateTimerDisplay();
|
| 339 |
+
updateProgressRing();
|
| 340 |
+
|
| 341 |
+
// Start timer automatically if it was running
|
| 342 |
+
if (isRunning) {
|
| 343 |
+
startTimer();
|
| 344 |
+
}
|
| 345 |
+
|
| 346 |
+
// Update ARIA live region
|
| 347 |
+
updateAriaLive();
|
| 348 |
+
}
|
| 349 |
+
|
| 350 |
+
function updateTimerDisplay() {
|
| 351 |
+
const minutes = Math.floor(timeLeft / 60);
|
| 352 |
+
const seconds = timeLeft % 60;
|
| 353 |
+
timerDisplay.textContent = `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
|
| 354 |
+
|
| 355 |
+
// Color change for different modes
|
| 356 |
+
if (currentMode === 'focus') {
|
| 357 |
+
document.documentElement.style.setProperty('--primary', '#6366f1');
|
| 358 |
+
timerDisplay.classList.remove('text-red-500');
|
| 359 |
+
timerDisplay.classList.add('text-gray-800');
|
| 360 |
+
} else {
|
| 361 |
+
document.documentElement.style.setProperty('--primary', '#f43f5e');
|
| 362 |
+
timerDisplay.classList.remove('text-gray-800');
|
| 363 |
+
timerDisplay.classList.add('text-red-500');
|
| 364 |
+
}
|
| 365 |
+
}
|
| 366 |
+
|
| 367 |
+
function updateProgressRing() {
|
| 368 |
+
const circumference = 283; // 2 * π * r (r = 45)
|
| 369 |
+
const timeFraction = timeLeft / (currentMode === 'focus' ? 25 * 60 :
|
| 370 |
+
currentMode === 'shortBreak' ? 5 * 60 : 15 * 60);
|
| 371 |
+
const offset = circumference * (1 - timeFraction);
|
| 372 |
+
progressRing.style.strokeDashoffset = offset;
|
| 373 |
+
|
| 374 |
+
// Reset GSAP animation
|
| 375 |
+
timerRingAnimation.kill();
|
| 376 |
+
timerRingAnimation = gsap.to("#progress-ring", {
|
| 377 |
+
strokeDashoffset: circumference,
|
| 378 |
+
duration: timeLeft,
|
| 379 |
+
ease: "linear",
|
| 380 |
+
paused: !isRunning
|
| 381 |
+
});
|
| 382 |
+
|
| 383 |
+
if (isRunning) {
|
| 384 |
+
timerRingAnimation.play();
|
| 385 |
+
}
|
| 386 |
+
}
|
| 387 |
+
|
| 388 |
+
function toggleSound() {
|
| 389 |
+
enableTickSound = !enableTickSound;
|
| 390 |
+
const soundIcon = soundBtn.querySelector('i');
|
| 391 |
+
|
| 392 |
+
if (enableTickSound) {
|
| 393 |
+
soundIcon.setAttribute('data-feather', 'volume-2');
|
| 394 |
+
} else {
|
| 395 |
+
soundIcon.setAttribute('data-feather', 'volume-x');
|
| 396 |
+
}
|
| 397 |
+
|
| 398 |
+
feather.replace();
|
| 399 |
+
|
| 400 |
+
// Show feedback
|
| 401 |
+
const feedback = document.createElement('div');
|
| 402 |
+
feedback.className = 'absolute bg-gray-800 text-white px-2 py-1 rounded text-sm';
|
| 403 |
+
feedback.textContent = enableTickSound ? 'Sound on' : 'Sound off';
|
| 404 |
+
soundBtn.appendChild(feedback);
|
| 405 |
+
|
| 406 |
+
setTimeout(() => {
|
| 407 |
+
feedback.remove();
|
| 408 |
+
}, 1000);
|
| 409 |
+
}
|
| 410 |
+
function saveSettingsHandler() {
|
| 411 |
+
const settings = {
|
| 412 |
+
focusDuration: parseInt(focusDurationInput.value) || 25,
|
| 413 |
+
shortBreak: parseInt(shortBreakInput.value) || 5,
|
| 414 |
+
longBreak: parseInt(longBreakInput.value) || 15,
|
| 415 |
+
enableTickSound: tickSoundCheckbox.checked
|
| 416 |
+
};
|
| 417 |
+
|
| 418 |
+
localStorage.setItem('pomodoroSettings', JSON.stringify(settings));
|
| 419 |
+
const focusDuration = parseInt(focusDurationInput.value) || 25;
|
| 420 |
+
const shortBreak = parseInt(shortBreakInput.value) || 5;
|
| 421 |
+
const longBreak = parseInt(longBreakInput.value) || 15;
|
| 422 |
+
|
| 423 |
+
// Update timer values
|
| 424 |
+
if (currentMode === 'focus') {
|
| 425 |
+
timeLeft = focusDuration * 60;
|
| 426 |
+
} else if (currentMode === 'shortBreak') {
|
| 427 |
+
timeLeft = shortBreak * 60;
|
| 428 |
+
} else {
|
| 429 |
+
timeLeft = longBreak * 60;
|
| 430 |
+
}
|
| 431 |
+
|
| 432 |
+
enableTickSound = tickSoundCheckbox.checked;
|
| 433 |
+
|
| 434 |
+
// Reset timer if running
|
| 435 |
+
if (isRunning) {
|
| 436 |
+
clearInterval(timer);
|
| 437 |
+
startTimer();
|
| 438 |
+
}
|
| 439 |
+
|
| 440 |
+
updateTimerDisplay();
|
| 441 |
+
updateProgressRing();
|
| 442 |
+
|
| 443 |
+
// Close modal
|
| 444 |
+
settingsModal.classList.add('hidden');
|
| 445 |
+
}
|
| 446 |
+
|
| 447 |
+
function updateAriaLive() {
|
| 448 |
+
const minutes = Math.floor(timeLeft / 60);
|
| 449 |
+
const seconds = timeLeft % 60;
|
| 450 |
+
const modeText = currentMode === 'focus' ? 'focus' :
|
| 451 |
+
currentMode === 'shortBreak' ? 'short break' : 'long break';
|
| 452 |
+
|
| 453 |
+
ariaLiveRegion.textContent = `${minutes} minute${minutes !== 1 ? 's' : ''} and ${seconds} second${seconds !== 1 ? 's' : ''} remaining in ${modeText} mode`;
|
| 454 |
+
}
|
| 455 |
+
</script>
|
| 456 |
+
</body>
|
| 457 |
</html>
|
|
@@ -0,0 +1,205 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>ChronoZen FlowMaster | Stats</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
| 9 |
+
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
| 10 |
+
<style>
|
| 11 |
+
:root {
|
| 12 |
+
--primary: #6366f1;
|
| 13 |
+
--secondary: #f43f5e;
|
| 14 |
+
--bg-light: #ffffff;
|
| 15 |
+
--bg-dark: #1a1a1a;
|
| 16 |
+
--text-light: #1a1a1a;
|
| 17 |
+
--text-dark: #f8f9fa;
|
| 18 |
+
}
|
| 19 |
+
</style>
|
| 20 |
+
</head>
|
| 21 |
+
<body class="bg-gray-50 dark:bg-gray-900 min-h-screen font-sans transition-colors duration-300">
|
| 22 |
+
<div class="container mx-auto px-4 py-8">
|
| 23 |
+
<header class="flex justify-between items-center mb-8">
|
| 24 |
+
<h1 class="text-2xl font-bold text-gray-800 dark:text-white">Your Productivity Stats</h1>
|
| 25 |
+
<div class="flex space-x-4">
|
| 26 |
+
<a href="/" class="flex items-center text-indigo-600 dark:text-indigo-400 hover:text-indigo-800 dark:hover:text-indigo-200 transition-colors">
|
| 27 |
+
<i data-feather="home" class="mr-1"></i> Timer
|
| 28 |
+
</a>
|
| 29 |
+
<button id="theme-toggle" class="p-2 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 transition-colors" aria-label="Toggle theme">
|
| 30 |
+
<i data-feather="moon" id="theme-icon"></i>
|
| 31 |
+
</button>
|
| 32 |
+
</div>
|
| 33 |
+
</header>
|
| 34 |
+
|
| 35 |
+
<div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-8">
|
| 36 |
+
<div class="bg-white dark:bg-gray-800 rounded-xl shadow-md p-6">
|
| 37 |
+
<h3 class="text-lg font-medium text-gray-500 dark:text-gray-400 mb-2">Today</h3>
|
| 38 |
+
<div class="flex items-end">
|
| 39 |
+
<span class="text-3xl font-bold text-gray-800 dark:text-white">4</span>
|
| 40 |
+
<span class="ml-1 text-gray-500 dark:text-gray-400">Pomodoros</span>
|
| 41 |
+
</div>
|
| 42 |
+
</div>
|
| 43 |
+
<div class="bg-white dark:bg-gray-800 rounded-xl shadow-md p-6">
|
| 44 |
+
<h3 class="text-lg font-medium text-gray-500 dark:text-gray-400 mb-2">This Week</h3>
|
| 45 |
+
<div class="flex items-end">
|
| 46 |
+
<span class="text-3xl font-bold text-gray-800 dark:text-white">18</span>
|
| 47 |
+
<span class="ml-1 text-gray-500 dark:text-gray-400">Pomodoros</span>
|
| 48 |
+
</div>
|
| 49 |
+
</div>
|
| 50 |
+
<div class="bg-white dark:bg-gray-800 rounded-xl shadow-md p-6">
|
| 51 |
+
<h3 class="text-lg font-medium text-gray-500 dark:text-gray-400 mb-2">All Time</h3>
|
| 52 |
+
<div class="flex items-end">
|
| 53 |
+
<span class="text-3xl font-bold text-gray-800 dark:text-white">127</span>
|
| 54 |
+
<span class="ml-1 text-gray-500 dark:text-gray-400">Pomodoros</span>
|
| 55 |
+
</div>
|
| 56 |
+
</div>
|
| 57 |
+
</div>
|
| 58 |
+
|
| 59 |
+
<div class="bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 mb-8">
|
| 60 |
+
<h2 class="text-xl font-bold text-gray-800 dark:text-white mb-4">Weekly Progress</h2>
|
| 61 |
+
<canvas id="weeklyChart" height="300"></canvas>
|
| 62 |
+
</div>
|
| 63 |
+
|
| 64 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
| 65 |
+
<div class="bg-white dark:bg-gray-800 rounded-xl shadow-md p-6">
|
| 66 |
+
<h2 class="text-xl font-bold text-gray-800 dark:text-white mb-4">Daily Distribution</h2>
|
| 67 |
+
<canvas id="dailyChart" height="250"></canvas>
|
| 68 |
+
</div>
|
| 69 |
+
<div class="bg-white dark:bg-gray-800 rounded-xl shadow-md p-6">
|
| 70 |
+
<h2 class="text-xl font-bold text-gray-800 dark:text-white mb-4">Recent Sessions</h2>
|
| 71 |
+
<div class="space-y-3">
|
| 72 |
+
<div class="flex justify-between items-center p-3 bg-gray-50 dark:bg-gray-700 rounded-lg">
|
| 73 |
+
<div>
|
| 74 |
+
<p class="font-medium text-gray-800 dark:text-white">Focus Session</p>
|
| 75 |
+
<p class="text-sm text-gray-500 dark:text-gray-400">25 minutes • 10:15 AM</p>
|
| 76 |
+
</div>
|
| 77 |
+
<span class="text-indigo-600 dark:text-indigo-400 font-medium">Completed</span>
|
| 78 |
+
</div>
|
| 79 |
+
<div class="flex justify-between items-center p-3 bg-gray-50 dark:bg-gray-700 rounded-lg">
|
| 80 |
+
<div>
|
| 81 |
+
<p class="font-medium text-gray-800 dark:text-white">Short Break</p>
|
| 82 |
+
<p class="text-sm text-gray-500 dark:text-gray-400">5 minutes • 10:40 AM</p>
|
| 83 |
+
</div>
|
| 84 |
+
<span class="text-indigo-600 dark:text-indigo-400 font-medium">Completed</span>
|
| 85 |
+
</div>
|
| 86 |
+
</div>
|
| 87 |
+
</div>
|
| 88 |
+
</div>
|
| 89 |
+
</div>
|
| 90 |
+
|
| 91 |
+
<script>
|
| 92 |
+
feather.replace();
|
| 93 |
+
|
| 94 |
+
// Theme toggle
|
| 95 |
+
const themeToggle = document.getElementById('theme-toggle');
|
| 96 |
+
const themeIcon = document.getElementById('theme-icon');
|
| 97 |
+
|
| 98 |
+
themeToggle.addEventListener('click', () => {
|
| 99 |
+
if (document.documentElement.classList.contains('dark')) {
|
| 100 |
+
document.documentElement.classList.remove('dark');
|
| 101 |
+
localStorage.setItem('theme', 'light');
|
| 102 |
+
themeIcon.setAttribute('data-feather', 'moon');
|
| 103 |
+
} else {
|
| 104 |
+
document.documentElement.classList.add('dark');
|
| 105 |
+
localStorage.setItem('theme', 'dark');
|
| 106 |
+
themeIcon.setAttribute('data-feather', 'sun');
|
| 107 |
+
}
|
| 108 |
+
feather.replace();
|
| 109 |
+
updateChartThemes();
|
| 110 |
+
});
|
| 111 |
+
|
| 112 |
+
// Check for saved theme preference
|
| 113 |
+
if (localStorage.getItem('theme') === 'dark' ||
|
| 114 |
+
(!localStorage.getItem('theme') && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
|
| 115 |
+
document.documentElement.classList.add('dark');
|
| 116 |
+
themeIcon.setAttribute('data-feather', 'sun');
|
| 117 |
+
feather.replace();
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
// Charts
|
| 121 |
+
const weeklyCtx = document.getElementById('weeklyChart').getContext('2d');
|
| 122 |
+
const dailyCtx = document.getElementById('dailyChart').getContext('2d');
|
| 123 |
+
|
| 124 |
+
const textColor = document.documentElement.classList.contains('dark') ? '#f8f9fa' : '#1a1a1a';
|
| 125 |
+
const gridColor = document.documentElement.classList.contains('dark') ? 'rgba(255, 255, 255, 0.1)' : 'rgba(0, 0, 0, 0.1)';
|
| 126 |
+
|
| 127 |
+
const weeklyChart = new Chart(weeklyCtx, {
|
| 128 |
+
type: 'bar',
|
| 129 |
+
data: {
|
| 130 |
+
labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
|
| 131 |
+
datasets: [{
|
| 132 |
+
label: 'Pomodoros',
|
| 133 |
+
data: [3, 5, 4, 6, 3, 2, 0],
|
| 134 |
+
backgroundColor: '#6366f1',
|
| 135 |
+
borderRadius: 6
|
| 136 |
+
}]
|
| 137 |
+
},
|
| 138 |
+
options: {
|
| 139 |
+
responsive: true,
|
| 140 |
+
plugins: {
|
| 141 |
+
legend: {
|
| 142 |
+
display: false
|
| 143 |
+
}
|
| 144 |
+
},
|
| 145 |
+
scales: {
|
| 146 |
+
y: {
|
| 147 |
+
beginAtZero: true,
|
| 148 |
+
ticks: {
|
| 149 |
+
color: textColor
|
| 150 |
+
},
|
| 151 |
+
grid: {
|
| 152 |
+
color: gridColor
|
| 153 |
+
}
|
| 154 |
+
},
|
| 155 |
+
x: {
|
| 156 |
+
ticks: {
|
| 157 |
+
color: textColor
|
| 158 |
+
},
|
| 159 |
+
grid: {
|
| 160 |
+
display: false
|
| 161 |
+
}
|
| 162 |
+
}
|
| 163 |
+
}
|
| 164 |
+
}
|
| 165 |
+
});
|
| 166 |
+
|
| 167 |
+
const dailyChart = new Chart(dailyCtx, {
|
| 168 |
+
type: 'doughnut',
|
| 169 |
+
data: {
|
| 170 |
+
labels: ['Focus', 'Short Break', 'Long Break'],
|
| 171 |
+
datasets: [{
|
| 172 |
+
data: [12, 8, 2],
|
| 173 |
+
backgroundColor: ['#6366f1', '#f43f5e', '#10b981'],
|
| 174 |
+
borderWidth: 0
|
| 175 |
+
}]
|
| 176 |
+
},
|
| 177 |
+
options: {
|
| 178 |
+
responsive: true,
|
| 179 |
+
plugins: {
|
| 180 |
+
legend: {
|
| 181 |
+
position: 'right',
|
| 182 |
+
labels: {
|
| 183 |
+
color: textColor
|
| 184 |
+
}
|
| 185 |
+
}
|
| 186 |
+
}
|
| 187 |
+
}
|
| 188 |
+
});
|
| 189 |
+
|
| 190 |
+
function updateChartThemes() {
|
| 191 |
+
const newTextColor = document.documentElement.classList.contains('dark') ? '#f8f9fa' : '#1a1a1a';
|
| 192 |
+
const newGridColor = document.documentElement.classList.contains('dark') ? 'rgba(255, 255, 255, 0.1)' : 'rgba(0, 0, 0, 0.1)';
|
| 193 |
+
|
| 194 |
+
weeklyChart.options.scales.x.ticks.color = newTextColor;
|
| 195 |
+
weeklyChart.options.scales.y.ticks.color = newTextColor;
|
| 196 |
+
weeklyChart.options.scales.y.grid.color = newGridColor;
|
| 197 |
+
|
| 198 |
+
dailyChart.options.plugins.legend.labels.color = newTextColor;
|
| 199 |
+
|
| 200 |
+
weeklyChart.update();
|
| 201 |
+
dailyChart.update();
|
| 202 |
+
}
|
| 203 |
+
</script>
|
| 204 |
+
</body>
|
| 205 |
+
</html>
|