Ialready8 commited on
Commit
bfef99b
·
verified ·
1 Parent(s): 4259c09

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. index.html +850 -19
index.html CHANGED
@@ -1,19 +1,850 @@
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>Personal Information Organizer</title>
7
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
8
+ <style>
9
+ * {
10
+ margin: 0;
11
+ padding: 0;
12
+ box-sizing: border-box;
13
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
14
+ }
15
+
16
+ :root {
17
+ --primary: #4361ee;
18
+ --secondary: #3a0ca3;
19
+ --success: #4cc9f0;
20
+ --danger: #f72585;
21
+ --warning: #f8961e;
22
+ --light: #f8f9fa;
23
+ --dark: #212529;
24
+ --gray: #6c757d;
25
+ --transition: all 0.3s ease;
26
+ }
27
+
28
+ body {
29
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
30
+ min-height: 100vh;
31
+ display: flex;
32
+ flex-direction: column;
33
+ align-items: center;
34
+ justify-content: center;
35
+ padding: 1rem;
36
+ color: var(--light);
37
+ }
38
+
39
+ .header {
40
+ position: absolute;
41
+ top: 1rem;
42
+ right: 1rem;
43
+ display: flex;
44
+ gap: 1rem;
45
+ align-items: center;
46
+ }
47
+
48
+ .header a {
49
+ color: var(--light);
50
+ text-decoration: none;
51
+ font-size: 0.9rem;
52
+ opacity: 0.8;
53
+ transition: var(--transition);
54
+ }
55
+
56
+ .header a:hover {
57
+ opacity: 1;
58
+ text-decoration: underline;
59
+ }
60
+
61
+ .container {
62
+ background: rgba(255, 255, 255, 0.1);
63
+ backdrop-filter: blur(10px);
64
+ border-radius: 20px;
65
+ padding: 2rem;
66
+ width: 100%;
67
+ max-width: 1000px;
68
+ box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
69
+ border: 1px solid rgba(255, 255, 255, 0.2);
70
+ }
71
+
72
+ h1 {
73
+ text-align: center;
74
+ margin-bottom: 1.5rem;
75
+ font-weight: 700;
76
+ font-size: 2.5rem;
77
+ text-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
78
+ }
79
+
80
+ .description {
81
+ text-align: center;
82
+ margin-bottom: 2rem;
83
+ font-size: 1.1rem;
84
+ opacity: 0.9;
85
+ line-height: 1.6;
86
+ }
87
+
88
+ .app-container {
89
+ display: grid;
90
+ grid-template-columns: 1fr 2fr;
91
+ gap: 2rem;
92
+ }
93
+
94
+ .input-section {
95
+ display: flex;
96
+ flex-direction: column;
97
+ gap: 1.5rem;
98
+ }
99
+
100
+ .input-group {
101
+ display: flex;
102
+ flex-direction: column;
103
+ gap: 0.8rem;
104
+ }
105
+
106
+ .input-group label {
107
+ font-weight: 600;
108
+ font-size: 1.1rem;
109
+ }
110
+
111
+ .input-group input,
112
+ .input-group textarea,
113
+ .input-group select {
114
+ padding: 0.8rem 1rem;
115
+ border-radius: 10px;
116
+ border: 1px solid rgba(255, 255, 255, 0.3);
117
+ background: rgba(255, 255, 255, 0.15);
118
+ color: var(--light);
119
+ font-size: 1rem;
120
+ transition: var(--transition);
121
+ }
122
+
123
+ .input-group input:focus,
124
+ .input-group textarea:focus,
125
+ .input-group select:focus {
126
+ outline: none;
127
+ border-color: var(--primary);
128
+ background: rgba(255, 255, 255, 0.2);
129
+ }
130
+
131
+ .input-group textarea {
132
+ min-height: 120px;
133
+ resize: vertical;
134
+ }
135
+
136
+ .input-group input::placeholder,
137
+ .input-group textarea::placeholder {
138
+ color: rgba(255, 255, 255, 0.6);
139
+ }
140
+
141
+ .categories {
142
+ display: flex;
143
+ flex-wrap: wrap;
144
+ gap: 0.5rem;
145
+ }
146
+
147
+ .category-tag {
148
+ background: rgba(255, 255, 255, 0.2);
149
+ padding: 0.3rem 0.8rem;
150
+ border-radius: 20px;
151
+ font-size: 0.9rem;
152
+ cursor: pointer;
153
+ transition: var(--transition);
154
+ }
155
+
156
+ .category-tag:hover {
157
+ background: rgba(255, 255, 255, 0.3);
158
+ }
159
+
160
+ .category-tag.active {
161
+ background: var(--primary);
162
+ }
163
+
164
+ .btn {
165
+ padding: 0.8rem 1.5rem;
166
+ border: none;
167
+ border-radius: 10px;
168
+ font-weight: 600;
169
+ cursor: pointer;
170
+ transition: var(--transition);
171
+ display: flex;
172
+ align-items: center;
173
+ justify-content: center;
174
+ gap: 0.5rem;
175
+ font-size: 1rem;
176
+ }
177
+
178
+ .btn-primary {
179
+ background: var(--primary);
180
+ color: white;
181
+ }
182
+
183
+ .btn-primary:hover {
184
+ background: var(--secondary);
185
+ transform: scale(1.05);
186
+ }
187
+
188
+ .btn-outline {
189
+ background: transparent;
190
+ color: var(--light);
191
+ border: 1px solid rgba(255, 255, 255, 0.3);
192
+ }
193
+
194
+ .btn-outline:hover {
195
+ background: rgba(255, 255, 255, 0.1);
196
+ }
197
+
198
+ .view-section {
199
+ display: flex;
200
+ flex-direction: column;
201
+ gap: 1.5rem;
202
+ }
203
+
204
+ .search-bar {
205
+ display: flex;
206
+ gap: 0.5rem;
207
+ }
208
+
209
+ .search-bar input {
210
+ flex: 1;
211
+ padding: 0.8rem 1rem;
212
+ border-radius: 10px;
213
+ border: 1px solid rgba(255, 255, 255, 0.3);
214
+ background: rgba(255, 255, 255, 0.15);
215
+ color: var(--light);
216
+ font-size: 1rem;
217
+ }
218
+
219
+ .search-bar input:focus {
220
+ outline: none;
221
+ border-color: var(--primary);
222
+ }
223
+
224
+ .notes-container {
225
+ display: flex;
226
+ flex-direction: column;
227
+ gap: 1rem;
228
+ max-height: 500px;
229
+ overflow-y: auto;
230
+ padding-right: 0.5rem;
231
+ }
232
+
233
+ .notes-container::-webkit-scrollbar {
234
+ width: 8px;
235
+ }
236
+
237
+ .notes-container::-webkit-scrollbar-track {
238
+ background: rgba(255, 255, 255, 0.1);
239
+ border-radius: 10px;
240
+ }
241
+
242
+ .notes-container::-webkit-scrollbar-thumb {
243
+ background: rgba(255, 255, 255, 0.3);
244
+ border-radius: 10px;
245
+ }
246
+
247
+ .notes-container::-webkit-scrollbar-thumb:hover {
248
+ background: rgba(255, 255, 255, 0.5);
249
+ }
250
+
251
+ .note-card {
252
+ background: rgba(255, 255, 255, 0.15);
253
+ border-radius: 15px;
254
+ padding: 1.5rem;
255
+ transition: var(--transition);
256
+ border: 1px solid rgba(255, 255, 255, 0.1);
257
+ }
258
+
259
+ .note-card:hover {
260
+ background: rgba(255, 255, 255, 0.2);
261
+ transform: translateY(-3px);
262
+ }
263
+
264
+ .note-header {
265
+ display: flex;
266
+ justify-content: space-between;
267
+ align-items: center;
268
+ margin-bottom: 1rem;
269
+ }
270
+
271
+ .note-title {
272
+ font-size: 1.3rem;
273
+ font-weight: 600;
274
+ }
275
+
276
+ .note-category {
277
+ padding: 0.3rem 0.8rem;
278
+ border-radius: 20px;
279
+ font-size: 0.8rem;
280
+ font-weight: 600;
281
+ background: var(--primary);
282
+ }
283
+
284
+ .note-content {
285
+ margin-bottom: 1rem;
286
+ line-height: 1.5;
287
+ }
288
+
289
+ .note-meta {
290
+ display: flex;
291
+ justify-content: space-between;
292
+ font-size: 0.8rem;
293
+ opacity: 0.8;
294
+ }
295
+
296
+ .note-actions {
297
+ display: flex;
298
+ gap: 0.5rem;
299
+ margin-top: 1rem;
300
+ }
301
+
302
+ .action-btn {
303
+ background: transparent;
304
+ border: none;
305
+ color: var(--light);
306
+ cursor: pointer;
307
+ opacity: 0.7;
308
+ transition: var(--transition);
309
+ padding: 0.3rem 0.5rem;
310
+ border-radius: 5px;
311
+ }
312
+
313
+ .action-btn:hover {
314
+ opacity: 1;
315
+ background: rgba(255, 255, 255, 0.1);
316
+ }
317
+
318
+ .empty-state {
319
+ text-align: center;
320
+ padding: 2rem;
321
+ opacity: 0.7;
322
+ }
323
+
324
+ .empty-state i {
325
+ font-size: 3rem;
326
+ margin-bottom: 1rem;
327
+ }
328
+
329
+ .stats-container {
330
+ display: grid;
331
+ grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
332
+ gap: 1rem;
333
+ margin-top: 2rem;
334
+ }
335
+
336
+ .stat-card {
337
+ background: rgba(255, 255, 255, 0.1);
338
+ border-radius: 12px;
339
+ padding: 1rem;
340
+ text-align: center;
341
+ transition: var(--transition);
342
+ }
343
+
344
+ .stat-card:hover {
345
+ background: rgba(255, 255, 255, 0.15);
346
+ transform: translateY(-3px);
347
+ }
348
+
349
+ .stat-value {
350
+ font-size: 2rem;
351
+ font-weight: 700;
352
+ margin-bottom: 0.5rem;
353
+ }
354
+
355
+ .stat-label {
356
+ font-size: 0.9rem;
357
+ opacity: 0.8;
358
+ }
359
+
360
+ .notification {
361
+ position: fixed;
362
+ bottom: 2rem;
363
+ right: 2rem;
364
+ background: var(--success);
365
+ color: var(--dark);
366
+ padding: 1rem 1.5rem;
367
+ border-radius: 10px;
368
+ box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
369
+ display: flex;
370
+ align-items: center;
371
+ gap: 0.8rem;
372
+ transform: translateY(150%);
373
+ transition: transform 0.4s ease;
374
+ z-index: 1000;
375
+ }
376
+
377
+ .notification.show {
378
+ transform: translateY(0);
379
+ }
380
+
381
+ @media (max-width: 900px) {
382
+ .app-container {
383
+ grid-template-columns: 1fr;
384
+ }
385
+ }
386
+
387
+ @media (max-width: 768px) {
388
+ .container {
389
+ padding: 1.5rem;
390
+ }
391
+
392
+ h1 {
393
+ font-size: 2rem;
394
+ }
395
+
396
+ .note-header {
397
+ flex-direction: column;
398
+ align-items: flex-start;
399
+ gap: 0.5rem;
400
+ margin-bottom: 1rem;
401
+ }
402
+ }
403
+
404
+ @media (max-width: 480px) {
405
+ .container {
406
+ padding: 1rem;
407
+ }
408
+
409
+ h1 {
410
+ font-size: 1.8rem;
411
+ }
412
+
413
+ .header {
414
+ position: relative;
415
+ top: 0;
416
+ right: 0;
417
+ margin-bottom: 1rem;
418
+ justify-content: flex-end;
419
+ }
420
+
421
+ .stats-container {
422
+ grid-template-columns: repeat(2, 1fr);
423
+ }
424
+ }
425
+ </style>
426
+ </head>
427
+
428
+ <body>
429
+ <div class="header">
430
+ <button class="btn btn-outline" id="exportBtn"><i class="fas fa-download"></i> Export</button>
431
+ <button class="btn btn-outline" id="importBtn"><i class="fas fa-upload"></i> Import</button>
432
+ <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank">Built with anycoder</a>
433
+ </div>
434
+
435
+ <div class="container">
436
+ <h1><i class="fas fa-brain"></i> Information Organizer</h1>
437
+ <p class="description">Capture and organize your thoughts, ideas, and information. Everything saves automatically!</p>
438
+
439
+ <div class="app-container">
440
+ <div class="input-section">
441
+ <div class="input-group">
442
+ <label for="noteTitle">Title</label>
443
+ <input type="text" id="noteTitle" placeholder="Give your note a title">
444
+ </div>
445
+
446
+ <div class="input-group">
447
+ <label for="noteContent">Content</label>
448
+ <textarea id="noteContent" placeholder="Write your thoughts, ideas, or information here..."></textarea>
449
+ </div>
450
+
451
+ <div class="input-group">
452
+ <label for="noteCategory">Category</label>
453
+ <div class="categories">
454
+ <div class="category-tag active" data-category="general">General</div>
455
+ <div class="category-tag" data-category="ideas">Ideas</div>
456
+ <div class="category-tag" data-category="tasks">Tasks</div>
457
+ <div class="category-tag" data-category="personal">Personal</div>
458
+ <div class="category-tag" data-category="work">Work</div>
459
+ </div>
460
+ </div>
461
+
462
+ <div class="input-group">
463
+ <label for="notePriority">Priority</label>
464
+ <select id="notePriority">
465
+ <option value="low">Low</option>
466
+ <option value="medium" selected>Medium</option>
467
+ <option value="high">High</option>
468
+ </select>
469
+ </div>
470
+
471
+ <button class="btn btn-primary" id="addNoteBtn"><i class="fas fa-plus"></i> Add Note</button>
472
+ </div>
473
+
474
+ <div class="view-section">
475
+ <div class="search-bar">
476
+ <input type="text" id="searchInput" placeholder="Search your notes...">
477
+ <button class="btn btn-outline" id="clearSearchBtn"><i class="fas fa-times"></i></button>
478
+ </div>
479
+
480
+ <div class="notes-container" id="notesContainer">
481
+ <!-- Notes will be dynamically added here -->
482
+ </div>
483
+ </div>
484
+ </div>
485
+
486
+ <div class="stats-container">
487
+ <div class="stat-card">
488
+ <div class="stat-value" id="totalNotes">0</div>
489
+ <div class="stat-label">Total Notes</div>
490
+ </div>
491
+ <div class="stat-card">
492
+ <div class="stat-value" id="generalNotes">0</div>
493
+ <div class="stat-label">General</div>
494
+ </div>
495
+ <div class="stat-card">
496
+ <div class="stat-value" id="ideasNotes">0</div>
497
+ <div class="stat-label">Ideas</div>
498
+ </div>
499
+ <div class="stat-card">
500
+ <div class="stat-value" id="tasksNotes">0</div>
501
+ <div class="stat-label">Tasks</div>
502
+ </div>
503
+ </div>
504
+ </div>
505
+
506
+ <div class="notification" id="notification">
507
+ <i class="fas fa-check-circle"></i>
508
+ <div>Note added successfully!</div>
509
+ </div>
510
+
511
+ <script>
512
+ document.addEventListener('DOMContentLoaded', function() {
513
+ // DOM Elements
514
+ const noteTitle = document.getElementById('noteTitle');
515
+ const noteContent = document.getElementById('noteContent');
516
+ const notePriority = document.getElementById('notePriority');
517
+ const addNoteBtn = document.getElementById('addNoteBtn');
518
+ const notesContainer = document.getElementById('notesContainer');
519
+ const searchInput = document.getElementById('searchInput');
520
+ const clearSearchBtn = document.getElementById('clearSearchBtn');
521
+ const categoryTags = document.querySelectorAll('.category-tag');
522
+ const notification = document.getElementById('notification');
523
+ const exportBtn = document.getElementById('exportBtn');
524
+ const importBtn = document.getElementById('importBtn');
525
+ const statElements = {
526
+ total: document.getElementById('totalNotes'),
527
+ general: document.getElementById('generalNotes'),
528
+ ideas: document.getElementById('ideasNotes'),
529
+ tasks: document.getElementById('tasksNotes')
530
+ };
531
+
532
+ // Current category
533
+ let currentCategory = 'general';
534
+
535
+ // Load notes from localStorage
536
+ let notes = JSON.parse(localStorage.getItem('personalOrganizerNotes')) || [];
537
+
538
+ // Initialize app
539
+ function init() {
540
+ renderNotes();
541
+ updateStats();
542
+
543
+ // Set up auto-save
544
+ setupAutoSave();
545
+
546
+ // Set up category selection
547
+ setupCategorySelection();
548
+ }
549
+
550
+ // Set up auto-save for input fields
551
+ function setupAutoSave() {
552
+ const inputs = [noteTitle, noteContent, notePriority];
553
+
554
+ inputs.forEach(input => {
555
+ // Load saved draft from localStorage
556
+ const savedDraft = JSON.parse(localStorage.getItem('organizerDraft')) || {};
557
+ if (savedDraft[input.id]) {
558
+ if (input.type === 'select-one') {
559
+ input.value = savedDraft[input.id];
560
+ } else {
561
+ input.value = savedDraft[input.id];
562
+ }
563
+ }
564
+
565
+ // Save on input change
566
+ input.addEventListener('input', function() {
567
+ saveDraft();
568
+ });
569
+ });
570
+ }
571
+
572
+ // Save draft to localStorage
573
+ function saveDraft() {
574
+ const draft = {
575
+ noteTitle: noteTitle.value,
576
+ noteContent: noteContent.value,
577
+ notePriority: notePriority.value
578
+ };
579
+
580
+ localStorage.setItem('organizerDraft', JSON.stringify(draft));
581
+ }
582
+
583
+ // Set up category selection
584
+ function setupCategorySelection() {
585
+ categoryTags.forEach(tag => {
586
+ tag.addEventListener('click', function() {
587
+ // Remove active class from all tags
588
+ categoryTags.forEach(t => t.classList.remove('active'));
589
+
590
+ // Add active class to clicked tag
591
+ this.classList.add('active');
592
+
593
+ // Update current category
594
+ currentCategory = this.getAttribute('data-category');
595
+ });
596
+ });
597
+ }
598
+
599
+ // Add a new note
600
+ function addNote() {
601
+ const title = noteTitle.value.trim();
602
+ const content = noteContent.value.trim();
603
+
604
+ if (!title || !content) {
605
+ showNotification('Please fill in both title and content', 'warning');
606
+ return;
607
+ }
608
+
609
+ const newNote = {
610
+ id: Date.now(),
611
+ title: title,
612
+ content: content,
613
+ category: currentCategory,
614
+ priority: notePriority.value,
615
+ createdAt: new Date().toISOString()
616
+ };
617
+
618
+ notes.unshift(newNote);
619
+ saveNotes();
620
+ renderNotes();
621
+ updateStats();
622
+
623
+ // Clear inputs
624
+ noteTitle.value = '';
625
+ noteContent.value = '';
626
+ notePriority.value = 'medium';
627
+
628
+ // Update draft
629
+ saveDraft();
630
+
631
+ showNotification('Note added successfully!', 'success');
632
+ }
633
+
634
+ // Delete a note
635
+ function deleteNote(id) {
636
+ notes = notes.filter(note => note.id !== id);
637
+ saveNotes();
638
+ renderNotes();
639
+ updateStats();
640
+ showNotification('Note deleted', 'danger');
641
+ }
642
+
643
+ // Edit a note
644
+ function editNote(id) {
645
+ const note = notes.find(note => note.id === id);
646
+
647
+ if (note) {
648
+ noteTitle.value = note.title;
649
+ noteContent.value = note.content;
650
+ notePriority.value = note.priority;
651
+
652
+ // Set category
653
+ categoryTags.forEach(tag => {
654
+ tag.classList.remove('active');
655
+ if (tag.getAttribute('data-category') === note.category) {
656
+ tag.classList.add('active');
657
+ currentCategory = note.category;
658
+ }
659
+ });
660
+
661
+ showNotification('Note loaded for editing', 'success');
662
+ }
663
+
664
+ // Save notes to localStorage
665
+ function saveNotes() {
666
+ localStorage.setItem('personalOrganizerNotes', JSON.stringify(notes));
667
+ }
668
+
669
+ // Render notes to the DOM
670
+ function renderNotes() {
671
+ const searchTerm = searchInput.value.toLowerCase();
672
+
673
+ let filteredNotes = notes;
674
+
675
+ if (searchTerm) {
676
+ filteredNotes = notes.filter(note =>
677
+ note.title.toLowerCase().includes(searchTerm) ||
678
+ note.content.toLowerCase().includes(searchTerm)
679
+ );
680
+ }
681
+
682
+ if (filteredNotes.length === 0) {
683
+ notesContainer.innerHTML = `
684
+ <div class="empty-state">
685
+ <i class="fas fa-sticky-note"></i>
686
+ <p>No notes found. Add your first note to get started!</p>
687
+ </div>
688
+ `;
689
+ return;
690
+ }
691
+
692
+ notesContainer.innerHTML = '';
693
+
694
+ filteredNotes.forEach(note => {
695
+ const noteElement = document.createElement('div');
696
+ noteElement.className = 'note-card';
697
+ noteElement.innerHTML = `
698
+ <div class="note-header">
699
+ <div class="note-title">${note.title}</div>
700
+ <div class="note-category">${note.category}</div>
701
+ </div>
702
+ <div class="note-content">${note.content}</div>
703
+ <div class="note-meta">
704
+ <div>Priority: <span style="color: ${getPriorityColor(note.priority)}">${note.priority}</span></div>
705
+ <div>${formatDate(note.createdAt)}</div>
706
+ </div>
707
+ <div class="note-actions">
708
+ <button class="action-btn edit-btn" data-id="${note.id}"><i class="fas fa-edit"></i> Edit</button>
709
+ <button class="action-btn delete-btn" data-id="${note.id}"><i class="fas fa-trash"></i> Delete</button>
710
+ </div>
711
+ `;
712
+
713
+ notesContainer.appendChild(noteElement);
714
+ });
715
+
716
+ // Add event listeners to action buttons
717
+ document.querySelectorAll('.edit-btn').forEach(btn => {
718
+ btn.addEventListener('click', function() {
719
+ const id = parseInt(this.getAttribute('data-id'));
720
+ editNote(id);
721
+ });
722
+ });
723
+
724
+ document.querySelectorAll('.delete-btn').forEach(btn => {
725
+ btn.addEventListener('click', function() {
726
+ const id = parseInt(this.getAttribute('data-id'));
727
+ deleteNote(id);
728
+ });
729
+ });
730
+ }
731
+
732
+ // Update statistics
733
+ function updateStats() {
734
+ const total = notes.length;
735
+ const general = notes.filter(note => note.category === 'general').length;
736
+ const ideas = notes.filter(note => note.category === 'ideas').length;
737
+ const tasks = notes.filter(note => note.category === 'tasks').length;
738
+
739
+ statElements.total.textContent = total;
740
+ statElements.general.textContent = general;
741
+ statElements.ideas.textContent = ideas;
742
+ statElements.tasks.textContent = tasks;
743
+ }
744
+
745
+ // Show notification
746
+ function showNotification(message, type) {
747
+ const icon = type === 'success' ? 'fa-check-circle' :
748
+ type === 'warning' ? 'fa-exclamation-triangle' : 'fa-info-circle';
749
+
750
+ notification.innerHTML = `
751
+ <i class="fas ${icon}"></i>
752
+ <div>${message}</div>
753
+ `;
754
+
755
+ notification.style.background = type === 'success' ? 'var(--success)' :
756
+ type === 'warning' ? 'var(--warning)' : 'var(--danger)';
757
+ notification.style.color = type === 'warning' ? 'var(--dark)' : 'var(--light)';
758
+
759
+ notification.classList.add('show');
760
+
761
+ setTimeout(() => {
762
+ notification.classList.remove('show');
763
+ }, 3000);
764
+ }
765
+
766
+ // Format date for display
767
+ function formatDate(dateString) {
768
+ const date = new Date(dateString);
769
+ return date.toLocaleDateString() + ' ' + date.toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'});
770
+ }
771
+
772
+ // Get color for priority
773
+ function getPriorityColor(priority) {
774
+ switch(priority) {
775
+ case 'high': return '#f72585';
776
+ case 'medium': return '#f8961e';
777
+ case 'low': return '#4cc9f0';
778
+ default: return '#ffffff';
779
+ }
780
+ }
781
+
782
+ // Export notes as JSON file
783
+ function exportNotes() {
784
+ const dataStr = JSON.stringify(notes, null, 2);
785
+ const dataBlob = new Blob([dataStr], {type: 'application/json'});
786
+
787
+ const url = URL.createObjectURL(dataBlob);
788
+ const link = document.createElement('a');
789
+ link.href = url;
790
+ link.download = 'personal-organizer-notes.json';
791
+ document.body.appendChild(link);
792
+ link.click();
793
+ document.body.removeChild(link);
794
+ URL.revokeObjectURL(url);
795
+
796
+ showNotification('Notes exported successfully!', 'success');
797
+ }
798
+
799
+ // Import notes from JSON file
800
+ function importNotes() {
801
+ const input = document.createElement('input');
802
+ input.type = 'file';
803
+ input.accept = '.json';
804
+
805
+ input.addEventListener('change', function() {
806
+ const file = this.files[0];
807
+ if (!file) return;
808
+
809
+ const reader = new FileReader();
810
+ reader.onload = function(e) {
811
+ try {
812
+ const importedNotes = JSON.parse(e.target.result);
813
+
814
+ if (Array.isArray(importedNotes)) {
815
+ notes = importedNotes;
816
+ saveNotes();
817
+ renderNotes();
818
+ updateStats();
819
+ showNotification('Notes imported successfully!', 'success');
820
+ } else {
821
+ showNotification('Invalid file format', 'danger');
822
+ }
823
+ };
824
+
825
+ reader.readAsText(file);
826
+ });
827
+
828
+ input.click();
829
+ }
830
+
831
+ // Event Listeners
832
+ addNoteBtn.addEventListener('click', addNote);
833
+
834
+ searchInput.addEventListener('input', renderNotes);
835
+
836
+ clearSearchBtn.addEventListener('click', function() {
837
+ searchInput.value = '';
838
+ renderNotes();
839
+ });
840
+
841
+ exportBtn.addEventListener('click', exportNotes);
842
+
843
+ importBtn.addEventListener('click', importNotes);
844
+
845
+ // Initialize the application
846
+ init();
847
+ });
848
+ </script>
849
+ </body>
850
+ </html>