trenesky commited on
Commit
bafc7d2
·
verified ·
1 Parent(s): a023ce0

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 +5 -11
index.html CHANGED
@@ -77,8 +77,7 @@
77
 
78
  const tabTasks = document.getElementById('tab-tasks');
79
  const tabNotes = document.getElementById('tab-notes');
80
-
81
- let currentTab = 'tasks'; // default
82
 
83
  // Load stored name
84
  const storedName = localStorage.getItem('sharedNotesUserName');
@@ -126,7 +125,7 @@
126
  addItemBtn.addEventListener('click', addItem);
127
  itemInput.addEventListener('keypress', (e) => { if (e.key === 'Enter') addItem(); });
128
 
129
- // Render item with edit support
130
  function renderItem(item) {
131
  const li = document.createElement("li");
132
  li.className = "note-item flex items-center justify-between p-4 bg-white dark:bg-gray-800 rounded-lg shadow-sm hover:shadow-md transition-all group";
@@ -154,7 +153,6 @@
154
  <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">
155
  <i data-feather="trash-2" class="w-4 h-4"></i>
156
  </button>`;
157
-
158
  li.querySelector(".done-checkbox").addEventListener("change", async (e) => {
159
  try { await updateDoc(doc(db, "notes", item.id), { done: e.target.checked }); }
160
  catch (err) { console.error("Error updating task:", err); }
@@ -176,17 +174,14 @@
176
  <i data-feather="trash-2" class="w-4 h-4"></i>
177
  </button>
178
  </div>`;
179
-
180
  li.querySelector(".edit-btn").addEventListener("click", () => {
181
  const textSpan = li.querySelector(".note-text");
182
  const input = document.createElement("input");
183
  input.type = "text";
184
  input.value = textSpan.textContent;
185
  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";
186
-
187
  textSpan.replaceWith(input);
188
  input.focus();
189
-
190
  const saveEdit = async () => {
191
  const newText = input.value.trim();
192
  if (newText && newText !== item.text) {
@@ -196,7 +191,6 @@
196
  input.replaceWith(textSpan);
197
  textSpan.textContent = newText || item.text;
198
  };
199
-
200
  input.addEventListener("blur", saveEdit);
201
  input.addEventListener("keypress", (e) => { if (e.key === "Enter") saveEdit(); });
202
  });
@@ -210,7 +204,7 @@
210
  itemsList.appendChild(li);
211
  }
212
 
213
- // Load items based on tab
214
  function loadItems(type) {
215
  itemsList.innerHTML = '<div class="text-center py-8"><div class="inline-block animate-spin h-8 w-8 border-t-2 border-b-2 border-blue-500 rounded-full"></div><p class="mt-2 text-gray-500">Loading...</p></div>';
216
  const q = query(collection(db, "notes"), where("type","==",type), orderBy("createdAt","asc"));
@@ -229,7 +223,7 @@
229
  // Tab switching
230
  tabTasks.addEventListener('click', () => {
231
  currentTab = 'tasks';
232
- tabTasks.classList.add('bg-blue-500', 'text-white');
233
  tabTasks.classList.remove('bg-gray-300','dark:bg-gray-700','text-gray-800','dark:text-gray-100');
234
  tabNotes.classList.add('bg-gray-300','dark:bg-gray-700','text-gray-800','dark:text-gray-100');
235
  tabNotes.classList.remove('bg-blue-500','text-white');
@@ -237,7 +231,7 @@
237
  });
238
  tabNotes.addEventListener('click', () => {
239
  currentTab = 'notes';
240
- tabNotes.classList.add('bg-blue-500', 'text-white');
241
  tabNotes.classList.remove('bg-gray-300','dark:bg-gray-700','text-gray-800','dark:text-gray-100');
242
  tabTasks.classList.add('bg-gray-300','dark:bg-gray-700','text-gray-800','dark:text-gray-100');
243
  tabTasks.classList.remove('bg-blue-500','text-white');
 
77
 
78
  const tabTasks = document.getElementById('tab-tasks');
79
  const tabNotes = document.getElementById('tab-notes');
80
+ let currentTab = 'tasks';
 
81
 
82
  // Load stored name
83
  const storedName = localStorage.getItem('sharedNotesUserName');
 
125
  addItemBtn.addEventListener('click', addItem);
126
  itemInput.addEventListener('keypress', (e) => { if (e.key === 'Enter') addItem(); });
127
 
128
+ // Render item
129
  function renderItem(item) {
130
  const li = document.createElement("li");
131
  li.className = "note-item flex items-center justify-between p-4 bg-white dark:bg-gray-800 rounded-lg shadow-sm hover:shadow-md transition-all group";
 
153
  <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">
154
  <i data-feather="trash-2" class="w-4 h-4"></i>
155
  </button>`;
 
156
  li.querySelector(".done-checkbox").addEventListener("change", async (e) => {
157
  try { await updateDoc(doc(db, "notes", item.id), { done: e.target.checked }); }
158
  catch (err) { console.error("Error updating task:", err); }
 
174
  <i data-feather="trash-2" class="w-4 h-4"></i>
175
  </button>
176
  </div>`;
 
177
  li.querySelector(".edit-btn").addEventListener("click", () => {
178
  const textSpan = li.querySelector(".note-text");
179
  const input = document.createElement("input");
180
  input.type = "text";
181
  input.value = textSpan.textContent;
182
  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";
 
183
  textSpan.replaceWith(input);
184
  input.focus();
 
185
  const saveEdit = async () => {
186
  const newText = input.value.trim();
187
  if (newText && newText !== item.text) {
 
191
  input.replaceWith(textSpan);
192
  textSpan.textContent = newText || item.text;
193
  };
 
194
  input.addEventListener("blur", saveEdit);
195
  input.addEventListener("keypress", (e) => { if (e.key === "Enter") saveEdit(); });
196
  });
 
204
  itemsList.appendChild(li);
205
  }
206
 
207
+ // Load items
208
  function loadItems(type) {
209
  itemsList.innerHTML = '<div class="text-center py-8"><div class="inline-block animate-spin h-8 w-8 border-t-2 border-b-2 border-blue-500 rounded-full"></div><p class="mt-2 text-gray-500">Loading...</p></div>';
210
  const q = query(collection(db, "notes"), where("type","==",type), orderBy("createdAt","asc"));
 
223
  // Tab switching
224
  tabTasks.addEventListener('click', () => {
225
  currentTab = 'tasks';
226
+ tabTasks.classList.add('bg-blue-500','text-white');
227
  tabTasks.classList.remove('bg-gray-300','dark:bg-gray-700','text-gray-800','dark:text-gray-100');
228
  tabNotes.classList.add('bg-gray-300','dark:bg-gray-700','text-gray-800','dark:text-gray-100');
229
  tabNotes.classList.remove('bg-blue-500','text-white');
 
231
  });
232
  tabNotes.addEventListener('click', () => {
233
  currentTab = 'notes';
234
+ tabNotes.classList.add('bg-blue-500','text-white');
235
  tabNotes.classList.remove('bg-gray-300','dark:bg-gray-700','text-gray-800','dark:text-gray-100');
236
  tabTasks.classList.add('bg-gray-300','dark:bg-gray-700','text-gray-800','dark:text-gray-100');
237
  tabTasks.classList.remove('bg-blue-500','text-white');