-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4b1f73e
commit 4521ba6
Showing
7 changed files
with
101 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import {auth} from "@clerk/nextjs"; | ||
import {notFound} from "next/navigation"; | ||
|
||
import SignOutButton from "@/components/account/signout-button"; | ||
|
||
export default async function Page() { | ||
const {userId} = auth(); | ||
|
||
if (!userId) return notFound(); | ||
|
||
return ( | ||
<div className={"w-full space-y-2"}> | ||
<div className={"flex justify-between items-center"}> | ||
<h1 className={"text-4xl font-bold"}>Account</h1> | ||
<SignOutButton/> | ||
</div> | ||
<section> | ||
This is where you will be able to set some user preferences | ||
</section> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
"use client" | ||
|
||
import {useClerk} from "@clerk/nextjs"; | ||
import {Button} from "@/components/ui/button"; | ||
|
||
export default function SignOutButton() { | ||
const clerk = useClerk(); | ||
|
||
return ( | ||
<Button | ||
variant={"outline"} | ||
onClick={async () => await clerk.signOut()} | ||
> | ||
Sign out | ||
</Button> | ||
|
||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import {NavigationMenu, NavigationMenuList} from "@/components/ui/navigation-menu"; | ||
import UserButtonMenuItem from "@/components/user/user-button"; | ||
|
||
export function Navigation() { | ||
return ( | ||
<NavigationMenu> | ||
<NavigationMenuList> | ||
<UserButtonMenuItem /> | ||
</NavigationMenuList> | ||
</NavigationMenu> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
"use client" | ||
import { UserButton as ClerkButton, useUser } from "@clerk/nextjs"; | ||
import Link from "next/link"; | ||
import {NavigationMenuItem, NavigationMenuLink, navigationMenuTriggerStyle} from "@/components/ui/navigation-menu"; | ||
import {useClerkTheme} from "@/lib/hooks/clerk"; | ||
|
||
export default function UserButtonMenuItem() { | ||
const auth = useUser(); | ||
const clerkTheme = useClerkTheme(); | ||
|
||
if (!auth.isLoaded || !auth.isSignedIn) { | ||
return ( | ||
<NavigationMenuItem> | ||
<Link href="/account/sign-in" legacyBehavior passHref> | ||
<NavigationMenuLink className={navigationMenuTriggerStyle()}> | ||
{auth.isLoaded ? "Sign in" : "Account"} | ||
</NavigationMenuLink> | ||
</Link> | ||
</NavigationMenuItem> | ||
) | ||
} | ||
|
||
return ( | ||
<NavigationMenuItem> | ||
<Link href={"/account"} legacyBehavior passHref> | ||
<NavigationMenuLink className={navigationMenuTriggerStyle()}> | ||
<ClerkButton afterSignOutUrl={"/"} appearance={{ | ||
baseTheme: clerkTheme, | ||
}} /> | ||
</NavigationMenuLink> | ||
</Link> | ||
</NavigationMenuItem> | ||
) | ||
} |