trenesky commited on
Commit
550f82a
·
verified ·
1 Parent(s): 853f10c

remove calendar dates notes - remain simple as it is for tasks only - Follow Up Deployment

Browse files
Files changed (1) hide show
  1. index.html +33 -29
index.html CHANGED
@@ -169,9 +169,39 @@
169
  Added by ${item.userName || 'Anonymous'} on ${dateText || '...'}
170
  </div>
171
  </div>
172
- <button class="delete-btn p-2 text-red-500 hover:bg-red-50 dark:hover:bg-gray-700 rounded-full opacity-100 md:opacity-0 md:group-hover:opacity-100 transition active:scale-95">
173
- <i data-feather="trash-2" class="w-4 h-4"></i>
174
- </button>`;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
175
  }
176
 
177
  // Delete button
@@ -180,32 +210,6 @@
180
  catch (err) { console.error("Error deleting item:", err); }
181
  });
182
 
183
- // Enable editing on tap
184
- const textSpan = li.querySelector(".note-text");
185
- textSpan.addEventListener("click", () => {
186
- const input = document.createElement("input");
187
- input.type = "text";
188
- input.value = textSpan.textContent;
189
- input.className = "w-full p-1 rounded bg-gray-100 dark:bg-gray-700 border border-gray-300 dark:border-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500";
190
-
191
- textSpan.replaceWith(input);
192
- input.focus();
193
-
194
- const saveEdit = async () => {
195
- const newText = input.value.trim();
196
- if (newText && newText !== item.text) {
197
- try {
198
- await updateDoc(doc(db, "notes", item.id), { text: newText });
199
- } catch (err) { console.error("Error updating text:", err); }
200
- }
201
- input.replaceWith(textSpan);
202
- textSpan.textContent = newText || item.text;
203
- };
204
-
205
- input.addEventListener("blur", saveEdit);
206
- input.addEventListener("keypress", (e) => { if (e.key === "Enter") saveEdit(); });
207
- });
208
-
209
  itemsList.appendChild(li);
210
  }
211
 
 
169
  Added by ${item.userName || 'Anonymous'} on ${dateText || '...'}
170
  </div>
171
  </div>
172
+ <div class="flex gap-2">
173
+ <button class="edit-btn p-2 text-blue-500 hover:bg-blue-50 dark:hover:bg-gray-700 rounded-full transition active:scale-95">
174
+ <i data-feather="edit-3" class="w-4 h-4"></i>
175
+ </button>
176
+ <button class="delete-btn p-2 text-red-500 hover:bg-red-50 dark:hover:bg-gray-700 rounded-full transition active:scale-95">
177
+ <i data-feather="trash-2" class="w-4 h-4"></i>
178
+ </button>
179
+ </div>`;
180
+
181
+ // Edit button
182
+ li.querySelector(".edit-btn").addEventListener("click", () => {
183
+ const textSpan = li.querySelector(".note-text");
184
+ const input = document.createElement("input");
185
+ input.type = "text";
186
+ input.value = textSpan.textContent;
187
+ input.className = "w-full p-1 rounded bg-gray-100 dark:bg-gray-700 border border-gray-300 dark:border-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500";
188
+
189
+ textSpan.replaceWith(input);
190
+ input.focus();
191
+
192
+ const saveEdit = async () => {
193
+ const newText = input.value.trim();
194
+ if (newText && newText !== item.text) {
195
+ try { await updateDoc(doc(db, "notes", item.id), { text: newText }); }
196
+ catch (err) { console.error("Error updating note:", err); }
197
+ }
198
+ input.replaceWith(textSpan);
199
+ textSpan.textContent = newText || item.text;
200
+ };
201
+
202
+ input.addEventListener("blur", saveEdit);
203
+ input.addEventListener("keypress", (e) => { if (e.key === "Enter") saveEdit(); });
204
+ });
205
  }
206
 
207
  // Delete button
 
210
  catch (err) { console.error("Error deleting item:", err); }
211
  });
212
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
213
  itemsList.appendChild(li);
214
  }
215