From 8dfae708ff76800ed5d78cc17f4f501d1d8bda8b Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Tue, 10 Jun 2025 00:24:35 +0800 Subject: [PATCH] feat: add empty state for some widgets (#7522) #### What type of PR is this? /area ui /kind improvement /milestone 2.21.x #### What this PR does / why we need it: Add empty state for some dashboard widgets #### Does this PR introduce a user-facing change? ```release-note None ``` --- .../comments/PendingCommentsWidget.vue | 20 ++++++++++++++++-- .../presets/posts/RecentPublishedWidget.vue | 21 +++++++++++++++++-- ui/src/locales/_missing_translations_es.yaml | 4 ++++ ui/src/locales/en.yaml | 4 ++++ ui/src/locales/zh-CN.yaml | 4 ++++ ui/src/locales/zh-TW.yaml | 4 ++++ 6 files changed, 53 insertions(+), 4 deletions(-) diff --git a/ui/console-src/modules/dashboard/widgets/presets/comments/PendingCommentsWidget.vue b/ui/console-src/modules/dashboard/widgets/presets/comments/PendingCommentsWidget.vue index 7f48413b8..0a1a0983b 100644 --- a/ui/console-src/modules/dashboard/widgets/presets/comments/PendingCommentsWidget.vue +++ b/ui/console-src/modules/dashboard/widgets/presets/comments/PendingCommentsWidget.vue @@ -2,12 +2,17 @@ import WidgetCard from "@console/modules/dashboard/components/WidgetCard.vue"; import type { ListedComment } from "@halo-dev/api-client"; import { consoleApiClient } from "@halo-dev/api-client"; -import { VEntityContainer } from "@halo-dev/components"; +import { + VButton, + VEmpty, + VEntityContainer, + VLoading, +} from "@halo-dev/components"; import { useQuery } from "@tanstack/vue-query"; import { OverlayScrollbarsComponent } from "overlayscrollbars-vue"; import CommentItem from "./CommentItem.vue"; -const { data } = useQuery({ +const { data, isLoading, isFetching, refetch } = useQuery({ queryKey: ["widget-pending-comments"], queryFn: async () => { const { data } = await consoleApiClient.content.comment.listComments({ @@ -29,6 +34,17 @@ const { data } = useQuery({ ) " > + + + + ({ +const { data, isLoading, isFetching, refetch } = useQuery({ queryKey: ["widget-recent-posts"], queryFn: async () => { const { data } = await consoleApiClient.content.post.listPosts({ @@ -25,7 +30,19 @@ const { data } = useQuery({ :body-class="['!overflow-auto']" :title="$t('core.dashboard.widgets.presets.recent_published.title')" > + + + +