1
1
<script setup lang="ts">
2
2
import { ref , computed , onMounted } from ' vue'
3
3
import { useHead } from ' @vueuse/head'
4
+ import { useRouter } from ' vue-router'
4
5
import { Line , Bar , Doughnut } from ' vue-chartjs'
5
6
import {
6
7
Chart as ChartJS ,
@@ -35,6 +36,8 @@ useHead({
35
36
title: ' Mail - Activity Dashboard' ,
36
37
})
37
38
39
+ const router = useRouter ()
40
+
38
41
// Time range state
39
42
const timeRange = ref <' day' | ' week' | ' month' | ' year' >(' week' )
40
43
const activeFolder = ref (' inbox' )
@@ -294,6 +297,17 @@ const changeTimeRange = async (newRange: 'day' | 'week' | 'month' | 'year') => {
294
297
await updateChartData ()
295
298
}
296
299
300
+ // Function to handle folder change
301
+ const handleFolderChange = (folder : string ) => {
302
+ // Navigate to the inbox page with the selected folder
303
+ router .push (` /inbox ` )
304
+ }
305
+
306
+ // Function to handle compose
307
+ const handleCompose = () => {
308
+ router .push (' /inbox?compose=true' )
309
+ }
310
+
297
311
// Initial load
298
312
onMounted (async () => {
299
313
isLoading .value = true
@@ -310,7 +324,8 @@ onMounted(async () => {
310
324
:active-folder =" activeFolder"
311
325
:folders =" folders"
312
326
:unread-counts =" unreadCounts"
313
- @update:active-folder =" activeFolder = $event"
327
+ @update:active-folder =" (folder) => { activeFolder = folder; handleFolderChange(folder); }"
328
+ @compose =" handleCompose"
314
329
/>
315
330
316
331
<!-- Main Content -->
0 commit comments