refactor: migrate session usage to better-auth API
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Textarea } from '@/components/ui/textarea'
|
||||
import { Card } from '@/components/ui/card'
|
||||
import { Session } from 'next-auth'
|
||||
|
||||
interface AIToolbarProps {
|
||||
session: Session | null
|
||||
status: 'loading' | 'authenticated' | 'unauthenticated'
|
||||
isAuthenticated: boolean
|
||||
isPending: boolean
|
||||
aiPrompt: string
|
||||
setAiPrompt: (prompt: string) => void
|
||||
aiLoading: boolean
|
||||
@@ -16,8 +15,8 @@ interface AIToolbarProps {
|
||||
}
|
||||
|
||||
export const AIToolbar = ({
|
||||
session,
|
||||
status,
|
||||
isAuthenticated,
|
||||
isPending,
|
||||
aiPrompt,
|
||||
setAiPrompt,
|
||||
aiLoading,
|
||||
@@ -28,17 +27,15 @@ export const AIToolbar = ({
|
||||
}: AIToolbarProps) => {
|
||||
return (
|
||||
<>
|
||||
{/* AI Toolbar */}
|
||||
{status === "loading" ? (
|
||||
{isPending ? (
|
||||
<div className='mb-4 p-4 text-center animate-pulse bg-muted'>Loading...</div>
|
||||
) : (
|
||||
<div>
|
||||
{session?.user ? (
|
||||
{isAuthenticated ? (
|
||||
<div className="flex flex-col sm:flex-row gap-4 mb-4 items-start">
|
||||
<div className='w-full'>
|
||||
<Textarea
|
||||
className="wrap-anywhere field-sizing-content resize-none w-full min-h-[2.5rem] max-h-64 overflow-y-auto sm:overflow-y-visible px-3 py-2 scroll-p-8 placeholder:italic"
|
||||
// Band-aid for scrollbar clipping out of the box
|
||||
style={{ clipPath: "inset(0 round 1rem)" }}
|
||||
placeholder='Describe event for AI to create'
|
||||
value={aiPrompt}
|
||||
|
||||
Reference in New Issue
Block a user