File tree 2 files changed +15
-7
lines changed
components/modules/dashboard/home
2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change 1
1
import { useQuery } from '@tanstack/react-query'
2
2
import { useMemo } from 'react'
3
+ import clsx from 'clsx'
3
4
import { useRouter } from 'next/navigation'
4
5
import type { ReactNode } from 'react'
5
6
@@ -31,6 +32,8 @@ interface CardProps {
31
32
primary ?: boolean
32
33
showBadage ?: boolean
33
34
} [ ]
35
+
36
+ highlight ?: boolean
34
37
}
35
38
36
39
export const DataStat = ( ) => {
@@ -142,6 +145,7 @@ export const DataStat = () => {
142
145
label : '未读评论' ,
143
146
value : stat . unreadComments ,
144
147
icon : < i className = "icon-[mingcute--comment-line]" /> ,
148
+ highlight : stat . unreadComments > 0 ,
145
149
actions : [
146
150
{
147
151
primary : true ,
@@ -241,7 +245,13 @@ export const DataStat = () => {
241
245
< div className = "grid grid-cols-2 gap-6 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 2xl:grid-cols-6" >
242
246
{ dataStat . map ( ( stat ) => {
243
247
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
+ >
245
255
< div className = "font-medium" > { stat . label } </ div >
246
256
247
257
< div className = "my-2 text-2xl font-medium" >
Original file line number Diff line number Diff line change 1
1
import { useMutation , useQueryClient } from '@tanstack/react-query'
2
2
import { produce } from 'immer'
3
3
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'
9
5
import type { InfiniteData , MutationOptions } from '@tanstack/react-query'
10
6
7
+ import { CommentState } from '@mx-space/api-client'
8
+
11
9
import { apiClient } from '~/lib/request'
12
10
import { toast } from '~/lib/toast'
13
11
@@ -36,7 +34,7 @@ export const commentAdmin = {
36
34
const useGetCurrentCommentStateFromQuery = ( ) => {
37
35
const search = useSearchParams ( )
38
36
const state = search . get ( 'tab' ) as any as CommentState
39
- return state
37
+ return state || CommentState . Unread
40
38
}
41
39
export const useUpdateCommentStateMutation = (
42
40
options ?: MutationOptions < any > ,
You can’t perform that action at this time.
0 commit comments