diff --git a/src/components/modules/dashboard/home/DataStat.tsx b/src/components/modules/dashboard/home/DataStat.tsx index 7aa8569378..e0997045b7 100644 --- a/src/components/modules/dashboard/home/DataStat.tsx +++ b/src/components/modules/dashboard/home/DataStat.tsx @@ -1,5 +1,6 @@ import { useQuery } from '@tanstack/react-query' import { useMemo } from 'react' +import clsx from 'clsx' import { useRouter } from 'next/navigation' import type { ReactNode } from 'react' @@ -31,6 +32,8 @@ interface CardProps { primary?: boolean showBadage?: boolean }[] + + highlight?: boolean } export const DataStat = () => { @@ -142,6 +145,7 @@ export const DataStat = () => { label: '未读评论', value: stat.unreadComments, icon: , + highlight: stat.unreadComments > 0, actions: [ { primary: true, @@ -241,7 +245,13 @@ export const DataStat = () => {
{dataStat.map((stat) => { return ( -
+
{stat.label}
diff --git a/src/queries/definition/comment.ts b/src/queries/definition/comment.ts index 85a252cec8..c6ab7e290f 100644 --- a/src/queries/definition/comment.ts +++ b/src/queries/definition/comment.ts @@ -1,13 +1,11 @@ import { useMutation, useQueryClient } from '@tanstack/react-query' import { produce } from 'immer' import { useSearchParams } from 'next/navigation' -import type { - CommentModel, - CommentState, - PaginateResult, -} from '@mx-space/api-client' +import type { CommentModel, PaginateResult } from '@mx-space/api-client' import type { InfiniteData, MutationOptions } from '@tanstack/react-query' +import { CommentState } from '@mx-space/api-client' + import { apiClient } from '~/lib/request' import { toast } from '~/lib/toast' @@ -36,7 +34,7 @@ export const commentAdmin = { const useGetCurrentCommentStateFromQuery = () => { const search = useSearchParams() const state = search.get('tab') as any as CommentState - return state + return state || CommentState.Unread } export const useUpdateCommentStateMutation = ( options?: MutationOptions,