Skip to content

Commit

Permalink
fix: reply comment
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Jan 16, 2024
1 parent 1f43e6c commit 946b234
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
12 changes: 11 additions & 1 deletion src/components/modules/dashboard/home/DataStat.tsx
Original file line number Diff line number Diff line change
@@ -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'

Expand Down Expand Up @@ -31,6 +32,8 @@ interface CardProps {
primary?: boolean
showBadage?: boolean
}[]

highlight?: boolean
}

export const DataStat = () => {
Expand Down Expand Up @@ -142,6 +145,7 @@ export const DataStat = () => {
label: '未读评论',
value: stat.unreadComments,
icon: <i className="icon-[mingcute--comment-line]" />,
highlight: stat.unreadComments > 0,
actions: [
{
primary: true,
Expand Down Expand Up @@ -241,7 +245,13 @@ export const DataStat = () => {
<div className="grid grid-cols-2 gap-6 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 2xl:grid-cols-6">
{dataStat.map((stat) => {
return (
<div className="relative rounded-md border p-4" key={stat.label}>
<div
className={clsx(
'relative rounded-md border p-4',
stat.highlight && 'border-accent bg-accent/20',
)}
key={stat.label}
>
<div className="font-medium">{stat.label}</div>

<div className="my-2 text-2xl font-medium">
Expand Down
10 changes: 4 additions & 6 deletions src/queries/definition/comment.ts
Original file line number Diff line number Diff line change
@@ -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'

Expand Down Expand Up @@ -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<any>,
Expand Down

0 comments on commit 946b234

Please sign in to comment.