Helleon commited on
Commit
ea31a97
·
verified ·
1 Parent(s): 674a068

çöp kutusuna kalıcı silme için buton ekle yukarı - Follow Up Deployment

Browse files
Files changed (1) hide show
  1. index.html +142 -2
index.html CHANGED
@@ -238,7 +238,7 @@
238
  <h3 class="text-lg font-bold text-primary mb-3">Dosya</h3>
239
  <ul class="space-y-2">
240
  <li>
241
- <a href="#" class="flex items-center text-gray-300 hover-text-primary">
242
  <i class="fas fa-inbox mr-3 text-primary"></i>
243
  <span>Gelen Kutusu</span>
244
  <span class="inbox-count ml-auto">12</span>
@@ -372,6 +372,33 @@
372
  </div>
373
  </div>
374
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
375
 
376
  <!-- Empty State -->
377
  <!-- <div class="bg-secondary rounded-lg p-8 text-center">
@@ -461,6 +488,36 @@
461
  }
462
  });
463
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
464
  // Move selected emails to trash
465
  function moveToTrash() {
466
  const selectedEmails = document.querySelectorAll('.email-item.selected');
@@ -562,10 +619,93 @@
562
  }
563
 
564
  trashEmails.forEach(email => {
565
- trashContainer.appendChild(email);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
566
  });
567
  }
568
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
569
  // Move selected emails to trash
570
  function moveToTrash() {
571
  const selectedEmails = document.querySelectorAll('.email-item.selected');
 
238
  <h3 class="text-lg font-bold text-primary mb-3">Dosya</h3>
239
  <ul class="space-y-2">
240
  <li>
241
+ <a href="#" onclick="goBackToInbox()" class="flex items-center text-gray-300 hover-text-primary">
242
  <i class="fas fa-inbox mr-3 text-primary"></i>
243
  <span>Gelen Kutusu</span>
244
  <span class="inbox-count ml-auto">12</span>
 
372
  </div>
373
  </div>
374
  </div>
375
+
376
+ <!-- Trash Container -->
377
+ <div id="trash-container" class="hidden bg-secondary rounded-lg overflow-hidden">
378
+ <div class="p-4 border-b border-gray-700 flex justify-between items-center">
379
+ <div class="flex items-center">
380
+ <button class="bg-dark hover:bg-gray-800 p-2 rounded mr-3" onclick="goBackToInbox()">
381
+ <i class="fas fa-arrow-left text-primary"></i>
382
+ </button>
383
+ <h2 class="text-lg font-bold text-primary">Çöp Kutusu</h2>
384
+ </div>
385
+ <div class="flex space-x-2">
386
+ <button id="select-all-trash" class="bg-dark hover:bg-gray-800 p-2 rounded">
387
+ <i class="fas fa-check-square text-primary" title="Select All"></i>
388
+ </button>
389
+ <button id="delete-selected-trash" class="bg-dark hover:bg-gray-800 p-2 rounded" onclick="emptyTrash()">
390
+ <i class="fas fa-trash text-accent"></i>
391
+ </button>
392
+ <button id="permanent-delete" class="bg-dark hover:bg-gray-800 p-2 rounded" onclick="permanentDelete()" title="Kalıcı Olarak Sil">
393
+ <i class="fas fa-skull text-red-500"></i>
394
+ </button>
395
+ </div>
396
+ </div>
397
+
398
+ <div id="trash-emails" class="divide-y divide-gray-700">
399
+ <!-- Trash emails will be rendered here -->
400
+ </div>
401
+ </div>
402
 
403
  <!-- Empty State -->
404
  <!-- <div class="bg-secondary rounded-lg p-8 text-center">
 
488
  }
489
  });
490
 
491
+ // Permanently delete selected emails
492
+ function permanentDelete() {
493
+ const selectedEmails = document.querySelectorAll('#trash-emails .email-item.selected');
494
+ const trashCount = document.getElementById('trash-count');
495
+
496
+ if (selectedEmails.length === 0) {
497
+ alert('Lütfen silmek istediğiniz e-postaları seçin.');
498
+ return;
499
+ }
500
+
501
+ if (!confirm('Seçili e-postaları kalıcı olarak silmek istediğinize emin misiniz? Bu işlem geri alınamaz!')) {
502
+ return;
503
+ }
504
+
505
+ selectedEmails.forEach(email => {
506
+ const index = Array.from(trashEmails).findIndex(e => e.isEqualNode(email));
507
+ if (index !== -1) {
508
+ trashEmails.splice(index, 1);
509
+ }
510
+ email.remove();
511
+ });
512
+
513
+ // Update trash count
514
+ const newCount = trashEmails.length;
515
+ trashCount.textContent = newCount;
516
+ if (newCount === 0) {
517
+ trashCount.classList.add('hidden');
518
+ }
519
+ }
520
+
521
  // Move selected emails to trash
522
  function moveToTrash() {
523
  const selectedEmails = document.querySelectorAll('.email-item.selected');
 
619
  }
620
 
621
  trashEmails.forEach(email => {
622
+ // Clone the email to avoid modifying the original
623
+ const clonedEmail = email.cloneNode(true);
624
+
625
+ // Add click event for expanding emails
626
+ clonedEmail.addEventListener('click', function() {
627
+ const content = this.querySelector('.email-content');
628
+ content.classList.toggle('open');
629
+ });
630
+
631
+ // Add checkbox functionality
632
+ const checkbox = clonedEmail.querySelector('input[type="checkbox"]');
633
+ if (checkbox) {
634
+ checkbox.addEventListener('click', function(e) {
635
+ e.stopPropagation();
636
+ if (this.checked) {
637
+ clonedEmail.classList.add('selected');
638
+ } else {
639
+ clonedEmail.classList.remove('selected');
640
+ }
641
+ });
642
+ }
643
+
644
+ trashContainer.appendChild(clonedEmail);
645
  });
646
  }
647
 
648
+ // Empty trash functionality
649
+ function emptyTrash() {
650
+ const selectedEmails = document.querySelectorAll('#trash-emails .email-item.selected');
651
+ const trashCount = document.getElementById('trash-count');
652
+
653
+ if (selectedEmails.length === 0) {
654
+ // If nothing selected, confirm emptying entire trash
655
+ if (confirm('Tüm çöp kutusunu boşaltmak istediğinize emin misiniz?')) {
656
+ trashEmails.length = 0;
657
+ trashCount.textContent = '0';
658
+ trashCount.classList.add('hidden');
659
+ renderTrashEmails();
660
+ }
661
+ return;
662
+ }
663
+
664
+ // Remove selected emails from trash
665
+ selectedEmails.forEach(email => {
666
+ const index = Array.from(trashEmails).findIndex(e => e.isEqualNode(email));
667
+ if (index !== -1) {
668
+ trashEmails.splice(index, 1);
669
+ }
670
+ });
671
+
672
+ // Update trash count
673
+ const newCount = trashEmails.length;
674
+ trashCount.textContent = newCount;
675
+ if (newCount === 0) {
676
+ trashCount.classList.add('hidden');
677
+ }
678
+
679
+ renderTrashEmails();
680
+ }
681
+
682
+ // Select all in trash
683
+ document.getElementById('select-all-trash')?.addEventListener('click', function(e) {
684
+ e.stopPropagation();
685
+ const checkboxes = document.querySelectorAll('#trash-emails .email-item input[type="checkbox"]');
686
+ const anyUnchecked = Array.from(checkboxes).some(checkbox => !checkbox.checked);
687
+
688
+ checkboxes.forEach(checkbox => {
689
+ checkbox.checked = anyUnchecked;
690
+ const emailItem = checkbox.closest('.email-item');
691
+ if (anyUnchecked) {
692
+ emailItem.classList.add('selected');
693
+ } else {
694
+ emailItem.classList.remove('selected');
695
+ }
696
+ });
697
+
698
+ // Change icon based on selection state
699
+ const icon = this.querySelector('i');
700
+ if (anyUnchecked) {
701
+ icon.classList.remove('fa-check-square');
702
+ icon.classList.add('fa-minus-square');
703
+ } else {
704
+ icon.classList.remove('fa-minus-square');
705
+ icon.classList.add('fa-check-square');
706
+ }
707
+ });
708
+
709
  // Move selected emails to trash
710
  function moveToTrash() {
711
  const selectedEmails = document.querySelectorAll('.email-item.selected');