fix: update sheet display and sidebar items
This commit is contained in:
parent
282ef825cb
commit
9158bfe82c
3 changed files with 8 additions and 28 deletions
|
|
@ -42,7 +42,7 @@ export const POST = auth(async function POST(req: Request) {
|
||||||
if (req.auth?.user?.email == null) {
|
if (req.auth?.user?.email == null) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const title = json.messages[0].content.substring(0, 20)
|
const title = json.messages[0].content.substring(0, 100)
|
||||||
const userId = (req as any).auth?.user?.email
|
const userId = (req as any).auth?.user?.email
|
||||||
const id = json.id ?? nanoid()
|
const id = json.id ?? nanoid()
|
||||||
const createdAt = Date.now()
|
const createdAt = Date.now()
|
||||||
|
|
|
||||||
|
|
@ -29,10 +29,7 @@ export function Sidebar({ session, children }: SidebarProps) {
|
||||||
<span className="sr-only">Toggle Sidebar</span>
|
<span className="sr-only">Toggle Sidebar</span>
|
||||||
</Button>
|
</Button>
|
||||||
</SheetTrigger>
|
</SheetTrigger>
|
||||||
<SheetContent
|
<SheetContent className="inset-y-0 flex h-auto w-[300px] flex-col p-0">
|
||||||
position="left"
|
|
||||||
className="inset-y-0 flex h-auto w-[300px] flex-col gap-0 rounded-r-lg p-0 lg:inset-y-2"
|
|
||||||
>
|
|
||||||
<SheetHeader className="p-4">
|
<SheetHeader className="p-4">
|
||||||
<SheetTitle className="text-sm">Chat History</SheetTitle>
|
<SheetTitle className="text-sm">Chat History</SheetTitle>
|
||||||
</SheetHeader>
|
</SheetHeader>
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import * as SheetPrimitive from '@radix-ui/react-dialog'
|
import * as SheetPrimitive from '@radix-ui/react-dialog'
|
||||||
import { cva, type VariantProps } from 'class-variance-authority'
|
|
||||||
|
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
import { IconClose } from '@/components/ui/icons'
|
import { IconClose } from '@/components/ui/icons'
|
||||||
|
|
@ -42,33 +41,17 @@ const SheetOverlay = React.forwardRef<
|
||||||
))
|
))
|
||||||
SheetOverlay.displayName = SheetPrimitive.Overlay.displayName
|
SheetOverlay.displayName = SheetPrimitive.Overlay.displayName
|
||||||
|
|
||||||
const sheetVariants = cva(
|
|
||||||
'fixed z-50 h-full scale-100 gap-4 border bg-background p-6 opacity-100 shadow-lg',
|
|
||||||
{
|
|
||||||
variants: {
|
|
||||||
position: {
|
|
||||||
left: 'data-[state=closed]:animate-slide-to-left data-[state=open]:animate-slide-from-left',
|
|
||||||
right: 'h-full animate-in slide-in-from-right duration-300'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
defaultVariants: {
|
|
||||||
position: 'left'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
export interface DialogContentProps
|
|
||||||
extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,
|
|
||||||
VariantProps<typeof sheetVariants> {}
|
|
||||||
|
|
||||||
const SheetContent = React.forwardRef<
|
const SheetContent = React.forwardRef<
|
||||||
React.ElementRef<typeof SheetPrimitive.Content>,
|
React.ElementRef<typeof SheetPrimitive.Content>,
|
||||||
DialogContentProps
|
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>
|
||||||
>(({ position, className, children, ...props }, ref) => (
|
>(({ className, children, ...props }, ref) => (
|
||||||
<SheetPortal>
|
<SheetPortal>
|
||||||
<SheetPrimitive.Content
|
<SheetPrimitive.Content
|
||||||
ref={ref}
|
ref={ref}
|
||||||
className={cn(sheetVariants({ position }), className)}
|
className={cn(
|
||||||
|
'fixed z-50 h-full border-r bg-background p-6 opacity-100 shadow-lg data-[state=closed]:animate-slide-to-left data-[state=open]:animate-slide-from-left',
|
||||||
|
className
|
||||||
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue