Helleon commited on
Commit
715a69a
·
verified ·
1 Parent(s): ea31a97

şimdi mail geldiğinde bir bildirim sesi koy - Follow Up Deployment

Browse files
Files changed (1) hide show
  1. index.html +165 -4
index.html CHANGED
@@ -245,9 +245,10 @@
245
  </a>
246
  </li>
247
  <li>
248
- <a href="#" class="flex items-center text-gray-300 hover-text-secondary">
249
  <i class="fas fa-star mr-3 text-secondary"></i>
250
  <span>Yıldız</span>
 
251
  </a>
252
  </li>
253
  <li>
@@ -373,6 +374,30 @@
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">
@@ -539,14 +564,43 @@
539
  btn.addEventListener('click', function(e) {
540
  e.stopPropagation();
541
  const icon = this.querySelector('i');
 
 
 
542
  if (icon.classList.contains('far')) {
 
543
  icon.classList.remove('far');
544
  icon.classList.add('fas', 'text-yellow-400');
545
- // Optional: Move to starred folder or mark in database
 
 
 
 
 
 
 
546
  } else {
 
547
  icon.classList.remove('fas', 'text-yellow-400');
548
  icon.classList.add('far');
549
- // Optional: Remove from starred folder or update in database
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
550
  }
551
  });
552
  });
@@ -587,8 +641,114 @@
587
  }
588
  }, 10000); // Check every 10 seconds
589
 
590
- // Trash functionality
591
  const trashEmails = [];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
592
 
593
  // Show trash container when clicking trash link
594
  document.getElementById('trash-link').addEventListener('click', function(e) {
@@ -600,6 +760,7 @@
600
 
601
  function goBackToInbox() {
602
  document.getElementById('trash-container').classList.add('hidden');
 
603
  document.querySelector('main > div').classList.remove('hidden');
604
  }
605
 
 
245
  </a>
246
  </li>
247
  <li>
248
+ <a href="#starred" id="starred-link" class="flex items-center text-gray-300 hover-text-secondary">
249
  <i class="fas fa-star mr-3 text-secondary"></i>
250
  <span>Yıldız</span>
251
+ <span id="starred-count" class="inbox-count ml-auto hidden">0</span>
252
  </a>
253
  </li>
254
  <li>
 
374
  </div>
375
  </div>
376
 
377
+ <!-- Starred Container -->
378
+ <div id="starred-container" class="hidden bg-secondary rounded-lg overflow-hidden">
379
+ <div class="p-4 border-b border-gray-700 flex justify-between items-center">
380
+ <div class="flex items-center">
381
+ <button class="bg-dark hover:bg-gray-800 p-2 rounded mr-3" onclick="goBackToInbox()">
382
+ <i class="fas fa-arrow-left text-primary"></i>
383
+ </button>
384
+ <h2 class="text-lg font-bold text-secondary">Yıldızlı E-postalar</h2>
385
+ </div>
386
+ <div class="flex space-x-2">
387
+ <button id="select-all-starred" class="bg-dark hover:bg-gray-800 p-2 rounded">
388
+ <i class="fas fa-check-square text-primary" title="Select All"></i>
389
+ </button>
390
+ <button id="delete-selected-starred" class="bg-dark hover:bg-gray-800 p-2 rounded" onclick="moveToTrashFromStarred()">
391
+ <i class="fas fa-trash text-accent"></i>
392
+ </button>
393
+ </div>
394
+ </div>
395
+
396
+ <div id="starred-emails" class="divide-y divide-gray-700">
397
+ <!-- Starred emails will be rendered here -->
398
+ </div>
399
+ </div>
400
+
401
  <!-- Trash Container -->
402
  <div id="trash-container" class="hidden bg-secondary rounded-lg overflow-hidden">
403
  <div class="p-4 border-b border-gray-700 flex justify-between items-center">
 
564
  btn.addEventListener('click', function(e) {
565
  e.stopPropagation();
566
  const icon = this.querySelector('i');
567
+ const emailItem = this.closest('.email-item');
568
+ const starredCount = document.getElementById('starred-count');
569
+
570
  if (icon.classList.contains('far')) {
571
+ // Star the email
572
  icon.classList.remove('far');
573
  icon.classList.add('fas', 'text-yellow-400');
574
+
575
+ // Add to starred collection
576
+ starredEmails.push(emailItem.cloneNode(true));
577
+
578
+ // Update count
579
+ const currentCount = parseInt(starredCount.textContent) || 0;
580
+ starredCount.textContent = currentCount + 1;
581
+ starredCount.classList.remove('hidden');
582
  } else {
583
+ // Unstar the email
584
  icon.classList.remove('fas', 'text-yellow-400');
585
  icon.classList.add('far');
586
+
587
+ // Remove from starred collection
588
+ const index = Array.from(starredEmails).findIndex(e => e.isEqualNode(emailItem));
589
+ if (index !== -1) {
590
+ starredEmails.splice(index, 1);
591
+ }
592
+
593
+ // Update count
594
+ const newCount = starredEmails.length;
595
+ starredCount.textContent = newCount;
596
+ if (newCount === 0) {
597
+ starredCount.classList.add('hidden');
598
+ }
599
+
600
+ // If viewing starred emails, re-render
601
+ if (!document.getElementById('starred-container').classList.contains('hidden')) {
602
+ renderStarredEmails();
603
+ }
604
  }
605
  });
606
  });
 
641
  }
642
  }, 10000); // Check every 10 seconds
643
 
644
+ // Email collections
645
  const trashEmails = [];
646
+ const starredEmails = [];
647
+
648
+ // Show starred container when clicking starred link
649
+ document.getElementById('starred-link').addEventListener('click', function(e) {
650
+ e.preventDefault();
651
+ document.querySelector('main > div').classList.add('hidden');
652
+ document.getElementById('starred-container').classList.remove('hidden');
653
+ renderStarredEmails();
654
+ });
655
+
656
+ function renderStarredEmails() {
657
+ const starredContainer = document.getElementById('starred-emails');
658
+ starredContainer.innerHTML = '';
659
+
660
+ if (starredEmails.length === 0) {
661
+ starredContainer.innerHTML = `
662
+ <div class="p-8 text-center">
663
+ <i class="fas fa-star text-4xl text-gray-500 mb-4"></i>
664
+ <h3 class="text-xl font-bold text-gray-400 mb-2">Yıldızlı e-posta yok</h3>
665
+ <p class="text-gray-500">Yıldızladığınız e-postalar burada görüntülenecek</p>
666
+ </div>
667
+ `;
668
+ return;
669
+ }
670
+
671
+ starredEmails.forEach(email => {
672
+ const clonedEmail = email.cloneNode(true);
673
+
674
+ clonedEmail.addEventListener('click', function() {
675
+ const content = this.querySelector('.email-content');
676
+ content.classList.toggle('open');
677
+ });
678
+
679
+ const checkbox = clonedEmail.querySelector('input[type="checkbox"]');
680
+ if (checkbox) {
681
+ checkbox.addEventListener('click', function(e) {
682
+ e.stopPropagation();
683
+ if (this.checked) {
684
+ clonedEmail.classList.add('selected');
685
+ } else {
686
+ clonedEmail.classList.remove('selected');
687
+ }
688
+ });
689
+ }
690
+
691
+ starredContainer.appendChild(clonedEmail);
692
+ });
693
+ }
694
+
695
+ // Move selected emails from starred to trash
696
+ function moveToTrashFromStarred() {
697
+ const selectedEmails = document.querySelectorAll('#starred-emails .email-item.selected');
698
+ const starredCount = document.getElementById('starred-count');
699
+ const trashCount = document.getElementById('trash-count');
700
+
701
+ selectedEmails.forEach(email => {
702
+ const index = Array.from(starredEmails).findIndex(e => e.isEqualNode(email));
703
+ if (index !== -1) {
704
+ // Add to trash
705
+ trashEmails.push(starredEmails[index]);
706
+ // Remove from starred
707
+ starredEmails.splice(index, 1);
708
+ }
709
+
710
+ // Update counts
711
+ const newStarredCount = starredEmails.length;
712
+ starredCount.textContent = newStarredCount;
713
+ if (newStarredCount === 0) {
714
+ starredCount.classList.add('hidden');
715
+ }
716
+
717
+ const newTrashCount = parseInt(trashCount.textContent) || 0;
718
+ trashCount.textContent = newTrashCount + 1;
719
+ trashCount.classList.remove('hidden');
720
+ });
721
+
722
+ renderStarredEmails();
723
+ }
724
+
725
+ // Select all in starred
726
+ document.getElementById('select-all-starred')?.addEventListener('click', function(e) {
727
+ e.stopPropagation();
728
+ const checkboxes = document.querySelectorAll('#starred-emails .email-item input[type="checkbox"]');
729
+ const anyUnchecked = Array.from(checkboxes).some(checkbox => !checkbox.checked);
730
+
731
+ checkboxes.forEach(checkbox => {
732
+ checkbox.checked = anyUnchecked;
733
+ const emailItem = checkbox.closest('.email-item');
734
+ if (anyUnchecked) {
735
+ emailItem.classList.add('selected');
736
+ } else {
737
+ emailItem.classList.remove('selected');
738
+ }
739
+ });
740
+
741
+ const icon = this.querySelector('i');
742
+ if (anyUnchecked) {
743
+ icon.classList.remove('fa-check-square');
744
+ icon.classList.add('fa-minus-square');
745
+ } else {
746
+ icon.classList.remove('fa-minus-square');
747
+ icon.classList.add('fa-check-square');
748
+ }
749
+ });
750
+
751
+ // Trash functionality
752
 
753
  // Show trash container when clicking trash link
754
  document.getElementById('trash-link').addEventListener('click', function(e) {
 
760
 
761
  function goBackToInbox() {
762
  document.getElementById('trash-container').classList.add('hidden');
763
+ document.getElementById('starred-container').classList.add('hidden');
764
  document.querySelector('main > div').classList.remove('hidden');
765
  }
766