1
1
<script setup lang="ts">
2
- import { ref , computed , onMounted , watch } from ' vue'
2
+ import { ref , computed , onMounted , onUnmounted , watch } from ' vue'
3
3
import { useHead } from ' @vueuse/head'
4
+ import { useRoute } from ' vue-router'
4
5
import EmailSidebar from ' ../../../components/Dashboard/Email/EmailSidebar.vue'
5
6
6
7
useHead ({
@@ -412,6 +413,18 @@ const sendEmail = () => {
412
413
// Initial load
413
414
onMounted (async () => {
414
415
isLoading .value = true
416
+
417
+ // Check for folder in query params
418
+ const route = useRoute ()
419
+ if (route .query .folder && typeof route .query .folder === ' string' ) {
420
+ activeFolder .value = route .query .folder
421
+ }
422
+
423
+ // Check for compose in query params
424
+ if (route .query .compose === ' true' ) {
425
+ isComposing .value = true
426
+ }
427
+
415
428
await new Promise (resolve => setTimeout (resolve , 500 ))
416
429
isLoading .value = false
417
430
})
@@ -431,6 +444,43 @@ const handleFolderChange = (folder: string) => {
431
444
const handleCompose = () => {
432
445
isComposing .value = true
433
446
}
447
+
448
+ // Add refresh functionality
449
+ const isRefreshing = ref (false )
450
+ const refreshEmails = async () => {
451
+ isRefreshing .value = true
452
+ // Simulate API call
453
+ await new Promise (resolve => setTimeout (resolve , 1000 ))
454
+ isRefreshing .value = false
455
+ }
456
+
457
+ // Add dropdown menu state
458
+ const showMoreMenu = ref (false )
459
+ const dropdownRef = ref <HTMLElement | null >(null )
460
+
461
+ const toggleMoreMenu = (event : MouseEvent ) => {
462
+ event .stopPropagation ()
463
+ showMoreMenu .value = ! showMoreMenu .value
464
+
465
+ if (showMoreMenu .value ) {
466
+ // Add event listener when dropdown is opened
467
+ setTimeout (() => {
468
+ document .addEventListener (' click' , handleClickOutside )
469
+ }, 0 )
470
+ }
471
+ }
472
+
473
+ const handleClickOutside = (event : MouseEvent ) => {
474
+ if (dropdownRef .value && ! dropdownRef .value .contains (event .target as Node )) {
475
+ showMoreMenu .value = false
476
+ document .removeEventListener (' click' , handleClickOutside )
477
+ }
478
+ }
479
+
480
+ // Clean up event listener when component is unmounted
481
+ onUnmounted (() => {
482
+ document .removeEventListener (' click' , handleClickOutside )
483
+ })
434
484
</script >
435
485
436
486
<template >
@@ -472,17 +522,38 @@ const handleCompose = () => {
472
522
<!-- Email list -->
473
523
<div v-if =" !selectedEmail || !isComposing" class =" w-full md:w-1/3 lg:w-2/5 border-r border-gray-200 dark:border-blue-gray-600 flex flex-col" >
474
524
<div class =" bg-white dark:bg-blue-gray-700 py-2 px-4 border-b border-gray-200 dark:border-blue-gray-600 flex items-center justify-between" >
475
- <div class =" flex items-center justify-between " >
476
- < h2 class = " text-lg font-medium text-gray-900 dark:text-gray-100 " >
477
- {{ folders.find(f => f.id === activeFolder)?.name || 'All Mail' }}
478
- </ h2 >
479
- <div class =" flex space-x-2 " >
480
- <button class =" p-1 rounded hover:bg -gray-100 dark:hover:bg-blue- gray-600 " >
481
- < i class = " i-hugeicons-refresh text-gray-500 dark:text-gray-400 text-lg " ></ i >
482
- </ button >
483
- <button class =" p-1 rounded hover:bg-gray-100 dark:hover:bg-blue-gray-600" >
525
+ <h2 class =" text-lg font-medium text-gray-900 dark:text-gray-100 " >
526
+ {{ folders.find(f => f.id === activeFolder)?.name || 'All Mail' }}
527
+ </ h2 >
528
+ < div class = " flex space-x-2 " >
529
+ <button @click = " refreshEmails " class =" p-1 rounded hover:bg-gray-100 dark:hover:bg-blue-gray-600 " >
530
+ <i class =" i-hugeicons-refresh text -gray-500 dark:text- gray-400 text-lg " :class = " { 'animate-spin': isRefreshing } " ></ i >
531
+ </ button >
532
+ < div class = " relative " >
533
+ <button @click = " toggleMoreMenu " class =" p-1 rounded hover:bg-gray-100 dark:hover:bg-blue-gray-600" >
484
534
<i class =" i-hugeicons-more-vertical-circle-01 text-gray-500 dark:text-gray-400 text-lg" ></i >
485
535
</button >
536
+ <!-- Dropdown menu -->
537
+ <div
538
+ v-if =" showMoreMenu"
539
+ ref =" dropdownRef"
540
+ class =" absolute right-0 mt-2 w-48 rounded-md shadow-lg bg-white dark:bg-blue-gray-600 ring-1 ring-black ring-opacity-5 z-10"
541
+ >
542
+ <div class =" py-1" role =" menu" aria-orientation =" vertical" aria-labelledby =" options-menu" >
543
+ <a href =" /inbox/activity" class =" block px-4 py-2 text-sm text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-blue-gray-700" role =" menuitem" >
544
+ <div class =" flex items-center" >
545
+ <i class =" i-hugeicons-chart-bar-01 text-lg mr-2" ></i >
546
+ Analytics
547
+ </div >
548
+ </a >
549
+ <a href =" #" class =" block px-4 py-2 text-sm text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-blue-gray-700" role =" menuitem" >
550
+ <div class =" flex items-center" >
551
+ <i class =" i-hugeicons-settings-01 text-lg mr-2" ></i >
552
+ Settings
553
+ </div >
554
+ </a >
555
+ </div >
556
+ </div >
486
557
</div >
487
558
</div >
488
559
</div >
0 commit comments