brata commited on
Commit
3d81e2a
·
verified ·
1 Parent(s): 12f6e67

Create a Notes App, with a notes section, and a history section.

Browse files
Files changed (2) hide show
  1. README.md +8 -5
  2. index.html +342 -18
README.md CHANGED
@@ -1,10 +1,13 @@
1
  ---
2
- title: Quillscrawl Chronicles
3
- emoji: 🏢
4
- colorFrom: gray
5
- colorTo: indigo
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: QuillScrawl Chronicles ✍️
3
+ colorFrom: green
4
+ colorTo: green
5
+ emoji: 🐳
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite-v3
10
  ---
11
 
12
+ # Welcome to your new DeepSite project!
13
+ This project was created with [DeepSite](https://deepsite.hf.co).
index.html CHANGED
@@ -1,19 +1,343 @@
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>QuillScrawl Chronicles - Notes App</title>
7
+ <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
8
+ <script src="https://cdn.tailwindcss.com"></script>
9
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
10
+ <script src="https://unpkg.com/feather-icons"></script>
11
+ <script src="https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.globe.min.js"></script>
12
+ <style>
13
+ .note-card {
14
+ transition: all 0.3s ease;
15
+ }
16
+ .note-card:hover {
17
+ transform: translateY(-5px);
18
+ box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
19
+ }
20
+ .vanta-bg {
21
+ position: fixed;
22
+ top: 0;
23
+ left: 0;
24
+ width: 100%;
25
+ height: 100%;
26
+ z-index: -1;
27
+ }
28
+ .glass-effect {
29
+ backdrop-filter: blur(16px) saturate(180%);
30
+ -webkit-backdrop-filter: blur(16px) saturate(180%);
31
+ background-color: rgba(255, 255, 255, 0.75);
32
+ }
33
+ .gradient-text {
34
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
35
+ -webkit-background-clip: text;
36
+ -webkit-text-fill-color: transparent;
37
+ }
38
+ </style>
39
+ </head>
40
+ <body class="min-h-screen bg-gray-50">
41
+ <div id="vanta-bg" class="vanta-bg"></div>
42
+
43
+ <!-- Navigation -->
44
+ <nav class="glass-effect border-b border-gray-200 sticky top-0 z-10">
45
+ <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
46
+ <div class="flex justify-between h-16">
47
+ <div class="flex items-center">
48
+ <div class="flex-shrink-0 flex items-center">
49
+ <i data-feather="edit-3" class="h-8 w-8 text-purple-600"></i>
50
+ <span class="ml-2 text-xl font-bold gradient-text">QuillScrawl Chronicles</span>
51
+ </div>
52
+ </div>
53
+ <div class="flex items-center space-x-4">
54
+ <button id="notes-tab" class="px-4 py-2 rounded-lg bg-purple-600 text-white font-medium transition-colors duration-200 hover:bg-purple-700">
55
+ <i data-feather="file-text" class="w-4 h-4 inline mr-2"></i>
56
+ Notes
57
+ </button>
58
+ <button id="history-tab" class="px-4 py-2 rounded-lg text-gray-600 font-medium transition-colors duration-200 hover:bg-gray-100">
59
+ <i data-feather="clock" class="w-4 h-4 inline mr-2"></i>
60
+ History
61
+ </button>
62
+ </div>
63
+ </div>
64
+ </div>
65
+ </nav>
66
+
67
+ <!-- Main Content -->
68
+ <main class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
69
+ <!-- Notes Section -->
70
+ <section id="notes-section" class="space-y-6">
71
+ <!-- Note Input -->
72
+ <div class="glass-effect rounded-2xl p-6 shadow-lg border border-gray-100">
73
+ <h2 class="text-2xl font-bold text-gray-800 mb-4">Create New Note</h2>
74
+ <form id="note-form" class="space-y-4">
75
+ <input type="text" id="note-title" placeholder="Note Title" class="w-full px-4 py-3 rounded-xl border border-gray-200 focus:ring-2 focus:ring-purple-500 focus:border-transparent transition-all duration-200">
76
+ <textarea id="note-content" placeholder="Start writing your note here..." rows="6" class="w-full px-4 py-3 rounded-xl border border-gray-200 focus:ring-2 focus:ring-purple-500 focus:border-transparent transition-all duration-200 resize-none"></textarea>
77
+ <div class="flex justify-between items-center">
78
+ <button type="submit" class="px-6 py-3 bg-purple-600 text-white rounded-xl font-medium hover:bg-purple-700 transition-colors duration-200 flex items-center">
79
+ <i data-feather="save" class="w-4 h-4 mr-2"></i>
80
+ Save Note
81
+ </button>
82
+ <div class="flex items-center space-x-2 text-sm text-gray-500">
83
+ <i data-feather="clock" class="w-4 h-4"></i>
84
+ <span id="char-count">0 characters</span>
85
+ </div>
86
+ </div>
87
+ </form>
88
+ </div>
89
+
90
+ <!-- Notes Grid -->
91
+ <div id="notes-grid" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
92
+ <!-- Notes will be dynamically added here -->
93
+ </div>
94
+ </section>
95
+
96
+ <!-- History Section -->
97
+ <section id="history-section" class="hidden space-y-6">
98
+ <div class="glass-effect rounded-2xl p-6 shadow-lg border border-gray-100">
99
+ <h2 class="text-2xl font-bold text-gray-800 mb-6">Note History</h2>
100
+ <div id="history-list" class="space-y-4">
101
+ <!-- History items will be dynamically added here -->
102
+ </div>
103
+ </div>
104
+ </section>
105
+ </main>
106
+
107
+ <!-- Edit Note Modal -->
108
+ <div id="edit-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center hidden z-20">
109
+ <div class="glass-effect rounded-2xl p-6 w-full max-w-2xl mx-4 shadow-2xl">
110
+ <div class="flex justify-between items-center mb-4">
111
+ <h3 class="text-xl font-bold text-gray-800">Edit Note</h3>
112
+ <button id="close-modal" class="text-gray-500 hover:text-gray-700">
113
+ <i data-feather="x" class="w-6 h-6"></i>
114
+ </button>
115
+ </div>
116
+ <form id="edit-form" class="space-y-4">
117
+ <input type="hidden" id="edit-id">
118
+ <input type="text" id="edit-title" placeholder="Note Title" class="w-full px-4 py-3 rounded-xl border border-gray-200 focus:ring-2 focus:ring-purple-500 focus:border-transparent">
119
+ <textarea id="edit-content" placeholder="Note Content" rows="6" class="w-full px-4 py-3 rounded-xl border border-gray-200 focus:ring-2 focus:ring-purple-500 focus:border-transparent resize-none"></textarea>
120
+ <div class="flex justify-end space-x-3">
121
+ <button type="button" id="cancel-edit" class="px-4 py-2 text-gray-600 hover:text-gray-800 transition-colors duration-200">
122
+ Cancel
123
+ </button>
124
+ <button type="submit" class="px-6 py-2 bg-purple-600 text-white rounded-xl hover:bg-purple-700 transition-colors duration-200">
125
+ Update Note
126
+ </button>
127
+ </div>
128
+ </form>
129
+ </div>
130
+ </div>
131
+
132
+ <script>
133
+ // Initialize Vanta.js background
134
+ VANTA.GLOBE({
135
+ el: "#vanta-bg",
136
+ mouseControls: true,
137
+ touchControls: true,
138
+ gyroControls: false,
139
+ minHeight: 200.00,
140
+ minWidth: 200.00,
141
+ scale: 1.00,
142
+ scaleMobile: 1.00,
143
+ color: 0x764ba2,
144
+ backgroundColor: 0xf8fafc
145
+ });
146
+
147
+ // Sample data
148
+ let notes = JSON.parse(localStorage.getItem('notes')) || [];
149
+ let history = JSON.parse(localStorage.getItem('history')) || [];
150
+
151
+ // DOM Elements
152
+ const notesSection = document.getElementById('notes-section');
153
+ const historySection = document.getElementById('history-section');
154
+ const notesTab = document.getElementById('notes-tab');
155
+ const historyTab = document.getElementById('history-tab');
156
+ const noteForm = document.getElementById('note-form');
157
+ const editForm = document.getElementById('edit-form');
158
+ const editModal = document.getElementById('edit-modal');
159
+ const notesGrid = document.getElementById('notes-grid');
160
+ const historyList = document.getElementById('history-list');
161
+ const charCount = document.getElementById('char-count');
162
+ const noteContent = document.getElementById('note-content');
163
+
164
+ // Tab switching
165
+ notesTab.addEventListener('click', () => {
166
+ notesSection.classList.remove('hidden');
167
+ historySection.classList.add('hidden');
168
+ notesTab.classList.add('bg-purple-600', 'text-white');
169
+ notesTab.classList.remove('text-gray-600', 'hover:bg-gray-100');
170
+ historyTab.classList.remove('bg-purple-600', 'text-white');
171
+ historyTab.classList.add('text-gray-600', 'hover:bg-gray-100');
172
+ });
173
+
174
+ historyTab.addEventListener('click', () => {
175
+ historySection.classList.remove('hidden');
176
+ notesSection.classList.add('hidden');
177
+ historyTab.classList.add('bg-purple-600', 'text-white');
178
+ historyTab.classList.remove('text-gray-600', 'hover:bg-gray-100');
179
+ notesTab.classList.remove('bg-purple-600', 'text-white');
180
+ notesTab.classList.add('text-gray-600', 'hover:bg-gray-100');
181
+ renderHistory();
182
+ });
183
+
184
+ // Character count
185
+ noteContent.addEventListener('input', () => {
186
+ charCount.textContent = `${noteContent.value.length} characters`;
187
+ });
188
+
189
+ // Save new note
190
+ noteForm.addEventListener('submit', (e) => {
191
+ e.preventDefault();
192
+ const title = document.getElementById('note-title').value;
193
+ const content = document.getElementById('note-content').value;
194
+
195
+ if (title.trim() && content.trim()) {
196
+ const newNote = {
197
+ id: Date.now(),
198
+ title: title.trim(),
199
+ content: content.trim(),
200
+ createdAt: new Date().toISOString(),
201
+ updatedAt: new Date().toISOString()
202
+ };
203
+
204
+ notes.unshift(newNote);
205
+ saveNotes();
206
+ addHistory('created', `Created note: "${title}"`);
207
+ renderNotes();
208
+ noteForm.reset();
209
+ charCount.textContent = '0 characters';
210
+ }
211
+ });
212
+
213
+ // Edit note
214
+ editForm.addEventListener('submit', (e) => {
215
+ e.preventDefault();
216
+ const id = parseInt(document.getElementById('edit-id').value);
217
+ const title = document.getElementById('edit-title').value;
218
+ const content = document.getElementById('edit-content').value;
219
+
220
+ if (title.trim() && content.trim()) {
221
+ const noteIndex = notes.findIndex(note => note.id === id);
222
+ if (noteIndex !== -1) {
223
+ const oldTitle = notes[noteIndex].title;
224
+ notes[noteIndex].title = title.trim();
225
+ notes[noteIndex].content = content.trim();
226
+ notes[noteIndex].updatedAt = new Date().toISOString();
227
+ saveNotes();
228
+ addHistory('updated', `Updated note: "${oldTitle}" to "${title}"`);
229
+ renderNotes();
230
+ closeModal();
231
+ }
232
+ }
233
+ });
234
+
235
+ // Modal controls
236
+ document.getElementById('close-modal').addEventListener('click', closeModal);
237
+ document.getElementById('cancel-edit').addEventListener('click', closeModal);
238
+
239
+ function openEditModal(note) {
240
+ document.getElementById('edit-id').value = note.id;
241
+ document.getElementById('edit-title').value = note.title;
242
+ document.getElementById('edit-content').value = note.content;
243
+ editModal.classList.remove('hidden');
244
+ }
245
+
246
+ function closeModal() {
247
+ editModal.classList.add('hidden');
248
+ }
249
+
250
+ // Delete note
251
+ function deleteNote(id) {
252
+ const note = notes.find(n => n.id === id);
253
+ if (note) {
254
+ notes = notes.filter(note => note.id !== id);
255
+ saveNotes();
256
+ addHistory('deleted', `Deleted note: "${note.title}"`);
257
+ renderNotes();
258
+ }
259
+ }
260
+
261
+ // Add history entry
262
+ function addHistory(action, description) {
263
+ const historyEntry = {
264
+ id: Date.now(),
265
+ action,
266
+ description,
267
+ timestamp: new Date().toISOString()
268
+ };
269
+ history.unshift(historyEntry);
270
+ localStorage.setItem('history', JSON.stringify(history));
271
+ }
272
+
273
+ // Save notes to localStorage
274
+ function saveNotes() {
275
+ localStorage.setItem('notes', JSON.stringify(notes));
276
+ }
277
+
278
+ // Render notes
279
+ function renderNotes() {
280
+ notesGrid.innerHTML = '';
281
+ notes.forEach(note => {
282
+ const noteElement = document.createElement('div');
283
+ noteElement.className = 'note-card glass-effect rounded-2xl p-6 shadow-lg border border-gray-100 hover:shadow-xl transition-all duration-300';
284
+ noteElement.innerHTML = `
285
+ <div class="flex justify-between items-start mb-3">
286
+ <h3 class="text-lg font-semibold text-gray-800 truncate">${note.title}</h3>
287
+ <div class="flex space-x-2">
288
+ <button onclick="openEditModal(${JSON.stringify(note).replace(/"/g, '&quot;')})" class="text-blue-600 hover:text-blue-800 transition-colors">
289
+ <i data-feather="edit-2" class="w-4 h-4"></i>
290
+ </button>
291
+ <button onclick="deleteNote(${note.id})" class="text-red-600 hover:text-red-800 transition-colors">
292
+ <i data-feather="trash-2" class="w-4 h-4"></i>
293
+ </button>
294
+ </div>
295
+ </div>
296
+ <p class="text-gray-600 text-sm mb-4 line-clamp-4">${note.content}</p>
297
+ <div class="text-xs text-gray-500 flex justify-between items-center">
298
+ <span>Created: ${new Date(note.createdAt).toLocaleDateString()}</span>
299
+ <span>Updated: ${new Date(note.updatedAt).toLocaleDateString()}</span>
300
+ </div>
301
+ `;
302
+ notesGrid.appendChild(noteElement);
303
+ });
304
+ feather.replace();
305
+ }
306
+
307
+ // Render history
308
+ function renderHistory() {
309
+ historyList.innerHTML = '';
310
+ history.forEach(entry => {
311
+ const historyElement = document.createElement('div');
312
+ historyElement.className = 'flex items-center space-x-4 p-4 bg-white rounded-xl shadow-sm border border-gray-100';
313
+
314
+ let icon = 'edit';
315
+ let color = 'text-blue-600';
316
+ if (entry.action === 'created') {
317
+ icon = 'plus';
318
+ color = 'text-green-600';
319
+ } else if (entry.action === 'deleted') {
320
+ icon = 'trash-2';
321
+ color = 'text-red-600';
322
+ }
323
+
324
+ historyElement.innerHTML = `
325
+ <div class="flex-shrink-0">
326
+ <i data-feather="${icon}" class="w-5 h-5 ${color}"></i>
327
+ </div>
328
+ <div class="flex-1">
329
+ <p class="text-gray-800">${entry.description}</p>
330
+ <p class="text-xs text-gray-500 mt-1">${new Date(entry.timestamp).toLocaleString()}</p>
331
+ </div>
332
+ `;
333
+ historyList.appendChild(historyElement);
334
+ });
335
+ feather.replace();
336
+ }
337
+
338
+ // Initialize
339
+ renderNotes();
340
+ feather.replace();
341
+ </script>
342
+ </body>
343
  </html>