Skip to content

Commit

Permalink
fix: styles
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed May 13, 2024
1 parent da23149 commit 3ab82a2
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 24 deletions.
51 changes: 29 additions & 22 deletions src/app/(app)/thinking/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
'use client'

import { useInfiniteQuery, useQueryClient } from '@tanstack/react-query'
import {
useInfiniteQuery,
useMutation,
useQueryClient,
} from '@tanstack/react-query'
import { useEffect, useMemo, useState } from 'react'
import clsx from 'clsx'
import { stagger, useAnimate } from 'framer-motion'
Expand Down Expand Up @@ -57,26 +61,29 @@ const PostBox = () => {

const [value, setValue] = useState('')
const queryClient = useQueryClient()
if (!isLogin) return null

const handleSend = () => {
apiClient.shorthand.proxy.post({ data: { content: value } }).then((res) => {
setValue('')

queryClient.setQueryData<
InfiniteData<
RecentlyModel[] & {
comments: number
}
>
>(QUERY_KEY, (old) => {
return produce(old, (draft) => {
draft?.pages[0].unshift(res.$serialized as any)
return draft
const { mutateAsync: handleSend, isPending } = useMutation({
mutationFn: async () => {
apiClient.shorthand.proxy
.post({ data: { content: value } })
.then((res) => {
setValue('')

queryClient.setQueryData<
InfiniteData<
RecentlyModel[] & {
comments: number
}
>
>(QUERY_KEY, (old) => {
return produce(old, (draft) => {
draft?.pages[0].unshift(res.$serialized as any)
return draft
})
})
})
})
})
}
},
})
if (!isLogin) return null
return (
<form onSubmit={preventDefault} className="mb-8">
<TextArea
Expand All @@ -94,8 +101,8 @@ const PostBox = () => {
>
<div className="absolute bottom-2 right-2 flex size-5 center">
<MotionButtonBase
onClick={handleSend}
disabled={value.length === 0}
onClick={() => handleSend()}
disabled={value.length === 0 || isPending}
className="duration-200 disabled:cursor-not-allowed disabled:opacity-10"
>
<TiltedSendIcon className="size-5 text-zinc-800 dark:text-zinc-200" />
Expand Down
4 changes: 2 additions & 2 deletions src/components/layout/header/internal/HeaderActionButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ export const HeaderActionButton = forwardRef<
role="button"
tabIndex={1}
className={clsx(
'group size-10 rounded-full bg-gradient-to-b',
'px-3 text-sm ring-1 ring-zinc-900/5 backdrop-blur transition dark:ring-white/10 dark:hover:ring-white/20',
'group size-10 rounded-full bg-base-100',
'px-3 text-sm ring-1 ring-zinc-900/5 transition dark:ring-white/10 dark:hover:ring-white/20',

'flex center',
)}
Expand Down

0 comments on commit 3ab82a2

Please sign in to comment.