fix: get current user server side in navbar. fix: adjust breadcump styling on account component
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import { SignedIn, SignedOut, UserButton } from '@clerk/nextjs';
|
||||
import { SignedIn, SignedOut, UserButton, currentUser } from '@clerk/nextjs';
|
||||
import Link from 'next/link';
|
||||
import { BiSolidMessageSquareAdd } from 'react-icons/bi';
|
||||
import ProfileLink from './ProfileLink';
|
||||
import ThemeButton from './ThemeButton';
|
||||
|
||||
export default function Navbar() {
|
||||
export default async function Navbar() {
|
||||
const user = await currentUser();
|
||||
|
||||
return (
|
||||
<nav className='flex items-center justify-between p-5 shadow-md dark:bg-secondary-gray'>
|
||||
<ul className='flex items-center gap-4'>
|
||||
@@ -31,7 +32,7 @@ export default function Navbar() {
|
||||
<Link href='#'>Following</Link>
|
||||
</li>
|
||||
<li>
|
||||
<ProfileLink />
|
||||
<Link href={`/profile/${user?.id}`}>Profile</Link>
|
||||
</li>
|
||||
<li>
|
||||
<Link
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
'use client';
|
||||
|
||||
import { useUser } from '@clerk/nextjs';
|
||||
import Link from 'next/link';
|
||||
|
||||
export default function ProfileLink() {
|
||||
const user = useUser();
|
||||
|
||||
if (user.isSignedIn !== true) {
|
||||
return <span>Profile</span>;
|
||||
}
|
||||
|
||||
return <Link href={`/profile/${user.user.id}`}>Profile</Link>;
|
||||
}
|
||||
Reference in New Issue
Block a user