Skip to content

Commit 3ab82a2

Browse files
committed
fix: styles
Signed-off-by: Innei <[email protected]>
1 parent da23149 commit 3ab82a2

File tree

2 files changed

+31
-24
lines changed

2 files changed

+31
-24
lines changed

src/app/(app)/thinking/page.tsx

+29-22
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
'use client'
22

3-
import { useInfiniteQuery, useQueryClient } from '@tanstack/react-query'
3+
import {
4+
useInfiniteQuery,
5+
useMutation,
6+
useQueryClient,
7+
} from '@tanstack/react-query'
48
import { useEffect, useMemo, useState } from 'react'
59
import clsx from 'clsx'
610
import { stagger, useAnimate } from 'framer-motion'
@@ -57,26 +61,29 @@ const PostBox = () => {
5761

5862
const [value, setValue] = useState('')
5963
const queryClient = useQueryClient()
60-
if (!isLogin) return null
61-
62-
const handleSend = () => {
63-
apiClient.shorthand.proxy.post({ data: { content: value } }).then((res) => {
64-
setValue('')
65-
66-
queryClient.setQueryData<
67-
InfiniteData<
68-
RecentlyModel[] & {
69-
comments: number
70-
}
71-
>
72-
>(QUERY_KEY, (old) => {
73-
return produce(old, (draft) => {
74-
draft?.pages[0].unshift(res.$serialized as any)
75-
return draft
64+
const { mutateAsync: handleSend, isPending } = useMutation({
65+
mutationFn: async () => {
66+
apiClient.shorthand.proxy
67+
.post({ data: { content: value } })
68+
.then((res) => {
69+
setValue('')
70+
71+
queryClient.setQueryData<
72+
InfiniteData<
73+
RecentlyModel[] & {
74+
comments: number
75+
}
76+
>
77+
>(QUERY_KEY, (old) => {
78+
return produce(old, (draft) => {
79+
draft?.pages[0].unshift(res.$serialized as any)
80+
return draft
81+
})
82+
})
7683
})
77-
})
78-
})
79-
}
84+
},
85+
})
86+
if (!isLogin) return null
8087
return (
8188
<form onSubmit={preventDefault} className="mb-8">
8289
<TextArea
@@ -94,8 +101,8 @@ const PostBox = () => {
94101
>
95102
<div className="absolute bottom-2 right-2 flex size-5 center">
96103
<MotionButtonBase
97-
onClick={handleSend}
98-
disabled={value.length === 0}
104+
onClick={() => handleSend()}
105+
disabled={value.length === 0 || isPending}
99106
className="duration-200 disabled:cursor-not-allowed disabled:opacity-10"
100107
>
101108
<TiltedSendIcon className="size-5 text-zinc-800 dark:text-zinc-200" />

src/components/layout/header/internal/HeaderActionButton.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ export const HeaderActionButton = forwardRef<
1111
role="button"
1212
tabIndex={1}
1313
className={clsx(
14-
'group size-10 rounded-full bg-gradient-to-b',
15-
'px-3 text-sm ring-1 ring-zinc-900/5 backdrop-blur transition dark:ring-white/10 dark:hover:ring-white/20',
14+
'group size-10 rounded-full bg-base-100',
15+
'px-3 text-sm ring-1 ring-zinc-900/5 transition dark:ring-white/10 dark:hover:ring-white/20',
1616

1717
'flex center',
1818
)}

0 commit comments

Comments
 (0)