feat: implement sharing page
This commit is contained in:
parent
137bdadaf9
commit
6962beb8e2
12 changed files with 113 additions and 69 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { Suspense } from 'react'
|
||||
import { Suspense, use } from 'react'
|
||||
|
||||
import { cn } from '@/lib/utils'
|
||||
import { buttonVariants } from '@/components/ui/button'
|
||||
|
|
@ -10,6 +10,7 @@ import { SidebarFooter } from '@/components/sidebar-footer'
|
|||
import { ThemeToggle } from '@/components/theme-toggle'
|
||||
import { ClearHistory } from '@/components/clear-history'
|
||||
import { clearChats } from '@/app/actions'
|
||||
import Link from 'next/link'
|
||||
|
||||
export async function Header() {
|
||||
const user = await currentUser()
|
||||
|
|
@ -18,38 +19,53 @@ export async function Header() {
|
|||
<header className="sticky top-0 z-50 flex h-16 w-full shrink-0 items-center justify-between border-b bg-gradient-to-b from-background/10 via-background/50 to-background/80 px-4 backdrop-blur-xl">
|
||||
<div className="flex items-center">
|
||||
{/* @ts-ignore */}
|
||||
<Sidebar user={user?.id}>
|
||||
<Suspense fallback={<div className="flex-1 overflow-auto" />}>
|
||||
{/* @ts-ignore */}
|
||||
<SidebarList userId={user?.id} />
|
||||
</Suspense>
|
||||
<SidebarFooter>
|
||||
<ThemeToggle />
|
||||
<ClearHistory clearChats={clearChats} />
|
||||
</SidebarFooter>
|
||||
</Sidebar>
|
||||
{user?.id ? (
|
||||
<Sidebar>
|
||||
<Suspense fallback={<div className="flex-1 overflow-auto" />}>
|
||||
{/* @ts-ignore */}
|
||||
<SidebarList userId={user?.id} />
|
||||
</Suspense>
|
||||
<SidebarFooter>
|
||||
<ThemeToggle />
|
||||
<ClearHistory clearChats={clearChats} />
|
||||
</SidebarFooter>
|
||||
</Sidebar>
|
||||
) : (
|
||||
<Link href="https://vercel.com" target="_blank" rel="nofollow">
|
||||
<IconVercel className="mr-2 h-6 w-6" />
|
||||
</Link>
|
||||
)}
|
||||
<div className="flex items-center">
|
||||
<IconSeparator className="h-6 w-6 text-muted-foreground/50" />
|
||||
<UserButton
|
||||
showName
|
||||
appearance={{
|
||||
elements: {
|
||||
avatarBox: 'w-6 h-6 rounded-full overflow-hidden',
|
||||
userButtonBox: 'flex-row-reverse',
|
||||
userButtonOuterIdentifier: 'text-primary',
|
||||
userButtonPopoverCard:
|
||||
'shadow-lg rounded-lg p-0 border border-border w-[200px] dark:bg-zinc-950 dark:text-zinc-50',
|
||||
userButtonPopoverFooter:
|
||||
'p-4 border-t border-border [&>*]:dark:text-zinc-600',
|
||||
userPreview: 'p-4 border-b border-border m-0',
|
||||
userButtonPopoverActionButton: 'px-1 gap-1',
|
||||
userButtonPopoverActionButtonText:
|
||||
'text-sm tracking-normal dark:text-zinc-400',
|
||||
userButtonPopoverActionButtonIcon:
|
||||
'h-4 w-4 text-muted-foreground'
|
||||
}
|
||||
}}
|
||||
/>
|
||||
{user?.id ? (
|
||||
<UserButton
|
||||
showName
|
||||
appearance={{
|
||||
elements: {
|
||||
avatarBox: 'w-6 h-6 rounded-full overflow-hidden',
|
||||
userButtonBox: 'flex-row-reverse',
|
||||
userButtonOuterIdentifier: 'text-primary',
|
||||
userButtonPopoverCard:
|
||||
'shadow-lg rounded-lg p-0 border border-border w-[200px] dark:bg-zinc-950 dark:text-zinc-50',
|
||||
userButtonPopoverFooter:
|
||||
'p-4 border-t border-border [&>*]:dark:text-zinc-600',
|
||||
userPreview: 'p-4 border-b border-border m-0',
|
||||
userButtonPopoverActionButton: 'px-1 gap-1',
|
||||
userButtonPopoverActionButtonText:
|
||||
'text-sm tracking-normal dark:text-zinc-400',
|
||||
userButtonPopoverActionButtonIcon:
|
||||
'h-4 w-4 text-muted-foreground'
|
||||
}
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<Link
|
||||
href="/sign-in"
|
||||
className={cn(buttonVariants({ variant: 'ghost' }))}
|
||||
>
|
||||
Sign in
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center justify-end space-x-2">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue