souliya_pps commited on
Commit
0d8d29b
·
1 Parent(s): 893b05c

Add clear all favorites button on /favorites page, mobile drawer, and bottom nav More menu

Browse files
views/layouts/main.php CHANGED
@@ -833,7 +833,12 @@
833
  <?php endif; ?>
834
  <?= $item['label'] ?>
835
  </a>
836
- <?php endforeach; ?>
 
 
 
 
 
837
  </div>
838
  </div>
839
  </div>
@@ -898,6 +903,11 @@
898
  <?= $item['label'] ?>
899
  </a>
900
  <?php endforeach; ?>
 
 
 
 
 
901
  </div>
902
  </div>
903
  <?php endif; ?>
 
833
  <?php endif; ?>
834
  <?= $item['label'] ?>
835
  </a>
836
+ <?php endforeach; ?>
837
+ <hr class="mx-2 my-2 border-gray-100">
838
+ <button @click="if(confirm('ຕ້ອງການລ້າງລາຍການທີ່ຖືກໃຈທັງໝົດ?')) { localStorage.setItem('buddhaword_favorites', '[]'); isMenuOpen = false; window.dispatchEvent(new CustomEvent('sync-complete')); }" class="flex items-center gap-4 py-3 sm:py-4 border-b px-2 rounded-xl w-full text-left transition-colors hover:bg-red-50 text-red-600">
839
+ <svg xmlns="http://www.w3.org/2000/svg" class="w-8 h-8 sm:w-10 sm:h-10" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" /></svg>
840
+ ລ້າງຖືກໃຈ
841
+ </button>
842
  </div>
843
  </div>
844
  </div>
 
903
  <?= $item['label'] ?>
904
  </a>
905
  <?php endforeach; ?>
906
+ <hr class="mx-2 my-1 border-gray-100">
907
+ <button @click="if(confirm('ຕ້ອງການລ້າງລາຍການທີ່ຖືກໃຈທັງໝົດ?')) { localStorage.setItem('buddhaword_favorites', '[]'); showMore = false; window.dispatchEvent(new CustomEvent('sync-complete')); }" class="flex items-center gap-2 px-4 py-2.5 text-sm text-red-600 hover:bg-red-50 w-full text-left transition-colors Lao-font">
908
+ <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" /></svg>
909
+ ລ້າງຖືກໃຈ
910
+ </button>
911
  </div>
912
  </div>
913
  <?php endif; ?>
views/pages/favorites.php CHANGED
@@ -2,6 +2,14 @@
2
  <h1 class="text-xl sm:text-2xl font-bold text-[#795548] mb-6 bg-white/80 px-4 py-2 rounded-xl shadow-sm Lao-font">ລາຍການທີ່ຖືກໃຈ</h1>
3
 
4
  <div class="flex flex-col gap-3 sm:gap-4 w-full max-w-4xl">
 
 
 
 
 
 
 
 
5
  <template x-if="favorites.length === 0">
6
  <div class="text-center py-16 sm:py-20 bg-white/50 backdrop-blur-sm rounded-2xl sm:rounded-3xl border border-white/20">
7
  <svg xmlns="http://www.w3.org/2000/svg" class="h-12 w-12 sm:h-16 sm:w-16 text-gray-300 mx-auto mb-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
 
2
  <h1 class="text-xl sm:text-2xl font-bold text-[#795548] mb-6 bg-white/80 px-4 py-2 rounded-xl shadow-sm Lao-font">ລາຍການທີ່ຖືກໃຈ</h1>
3
 
4
  <div class="flex flex-col gap-3 sm:gap-4 w-full max-w-4xl">
5
+ <template x-if="favorites.length > 0">
6
+ <div class="flex justify-end">
7
+ <button @click="if(confirm('ຕ້ອງການລ້າງລາຍການທີ່ຖືກໃຈທັງໝົດ?')) { favorites = []; localStorage.setItem('buddhaword_favorites', '[]'); window.dispatchEvent(new CustomEvent('sync-complete')); }" class="flex items-center gap-1.5 px-3 py-1.5 text-sm text-red-600 bg-red-50 hover:bg-red-100 rounded-xl transition-colors Lao-font">
8
+ <svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" /></svg>
9
+ ລ້າງທັງໝົດ
10
+ </button>
11
+ </div>
12
+ </template>
13
  <template x-if="favorites.length === 0">
14
  <div class="text-center py-16 sm:py-20 bg-white/50 backdrop-blur-sm rounded-2xl sm:rounded-3xl border border-white/20">
15
  <svg xmlns="http://www.w3.org/2000/svg" class="h-12 w-12 sm:h-16 sm:w-16 text-gray-300 mx-auto mb-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">