Skip to content

Commit

Permalink
Merge pull request #2 from AtharvaChobe/fix/shadcn-ui#243-login-btn-r…
Browse files Browse the repository at this point in the history
…emoved-and-added-profile-btn

removed the login btn after login and added a profile button
  • Loading branch information
SergeWilfried authored Feb 20, 2024
2 parents 68f680c + 007b250 commit 97f757d
Showing 1 changed file with 34 additions and 10 deletions.
44 changes: 34 additions & 10 deletions app/(marketing)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import Link from "next/link"

import { UserAccountNav } from "@/components/user-account-nav"
import { marketingConfig } from "@/config/marketing"
import { cn } from "@/lib/utils"
import { buttonVariants } from "@/components/ui/button"
import { MainNav } from "@/components/main-nav"
import { SiteFooter } from "@/components/site-footer"
import { getCurrentUser } from "@/lib/session"

interface MarketingLayoutProps {
children: React.ReactNode
Expand All @@ -13,21 +14,44 @@ interface MarketingLayoutProps {
export default async function MarketingLayout({
children,
}: MarketingLayoutProps) {


let user: any;
getCurrentUser().then(currentUser => {
user = currentUser;
});


return (
<div className="flex min-h-screen flex-col">
<header className="container z-40 bg-background">
<div className="flex h-20 items-center justify-between py-6">
<MainNav items={marketingConfig.mainNav} />
<nav>
<Link
href="/login"
className={cn(
buttonVariants({ variant: "secondary", size: "sm" }),
"px-4"
)}
>
Login
</Link>
{
user
?
<Link
href="/login"
className={cn(
buttonVariants({ variant: "secondary", size: "sm" }),
"px-4"
)}
>
Login
</Link>
:
<div className='flex justify-center items-center gap-3'>
<h3>Welcome {user.name}</h3>
<UserAccountNav
user={{
name: user.name,
image: user.image,
email: user.email,
}}
/>
</div>
}
</nav>
</div>
</header>
Expand Down

0 comments on commit 97f757d

Please sign in to comment.