Skip to content

Commit 946b234

Browse files
committed
fix: reply comment
Signed-off-by: Innei <[email protected]>
1 parent 1f43e6c commit 946b234

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

src/components/modules/dashboard/home/DataStat.tsx

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useQuery } from '@tanstack/react-query'
22
import { useMemo } from 'react'
3+
import clsx from 'clsx'
34
import { useRouter } from 'next/navigation'
45
import type { ReactNode } from 'react'
56

@@ -31,6 +32,8 @@ interface CardProps {
3132
primary?: boolean
3233
showBadage?: boolean
3334
}[]
35+
36+
highlight?: boolean
3437
}
3538

3639
export const DataStat = () => {
@@ -142,6 +145,7 @@ export const DataStat = () => {
142145
label: '未读评论',
143146
value: stat.unreadComments,
144147
icon: <i className="icon-[mingcute--comment-line]" />,
148+
highlight: stat.unreadComments > 0,
145149
actions: [
146150
{
147151
primary: true,
@@ -241,7 +245,13 @@ export const DataStat = () => {
241245
<div className="grid grid-cols-2 gap-6 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 2xl:grid-cols-6">
242246
{dataStat.map((stat) => {
243247
return (
244-
<div className="relative rounded-md border p-4" key={stat.label}>
248+
<div
249+
className={clsx(
250+
'relative rounded-md border p-4',
251+
stat.highlight && 'border-accent bg-accent/20',
252+
)}
253+
key={stat.label}
254+
>
245255
<div className="font-medium">{stat.label}</div>
246256

247257
<div className="my-2 text-2xl font-medium">

src/queries/definition/comment.ts

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import { useMutation, useQueryClient } from '@tanstack/react-query'
22
import { produce } from 'immer'
33
import { useSearchParams } from 'next/navigation'
4-
import type {
5-
CommentModel,
6-
CommentState,
7-
PaginateResult,
8-
} from '@mx-space/api-client'
4+
import type { CommentModel, PaginateResult } from '@mx-space/api-client'
95
import type { InfiniteData, MutationOptions } from '@tanstack/react-query'
106

7+
import { CommentState } from '@mx-space/api-client'
8+
119
import { apiClient } from '~/lib/request'
1210
import { toast } from '~/lib/toast'
1311

@@ -36,7 +34,7 @@ export const commentAdmin = {
3634
const useGetCurrentCommentStateFromQuery = () => {
3735
const search = useSearchParams()
3836
const state = search.get('tab') as any as CommentState
39-
return state
37+
return state || CommentState.Unread
4038
}
4139
export const useUpdateCommentStateMutation = (
4240
options?: MutationOptions<any>,

0 commit comments

Comments
 (0)