Skip to content

Commit

Permalink
fix(markdown.tsx): failing due to some version bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Vette1123 committed Sep 26, 2023
1 parent d47d960 commit f69c4c0
Show file tree
Hide file tree
Showing 5 changed files with 240 additions and 570 deletions.
2 changes: 1 addition & 1 deletion auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const {
if (profile) {
token.id = profile.id
token.profile = profile.picture
if(!profile.id){
if (!profile.id) {
token.id = profile.sub
}
}
Expand Down
55 changes: 55 additions & 0 deletions components/header-upper-section.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import React from 'react'
import Link from 'next/link'
import { auth } from '@/auth'

import { Button } from '@/components/ui/button'
import { Icons } from '@/components/icons'
import { Sidebar } from '@/components/sidebar/sidebar'
import { ClearHistory } from '@/components/sidebar/sidebar-clear-history'
import { SidebarFooter } from '@/components/sidebar/sidebar-footer'
import { SidebarList } from '@/components/sidebar/sidebar-list'
import { UserMenu } from '@/components/user-menu'
import { clearChats } from '@/app/actions'

export const HeaderUpperSection = async () => {
const session = await auth()

return (
<section className="flex items-center">
{session?.user ? (
<Sidebar>
<React.Suspense fallback={<div className="flex-1 overflow-auto" />}>
<SidebarList userId={session?.user?.id} />
</React.Suspense>
<SidebarFooter>
<Button variant="link">
<Link
target="_blank"
rel="noreferrer"
href="https://www.mohamedgado.info"
>
Portfolio
</Link>
</Button>
<ClearHistory clearChats={clearChats} />
</SidebarFooter>
</Sidebar>
) : (
<Link href="/" target="_blank" rel="nofollow">
<Icons.nextChat className="mr-2 h-6 w-6 dark:hidden" inverted />
<Icons.nextChat className="mr-2 hidden h-6 w-6 dark:block" />
</Link>
)}
<div className="flex items-center">
<Icons.separator className="h-6 w-6 text-muted-foreground/50" />
{session?.user ? (
<UserMenu user={session.user} />
) : (
<Button variant="link" asChild className="-ml-2">
<Link href="/login?callbackUrl=/">Login</Link>
</Button>
)}
</div>
</section>
)
}
54 changes: 5 additions & 49 deletions components/header.tsx
Original file line number Diff line number Diff line change
@@ -1,59 +1,15 @@
import * as React from 'react'
import Link from 'next/link'
import { auth } from '@/auth'

import { siteConfig } from '@/config/site'
import { Button, buttonVariants } from '@/components/ui/button'
import { buttonVariants } from '@/components/ui/button'
import { HeaderUpperSection } from '@/components/header-upper-section'
import { Icons } from '@/components/icons'
import { Sidebar } from '@/components/sidebar/sidebar'
import { ClearHistory } from '@/components/sidebar/sidebar-clear-history'
import { SidebarFooter } from '@/components/sidebar/sidebar-footer'
import { SidebarList } from '@/components/sidebar/sidebar-list'
import { UserMenu } from '@/components/user-menu'
import { clearChats } from '@/app/actions'
import { ThemeToggle } from '@/components/theme-toggle'

import { ThemeToggle } from './theme-toggle'

export async function Header() {
const session = await auth()
export function Header() {
return (
<header className="sticky top-0 z-50 flex h-16 w-full shrink-0 items-center justify-between overflow-hidden 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">
{session?.user ? (
<Sidebar>
<React.Suspense fallback={<div className="flex-1 overflow-auto" />}>
<SidebarList userId={session?.user?.id} />
</React.Suspense>
<SidebarFooter>
<Button variant="link">
<Link
target="_blank"
rel="noreferrer"
href="https://www.mohamedgado.info"
>
Portfolio
</Link>
</Button>
<ClearHistory clearChats={clearChats} />
</SidebarFooter>
</Sidebar>
) : (
<Link href="/" target="_blank" rel="nofollow">
<Icons.nextChat className="mr-2 h-6 w-6 dark:hidden" inverted />
<Icons.nextChat className="mr-2 hidden h-6 w-6 dark:block" />
</Link>
)}
<div className="flex items-center">
<Icons.separator className="h-6 w-6 text-muted-foreground/50" />
{session?.user ? (
<UserMenu user={session.user} />
) : (
<Button variant="link" asChild className="-ml-2">
<Link href="/login?callbackUrl=/">Login</Link>
</Button>
)}
</div>
</div>
<HeaderUpperSection />
<div>
<Link href={siteConfig.links.github} target="_blank" rel="noreferrer">
<div
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
"react-markdown": "^8.0.7",
"react-syntax-highlighter": "^15.5.0",
"react-textarea-autosize": "^8.5.3",
"remark-gfm": "^4.0.0",
"remark-math": "^6.0.0",
"remark-gfm": "^3.0.1",
"remark-math": "^5.1.1",
"sonner": "^1.0.3",
"zod": "^3.22.2"
},
Expand Down
Loading

0 comments on commit f69c4c0

Please sign in to comment.