bala41 commited on
Commit
5bd00e7
·
verified ·
1 Parent(s): 7342629

Add 2 files

Browse files
Files changed (2) hide show
  1. index.html +27 -37
  2. prompts.txt +3 -1
index.html CHANGED
@@ -207,6 +207,12 @@
207
  let items = JSON.parse(localStorage.getItem('kitchenStockItems')) || [];
208
  let recentItems = JSON.parse(localStorage.getItem('recentKitchenItems')) || [];
209
 
 
 
 
 
 
 
210
  // DOM Elements
211
  const itemsContainer = document.getElementById('itemsContainer');
212
  const emptyState = document.getElementById('emptyState');
@@ -352,11 +358,17 @@
352
  dateAdded: new Date().toISOString()
353
  };
354
 
 
355
  items.unshift(newItem);
356
- recentItems.unshift(newItem);
357
 
358
- if (recentItems.length > 5) {
359
- recentItems.pop();
 
 
 
 
 
 
360
  }
361
 
362
  saveItems();
@@ -383,43 +395,21 @@
383
  const itemId = restockItemId.value;
384
  const restockedItem = items[itemId];
385
 
386
- // Add to recent items before removing
387
- recentItems.unshift(restockedItem);
388
- if (recentItems.length > 5) {
389
- recentItems.pop();
390
- }
391
-
392
  items.splice(itemId, 1);
393
 
 
 
 
 
 
 
 
 
 
 
394
  saveItems();
395
  renderItems();
396
  updateStats();
397
- closeRestockModal();
398
- }
399
-
400
- // Filter items based on search input
401
- function filterItems() {
402
- const searchTerm = searchInput.value.toLowerCase();
403
- const filteredItems = items.filter(item =>
404
- item.name.toLowerCase().includes(searchTerm) ||
405
- item.category.toLowerCase().includes(searchTerm) ||
406
- (item.notes && item.notes.toLowerCase().includes(searchTerm))
407
- );
408
- renderItems(filteredItems);
409
- }
410
-
411
- // Update statistics
412
- function updateStats() {
413
- outOfStockCount.textContent = items.length;
414
- totalItemsCount.textContent = items.length; // Fixed: Now correctly shows only current out-of-stock items count
415
- recentItemsCount.textContent = recentItems.length;
416
- }
417
-
418
- // Save items to localStorage
419
- function saveItems() {
420
- localStorage.setItem('kitchenStockItems', JSON.stringify(items));
421
- localStorage.setItem('recentKitchenItems', JSON.stringify(recentItems));
422
- }
423
- </script>
424
- <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=bala41/kitchen" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
425
  </html>
 
207
  let items = JSON.parse(localStorage.getItem('kitchenStockItems')) || [];
208
  let recentItems = JSON.parse(localStorage.getItem('recentKitchenItems')) || [];
209
 
210
+ // Clear recent items if no items exist
211
+ if (items.length === 0) {
212
+ recentItems = [];
213
+ localStorage.setItem('recentKitchenItems', JSON.stringify(recentItems));
214
+ }
215
+
216
  // DOM Elements
217
  const itemsContainer = document.getElementById('itemsContainer');
218
  const emptyState = document.getElementById('emptyState');
 
358
  dateAdded: new Date().toISOString()
359
  };
360
 
361
+ // Add to items list
362
  items.unshift(newItem);
 
363
 
364
+ // Add to recent items (only if not already there)
365
+ if (!recentItems.some(item => item.name === newItem.name && item.dateAdded === newItem.dateAdded)) {
366
+ recentItems.unshift(newItem);
367
+
368
+ // Keep only the 5 most recent items
369
+ if (recentItems.length > 5) {
370
+ recentItems = recentItems.slice(0, 5);
371
+ }
372
  }
373
 
374
  saveItems();
 
395
  const itemId = restockItemId.value;
396
  const restockedItem = items[itemId];
397
 
398
+ // Remove from items list
 
 
 
 
 
399
  items.splice(itemId, 1);
400
 
401
+ // Add to recent items (only if not already there)
402
+ if (!recentItems.some(item => item.name === restockedItem.name && item.dateAdded === restockedItem.dateAdded)) {
403
+ recentItems.unshift(restockedItem);
404
+
405
+ // Keep only the 5 most recent items
406
+ if (recentItems.length > 5) {
407
+ recentItems = recentItems.slice(0, 5);
408
+ }
409
+ }
410
+
411
  saveItems();
412
  renderItems();
413
  updateStats();
414
+ closeRestock
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
415
  </html>
prompts.txt CHANGED
@@ -2,4 +2,6 @@ DeepSite LogoDeepSite | New Imagine and Share in 1-Click Load Space Space Ico
2
  bottons are not adding anything
3
  i dont have item but it is showing 1 out of stock item, and 2 total items
4
  after restocked everything, still it is showing 2 total items , correct that issue
5
- Total Items showing 2, eventhough no items present
 
 
 
2
  bottons are not adding anything
3
  i dont have item but it is showing 1 out of stock item, and 2 total items
4
  after restocked everything, still it is showing 2 total items , correct that issue
5
+ Total Items showing 2, eventhough no items present
6
+ Recently Added is showing 4 eventhough nothing s present, please correct it
7
+ after adding item and restock, Recently Added 2 is showing, please make it correct