maylay0 commited on
Commit
fb2d11d
·
verified ·
1 Parent(s): 5614994

i need an app keep up with my daliy life - Initial Deployment

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +933 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: X4
3
- emoji: 📈
4
- colorFrom: purple
5
- colorTo: yellow
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: x4
3
+ emoji: 🐳
4
+ colorFrom: red
5
+ colorTo: pink
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,933 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
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>Daily Life Tracker</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ /* Custom scrollbar */
11
+ ::-webkit-scrollbar {
12
+ width: 8px;
13
+ }
14
+ ::-webkit-scrollbar-track {
15
+ background: #f1f1f1;
16
+ }
17
+ ::-webkit-scrollbar-thumb {
18
+ background: #888;
19
+ border-radius: 4px;
20
+ }
21
+ ::-webkit-scrollbar-thumb:hover {
22
+ background: #555;
23
+ }
24
+
25
+ /* Animation for task completion */
26
+ @keyframes fadeOut {
27
+ from { opacity: 1; }
28
+ to { opacity: 0; transform: translateX(50px); }
29
+ }
30
+
31
+ .completed {
32
+ animation: fadeOut 0.5s forwards;
33
+ }
34
+
35
+ /* Mood selector animation */
36
+ .mood-option:hover {
37
+ transform: scale(1.1);
38
+ transition: transform 0.2s;
39
+ }
40
+
41
+ /* Calendar day hover */
42
+ .calendar-day:hover:not(.empty-day) {
43
+ background-color: #e2e8f0;
44
+ cursor: pointer;
45
+ }
46
+
47
+ /* Pulse animation for notifications */
48
+ @keyframes pulse {
49
+ 0% { transform: scale(1); }
50
+ 50% { transform: scale(1.05); }
51
+ 100% { transform: scale(1); }
52
+ }
53
+
54
+ .pulse {
55
+ animation: pulse 1.5s infinite;
56
+ }
57
+ </style>
58
+ </head>
59
+ <body class="bg-gray-100 min-h-screen">
60
+ <div class="container mx-auto px-4 py-8 max-w-6xl">
61
+ <!-- Header -->
62
+ <header class="flex justify-between items-center mb-8">
63
+ <div>
64
+ <h1 class="text-3xl font-bold text-indigo-700">Daily Life Tracker</h1>
65
+ <p class="text-gray-600">Organize your day, build habits, and track your mood</p>
66
+ </div>
67
+ <div class="flex items-center space-x-4">
68
+ <div class="relative">
69
+ <button id="notificationBtn" class="text-gray-600 hover:text-indigo-700">
70
+ <i class="fas fa-bell text-xl"></i>
71
+ <span id="notificationCount" class="absolute -top-2 -right-2 bg-red-500 text-white text-xs rounded-full h-5 w-5 flex items-center justify-center hidden">0</span>
72
+ </button>
73
+ <div id="notificationDropdown" class="hidden absolute right-0 mt-2 w-64 bg-white rounded-md shadow-lg z-10 p-2 max-h-80 overflow-y-auto">
74
+ <p class="text-gray-500 text-sm p-2">No new notifications</p>
75
+ </div>
76
+ </div>
77
+ <div class="relative">
78
+ <button id="profileBtn" class="flex items-center space-x-2">
79
+ <div class="h-10 w-10 rounded-full bg-indigo-500 flex items-center justify-center text-white font-bold">U</div>
80
+ </button>
81
+ </div>
82
+ </div>
83
+ </header>
84
+
85
+ <!-- Main Content -->
86
+ <div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
87
+ <!-- Left Column -->
88
+ <div class="lg:col-span-2 space-y-6">
89
+ <!-- Date and Quick Stats -->
90
+ <div class="bg-white rounded-xl shadow p-6">
91
+ <div class="flex justify-between items-center mb-4">
92
+ <h2 class="text-xl font-semibold text-gray-800" id="currentDate">Today, June 15, 2023</h2>
93
+ <div class="flex space-x-2">
94
+ <button id="prevDay" class="p-2 rounded-full hover:bg-gray-100">
95
+ <i class="fas fa-chevron-left"></i>
96
+ </button>
97
+ <button id="nextDay" class="p-2 rounded-full hover:bg-gray-100">
98
+ <i class="fas fa-chevron-right"></i>
99
+ </button>
100
+ <button id="todayBtn" class="px-3 py-1 bg-indigo-100 text-indigo-700 rounded-full text-sm hover:bg-indigo-200">Today</button>
101
+ </div>
102
+ </div>
103
+
104
+ <div class="grid grid-cols-3 gap-4 text-center">
105
+ <div class="bg-blue-50 p-3 rounded-lg">
106
+ <p class="text-sm text-blue-600">Tasks</p>
107
+ <p class="text-xl font-bold"><span id="taskCount">0</span>/<span id="taskTotal">0</span></p>
108
+ </div>
109
+ <div class="bg-green-50 p-3 rounded-lg">
110
+ <p class="text-sm text-green-600">Habits</p>
111
+ <p class="text-xl font-bold"><span id="habitCount">0</span>/<span id="habitTotal">0</span></p>
112
+ </div>
113
+ <div class="bg-purple-50 p-3 rounded-lg">
114
+ <p class="text-sm text-purple-600">Mood</p>
115
+ <p class="text-xl font-bold" id="moodScore">-</p>
116
+ </div>
117
+ </div>
118
+ </div>
119
+
120
+ <!-- Tasks Section -->
121
+ <div class="bg-white rounded-xl shadow p-6">
122
+ <div class="flex justify-between items-center mb-4">
123
+ <h2 class="text-xl font-semibold text-gray-800">Tasks</h2>
124
+ <button id="addTaskBtn" class="px-3 py-1 bg-indigo-600 text-white rounded-full text-sm hover:bg-indigo-700 flex items-center space-x-1">
125
+ <i class="fas fa-plus text-xs"></i>
126
+ <span>Add Task</span>
127
+ </button>
128
+ </div>
129
+
130
+ <div id="taskForm" class="hidden mb-4">
131
+ <div class="flex space-x-2">
132
+ <input type="text" id="newTaskInput" placeholder="What needs to be done?" class="flex-1 px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500">
133
+ <button id="saveTaskBtn" class="px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700">Add</button>
134
+ </div>
135
+ <div class="flex items-center mt-2 space-x-4">
136
+ <div class="flex items-center">
137
+ <input type="checkbox" id="importantTask" class="mr-2">
138
+ <label for="importantTask" class="text-sm text-gray-600">Important</label>
139
+ </div>
140
+ <div class="flex items-center">
141
+ <input type="checkbox" id="urgentTask" class="mr-2">
142
+ <label for="urgentTask" class="text-sm text-gray-600">Urgent</label>
143
+ </div>
144
+ </div>
145
+ </div>
146
+
147
+ <div id="taskList" class="space-y-2">
148
+ <p class="text-gray-500 text-center py-4">No tasks added yet</p>
149
+ </div>
150
+ </div>
151
+
152
+ <!-- Habits Section -->
153
+ <div class="bg-white rounded-xl shadow p-6">
154
+ <div class="flex justify-between items-center mb-4">
155
+ <h2 class="text-xl font-semibold text-gray-800">Habits</h2>
156
+ <button id="addHabitBtn" class="px-3 py-1 bg-indigo-600 text-white rounded-full text-sm hover:bg-indigo-700 flex items-center space-x-1">
157
+ <i class="fas fa-plus text-xs"></i>
158
+ <span>Add Habit</span>
159
+ </button>
160
+ </div>
161
+
162
+ <div id="habitForm" class="hidden mb-4">
163
+ <div class="flex space-x-2">
164
+ <input type="text" id="newHabitInput" placeholder="What habit do you want to track?" class="flex-1 px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500">
165
+ <button id="saveHabitBtn" class="px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700">Add</button>
166
+ </div>
167
+ <div class="mt-2">
168
+ <p class="text-sm text-gray-600 mb-1">Frequency</p>
169
+ <div class="flex space-x-2">
170
+ <button class="frequency-btn px-3 py-1 bg-gray-200 rounded-full text-sm" data-frequency="daily">Daily</button>
171
+ <button class="frequency-btn px-3 py-1 bg-gray-200 rounded-full text-sm" data-frequency="weekly">Weekly</button>
172
+ <button class="frequency-btn px-3 py-1 bg-gray-200 rounded-full text-sm" data-frequency="monthly">Monthly</button>
173
+ </div>
174
+ </div>
175
+ </div>
176
+
177
+ <div id="habitList" class="space-y-3">
178
+ <p class="text-gray-500 text-center py-4">No habits added yet</p>
179
+ </div>
180
+ </div>
181
+ </div>
182
+
183
+ <!-- Right Column -->
184
+ <div class="space-y-6">
185
+ <!-- Mood Tracker -->
186
+ <div class="bg-white rounded-xl shadow p-6">
187
+ <h2 class="text-xl font-semibold text-gray-800 mb-4">How are you feeling today?</h2>
188
+
189
+ <div class="grid grid-cols-5 gap-2 mb-4">
190
+ <button class="mood-option p-2 rounded-full bg-red-100 text-red-500" data-mood="1">
191
+ <i class="fas fa-frown text-2xl"></i>
192
+ </button>
193
+ <button class="mood-option p-2 rounded-full bg-yellow-100 text-yellow-500" data-mood="2">
194
+ <i class="fas fa-meh text-2xl"></i>
195
+ </button>
196
+ <button class="mood-option p-2 rounded-full bg-blue-100 text-blue-500" data-mood="3">
197
+ <i class="fas fa-smile text-2xl"></i>
198
+ </button>
199
+ <button class="mood-option p-2 rounded-full bg-green-100 text-green-500" data-mood="4">
200
+ <i class="fas fa-laugh text-2xl"></i>
201
+ </button>
202
+ <button class="mood-option p-2 rounded-full bg-purple-100 text-purple-500" data-mood="5">
203
+ <i class="fas fa-grin-stars text-2xl"></i>
204
+ </button>
205
+ </div>
206
+
207
+ <div id="moodNotes" class="hidden">
208
+ <textarea id="moodJournal" placeholder="Add some notes about your day..." class="w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 h-24"></textarea>
209
+ <button id="saveMoodBtn" class="mt-2 px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 w-full">Save Mood</button>
210
+ </div>
211
+
212
+ <div id="moodHistory" class="mt-4">
213
+ <h3 class="text-sm font-medium text-gray-500 mb-2">Recent Moods</h3>
214
+ <div id="moodHistoryList" class="space-y-2">
215
+ <p class="text-gray-500 text-sm">No mood data yet</p>
216
+ </div>
217
+ </div>
218
+ </div>
219
+
220
+ <!-- Mini Calendar -->
221
+ <div class="bg-white rounded-xl shadow p-6">
222
+ <div class="flex justify-between items-center mb-4">
223
+ <h2 class="text-xl font-semibold text-gray-800">Calendar</h2>
224
+ <div class="flex space-x-2">
225
+ <button id="prevMonth" class="p-1 rounded-full hover:bg-gray-100">
226
+ <i class="fas fa-chevron-left"></i>
227
+ </button>
228
+ <button id="nextMonth" class="p-1 rounded-full hover:bg-gray-100">
229
+ <i class="fas fa-chevron-right"></i>
230
+ </button>
231
+ </div>
232
+ </div>
233
+
234
+ <div id="currentMonthYear" class="text-center font-medium mb-2">June 2023</div>
235
+
236
+ <div class="grid grid-cols-7 gap-1 text-center text-sm">
237
+ <div class="font-medium py-1">Sun</div>
238
+ <div class="font-medium py-1">Mon</div>
239
+ <div class="font-medium py-1">Tue</div>
240
+ <div class="font-medium py-1">Wed</div>
241
+ <div class="font-medium py-1">Thu</div>
242
+ <div class="font-medium py-1">Fri</div>
243
+ <div class="font-medium py-1">Sat</div>
244
+ </div>
245
+
246
+ <div id="calendarDays" class="grid grid-cols-7 gap-1 text-center text-sm">
247
+ <!-- Calendar days will be populated here -->
248
+ </div>
249
+ </div>
250
+
251
+ <!-- Quick Notes -->
252
+ <div class="bg-white rounded-xl shadow p-6">
253
+ <h2 class="text-xl font-semibold text-gray-800 mb-4">Quick Notes</h2>
254
+ <textarea id="quickNotes" placeholder="Jot down any thoughts or reminders..." class="w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 h-32"></textarea>
255
+ <button id="saveNotesBtn" class="mt-2 px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 w-full">Save Notes</button>
256
+ </div>
257
+ </div>
258
+ </div>
259
+ </div>
260
+
261
+ <script>
262
+ // Initialize data
263
+ let tasks = [];
264
+ let habits = [];
265
+ let moods = [];
266
+ let notes = "";
267
+ let currentDate = new Date();
268
+ let currentMonth = currentDate.getMonth();
269
+ let currentYear = currentDate.getFullYear();
270
+
271
+ // DOM Elements
272
+ const currentDateEl = document.getElementById('currentDate');
273
+ const prevDayBtn = document.getElementById('prevDay');
274
+ const nextDayBtn = document.getElementById('nextDay');
275
+ const todayBtn = document.getElementById('todayBtn');
276
+ const taskCountEl = document.getElementById('taskCount');
277
+ const taskTotalEl = document.getElementById('taskTotal');
278
+ const habitCountEl = document.getElementById('habitCount');
279
+ const habitTotalEl = document.getElementById('habitTotal');
280
+ const moodScoreEl = document.getElementById('moodScore');
281
+ const addTaskBtn = document.getElementById('addTaskBtn');
282
+ const taskForm = document.getElementById('taskForm');
283
+ const newTaskInput = document.getElementById('newTaskInput');
284
+ const saveTaskBtn = document.getElementById('saveTaskBtn');
285
+ const importantTask = document.getElementById('importantTask');
286
+ const urgentTask = document.getElementById('urgentTask');
287
+ const taskList = document.getElementById('taskList');
288
+ const addHabitBtn = document.getElementById('addHabitBtn');
289
+ const habitForm = document.getElementById('habitForm');
290
+ const newHabitInput = document.getElementById('newHabitInput');
291
+ const saveHabitBtn = document.getElementById('saveHabitBtn');
292
+ const habitList = document.getElementById('habitList');
293
+ const frequencyBtns = document.querySelectorAll('.frequency-btn');
294
+ const moodOptions = document.querySelectorAll('.mood-option');
295
+ const moodNotes = document.getElementById('moodNotes');
296
+ const moodJournal = document.getElementById('moodJournal');
297
+ const saveMoodBtn = document.getElementById('saveMoodBtn');
298
+ const moodHistoryList = document.getElementById('moodHistoryList');
299
+ const prevMonthBtn = document.getElementById('prevMonth');
300
+ const nextMonthBtn = document.getElementById('nextMonth');
301
+ const currentMonthYearEl = document.getElementById('currentMonthYear');
302
+ const calendarDaysEl = document.getElementById('calendarDays');
303
+ const quickNotes = document.getElementById('quickNotes');
304
+ const saveNotesBtn = document.getElementById('saveNotesBtn');
305
+ const notificationBtn = document.getElementById('notificationBtn');
306
+ const notificationCount = document.getElementById('notificationCount');
307
+ const notificationDropdown = document.getElementById('notificationDropdown');
308
+
309
+ // Format date as "Weekday, Month Day, Year"
310
+ function formatDate(date) {
311
+ const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
312
+ return date.toLocaleDateString('en-US', options);
313
+ }
314
+
315
+ // Format date as YYYY-MM-DD for storage
316
+ function formatDateKey(date) {
317
+ return date.toISOString().split('T')[0];
318
+ }
319
+
320
+ // Update the UI with the current date
321
+ function updateDateDisplay() {
322
+ currentDateEl.textContent = formatDate(currentDate);
323
+ loadDayData();
324
+ generateCalendar();
325
+ }
326
+
327
+ // Load data for the current day
328
+ function loadDayData() {
329
+ const dateKey = formatDateKey(currentDate);
330
+
331
+ // Load tasks
332
+ const dayTasks = tasks.filter(task => task.date === dateKey);
333
+ renderTasks(dayTasks);
334
+
335
+ // Load habits
336
+ const dayHabits = habits.filter(habit => {
337
+ if (habit.frequency === 'daily') return true;
338
+ if (habit.frequency === 'weekly' && currentDate.getDay() === 0) return true; // Sunday
339
+ if (habit.frequency === 'monthly' && currentDate.getDate() === 1) return true; // 1st of month
340
+ return false;
341
+ });
342
+ renderHabits(dayHabits);
343
+
344
+ // Load mood
345
+ const dayMood = moods.find(mood => mood.date === dateKey);
346
+ if (dayMood) {
347
+ moodScoreEl.textContent = dayMood.score;
348
+ moodJournal.value = dayMood.notes || '';
349
+ moodHistoryList.innerHTML = `
350
+ <div class="flex items-center justify-between bg-gray-50 p-2 rounded">
351
+ <div class="flex items-center">
352
+ <i class="fas ${getMoodIcon(dayMood.score)} text-${getMoodColor(dayMood.score)}-500 mr-2"></i>
353
+ <span>${dayMood.score}/5</span>
354
+ </div>
355
+ <span class="text-xs text-gray-500">Today</span>
356
+ </div>
357
+ `;
358
+ } else {
359
+ moodScoreEl.textContent = '-';
360
+ moodJournal.value = '';
361
+ moodHistoryList.innerHTML = '<p class="text-gray-500 text-sm">No mood data yet</p>';
362
+ }
363
+
364
+ // Load quick notes
365
+ quickNotes.value = notes;
366
+
367
+ // Update stats
368
+ updateStats();
369
+ }
370
+
371
+ // Update the quick stats display
372
+ function updateStats() {
373
+ const dateKey = formatDateKey(currentDate);
374
+
375
+ // Task stats
376
+ const dayTasks = tasks.filter(task => task.date === dateKey);
377
+ const completedTasks = dayTasks.filter(task => task.completed).length;
378
+ taskCountEl.textContent = completedTasks;
379
+ taskTotalEl.textContent = dayTasks.length;
380
+
381
+ // Habit stats
382
+ const dayHabits = habits.filter(habit => {
383
+ if (habit.frequency === 'daily') return true;
384
+ if (habit.frequency === 'weekly' && currentDate.getDay() === 0) return true;
385
+ if (habit.frequency === 'monthly' && currentDate.getDate() === 1) return true;
386
+ return false;
387
+ });
388
+ const completedHabits = dayHabits.filter(habit => habit.completedDates.includes(dateKey)).length;
389
+ habitCountEl.textContent = completedHabits;
390
+ habitTotalEl.textContent = dayHabits.length;
391
+ }
392
+
393
+ // Render tasks to the UI
394
+ function renderTasks(taskArray) {
395
+ if (taskArray.length === 0) {
396
+ taskList.innerHTML = '<p class="text-gray-500 text-center py-4">No tasks added yet</p>';
397
+ return;
398
+ }
399
+
400
+ taskList.innerHTML = '';
401
+ taskArray.forEach((task, index) => {
402
+ const taskEl = document.createElement('div');
403
+ taskEl.className = `flex items-center justify-between p-3 border rounded-lg ${task.completed ? 'bg-gray-50' : 'bg-white'}`;
404
+ taskEl.dataset.id = index;
405
+
406
+ const leftContent = document.createElement('div');
407
+ leftContent.className = 'flex items-center';
408
+
409
+ const checkbox = document.createElement('input');
410
+ checkbox.type = 'checkbox';
411
+ checkbox.className = 'mr-3 h-5 w-5 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500';
412
+ checkbox.checked = task.completed;
413
+ checkbox.addEventListener('change', () => toggleTaskComplete(index));
414
+
415
+ const taskText = document.createElement('span');
416
+ taskText.className = `${task.completed ? 'line-through text-gray-400' : 'text-gray-700'}`;
417
+ taskText.textContent = task.text;
418
+
419
+ leftContent.appendChild(checkbox);
420
+ leftContent.appendChild(taskText);
421
+
422
+ const rightContent = document.createElement('div');
423
+ rightContent.className = 'flex items-center space-x-2';
424
+
425
+ if (task.important) {
426
+ const importantIcon = document.createElement('i');
427
+ importantIcon.className = 'fas fa-exclamation-circle text-red-500';
428
+ rightContent.appendChild(importantIcon);
429
+ }
430
+
431
+ if (task.urgent) {
432
+ const urgentIcon = document.createElement('i');
433
+ urgentIcon.className = 'fas fa-bolt text-yellow-500';
434
+ rightContent.appendChild(urgentIcon);
435
+ }
436
+
437
+ const deleteBtn = document.createElement('button');
438
+ deleteBtn.className = 'text-gray-400 hover:text-red-500';
439
+ deleteBtn.innerHTML = '<i class="fas fa-trash"></i>';
440
+ deleteBtn.addEventListener('click', (e) => {
441
+ e.stopPropagation();
442
+ deleteTask(index);
443
+ });
444
+
445
+ rightContent.appendChild(deleteBtn);
446
+
447
+ taskEl.appendChild(leftContent);
448
+ taskEl.appendChild(rightContent);
449
+
450
+ taskList.appendChild(taskEl);
451
+ });
452
+ }
453
+
454
+ // Render habits to the UI
455
+ function renderHabits(habitArray) {
456
+ if (habitArray.length === 0) {
457
+ habitList.innerHTML = '<p class="text-gray-500 text-center py-4">No habits added yet</p>';
458
+ return;
459
+ }
460
+
461
+ habitList.innerHTML = '';
462
+ habitArray.forEach((habit, index) => {
463
+ const dateKey = formatDateKey(currentDate);
464
+ const isCompleted = habit.completedDates.includes(dateKey);
465
+
466
+ const habitEl = document.createElement('div');
467
+ habitEl.className = 'flex items-center justify-between p-3 border rounded-lg bg-white';
468
+ habitEl.dataset.id = index;
469
+
470
+ const leftContent = document.createElement('div');
471
+ leftContent.className = 'flex items-center';
472
+
473
+ const checkbox = document.createElement('input');
474
+ checkbox.type = 'checkbox';
475
+ checkbox.className = 'mr-3 h-5 w-5 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500';
476
+ checkbox.checked = isCompleted;
477
+ checkbox.addEventListener('change', () => toggleHabitComplete(index));
478
+
479
+ const habitText = document.createElement('div');
480
+
481
+ const habitTitle = document.createElement('span');
482
+ habitTitle.className = 'text-gray-700';
483
+ habitTitle.textContent = habit.text;
484
+
485
+ const habitFrequency = document.createElement('p');
486
+ habitFrequency.className = 'text-xs text-gray-500';
487
+ habitFrequency.textContent = `Frequency: ${habit.frequency}`;
488
+
489
+ habitText.appendChild(habitTitle);
490
+ habitText.appendChild(habitFrequency);
491
+
492
+ leftContent.appendChild(checkbox);
493
+ leftContent.appendChild(habitText);
494
+
495
+ const rightContent = document.createElement('div');
496
+ rightContent.className = 'flex items-center space-x-2';
497
+
498
+ const streakText = document.createElement('span');
499
+ streakText.className = 'text-xs bg-indigo-100 text-indigo-800 px-2 py-1 rounded-full';
500
+ streakText.textContent = `Streak: ${habit.streak}`;
501
+
502
+ const deleteBtn = document.createElement('button');
503
+ deleteBtn.className = 'text-gray-400 hover:text-red-500';
504
+ deleteBtn.innerHTML = '<i class="fas fa-trash"></i>';
505
+ deleteBtn.addEventListener('click', (e) => {
506
+ e.stopPropagation();
507
+ deleteHabit(index);
508
+ });
509
+
510
+ rightContent.appendChild(streakText);
511
+ rightContent.appendChild(deleteBtn);
512
+
513
+ habitEl.appendChild(leftContent);
514
+ habitEl.appendChild(rightContent);
515
+
516
+ habitList.appendChild(habitEl);
517
+ });
518
+ }
519
+
520
+ // Generate calendar view
521
+ function generateCalendar() {
522
+ const firstDay = new Date(currentYear, currentMonth, 1);
523
+ const lastDay = new Date(currentYear, currentMonth + 1, 0);
524
+ const daysInMonth = lastDay.getDate();
525
+ const startingDay = firstDay.getDay();
526
+
527
+ currentMonthYearEl.textContent = new Date(currentYear, currentMonth).toLocaleDateString('en-US', { month: 'long', year: 'numeric' });
528
+
529
+ calendarDaysEl.innerHTML = '';
530
+
531
+ // Add empty cells for days before the first day of the month
532
+ for (let i = 0; i < startingDay; i++) {
533
+ const emptyDay = document.createElement('div');
534
+ emptyDay.className = 'empty-day py-1';
535
+ calendarDaysEl.appendChild(emptyDay);
536
+ }
537
+
538
+ // Add cells for each day of the month
539
+ for (let day = 1; day <= daysInMonth; day++) {
540
+ const dayCell = document.createElement('div');
541
+ dayCell.className = 'calendar-day py-1 rounded';
542
+
543
+ // Highlight today
544
+ const date = new Date(currentYear, currentMonth, day);
545
+ if (date.toDateString() === new Date().toDateString()) {
546
+ dayCell.classList.add('bg-indigo-100', 'font-medium');
547
+ }
548
+
549
+ // Highlight selected day
550
+ if (date.toDateString() === currentDate.toDateString()) {
551
+ dayCell.classList.add('bg-indigo-500', 'text-white');
552
+ }
553
+
554
+ dayCell.textContent = day;
555
+ dayCell.addEventListener('click', () => {
556
+ currentDate = new Date(currentYear, currentMonth, day);
557
+ updateDateDisplay();
558
+ });
559
+
560
+ calendarDaysEl.appendChild(dayCell);
561
+ }
562
+ }
563
+
564
+ // Get mood icon based on score
565
+ function getMoodIcon(score) {
566
+ switch(score) {
567
+ case 1: return 'fa-frown';
568
+ case 2: return 'fa-meh';
569
+ case 3: return 'fa-smile';
570
+ case 4: return 'fa-laugh';
571
+ case 5: return 'fa-grin-stars';
572
+ default: return 'fa-question';
573
+ }
574
+ }
575
+
576
+ // Get mood color based on score
577
+ function getMoodColor(score) {
578
+ switch(score) {
579
+ case 1: return 'red';
580
+ case 2: return 'yellow';
581
+ case 3: return 'blue';
582
+ case 4: return 'green';
583
+ case 5: return 'purple';
584
+ default: return 'gray';
585
+ }
586
+ }
587
+
588
+ // Toggle task completion status
589
+ function toggleTaskComplete(index) {
590
+ const dateKey = formatDateKey(currentDate);
591
+ tasks[index].completed = !tasks[index].completed;
592
+
593
+ // Add notification for task completion
594
+ if (tasks[index].completed) {
595
+ addNotification(`Task completed: ${tasks[index].text}`);
596
+ }
597
+
598
+ // Animation for completed task
599
+ if (tasks[index].completed) {
600
+ const taskEl = document.querySelector(`#taskList div[data-id="${index}"]`);
601
+ taskEl.classList.add('completed');
602
+ setTimeout(() => {
603
+ renderTasks(tasks.filter(task => task.date === dateKey));
604
+ updateStats();
605
+ }, 500);
606
+ } else {
607
+ renderTasks(tasks.filter(task => task.date === dateKey));
608
+ updateStats();
609
+ }
610
+ }
611
+
612
+ // Toggle habit completion status
613
+ function toggleHabitComplete(index) {
614
+ const dateKey = formatDateKey(currentDate);
615
+ const habit = habits[index];
616
+
617
+ if (habit.completedDates.includes(dateKey)) {
618
+ // Remove from completed dates
619
+ habit.completedDates = habit.completedDates.filter(d => d !== dateKey);
620
+
621
+ // Decrease streak if this was the most recent completion
622
+ const sortedDates = [...habit.completedDates].sort();
623
+ if (sortedDates.length > 0) {
624
+ const lastDate = new Date(sortedDates[sortedDates.length - 1]);
625
+ const yesterday = new Date(currentDate);
626
+ yesterday.setDate(yesterday.getDate() - 1);
627
+
628
+ if (lastDate.toDateString() !== yesterday.toDateString()) {
629
+ habit.streak = sortedDates.length;
630
+ }
631
+ } else {
632
+ habit.streak = 0;
633
+ }
634
+ } else {
635
+ // Add to completed dates
636
+ habit.completedDates.push(dateKey);
637
+
638
+ // Check if this continues a streak
639
+ const yesterday = new Date(currentDate);
640
+ yesterday.setDate(yesterday.getDate() - 1);
641
+ const yesterdayKey = formatDateKey(yesterday);
642
+
643
+ if (habit.completedDates.includes(yesterdayKey) || habit.completedDates.length === 1) {
644
+ habit.streak++;
645
+ } else {
646
+ habit.streak = 1;
647
+ }
648
+
649
+ // Add notification for habit completion
650
+ addNotification(`Habit completed: ${habit.text}`);
651
+ }
652
+
653
+ renderHabits(habits.filter(h => {
654
+ if (h.frequency === 'daily') return true;
655
+ if (h.frequency === 'weekly' && currentDate.getDay() === 0) return true;
656
+ if (h.frequency === 'monthly' && currentDate.getDate() === 1) return true;
657
+ return false;
658
+ }));
659
+ updateStats();
660
+ }
661
+
662
+ // Add a new task
663
+ function addTask() {
664
+ const text = newTaskInput.value.trim();
665
+ if (!text) return;
666
+
667
+ const dateKey = formatDateKey(currentDate);
668
+ tasks.push({
669
+ text,
670
+ date: dateKey,
671
+ completed: false,
672
+ important: importantTask.checked,
673
+ urgent: urgentTask.checked
674
+ });
675
+
676
+ newTaskInput.value = '';
677
+ importantTask.checked = false;
678
+ urgentTask.checked = false;
679
+ taskForm.classList.add('hidden');
680
+
681
+ renderTasks(tasks.filter(task => task.date === dateKey));
682
+ updateStats();
683
+
684
+ // Add notification for new task
685
+ addNotification(`New task added: ${text}`);
686
+ }
687
+
688
+ // Add a new habit
689
+ function addHabit() {
690
+ const text = newHabitInput.value.trim();
691
+ if (!text) return;
692
+
693
+ const frequency = document.querySelector('.frequency-btn.active')?.dataset.frequency || 'daily';
694
+
695
+ habits.push({
696
+ text,
697
+ frequency,
698
+ completedDates: [],
699
+ streak: 0
700
+ });
701
+
702
+ newHabitInput.value = '';
703
+ habitForm.classList.add('hidden');
704
+
705
+ renderHabits(habits.filter(h => {
706
+ if (h.frequency === 'daily') return true;
707
+ if (h.frequency === 'weekly' && currentDate.getDay() === 0) return true;
708
+ if (h.frequency === 'monthly' && currentDate.getDate() === 1) return true;
709
+ return false;
710
+ }));
711
+ updateStats();
712
+
713
+ // Add notification for new habit
714
+ addNotification(`New habit added: ${text}`);
715
+ }
716
+
717
+ // Delete a task
718
+ function deleteTask(index) {
719
+ tasks.splice(index, 1);
720
+ const dateKey = formatDateKey(currentDate);
721
+ renderTasks(tasks.filter(task => task.date === dateKey));
722
+ updateStats();
723
+ }
724
+
725
+ // Delete a habit
726
+ function deleteHabit(index) {
727
+ habits.splice(index, 1);
728
+ renderHabits(habits.filter(h => {
729
+ if (h.frequency === 'daily') return true;
730
+ if (h.frequency === 'weekly' && currentDate.getDay() === 0) return true;
731
+ if (h.frequency === 'monthly' && currentDate.getDate() === 1) return true;
732
+ return false;
733
+ }));
734
+ updateStats();
735
+ }
736
+
737
+ // Save mood data
738
+ function saveMood(score) {
739
+ const dateKey = formatDateKey(currentDate);
740
+ const existingIndex = moods.findIndex(m => m.date === dateKey);
741
+
742
+ const moodData = {
743
+ date: dateKey,
744
+ score: parseInt(score),
745
+ notes: moodJournal.value
746
+ };
747
+
748
+ if (existingIndex >= 0) {
749
+ moods[existingIndex] = moodData;
750
+ } else {
751
+ moods.push(moodData);
752
+ }
753
+
754
+ moodNotes.classList.add('hidden');
755
+ moodScoreEl.textContent = score;
756
+
757
+ // Update mood history
758
+ moodHistoryList.innerHTML = `
759
+ <div class="flex items-center justify-between bg-gray-50 p-2 rounded">
760
+ <div class="flex items-center">
761
+ <i class="fas ${getMoodIcon(score)} text-${getMoodColor(score)}-500 mr-2"></i>
762
+ <span>${score}/5</span>
763
+ </div>
764
+ <span class="text-xs text-gray-500">Today</span>
765
+ </div>
766
+ `;
767
+
768
+ // Add notification for mood update
769
+ addNotification(`Mood recorded: ${score}/5`);
770
+ }
771
+
772
+ // Save quick notes
773
+ function saveNotes() {
774
+ notes = quickNotes.value;
775
+
776
+ // Add notification for notes saved
777
+ addNotification('Notes saved');
778
+ }
779
+
780
+ // Add notification
781
+ function addNotification(message) {
782
+ const notification = document.createElement('div');
783
+ notification.className = 'p-2 border-b border-gray-100';
784
+ notification.innerHTML = `
785
+ <p class="text-sm">${message}</p>
786
+ <p class="text-xs text-gray-500">Just now</p>
787
+ `;
788
+
789
+ notificationDropdown.insertBefore(notification, notificationDropdown.firstChild);
790
+
791
+ // Show notification count
792
+ const count = notificationDropdown.children.length - 1; // Subtract the "No notifications" message
793
+ if (count > 0) {
794
+ notificationCount.textContent = count;
795
+ notificationCount.classList.remove('hidden');
796
+
797
+ // Add pulse animation to notification button
798
+ notificationBtn.classList.add('pulse');
799
+ setTimeout(() => {
800
+ notificationBtn.classList.remove('pulse');
801
+ }, 3000);
802
+ }
803
+
804
+ // Remove "No notifications" message if present
805
+ const noNotifications = notificationDropdown.querySelector('p.text-gray-500');
806
+ if (noNotifications && count > 0) {
807
+ noNotifications.remove();
808
+ }
809
+ }
810
+
811
+ // Event Listeners
812
+ prevDayBtn.addEventListener('click', () => {
813
+ currentDate.setDate(currentDate.getDate() - 1);
814
+ updateDateDisplay();
815
+ });
816
+
817
+ nextDayBtn.addEventListener('click', () => {
818
+ currentDate.setDate(currentDate.getDate() + 1);
819
+ updateDateDisplay();
820
+ });
821
+
822
+ todayBtn.addEventListener('click', () => {
823
+ currentDate = new Date();
824
+ updateDateDisplay();
825
+ });
826
+
827
+ addTaskBtn.addEventListener('click', () => {
828
+ taskForm.classList.toggle('hidden');
829
+ if (!taskForm.classList.contains('hidden')) {
830
+ newTaskInput.focus();
831
+ }
832
+ });
833
+
834
+ saveTaskBtn.addEventListener('click', addTask);
835
+
836
+ newTaskInput.addEventListener('keypress', (e) => {
837
+ if (e.key === 'Enter') addTask();
838
+ });
839
+
840
+ addHabitBtn.addEventListener('click', () => {
841
+ habitForm.classList.toggle('hidden');
842
+ if (!habitForm.classList.contains('hidden')) {
843
+ newHabitInput.focus();
844
+ }
845
+ });
846
+
847
+ saveHabitBtn.addEventListener('click', addHabit);
848
+
849
+ newHabitInput.addEventListener('keypress', (e) => {
850
+ if (e.key === 'Enter') addHabit();
851
+ });
852
+
853
+ frequencyBtns.forEach(btn => {
854
+ btn.addEventListener('click', () => {
855
+ frequencyBtns.forEach(b => b.classList.remove('bg-indigo-600', 'text-white'));
856
+ btn.classList.add('bg-indigo-600', 'text-white');
857
+ btn.classList.add('active');
858
+ });
859
+ });
860
+
861
+ moodOptions.forEach(option => {
862
+ option.addEventListener('click', () => {
863
+ const score = option.dataset.mood;
864
+ moodNotes.classList.remove('hidden');
865
+ moodJournal.focus();
866
+
867
+ // Set up save button with this score
868
+ saveMoodBtn.onclick = () => saveMood(score);
869
+ });
870
+ });
871
+
872
+ prevMonthBtn.addEventListener('click', () => {
873
+ currentMonth--;
874
+ if (currentMonth < 0) {
875
+ currentMonth = 11;
876
+ currentYear--;
877
+ }
878
+ generateCalendar();
879
+ });
880
+
881
+ nextMonthBtn.addEventListener('click', () => {
882
+ currentMonth++;
883
+ if (currentMonth > 11) {
884
+ currentMonth = 0;
885
+ currentYear++;
886
+ }
887
+ generateCalendar();
888
+ });
889
+
890
+ saveNotesBtn.addEventListener('click', saveNotes);
891
+
892
+ notificationBtn.addEventListener('click', () => {
893
+ notificationDropdown.classList.toggle('hidden');
894
+
895
+ // Reset notification count when dropdown is opened
896
+ if (!notificationDropdown.classList.contains('hidden')) {
897
+ notificationCount.classList.add('hidden');
898
+ notificationCount.textContent = '0';
899
+ }
900
+ });
901
+
902
+ // Close dropdowns when clicking outside
903
+ document.addEventListener('click', (e) => {
904
+ if (!notificationBtn.contains(e.target) && !notificationDropdown.contains(e.target)) {
905
+ notificationDropdown.classList.add('hidden');
906
+ }
907
+ });
908
+
909
+ // Initialize the app
910
+ updateDateDisplay();
911
+
912
+ // Sample data for demo purposes
913
+ tasks = [
914
+ { text: "Complete project proposal", date: formatDateKey(new Date()), completed: false, important: true, urgent: true },
915
+ { text: "Buy groceries", date: formatDateKey(new Date()), completed: false, important: true, urgent: false },
916
+ { text: "Call mom", date: formatDateKey(new Date()), completed: true, important: false, urgent: false }
917
+ ];
918
+
919
+ habits = [
920
+ { text: "Drink 8 glasses of water", frequency: "daily", completedDates: [formatDateKey(new Date())], streak: 5 },
921
+ { text: "30-minute workout", frequency: "daily", completedDates: [], streak: 0 },
922
+ { text: "Weekly review", frequency: "weekly", completedDates: [], streak: 2 }
923
+ ];
924
+
925
+ moods = [
926
+ { date: formatDateKey(new Date()), score: 4, notes: "Had a productive day at work!" }
927
+ ];
928
+
929
+ // Render initial data
930
+ loadDayData();
931
+ </script>
932
+ <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=maylay0/x4" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
933
+ </html>