From f9e23f74ecd63217f53773501f3a4adf8477cb69 Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Sun, 24 Sep 2023 21:49:19 +0800 Subject: [PATCH] Refine notification center ui Signed-off-by: Ryan Wang --- console/src/layouts/BasicLayout.vue | 9 ++++++ .../dashboard/widgets/NotificationWidget.vue | 23 +++++++++++++-- .../modules/system/users/Notifications.vue | 29 ++++++++++++++++++- 3 files changed, 58 insertions(+), 3 deletions(-) diff --git a/console/src/layouts/BasicLayout.vue b/console/src/layouts/BasicLayout.vue index 4aa16ffb0e..2d6190ba15 100644 --- a/console/src/layouts/BasicLayout.vue +++ b/console/src/layouts/BasicLayout.vue @@ -302,6 +302,15 @@ onMounted(() => { > {{ $t("core.sidebar.operations.profile.button") }} + + 我的消息 + {{ $t("core.sidebar.operations.logout.button") }} diff --git a/console/src/modules/dashboard/widgets/NotificationWidget.vue b/console/src/modules/dashboard/widgets/NotificationWidget.vue index 342e61900b..dc45068b94 100644 --- a/console/src/modules/dashboard/widgets/NotificationWidget.vue +++ b/console/src/modules/dashboard/widgets/NotificationWidget.vue @@ -2,13 +2,25 @@ import { useUserStore } from "@/stores/user"; import { apiClient } from "@/utils/api-client"; import { relativeTimeTo } from "@/utils/date"; -import { VCard, VEntity, VEntityField } from "@halo-dev/components"; +import { + VButton, + VCard, + VEmpty, + VEntity, + VEntityField, + VLoading, +} from "@halo-dev/components"; import { useQuery } from "@tanstack/vue-query"; import { OverlayScrollbarsComponent } from "overlayscrollbars-vue"; const { currentUser } = useUserStore(); -const { data: notifications } = useQuery({ +const { + data: notifications, + isLoading, + refetch, + isFetching, +} = useQuery({ queryKey: ["user-notifications"], queryFn: async () => { const { data } = await apiClient.notification.listUserNotifications({ @@ -39,7 +51,14 @@ const { data: notifications } = useQuery({ + + + + { const { data } = await apiClient.notification.listUserNotifications({ @@ -29,6 +36,7 @@ const { data: notifications, isLoading } = useQuery({ return data; }, + cacheTime: 0, }); const selectedNotificationName = useRouteQuery("name"); @@ -72,6 +80,25 @@ const selectedNotification = computed(() => { @change="selectedNotificationName = undefined" > + + + + +