aworkimmersive commited on
Commit
53c1ca9
·
verified ·
1 Parent(s): 1cfb2d0

Add 3 files

Browse files
Files changed (3) hide show
  1. README.md +7 -5
  2. index.html +1174 -19
  3. prompts.txt +4 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Mum
3
- emoji: 🐠
4
- colorFrom: red
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: mum
3
+ emoji: 🐳
4
+ colorFrom: blue
5
+ colorTo: purple
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,1174 @@
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>Mum's Personal Diary | Enhanced</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
+ <script>
10
+ tailwind.config = {
11
+ theme: {
12
+ extend: {
13
+ colors: {
14
+ primary: {
15
+ 50: '#f0f9ff',
16
+ 100: '#e0f2fe',
17
+ 200: '#bae6fd',
18
+ 300: '#7dd3fc',
19
+ 400: '#38bdf8',
20
+ 500: '#0ea5e9',
21
+ 600: '#0284c7',
22
+ 700: '#0369a1',
23
+ 800: '#075985',
24
+ 900: '#0c4a6e',
25
+ },
26
+ secondary: {
27
+ 50: '#f5f3ff',
28
+ 100: '#ede9fe',
29
+ 200: '#ddd6fe',
30
+ 300: '#c4b5fd',
31
+ 400: '#a78bfa',
32
+ 500: '#8b5cf6',
33
+ 600: '#7c3aed',
34
+ 700: '#6d28d9',
35
+ 800: '#5b21b6',
36
+ 900: '#4c1d95',
37
+ }
38
+ }
39
+ }
40
+ }
41
+ }
42
+ </script>
43
+ <style>
44
+ @keyframes fadeIn {
45
+ from { opacity: 0; transform: translateY(10px); }
46
+ to { opacity: 1; transform: translateY(0); }
47
+ }
48
+
49
+ .fade-in {
50
+ animation: fadeIn 0.5s ease-in-out;
51
+ }
52
+
53
+ .card {
54
+ box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
55
+ }
56
+
57
+ .diary-entry {
58
+ transition: all 0.3s ease;
59
+ }
60
+
61
+ .diary-entry:hover {
62
+ transform: translateY(-2px);
63
+ box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
64
+ }
65
+
66
+ .mood-selector input[type="radio"] {
67
+ display: none;
68
+ }
69
+
70
+ .mood-selector input[type="radio"]:checked + label {
71
+ transform: scale(1.1);
72
+ border: 2px solid #0ea5e9;
73
+ }
74
+
75
+ .entry-content {
76
+ min-height: 200px;
77
+ }
78
+
79
+ /* Custom scrollbar */
80
+ ::-webkit-scrollbar {
81
+ width: 8px;
82
+ }
83
+
84
+ ::-webkit-scrollbar-track {
85
+ background: #f1f1f1;
86
+ border-radius: 10px;
87
+ }
88
+
89
+ ::-webkit-scrollbar-thumb {
90
+ background: #7dd3fc;
91
+ border-radius: 10px;
92
+ }
93
+
94
+ ::-webkit-scrollbar-thumb:hover {
95
+ background: #0ea5e9;
96
+ }
97
+ </style>
98
+ </head>
99
+ <body class="bg-gradient-to-br from-primary-50 to-secondary-50 min-h-screen p-4">
100
+ <!-- App Container -->
101
+ <div id="app-container" class="max-w-6xl mx-auto">
102
+ <!-- Sign In Section (shown by default) -->
103
+ <div id="signin-section" class="flex items-center justify-center min-h-screen">
104
+ <div class="w-full max-w-md">
105
+ <!-- Sign In Card -->
106
+ <div class="bg-white rounded-xl card p-8 fade-in">
107
+ <!-- Welcome Header -->
108
+ <div class="text-center mb-8">
109
+ <div class="w-16 h-16 bg-primary-100 rounded-full flex items-center justify-center mx-auto mb-4">
110
+ <i class="fas fa-book-open text-primary-600 text-2xl"></i>
111
+ </div>
112
+ <h1 class="text-3xl font-bold text-gray-800">Hello Mum!</h1>
113
+ <p class="text-gray-600 mt-2">Welcome to your enhanced personal diary</p>
114
+ </div>
115
+
116
+ <!-- Sign In Form -->
117
+ <form id="signin-form" class="space-y-6">
118
+ <div>
119
+ <label for="name" class="block text-sm font-medium text-gray-700 mb-1">Name</label>
120
+ <input type="text" id="name" name="name" required
121
+ class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-primary-500"
122
+ placeholder="Enter your name">
123
+ </div>
124
+
125
+ <div>
126
+ <label for="password" class="block text-sm font-medium text-gray-700 mb-1">Password</label>
127
+ <div class="relative">
128
+ <input type="password" id="password" name="password" required
129
+ class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-primary-500"
130
+ placeholder="Enter your password">
131
+ <button type="button" id="toggle-password" class="absolute right-3 top-2.5 text-gray-500 hover:text-primary-600">
132
+ <i class="fas fa-eye"></i>
133
+ </button>
134
+ </div>
135
+ </div>
136
+
137
+ <div class="flex items-center justify-between">
138
+ <div class="flex items-center">
139
+ <input id="remember-me" name="remember-me" type="checkbox"
140
+ class="h-4 w-4 text-primary-600 focus:ring-primary-500 border-gray-300 rounded">
141
+ <label for="remember-me" class="ml-2 block text-sm text-gray-700">
142
+ Remember me
143
+ </label>
144
+ </div>
145
+
146
+ <div class="text-sm">
147
+ <a href="#" class="font-medium text-primary-600 hover:text-primary-500">
148
+ Forgot password?
149
+ </a>
150
+ </div>
151
+ </div>
152
+
153
+ <div>
154
+ <button type="submit"
155
+ class="w-full flex justify-center py-3 px-4 border border-transparent rounded-lg shadow-sm text-sm font-medium text-white bg-primary-600 hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500 transition-colors duration-200">
156
+ <i class="fas fa-sign-in-alt mr-2"></i> Sign in
157
+ </button>
158
+ </div>
159
+ </form>
160
+
161
+ <!-- Success Message (Hidden by default) -->
162
+ <div id="welcome-message" class="hidden mt-6 p-4 bg-green-50 rounded-lg text-center">
163
+ <i class="fas fa-heart text-green-500 text-2xl mb-2"></i>
164
+ <p class="text-green-800 font-medium">Welcome back Mum! Hope this helps ❤️</p>
165
+ </div>
166
+ </div>
167
+
168
+ <!-- Footer -->
169
+ <div class="text-center mt-6 text-sm text-gray-500">
170
+ <p>© <span id="current-year"></span> Enhanced Personal Diary. All rights reserved.</p>
171
+ </div>
172
+ </div>
173
+ </div>
174
+
175
+ <!-- Diary Section (hidden by default) -->
176
+ <div id="diary-section" class="hidden min-h-screen">
177
+ <!-- Diary Header -->
178
+ <header class="py-6 flex flex-col md:flex-row justify-between items-start md:items-center gap-4">
179
+ <div>
180
+ <h1 class="text-3xl font-bold text-primary-600 flex items-center">
181
+ <i class="fas fa-book mr-3"></i>
182
+ <span>Mum's Enhanced Diary</span>
183
+ </h1>
184
+ <p class="text-gray-600">Your private thoughts, memories, and more</p>
185
+ </div>
186
+ <div class="flex flex-wrap gap-3">
187
+ <button id="new-entry-btn" class="px-4 py-2 bg-primary-600 text-white rounded-lg hover:bg-primary-700 flex items-center transition-colors duration-200">
188
+ <i class="fas fa-plus mr-2"></i> New Entry
189
+ </button>
190
+ <button id="backup-btn" class="px-4 py-2 bg-secondary-600 text-white rounded-lg hover:bg-secondary-700 flex items-center transition-colors duration-200">
191
+ <i class="fas fa-download mr-2"></i> Backup
192
+ </button>
193
+ <button id="restore-btn" class="px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 flex items-center transition-colors duration-200">
194
+ <i class="fas fa-upload mr-2"></i> Restore
195
+ </button>
196
+ <button id="maintenance-btn" class="px-4 py-2 bg-yellow-600 text-white rounded-lg hover:bg-yellow-700 flex items-center transition-colors duration-200">
197
+ <i class="fas fa-tools mr-2"></i> Maintenance
198
+ </button>
199
+ <button id="sign-out-btn" class="px-4 py-2 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-100 flex items-center transition-colors duration-200">
200
+ <i class="fas fa-sign-out-alt mr-2"></i> Sign Out
201
+ </button>
202
+ </div>
203
+ </header>
204
+
205
+ <!-- Stats and Current Date -->
206
+ <div class="flex flex-col md:flex-row justify-between items-start md:items-center gap-4 mb-6">
207
+ <div class="text-lg font-medium text-gray-700 flex items-center">
208
+ <i class="far fa-calendar-alt mr-2 text-primary-500"></i>
209
+ <span id="current-date"></span>
210
+ </div>
211
+
212
+ <div class="flex flex-wrap gap-4">
213
+ <div class="bg-white px-4 py-2 rounded-lg shadow-sm flex items-center">
214
+ <i class="fas fa-book-open text-primary-500 mr-2"></i>
215
+ <span class="text-sm font-medium">
216
+ <span id="total-entries">0</span> entries
217
+ </span>
218
+ </div>
219
+ <div class="bg-white px-4 py-2 rounded-lg shadow-sm flex items-center">
220
+ <i class="fas fa-star text-yellow-500 mr-2"></i>
221
+ <span class="text-sm font-medium">
222
+ <span id="favorite-entries">0</span> favorites
223
+ </span>
224
+ </div>
225
+ <div class="bg-white px-4 py-2 rounded-lg shadow-sm flex items-center">
226
+ <i class="fas fa-tag text-secondary-500 mr-2"></i>
227
+ <span class="text-sm font-medium">
228
+ <span id="total-tags">0</span> tags
229
+ </span>
230
+ </div>
231
+ </div>
232
+ </div>
233
+
234
+ <!-- Search and Filter -->
235
+ <div class="bg-white p-4 rounded-xl shadow-sm mb-6">
236
+ <div class="flex flex-col md:flex-row gap-4">
237
+ <div class="flex-1 relative">
238
+ <i class="fas fa-search absolute left-3 top-3 text-gray-400"></i>
239
+ <input type="text" id="search-entries" placeholder="Search entries..."
240
+ class="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-primary-500">
241
+ </div>
242
+ <select id="filter-tags" class="px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-primary-500">
243
+ <option value="">All Tags</option>
244
+ <!-- Tags will be added here by JavaScript -->
245
+ </select>
246
+ <select id="filter-mood" class="px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-primary-500">
247
+ <option value="">All Moods</option>
248
+ <option value="happy">Happy</option>
249
+ <option value="sad">Sad</option>
250
+ <option value="excited">Excited</option>
251
+ <option value="calm">Calm</option>
252
+ <option value="angry">Angry</option>
253
+ </select>
254
+ <button id="clear-filters" class="px-4 py-2 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-100">
255
+ <i class="fas fa-times mr-1"></i> Clear
256
+ </button>
257
+ </div>
258
+ </div>
259
+
260
+ <!-- Diary Entries Container -->
261
+ <div id="entries-container" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 mb-8">
262
+ <!-- Sample entries will be added here by JavaScript -->
263
+ </div>
264
+
265
+ <!-- New Entry Modal (hidden by default) -->
266
+ <div id="entry-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 hidden z-50">
267
+ <div class="bg-white rounded-xl w-full max-w-2xl p-6 max-h-[90vh] overflow-y-auto">
268
+ <div class="flex justify-between items-center mb-4">
269
+ <h3 class="text-xl font-bold text-gray-800" id="modal-title">New Diary Entry</h3>
270
+ <button id="close-modal-btn" class="text-gray-500 hover:text-gray-700">
271
+ <i class="fas fa-times"></i>
272
+ </button>
273
+ </div>
274
+
275
+ <form id="entry-form">
276
+ <input type="hidden" id="entry-id">
277
+ <div class="mb-4">
278
+ <label for="entry-title" class="block text-sm font-medium text-gray-700 mb-1">Title</label>
279
+ <input type="text" id="entry-title" required
280
+ class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-primary-500"
281
+ placeholder="Entry title">
282
+ </div>
283
+
284
+ <div class="mb-4">
285
+ <label class="block text-sm font-medium text-gray-700 mb-1">Mood</label>
286
+ <div class="mood-selector flex justify-between mt-2">
287
+ <input type="radio" id="mood-happy" name="mood" value="happy">
288
+ <label for="mood-happy" class="cursor-pointer p-2 rounded-full bg-yellow-100 text-yellow-600 hover:bg-yellow-200 transition-colors duration-200" title="Happy">
289
+ <i class="fas fa-smile text-2xl"></i>
290
+ </label>
291
+
292
+ <input type="radio" id="mood-sad" name="mood" value="sad">
293
+ <label for="mood-sad" class="cursor-pointer p-2 rounded-full bg-blue-100 text-blue-600 hover:bg-blue-200 transition-colors duration-200" title="Sad">
294
+ <i class="fas fa-sad-tear text-2xl"></i>
295
+ </label>
296
+
297
+ <input type="radio" id="mood-excited" name="mood" value="excited">
298
+ <label for="mood-excited" class="cursor-pointer p-2 rounded-full bg-green-100 text-green-600 hover:bg-green-200 transition-colors duration-200" title="Excited">
299
+ <i class="fas fa-grin-stars text-2xl"></i>
300
+ </label>
301
+
302
+ <input type="radio" id="mood-calm" name="mood" value="calm">
303
+ <label for="mood-calm" class="cursor-pointer p-2 rounded-full bg-purple-100 text-purple-600 hover:bg-purple-200 transition-colors duration-200" title="Calm">
304
+ <i class="fas fa-spa text-2xl"></i>
305
+ </label>
306
+
307
+ <input type="radio" id="mood-angry" name="mood" value="angry">
308
+ <label for="mood-angry" class="cursor-pointer p-2 rounded-full bg-red-100 text-red-600 hover:bg-red-200 transition-colors duration-200" title="Angry">
309
+ <i class="fas fa-angry text-2xl"></i>
310
+ </label>
311
+
312
+ <input type="radio" id="mood-neutral" name="mood" value="neutral" checked>
313
+ <label for="mood-neutral" class="cursor-pointer p-2 rounded-full bg-gray-100 text-gray-600 hover:bg-gray-200 transition-colors duration-200" title="Neutral">
314
+ <i class="fas fa-meh text-2xl"></i>
315
+ </label>
316
+ </div>
317
+ </div>
318
+
319
+ <div class="mb-4">
320
+ <label for="entry-tags" class="block text-sm font-medium text-gray-700 mb-1">Tags (comma separated)</label>
321
+ <input type="text" id="entry-tags"
322
+ class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-primary-500"
323
+ placeholder="family, gardening, travel">
324
+ </div>
325
+
326
+ <div class="mb-4">
327
+ <label for="entry-content" class="block text-sm font-medium text-gray-700 mb-1">Content</label>
328
+ <textarea id="entry-content" rows="8" required
329
+ class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-primary-500 entry-content"
330
+ placeholder="Write your thoughts here..."></textarea>
331
+ </div>
332
+
333
+ <div class="flex items-center mb-4">
334
+ <input type="checkbox" id="entry-favorite" class="h-4 w-4 text-primary-600 focus:ring-primary-500 border-gray-300 rounded">
335
+ <label for="entry-favorite" class="ml-2 block text-sm text-gray-700">
336
+ Mark as favorite
337
+ </label>
338
+ </div>
339
+
340
+ <div class="flex justify-end space-x-3">
341
+ <button type="button" id="cancel-entry-btn" class="px-4 py-2 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-100 transition-colors duration-200">
342
+ Cancel
343
+ </button>
344
+ <button type="submit" class="px-4 py-2 bg-primary-600 text-white rounded-lg hover:bg-primary-700 transition-colors duration-200">
345
+ Save Entry
346
+ </button>
347
+ </div>
348
+ </form>
349
+ </div>
350
+ </div>
351
+
352
+ <!-- Maintenance Modal (hidden by default) -->
353
+ <div id="maintenance-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 hidden z-50">
354
+ <div class="bg-white rounded-xl w-full max-w-md p-6">
355
+ <div class="flex justify-between items-center mb-4">
356
+ <h3 class="text-xl font-bold text-gray-800">Diary Maintenance</h3>
357
+ <button id="close-maintenance-btn" class="text-gray-500 hover:text-gray-700">
358
+ <i class="fas fa-times"></i>
359
+ </button>
360
+ </div>
361
+
362
+ <div class="space-y-4">
363
+ <div class="p-4 border border-gray-200 rounded-lg">
364
+ <h4 class="font-medium text-gray-800 mb-2">Export & Import</h4>
365
+ <div class="flex flex-wrap gap-2">
366
+ <button id="export-json" class="px-3 py-1.5 bg-blue-100 text-blue-700 rounded hover:bg-blue-200 text-sm">
367
+ <i class="fas fa-file-export mr-1"></i> Export JSON
368
+ </button>
369
+ <button id="import-json" class="px-3 py-1.5 bg-green-100 text-green-700 rounded hover:bg-green-200 text-sm">
370
+ <i class="fas fa-file-import mr-1"></i> Import JSON
371
+ </button>
372
+ <button id="export-csv" class="px-3 py-1.5 bg-purple-100 text-purple-700 rounded hover:bg-purple-200 text-sm">
373
+ <i class="fas fa-file-csv mr-1"></i> Export CSV
374
+ </button>
375
+ </div>
376
+ </div>
377
+
378
+ <div class="p-4 border border-gray-200 rounded-lg">
379
+ <h4 class="font-medium text-gray-800 mb-2">Data Management</h4>
380
+ <div class="flex flex-wrap gap-2">
381
+ <button id="clear-data" class="px-3 py-1.5 bg-red-100 text-red-700 rounded hover:bg-red-200 text-sm">
382
+ <i class="fas fa-trash mr-1"></i> Clear All Data
383
+ </button>
384
+ <button id="reset-demo" class="px-3 py-1.5 bg-yellow-100 text-yellow-700 rounded hover:bg-yellow-200 text-sm">
385
+ <i class="fas fa-redo mr-1"></i> Reset Demo Data
386
+ </button>
387
+ </div>
388
+ </div>
389
+
390
+ <div class="p-4 border border-gray-200 rounded-lg">
391
+ <h4 class="font-medium text-gray-800 mb-2">Statistics</h4>
392
+ <div class="grid grid-cols-2 gap-2 text-sm">
393
+ <div class="bg-gray-50 p-2 rounded">
394
+ <div class="text-gray-500">Total Entries</div>
395
+ <div class="font-medium" id="stats-total">0</div>
396
+ </div>
397
+ <div class="bg-gray-50 p-2 rounded">
398
+ <div class="text-gray-500">Favorites</div>
399
+ <div class="font-medium" id="stats-favorites">0</div>
400
+ </div>
401
+ <div class="bg-gray-50 p-2 rounded">
402
+ <div class="text-gray-500">Tags</div>
403
+ <div class="font-medium" id="stats-tags">0</div>
404
+ </div>
405
+ <div class="bg-gray-50 p-2 rounded">
406
+ <div class="text-gray-500">Oldest Entry</div>
407
+ <div class="font-medium" id="stats-oldest">-</div>
408
+ </div>
409
+ </div>
410
+ </div>
411
+ </div>
412
+ </div>
413
+ </div>
414
+
415
+ <!-- Backup/Restore Modal (hidden by default) -->
416
+ <div id="backup-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 hidden z-50">
417
+ <div class="bg-white rounded-xl w-full max-w-md p-6">
418
+ <div class="flex justify-between items-center mb-4">
419
+ <h3 class="text-xl font-bold text-gray-800" id="backup-modal-title">Backup Data</h3>
420
+ <button id="close-backup-btn" class="text-gray-500 hover:text-gray-700">
421
+ <i class="fas fa-times"></i>
422
+ </button>
423
+ </div>
424
+
425
+ <div id="backup-content" class="space-y-4">
426
+ <div class="p-4 bg-blue-50 rounded-lg">
427
+ <h4 class="font-medium text-blue-800 mb-2">Create Backup</h4>
428
+ <p class="text-sm text-blue-600 mb-3">Save all your diary entries to a file</p>
429
+ <button id="create-backup" class="w-full px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700">
430
+ <i class="fas fa-download mr-2"></i> Download Backup
431
+ </button>
432
+ </div>
433
+
434
+ <div class="p-4 bg-green-50 rounded-lg">
435
+ <h4 class="font-medium text-green-800 mb-2">Restore Backup</h4>
436
+ <p class="text-sm text-green-600 mb-3">Upload a previously saved backup file</p>
437
+ <input type="file" id="restore-file" class="hidden" accept=".json">
438
+ <label for="restore-file" class="w-full px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 flex items-center justify-center cursor-pointer">
439
+ <i class="fas fa-upload mr-2"></i> Choose Backup File
440
+ </label>
441
+ <div id="restore-filename" class="text-sm text-gray-500 mt-2 text-center hidden"></div>
442
+ </div>
443
+ </div>
444
+ </div>
445
+ </div>
446
+ </div>
447
+ </div>
448
+
449
+ <script>
450
+ // Set current year
451
+ document.getElementById('current-year').textContent = new Date().getFullYear();
452
+
453
+ // Format current date
454
+ const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
455
+ document.getElementById('current-date').textContent = new Date().toLocaleDateString('en-US', options);
456
+
457
+ // Sample diary entries data with enhanced features
458
+ let entries = [
459
+ {
460
+ id: 1,
461
+ title: "Family Dinner",
462
+ content: "Had a wonderful dinner with the family today. Everyone was in such good spirits and the food was delicious! We talked about our upcoming vacation plans and shared funny stories from when the kids were little.",
463
+ date: "May 15, 2023",
464
+ mood: "happy",
465
+ tags: ["family", "dinner", "memories"],
466
+ favorite: true
467
+ },
468
+ {
469
+ id: 2,
470
+ title: "Garden Update",
471
+ content: "Planted new roses in the garden today. The weather was perfect for gardening - not too hot with a gentle breeze. I chose a mix of hybrid tea roses and floribundas. Can't wait to see them bloom in a few weeks! Also planted some lavender near the patio for that lovely scent in the evenings.",
472
+ date: "May 10, 2023",
473
+ mood: "calm",
474
+ tags: ["gardening", "outdoors", "hobbies"],
475
+ favorite: false
476
+ },
477
+ {
478
+ id: 3,
479
+ title: "Weekend Plans",
480
+ content: "Planning a small getaway for the weekend. Thinking about visiting the coast for some fresh sea air. Found a cute little bed and breakfast that looks perfect - right on the cliffs with amazing ocean views. Need to pack warm clothes though as it can get breezy by the water.",
481
+ date: "May 5, 2023",
482
+ mood: "excited",
483
+ tags: ["travel", "weekend", "plans"],
484
+ favorite: true
485
+ }
486
+ ];
487
+
488
+ // DOM Elements
489
+ const signinSection = document.getElementById('signin-section');
490
+ const diarySection = document.getElementById('diary-section');
491
+ const entriesContainer = document.getElementById('entries-container');
492
+ const entryModal = document.getElementById('entry-modal');
493
+ const entryForm = document.getElementById('entry-form');
494
+ const newEntryBtn = document.getElementById('new-entry-btn');
495
+ const closeModalBtn = document.getElementById('close-modal-btn');
496
+ const cancelEntryBtn = document.getElementById('cancel-entry-btn');
497
+ const signOutBtn = document.getElementById('sign-out-btn');
498
+ const maintenanceBtn = document.getElementById('maintenance-btn');
499
+ const maintenanceModal = document.getElementById('maintenance-modal');
500
+ const closeMaintenanceBtn = document.getElementById('close-maintenance-btn');
501
+ const backupBtn = document.getElementById('backup-btn');
502
+ const restoreBtn = document.getElementById('restore-btn');
503
+ const backupModal = document.getElementById('backup-modal');
504
+ const closeBackupBtn = document.getElementById('close-backup-btn');
505
+ const searchInput = document.getElementById('search-entries');
506
+ const filterTags = document.getElementById('filter-tags');
507
+ const filterMood = document.getElementById('filter-mood');
508
+ const clearFilters = document.getElementById('clear-filters');
509
+
510
+ // Toggle password visibility
511
+ document.getElementById('toggle-password').addEventListener('click', function() {
512
+ const passwordInput = document.getElementById('password');
513
+ const icon = this.querySelector('i');
514
+
515
+ if (passwordInput.type === 'password') {
516
+ passwordInput.type = 'text';
517
+ icon.classList.replace('fa-eye', 'fa-eye-slash');
518
+ } else {
519
+ passwordInput.type = 'password';
520
+ icon.classList.replace('fa-eye-slash', 'fa-eye');
521
+ }
522
+ });
523
+
524
+ // Handle form submission
525
+ document.getElementById('signin-form').addEventListener('submit', function(e) {
526
+ e.preventDefault();
527
+
528
+ const name = document.getElementById('name').value.trim();
529
+ const password = document.getElementById('password').value;
530
+
531
+ // Check credentials (Name: Mum, Password: Reardon)
532
+ if (name === 'Mum' && password === 'Reardon') {
533
+ // Show welcome message
534
+ document.getElementById('welcome-message').classList.remove('hidden');
535
+
536
+ // Hide form
537
+ document.getElementById('signin-form').classList.add('hidden');
538
+
539
+ // After 1.5 seconds, show diary section
540
+ setTimeout(() => {
541
+ signinSection.classList.add('hidden');
542
+ diarySection.classList.remove('hidden');
543
+ renderEntries();
544
+ updateStats();
545
+ }, 1500);
546
+ } else {
547
+ alert('Incorrect name or password. Please try again.');
548
+ }
549
+ });
550
+
551
+ // Render diary entries with enhanced features
552
+ function renderEntries(filteredEntries = null) {
553
+ const entriesToRender = filteredEntries || entries;
554
+ entriesContainer.innerHTML = '';
555
+
556
+ if (entriesToRender.length === 0) {
557
+ entriesContainer.innerHTML = `
558
+ <div class="col-span-full text-center py-12">
559
+ <i class="fas fa-book-open text-gray-300 text-5xl mb-4"></i>
560
+ <p class="text-gray-500">No entries found. Click "New Entry" to get started!</p>
561
+ </div>
562
+ `;
563
+ updateStats();
564
+ return;
565
+ }
566
+
567
+ entriesToRender.forEach(entry => {
568
+ const moodIcons = {
569
+ happy: 'fa-smile text-yellow-500',
570
+ sad: 'fa-sad-tear text-blue-500',
571
+ excited: 'fa-grin-stars text-green-500',
572
+ calm: 'fa-spa text-purple-500',
573
+ angry: 'fa-angry text-red-500',
574
+ neutral: 'fa-meh text-gray-500'
575
+ };
576
+
577
+ const moodIcon = moodIcons[entry.mood] || moodIcons['neutral'];
578
+
579
+ const entryElement = document.createElement('div');
580
+ entryElement.className = `bg-white rounded-xl p-6 diary-entry cursor-pointer ${entry.favorite ? 'border-l-4 border-yellow-400' : ''}`;
581
+ entryElement.innerHTML = `
582
+ <div class="flex justify-between items-start mb-2">
583
+ <h3 class="text-xl font-bold text-primary-600">${entry.title}</h3>
584
+ ${entry.favorite ? '<i class="fas fa-star text-yellow-400"></i>' : ''}
585
+ </div>
586
+ <div class="flex items-center text-sm text-gray-500 mb-3">
587
+ <i class="far fa-calendar-alt mr-1"></i>
588
+ <span class="mr-3">${entry.date}</span>
589
+ <i class="fas ${moodIcon} mr-1"></i>
590
+ <span class="capitalize">${entry.mood}</span>
591
+ </div>
592
+ <p class="text-gray-700 mb-4 line-clamp-3">${entry.content}</p>
593
+ <div class="flex flex-wrap gap-1 mb-4">
594
+ ${entry.tags ? entry.tags.map(tag => `
595
+ <span class="px-2 py-1 bg-secondary-100 text-secondary-700 text-xs rounded-full">${tag}</span>
596
+ `).join('') : ''}
597
+ </div>
598
+ <div class="flex justify-between items-center text-sm">
599
+ <button class="text-primary-600 hover:text-primary-800 edit-entry" data-id="${entry.id}">
600
+ <i class="fas fa-edit mr-1"></i> Edit
601
+ </button>
602
+ <button class="text-red-600 hover:text-red-800 delete-entry" data-id="${entry.id}">
603
+ <i class="fas fa-trash-alt mr-1"></i> Delete
604
+ </button>
605
+ </div>
606
+ `;
607
+ entriesContainer.appendChild(entryElement);
608
+
609
+ // Add click event to view full entry
610
+ entryElement.addEventListener('click', (e) => {
611
+ if (!e.target.closest('button')) {
612
+ viewEntry(entry.id);
613
+ }
614
+ });
615
+ });
616
+
617
+ // Update tag filter options
618
+ updateTagFilter();
619
+
620
+ // Update stats
621
+ updateStats();
622
+
623
+ // Add event listeners to edit and delete buttons
624
+ document.querySelectorAll('.edit-entry').forEach(btn => {
625
+ btn.addEventListener('click', (e) => {
626
+ e.stopPropagation();
627
+ editEntry(parseInt(e.target.dataset.id || e.target.closest('button').dataset.id));
628
+ });
629
+ });
630
+
631
+ document.querySelectorAll('.delete-entry').forEach(btn => {
632
+ btn.addEventListener('click', (e) => {
633
+ e.stopPropagation();
634
+ deleteEntry(parseInt(e.target.dataset.id || e.target.closest('button').dataset.id));
635
+ });
636
+ });
637
+ }
638
+
639
+ // Update tag filter dropdown
640
+ function updateTagFilter() {
641
+ filterTags.innerHTML = '<option value="">All Tags</option>';
642
+
643
+ // Get all unique tags
644
+ const allTags = new Set();
645
+ entries.forEach(entry => {
646
+ if (entry.tags) {
647
+ entry.tags.forEach(tag => allTags.add(tag));
648
+ }
649
+ });
650
+
651
+ // Add tags to filter
652
+ Array.from(allTags).sort().forEach(tag => {
653
+ const option = document.createElement('option');
654
+ option.value = tag;
655
+ option.textContent = tag;
656
+ filterTags.appendChild(option);
657
+ });
658
+ }
659
+
660
+ // Update statistics
661
+ function updateStats() {
662
+ document.getElementById('total-entries').textContent = entries.length;
663
+
664
+ // Count favorites
665
+ const favoriteCount = entries.filter(e => e.favorite).length;
666
+ document.getElementById('favorite-entries').textContent = favoriteCount;
667
+
668
+ // Count unique tags
669
+ const allTags = new Set();
670
+ entries.forEach(entry => {
671
+ if (entry.tags) {
672
+ entry.tags.forEach(tag => allTags.add(tag));
673
+ }
674
+ });
675
+ document.getElementById('total-tags').textContent = allTags.size;
676
+
677
+ // Update maintenance stats
678
+ document.getElementById('stats-total').textContent = entries.length;
679
+ document.getElementById('stats-favorites').textContent = favoriteCount;
680
+ document.getElementById('stats-tags').textContent = allTags.size;
681
+
682
+ // Find oldest entry
683
+ if (entries.length > 0) {
684
+ const oldestEntry = entries.reduce((oldest, current) => {
685
+ return new Date(oldest.date) < new Date(current.date) ? oldest : current;
686
+ });
687
+ document.getElementById('stats-oldest').textContent = oldestEntry.date;
688
+ } else {
689
+ document.getElementById('stats-oldest').textContent = '-';
690
+ }
691
+ }
692
+
693
+ // View full entry
694
+ function viewEntry(id) {
695
+ const entry = entries.find(e => e.id === id);
696
+ if (entry) {
697
+ document.getElementById('modal-title').textContent = entry.title;
698
+ document.getElementById('entry-title').value = entry.title;
699
+ document.getElementById('entry-content').value = entry.content;
700
+ document.getElementById('entry-id').value = entry.id;
701
+ document.getElementById('entry-tags').value = entry.tags ? entry.tags.join(', ') : '';
702
+
703
+ // Set mood
704
+ if (entry.mood) {
705
+ document.getElementById(`mood-${entry.mood}`).checked = true;
706
+ } else {
707
+ document.getElementById('mood-neutral').checked = true;
708
+ }
709
+
710
+ // Set favorite
711
+ document.getElementById('entry-favorite').checked = entry.favorite || false;
712
+
713
+ // Disable form fields for viewing
714
+ document.getElementById('entry-title').readOnly = true;
715
+ document.getElementById('entry-content').readOnly = true;
716
+ document.getElementById('entry-tags').readOnly = true;
717
+ document.getElementById('entry-favorite').disabled = true;
718
+ document.querySelectorAll('.mood-selector input').forEach(radio => {
719
+ radio.disabled = true;
720
+ });
721
+ document.getElementById('entry-form').querySelector('button[type="submit"]').classList.add('hidden');
722
+ document.getElementById('cancel-entry-btn').textContent = 'Close';
723
+
724
+ entryModal.classList.remove('hidden');
725
+ }
726
+ }
727
+
728
+ // Edit entry
729
+ function editEntry(id) {
730
+ const entry = entries.find(e => e.id === id);
731
+ if (entry) {
732
+ document.getElementById('modal-title').textContent = 'Edit Entry';
733
+ document.getElementById('entry-title').value = entry.title;
734
+ document.getElementById('entry-content').value = entry.content;
735
+ document.getElementById('entry-id').value = entry.id;
736
+ document.getElementById('entry-tags').value = entry.tags ? entry.tags.join(', ') : '';
737
+
738
+ // Set mood
739
+ if (entry.mood) {
740
+ document.getElementById(`mood-${entry.mood}`).checked = true;
741
+ } else {
742
+ document.getElementById('mood-neutral').checked = true;
743
+ }
744
+
745
+ // Set favorite
746
+ document.getElementById('entry-favorite').checked = entry.favorite || false;
747
+
748
+ // Enable form fields for editing
749
+ document.getElementById('entry-title').readOnly = false;
750
+ document.getElementById('entry-content').readOnly = false;
751
+ document.getElementById('entry-tags').readOnly = false;
752
+ document.getElementById('entry-favorite').disabled = false;
753
+ document.querySelectorAll('.mood-selector input').forEach(radio => {
754
+ radio.disabled = false;
755
+ });
756
+ document.getElementById('entry-form').querySelector('button[type="submit"]').classList.remove('hidden');
757
+ document.getElementById('cancel-entry-btn').textContent = 'Cancel';
758
+
759
+ entryModal.classList.remove('hidden');
760
+ }
761
+ }
762
+
763
+ // Delete entry
764
+ function deleteEntry(id) {
765
+ if (confirm('Are you sure you want to delete this entry?')) {
766
+ entries = entries.filter(e => e.id !== id);
767
+ renderEntries();
768
+ }
769
+ }
770
+
771
+ // New entry
772
+ newEntryBtn.addEventListener('click', () => {
773
+ document.getElementById('modal-title').textContent = 'New Diary Entry';
774
+ document.getElementById('entry-title').value = '';
775
+ document.getElementById('entry-content').value = '';
776
+ document.getElementById('entry-tags').value = '';
777
+ document.getElementById('entry-id').value = '';
778
+ document.getElementById('mood-neutral').checked = true;
779
+ document.getElementById('entry-favorite').checked = false;
780
+
781
+ // Enable form fields
782
+ document.getElementById('entry-title').readOnly = false;
783
+ document.getElementById('entry-content').readOnly = false;
784
+ document.getElementById('entry-tags').readOnly = false;
785
+ document.getElementById('entry-favorite').disabled = false;
786
+ document.querySelectorAll('.mood-selector input').forEach(radio => {
787
+ radio.disabled = false;
788
+ });
789
+ document.getElementById('entry-form').querySelector('button[type="submit"]').classList.remove('hidden');
790
+ document.getElementById('cancel-entry-btn').textContent = 'Cancel';
791
+
792
+ entryModal.classList.remove('hidden');
793
+ });
794
+
795
+ // Close modal
796
+ function closeModal() {
797
+ entryModal.classList.add('hidden');
798
+ }
799
+
800
+ closeModalBtn.addEventListener('click', closeModal);
801
+ cancelEntryBtn.addEventListener('click', closeModal);
802
+
803
+ // Handle entry form submission
804
+ entryForm.addEventListener('submit', (e) => {
805
+ e.preventDefault();
806
+
807
+ const id = document.getElementById('entry-id').value;
808
+ const title = document.getElementById('entry-title').value.trim();
809
+ const content = document.getElementById('entry-content').value.trim();
810
+ const tags = document.getElementById('entry-tags').value.trim();
811
+ const mood = document.querySelector('input[name="mood"]:checked').value;
812
+ const favorite = document.getElementById('entry-favorite').checked;
813
+ const date = new Date().toLocaleDateString('en-US', options);
814
+
815
+ const tagArray = tags ? tags.split(',').map(tag => tag.trim()).filter(tag => tag) : [];
816
+
817
+ if (id) {
818
+ // Update existing entry
819
+ const index = entries.findIndex(e => e.id === parseInt(id));
820
+ if (index !== -1) {
821
+ entries[index] = {
822
+ ...entries[index],
823
+ title,
824
+ content,
825
+ tags: tagArray,
826
+ mood,
827
+ favorite,
828
+ date
829
+ };
830
+ }
831
+ } else {
832
+ // Create new entry
833
+ const newId = entries.length > 0 ? Math.max(...entries.map(e => e.id)) + 1 : 1;
834
+ entries.unshift({
835
+ id: newId,
836
+ title,
837
+ content,
838
+ tags: tagArray,
839
+ mood,
840
+ favorite,
841
+ date
842
+ });
843
+ }
844
+
845
+ renderEntries();
846
+ closeModal();
847
+ });
848
+
849
+ // Sign out
850
+ signOutBtn.addEventListener('click', () => {
851
+ if (confirm('Are you sure you want to sign out?')) {
852
+ diarySection.classList.add('hidden');
853
+ signinSection.classList.remove('hidden');
854
+ document.getElementById('signin-form').classList.remove('hidden');
855
+ document.getElementById('welcome-message').classList.add('hidden');
856
+ document.getElementById('name').value = '';
857
+ document.getElementById('password').value = '';
858
+ }
859
+ });
860
+
861
+ // Open maintenance modal
862
+ maintenanceBtn.addEventListener('click', () => {
863
+ maintenanceModal.classList.remove('hidden');
864
+ });
865
+
866
+ // Close maintenance modal
867
+ closeMaintenanceBtn.addEventListener('click', () => {
868
+ maintenanceModal.classList.add('hidden');
869
+ });
870
+
871
+ // Open backup modal
872
+ backupBtn.addEventListener('click', () => {
873
+ document.getElementById('backup-modal-title').textContent = 'Backup Data';
874
+ backupModal.classList.remove('hidden');
875
+ });
876
+
877
+ // Open restore modal
878
+ restoreBtn.addEventListener('click', () => {
879
+ document.getElementById('backup-modal-title').textContent = 'Restore Data';
880
+ backupModal.classList.remove('hidden');
881
+ });
882
+
883
+ // Close backup modal
884
+ closeBackupBtn.addEventListener('click', () => {
885
+ backupModal.classList.add('hidden');
886
+ document.getElementById('restore-filename').classList.add('hidden');
887
+ });
888
+
889
+ // Create backup (export JSON)
890
+ document.getElementById('create-backup').addEventListener('click', () => {
891
+ const dataStr = JSON.stringify(entries, null, 2);
892
+ const dataUri = 'data:application/json;charset=utf-8,'+ encodeURIComponent(dataStr);
893
+
894
+ const exportFileDefaultName = `mum-diary-backup-${new Date().toISOString().split('T')[0]}.json`;
895
+
896
+ const linkElement = document.createElement('a');
897
+ linkElement.setAttribute('href', dataUri);
898
+ linkElement.setAttribute('download', exportFileDefaultName);
899
+ linkElement.click();
900
+ });
901
+
902
+ // Handle restore file selection
903
+ document.getElementById('restore-file').addEventListener('change', function(e) {
904
+ const file = e.target.files[0];
905
+ if (!file) return;
906
+
907
+ document.getElementById('restore-filename').textContent = `Selected: ${file.name}`;
908
+ document.getElementById('restore-filename').classList.remove('hidden');
909
+
910
+ const reader = new FileReader();
911
+ reader.onload = function(e) {
912
+ try {
913
+ const jsonData = JSON.parse(e.target.result);
914
+ if (Array.isArray(jsonData)) {
915
+ if (confirm('This will replace all current entries. Are you sure?')) {
916
+ entries = jsonData;
917
+ renderEntries();
918
+ backupModal.classList.add('hidden');
919
+ document.getElementById('restore-filename').classList.add('hidden');
920
+
921
+ // Show success message
922
+ const successMsg = document.createElement('div');
923
+ successMsg.className = 'fixed top-4 right-4 bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded z-50';
924
+ successMsg.innerHTML = `
925
+ <div class="flex items-center">
926
+ <i class="fas fa-check-circle mr-2"></i>
927
+ <span>Successfully restored ${jsonData.length} entries!</span>
928
+ </div>
929
+ `;
930
+ document.body.appendChild(successMsg);
931
+
932
+ setTimeout(() => {
933
+ successMsg.remove();
934
+ }, 3000);
935
+ }
936
+ } else {
937
+ alert('Invalid backup file format. The file should contain an array of diary entries.');
938
+ }
939
+ } catch (error) {
940
+ alert('Error reading backup file: ' + error.message);
941
+ }
942
+ };
943
+ reader.readAsText(file);
944
+ });
945
+
946
+ // Export JSON from maintenance
947
+ document.getElementById('export-json').addEventListener('click', function() {
948
+ const dataStr = JSON.stringify(entries, null, 2);
949
+ const dataUri = 'data:application/json;charset=utf-8,'+ encodeURIComponent(dataStr);
950
+
951
+ const exportFileDefaultName = `mum-diary-export-${new Date().toISOString().split('T')[0]}.json`;
952
+
953
+ const linkElement = document.createElement('a');
954
+ linkElement.setAttribute('href', dataUri);
955
+ linkElement.setAttribute('download', exportFileDefaultName);
956
+ linkElement.click();
957
+ });
958
+
959
+ // Import JSON from maintenance
960
+ document.getElementById('import-json').addEventListener('click', function() {
961
+ const input = document.createElement('input');
962
+ input.type = 'file';
963
+ input.accept = '.json';
964
+
965
+ input.onchange = e => {
966
+ const file = e.target.files[0];
967
+ if (!file) return;
968
+
969
+ const reader = new FileReader();
970
+ reader.onload = function(e) {
971
+ try {
972
+ const jsonData = JSON.parse(e.target.result);
973
+ if (Array.isArray(jsonData)) {
974
+ if (confirm('This will replace all current entries. Are you sure?')) {
975
+ entries = jsonData;
976
+ renderEntries();
977
+ maintenanceModal.classList.add('hidden');
978
+
979
+ // Show success message
980
+ const successMsg = document.createElement('div');
981
+ successMsg.className = 'fixed top-4 right-4 bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded z-50';
982
+ successMsg.innerHTML = `
983
+ <div class="flex items-center">
984
+ <i class="fas fa-check-circle mr-2"></i>
985
+ <span>Successfully imported ${jsonData.length} entries!</span>
986
+ </div>
987
+ `;
988
+ document.body.appendChild(successMsg);
989
+
990
+ setTimeout(() => {
991
+ successMsg.remove();
992
+ }, 3000);
993
+ }
994
+ } else {
995
+ alert('Invalid import file format. The file should contain an array of diary entries.');
996
+ }
997
+ } catch (error) {
998
+ alert('Error reading import file: ' + error.message);
999
+ }
1000
+ };
1001
+ reader.readAsText(file);
1002
+ };
1003
+
1004
+ input.click();
1005
+ });
1006
+
1007
+ // Export CSV from maintenance
1008
+ document.getElementById('export-csv').addEventListener('click', function() {
1009
+ let csvContent = "data:text/csv;charset=utf-8,";
1010
+
1011
+ // Add headers
1012
+ csvContent += "ID,Title,Content,Date,Mood,Tags,Favorite\n";
1013
+
1014
+ // Add data
1015
+ entries.forEach(entry => {
1016
+ const row = [
1017
+ entry.id,
1018
+ `"${entry.title.replace(/"/g, '""')}"`,
1019
+ `"${entry.content.replace(/"/g, '""')}"`,
1020
+ entry.date,
1021
+ entry.mood || '',
1022
+ entry.tags ? entry.tags.join(';') : '',
1023
+ entry.favorite ? 'Yes' : 'No'
1024
+ ];
1025
+ csvContent += row.join(",") + "\n";
1026
+ });
1027
+
1028
+ const encodedUri = encodeURI(csvContent);
1029
+ const link = document.createElement("a");
1030
+ link.setAttribute("href", encodedUri);
1031
+ link.setAttribute("download", `mum-diary-export-${new Date().toISOString().split('T')[0]}.csv`);
1032
+ document.body.appendChild(link);
1033
+ link.click();
1034
+ document.body.removeChild(link);
1035
+ });
1036
+
1037
+ // Clear all data
1038
+ document.getElementById('clear-data').addEventListener('click', function() {
1039
+ if (confirm('This will permanently delete ALL entries. Are you absolutely sure?')) {
1040
+ entries = [];
1041
+ renderEntries();
1042
+ maintenanceModal.classList.add('hidden');
1043
+
1044
+ // Show success message
1045
+ const successMsg = document.createElement('div');
1046
+ successMsg.className = 'fixed top-4 right-4 bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded z-50';
1047
+ successMsg.innerHTML = `
1048
+ <div class="flex items-center">
1049
+ <i class="fas fa-check-circle mr-2"></i>
1050
+ <span>All entries have been cleared!</span>
1051
+ </div>
1052
+ `;
1053
+ document.body.appendChild(successMsg);
1054
+
1055
+ setTimeout(() => {
1056
+ successMsg.remove();
1057
+ }, 3000);
1058
+ }
1059
+ });
1060
+
1061
+ // Reset demo data
1062
+ document.getElementById('reset-demo').addEventListener('click', function() {
1063
+ if (confirm('This will replace all current entries with demo data. Continue?')) {
1064
+ entries = [
1065
+ {
1066
+ id: 1,
1067
+ title: "Family Dinner",
1068
+ content: "Had a wonderful dinner with the family today. Everyone was in such good spirits and the food was delicious! We talked about our upcoming vacation plans and shared funny stories from when the kids were little.",
1069
+ date: "May 15, 2023",
1070
+ mood: "happy",
1071
+ tags: ["family", "dinner", "memories"],
1072
+ favorite: true
1073
+ },
1074
+ {
1075
+ id: 2,
1076
+ title: "Garden Update",
1077
+ content: "Planted new roses in the garden today. The weather was perfect for gardening - not too hot with a gentle breeze. I chose a mix of hybrid tea roses and floribundas. Can't wait to see them bloom in a few weeks! Also planted some lavender near the patio for that lovely scent in the evenings.",
1078
+ date: "May 10, 2023",
1079
+ mood: "calm",
1080
+ tags: ["gardening", "outdoors", "hobbies"],
1081
+ favorite: false
1082
+ },
1083
+ {
1084
+ id: 3,
1085
+ title: "Weekend Plans",
1086
+ content: "Planning a small getaway for the weekend. Thinking about visiting the coast for some fresh sea air. Found a cute little bed and breakfast that looks perfect - right on the cliffs with amazing ocean views. Need to pack warm clothes though as it can get breezy by the water.",
1087
+ date: "May 5, 2023",
1088
+ mood: "excited",
1089
+ tags: ["travel", "weekend", "plans"],
1090
+ favorite: true
1091
+ }
1092
+ ];
1093
+ renderEntries();
1094
+ maintenanceModal.classList.add('hidden');
1095
+
1096
+ // Show success message
1097
+ const successMsg = document.createElement('div');
1098
+ successMsg.className = 'fixed top-4 right-4 bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded z-50';
1099
+ successMsg.innerHTML = `
1100
+ <div class="flex items-center">
1101
+ <i class="fas fa-check-circle mr-2"></i>
1102
+ <span>Demo data has been reset!</span>
1103
+ </div>
1104
+ `;
1105
+ document.body.appendChild(successMsg);
1106
+
1107
+ setTimeout(() => {
1108
+ successMsg.remove();
1109
+ }, 3000);
1110
+ }
1111
+ });
1112
+
1113
+ // Search functionality
1114
+ searchInput.addEventListener('input', function() {
1115
+ const searchTerm = this.value.toLowerCase();
1116
+
1117
+ if (searchTerm.trim() === '') {
1118
+ renderEntries();
1119
+ return;
1120
+ }
1121
+
1122
+ const filteredEntries = entries.filter(entry => {
1123
+ return (
1124
+ entry.title.toLowerCase().includes(searchTerm) ||
1125
+ entry.content.toLowerCase().includes(searchTerm) ||
1126
+ (entry.tags && entry.tags.some(tag => tag.toLowerCase().includes(searchTerm)))
1127
+ );
1128
+ });
1129
+
1130
+ renderEntries(filteredEntries);
1131
+ });
1132
+
1133
+ // Filter by tag
1134
+ filterTags.addEventListener('change', function() {
1135
+ const selectedTag = this.value;
1136
+
1137
+ if (!selectedTag) {
1138
+ renderEntries();
1139
+ return;
1140
+ }
1141
+
1142
+ const filteredEntries = entries.filter(entry => {
1143
+ return entry.tags && entry.tags.includes(selectedTag);
1144
+ });
1145
+
1146
+ renderEntries(filteredEntries);
1147
+ });
1148
+
1149
+ // Filter by mood
1150
+ filterMood.addEventListener('change', function() {
1151
+ const selectedMood = this.value;
1152
+
1153
+ if (!selectedMood) {
1154
+ renderEntries();
1155
+ return;
1156
+ }
1157
+
1158
+ const filteredEntries = entries.filter(entry => {
1159
+ return entry.mood === selectedMood;
1160
+ });
1161
+
1162
+ renderEntries(filteredEntries);
1163
+ });
1164
+
1165
+ // Clear all filters
1166
+ clearFilters.addEventListener('click', function() {
1167
+ searchInput.value = '';
1168
+ filterTags.value = '';
1169
+ filterMood.value = '';
1170
+ renderEntries();
1171
+ });
1172
+ </script>
1173
+ <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=aworkimmersive/mum" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
1174
+ </html>
prompts.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ Add tailwind design and shadCN to this code, improve where possible and use best practice ' <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Personal Diary Application</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> .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); } } .pulse { animation: pulse 2s infinite; } @keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } } .entry-card { transition: all 0.3s ease; } .entry-card:hover { transform: translateY(-3px); box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1); } /* Custom scrollbar */ .custom-scrollbar::-webkit-scrollbar { width: 6px; } .custom-scrollbar::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 10px; } .custom-scrollbar::-webkit-scrollbar-thumb { background: #888; border-radius: 10px; } .custom-scrollbar::-webkit-scrollbar-thumb:hover { background: #555; } </style> </head> <body class="bg-gradient-to-br from-blue-50 to-purple-50 min-h-screen"> <div class="container mx-auto px-4 py-8 max-w-6xl"> <!-- Header --> <header class="text-center mb-10"> <h1 class="text-4xl md:text-5xl font-bold text-indigo-800 mb-3"> <i class="fas fa-book-open mr-2"></i>Personal Diary </h1> <p class="text-lg text-gray-600">Track and manage important aspects of your daily life</p> </header> <!-- Main Content --> <div class="grid grid-cols-1 lg:grid-cols-3 gap-6"> <!-- Left Sidebar --> <div class="lg:col-span-1 space-y-6"> <!-- Topic Selection --> <div class="bg-white rounded-xl shadow-md p-5"> <h2 class="text-xl font-semibold text-gray-800 mb-4 flex items-center"> <i class="fas fa-folder-open mr-2 text-indigo-600"></i>Select Topic </h2> <div class="space-y-3" id="topic-buttons"> <!-- Topics will be added here by JavaScript --> </div> </div> <!-- Quick Stats --> <div class="bg-white rounded-xl shadow-md p-5"> <h2 class="text-xl font-semibold text-gray-800 mb-4 flex items-center"> <i class="fas fa-chart-pie mr-2 text-indigo-600"></i>Quick Stats </h2> <div class="grid grid-cols-2 gap-3" id="stats-container"> <div class="bg-blue-50 p-3 rounded-lg text-center"> <div class="text-2xl font-bold text-blue-600" id="total-entries">0</div> <div class="text-xs text-gray-600">Total Entries</div> </div> <div class="bg-purple-50 p-3 rounded-lg text-center"> <div class="text-2xl font-bold text-purple-600" id="high-priority">0</div> <div class="text-xs text-gray-600">High Priority</div> </div> <div class="bg-green-50 p-3 rounded-lg text-center"> <div class="text-2xl font-bold text-green-600" id="upcoming">0</div> <div class="text-xs text-gray-600">Upcoming</div> </div> <div class="bg-yellow-50 p-3 rounded-lg text-center"> <div class="text-2xl font-bold text-yellow-600" id="notifications-count">0</div> <div class="text-xs text-gray-600">Alerts</div> </div> </div> </div> <!-- Help & Support --> <div class="bg-white rounded-xl shadow-md p-5"> <h2 class="text-xl font-semibold text-gray-800 mb-4 flex items-center"> <i class="fas fa-question-circle mr-2 text-indigo-600"></i>Help & Support </h2> <div class="space-y-3"> <a href="https://example.com/help" target="_blank" class="flex items-center text-blue-600 hover:text-blue-800"> <i class="fas fa-info-circle mr-2"></i> Documentation </a> <a href="mailto:support@diaryapp.com" class="flex items-center text-blue-600 hover:text-blue-800"> <i class="fas fa-envelope mr-2"></i> Contact Support </a> <a href="https://example.com/feedback" target="_blank" class="flex items-center text-blue-600 hover:text-blue-800"> <i class="fas fa-comment-alt mr-2"></i> Send Feedback </a> </div> </div> </div> <!-- Main Content Area --> <div class="lg:col-span-2 space-y-6"> <!-- Notifications Panel --> <div class="bg-white rounded-xl shadow-md overflow-hidden"> <div class="flex justify-between items-center bg-indigo-100 px-5 py-3"> <h2 class="text-xl font-semibold text-indigo-800 flex items-center"> <i class="fas fa-bell mr-2"></i>Notifications </h2> <button id="clear-notifications" class="text-sm text-indigo-600 hover:text-indigo-800"> <i class="fas fa-trash-alt mr-1"></i>Clear All </button> </div> <div class="p-4 max-h-64 overflow-y-auto custom-scrollbar" id="notifications-container"> <div class="text-center text-gray-500 italic py-4" id="no-notifications"> No notifications at this time. </div> <!-- Notifications will be added here by JavaScript --> </div> </div> <!-- Add New Entry --> <div class="bg-white rounded-xl shadow-md overflow-hidden"> <div class="flex justify-between items-center bg-indigo-100 px-5 py-3"> <h2 class="text-xl font-semibold text-indigo-800 flex items-center"> <i class="fas fa-plus-circle mr-2"></i>Add New Entry </h2> <button id="toggle-form" class="text-sm text-indigo-600 hover:text-indigo-800"> <i class="fas fa-chevron-down mr-1"></i>Show Form </button> </div> <form id="entry-form" class="hidden p-5 space-y-4"> <div class="grid grid-cols-1 md:grid-cols-2 gap-4"> <div> <label class="block text-gray-700 mb-1 font-medium">Title</label> <input type="text" id="entry-title" required class="w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500" placeholder="Entry title"> </div> <div> <label class="block text-gray-700 mb-1 font-medium">Aspect</label> <select id="entry-aspect" required class="w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"> <option value="">Select Aspect</option> <!-- Aspects will be added here by JavaScript --> </select> </div> </div> <div> <label class="block text-gray-700 mb-1 font-medium">Description</label> <textarea id="entry-description" rows="3" required class="w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500" placeholder="Describe what you'd like to remember..."></textarea> </div> <div class="grid grid-cols-1 md:grid-cols-2 gap-4"> <div> <label class="block text-gray-700 mb-1 font-medium">Importance Level</label> <div class="flex space-x-2"> <label class="flex items-center"> <input type="radio" name="importance" value="low" class="form-radio text-green-500" checked> <span class="ml-2">Low</span> </label> <label class="flex items-center"> <input type="radio" name="importance" value="medium" class="form-radio text-yellow-500"> <span class="ml-2">Medium</span> </label> <label class="flex items-center"> <input type="radio" name="importance" value="high" class="form-radio text-red-500"> <span class="ml-2">High</span> </label> </div> </div> <div> <label class="block text-gray-700 mb-1 font-medium">Due Date</label> <input type="date" id="entry-date" class="w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"> </div> </div> <div class="pt-2"> <button type="submit" class="w-full py-3 px-4 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition duration-200 font-medium flex items-center justify-center"> <i class="fas fa-save mr-2"></i>Save Entry </button> </div> </form> </div> <!-- Entries List --> <div class="bg-white rounded-xl shadow-md overflow-hidden"> <div class="flex justify-between items-center bg-indigo-100 px-5 py-3"> <h2 class="text-xl font-semibold text-indigo-800 flex items-center"> <i class="fas fa-list-ul mr-2"></i>Recent Entries </h2> <div class="text-sm text-indigo-600" id="current-topic-display"> Showing: <span class="font-medium">House</span> </div> </div> <div class="p-4 max-h-96 overflow-y-auto custom-scrollbar" id="entries-container"> <div class="text-center text-gray-500 italic py-8" id="no-entries"> No entries found for this topic yet. Add your first entry! </div> <!-- Entries will be added here by JavaScript --> </div> </div> </div> </div> <!-- Footer --> <footer class="mt-12 text-center text-gray-500 text-sm"> <p>© <span id="current-year"></span> Personal Diary Application. All rights reserved.</p> <div class="mt-2 flex justify-center space-x-4"> <a href="https://example.com/privacy" target="_blank" class="hover:text-indigo-600">Privacy Policy</a> <a href="https://example.com/terms" target="_blank" class="hover:text-indigo-600">Terms of Service</a> <a href="https://example.com/about" target="_blank" class="hover:text-indigo-600">About Us</a> </div> </footer> </div> <script> // Topic configuration const topics = { House: ['Maintenance', 'Bills', 'Cleaning', 'Repairs', 'Decor'], Flat: ['Rent', 'Utilities', 'Neighbours', 'Rules', 'Security'], Car: ['Servicing', 'Fuel', 'Insurance', 'Repairs', 'Trips'], Animal: ['Feeding', 'Health', 'Exercise', 'Grooming', 'Vet'], Child: ['School', 'Health', 'Activities', 'Milestones', 'Shopping'], Husband: ['Anniversary', 'Health', 'Work', 'Hobbies', 'Dates'] }; // State variables let selectedTopic = 'House'; let entries = []; let notifications = []; // DOM Elements const topicButtonsContainer = document.getElementById('topic-buttons'); const currentTopicDisplay = document.getElementById('current-topic-display'); const entriesContainer = document.getElementById('entries-container'); const noEntriesMessage = document.getElementById('no-entries'); const notificationsContainer = document.getElementById('notifications-container'); const noNotificationsMessage = document.getElementById('no-notifications'); const entryForm = document.getElementById('entry-form'); const toggleFormButton = document.getElementById('toggle-form'); const clearNotificationsButton = document.getElementById('clear-notifications'); const entryAspectSelect = document.getElementById('entry-aspect'); const statsTotalEntries = document.getElementById('total-entries'); const statsHighPriority = document.getElementById('high-priority'); const statsUpcoming = document.getElementById('upcoming'); const statsNotificationsCount = document.getElementById('notifications-count'); // Initialize the application function init() { // Set current year in footer document.getElementById('current-year').textContent = new Date().getFullYear(); // Load saved data from localStorage loadData(); // Render topic buttons renderTopicButtons(); // Render entries for the selected topic renderEntries(); // Render notifications renderNotifications(); // Update stats updateStats(); // Set up event listeners setupEventListeners(); } // Load data from localStorage function loadData() { const savedEntries = localStorage.getItem('diary_entries'); const savedNotifications = localStorage.getItem('diary_notifications'); if (savedEntries) { entries = JSON.parse(savedEntries); } if (savedNotifications) { notifications = JSON.parse(savedNotifications); } } // Save data to localStorage function saveData() { localStorage.setItem('diary_entries', JSON.stringify(entries)); localStorage.setItem('diary_notifications', JSON.stringify(notifications)); } // Render topic buttons function renderTopicButtons() { topicButtonsContainer.innerHTML = ''; Object.keys(topics).forEach(topic => { const button = document.createElement('button'); button.className = `w-full text-left p-3 rounded-lg transition duration-200 flex items-center ${ topic === selectedTopic ? 'bg-indigo-100 text-indigo-800 font-medium' : 'hover:bg-gray-100' }`; button.innerHTML = ` <i class="fas ${getTopicIcon(topic)} mr-2 ${topic === selectedTopic ? 'text-indigo-600' : 'text-gray-500'}"></i> ${topic} `; button.addEventListener('click', () => { selectedTopic = topic; renderTopicButtons(); renderEntries(); updateAspectOptions(); currentTopicDisplay.innerHTML = `Showing: <span class="font-medium">${topic}</span>`; }); topicButtonsContainer.appendChild(button); }); } // Get icon for each topic function getTopicIcon(topic) { const icons = { House: 'fa-home', Flat: 'fa-building', Car: 'fa-car', Animal: 'fa-paw', Child: 'fa-child', Husband: 'fa-user-tie' }; return icons[topic] || 'fa-file-alt'; } // Update aspect options in the form function updateAspectOptions() { entryAspectSelect.innerHTML = '<option value="">Select Aspect</option>'; topics[selectedTopic].forEach(aspect => { const option = document.createElement('option'); option.value = aspect; option.textContent = aspect; entryAspectSelect.appendChild(option); }); } // Render entries function renderEntries() { entriesContainer.innerHTML = ''; const filteredEntries = entries.filter(entry => entry.topic === selectedTopic); if (filteredEntries.length === 0) { noEntriesMessage.classList.remove('hidden'); return; } noEntriesMessage.classList.add('hidden'); filteredEntries.forEach(entry => { const entryElement = document.createElement('div'); entryElement.className = 'entry-card bg-white border border-gray-200 rounded-lg p-4 mb-4 fade-in'; entryElement.innerHTML = ` <div class="flex justify-between items-start"> <div class="flex-1"> <div class="flex items-center mb-2"> <span class="w-3 h-3 rounded-full ${getImportanceColor(entry.importance)} mr-2"></span> <h3 class="font-bold text-lg text-gray-800">${entry.title}</h3> </div> <div class="flex items-center text-sm text-gray-600 mb-2"> <i class="fas fa-tag mr-1"></i> <span class="bg-gray-100 px-2 py-1 rounded-full text-xs">${entry.aspect}</span> </div> <p class="text-gray-700 mb-3">${entry.description}</p> <div class="flex items-center text-sm text-gray-500"> <i class="far fa-calendar-alt mr-1"></i> <span>${entry.date || 'No date set'}</span> </div> </div> <button class="delete-entry text-red-500 hover:text-red-700 p-2 rounded-full hover:bg-red-50" data-id="${entry.id}"> <i class="fas fa-trash-alt"></i> </button> </div> `; entriesContainer.appendChild(entryElement); }); // Add event listeners to delete buttons document.querySelectorAll('.delete-entry').forEach(button => { button.addEventListener('click', (e) => { const entryId = parseInt(button.getAttribute('data-id')); deleteEntry(entryId); }); }); } // Get importance color function getImportanceColor(level) { switch (level) { case 'high': return 'bg-red-500'; case 'medium': return 'bg-yellow-500'; default: return 'bg-green-500'; } } // Render notifications function renderNotifications() { notificationsContainer.innerHTML = ''; if (notifications.length === 0) { noNotificationsMessage.classList.remove('hidden'); return; } noNotificationsMessage.classList.add('hidden'); notifications.forEach(notification => { const notificationElement = document.createElement('div'); notificationElement.className = 'bg-gray-50 rounded-lg p-3 mb-2 flex justify-between items-center slide-in'; notificationElement.innerHTML = ` <div class="flex items-center"> <span class="w-2 h-2 rounded-full bg-red-500 mr-2"></span> <span>${notification.message}</span> </div> <div class="flex items-center"> <span class="text-xs text-gray-500 mr-3">${notification.time}</span> <button class="delete-notification text-gray-400 hover:text-gray-600" data-id="${notification.id}"> <i class="fas fa-times"></i> </button> </div> `; notificationsContainer.appendChild(notificationElement); }); // Add event listeners to delete buttons document.querySelectorAll('.delete-notification').forEach(button => { button.addEventListener('click', (e) => { const notificationId = parseInt(button.getAttribute('data-id')); deleteNotification(notificationId); }); }); } // Add new entry function addEntry(event) { event.preventDefault(); const title = document.getElementById('entry-title').value.trim(); const aspect = document.getElementById('entry-aspect').value; const description = document.getElementById('entry-description').value.trim(); const importance = document.querySelector('input[name="importance"]:checked').value; const date = document.getElementById('entry-date').value; if (!title || !aspect || !description) return; const newEntry = { id: Date.now(), topic: selectedTopic, title, aspect, description, importance, date: date || null }; entries.push(newEntry); saveData(); renderEntries(); generateNotification(newEntry); // Reset form document.getElementById('entry-form').reset(); document.getElementById('entry-title').focus(); // Update stats updateStats(); // Show success animation const submitButton = event.target.querySelector('button[type="submit"]'); submitButton.innerHTML = '<i class="fas fa-check mr-2"></i>Entry Saved!'; submitButton.classList.remove('bg-indigo-600', 'hover:bg-indigo-700'); submitButton.classList.add('bg-green-500', 'hover:bg-green-600'); setTimeout(() => { submitButton.innerHTML = '<i class="fas fa-save mr-2"></i>Save Entry'; submitButton.classList.remove('bg-green-500', 'hover:bg-green-600'); submitButton.classList.add('bg-indigo-600', 'hover:bg-indigo-700'); }, 2000); } // Generate notification for an entry function generateNotification(entry) { if (!entry.date) return; const now = new Date(); const entryDate = new Date(entry.date); const diffTime = Math.abs(entryDate - now); const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)); if (diffDays <= 3) { const newNotification = { id: Date.now(), message: `${entry.title} (${entry.aspect}) is due in ${diffDays} day(s)`, topic: entry.topic, time: new Date().toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }) }; notifications.unshift(newNotification); saveData(); renderNotifications(); updateStats(); // Show notification badge const notificationBadge = document.createElement('div'); notificationBadge.className = 'absolute -top-2 -right-2 w-5 h-5 bg-red-500 text-white text-xs rounded-full flex items-center justify-center pulse'; notificationBadge.textContent = '!'; document.querySelector('[data-topic="' + entry.topic + '"]').appendChild(notificationBadge); setTimeout(() => { notificationBadge.remove(); }, 3000); } } // Delete an entry function deleteEntry(id) { entries = entries.filter(entry => entry.id !== id); saveData(); renderEntries(); updateStats(); } // Delete a notification function deleteNotification(id) { notifications = notifications.filter(notification => notification.id !== id); saveData(); renderNotifications(); updateStats(); } // Clear all notifications function clearAllNotifications() { notifications = []; saveData(); renderNotifications(); updateStats(); } // Update statistics function updateStats() { // Total entries statsTotalEntries.textContent = entries.filter(entry => entry.topic === selectedTopic).length; // High priority entries statsHighPriority.textContent = entries.filter(entry => entry.topic === selectedTopic && entry.importance === 'high' ).length; // Upcoming entries (within 3 days) const now = new Date(); statsUpcoming.textContent = entries.filter(entry => { if (!entry.date) return false; const entryDate = new Date(entry.date); const diffTime = Math.abs(entryDate - now); const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)); return entry.topic === selectedTopic && diffDays <= 3; }).length; // Notifications count statsNotificationsCount.textContent = notifications.length; } // Set up event listeners function setupEventListeners() { // Toggle form visibility toggleFormButton.addEventListener('click', () => { entryForm.classList.toggle('hidden'); toggleFormButton.innerHTML = entryForm.classList.contains('hidden') ? '<i class="fas fa-chevron-down mr-1"></i>Show Form' : '<i class="fas fa-chevron-up mr-1"></i>Hide Form'; }); // Form submission entryForm.addEventListener('submit', addEntry); // Clear notifications clearNotificationsButton.addEventListener('click', clearAllNotifications); // Update aspect options when topic changes document.querySelectorAll('[data-topic]').forEach(button => { button.addEventListener('click', updateAspectOptions); }); } // Initialize the app when DOM is loaded document.addEventListener('DOMContentLoaded', init); </script> </body> </html>
2
+ Create sign in page with welcome message hello Mum' Hope this helps 'Name: Mum, Password:Reardon
3
+ ensure we can enter the diary app
4
+ enahnce this site and improve the option, allow maintainance buttons and tailwind desing functino and features