add client/admin pages, show info and created admin api and server actions

This commit is contained in:
2024-04-28 19:32:31 +03:00
parent db66161d81
commit d6b259d71c
33 changed files with 458 additions and 91 deletions

View File

@@ -3,45 +3,31 @@
import { Button } from '@/components/ui/button'
import Link from 'next/link'
import { USER_PROFILE_URL } from '@/config/routes'
import { CABINET_ROUTES, USER_PROFILE_URL } from '@/config/routes'
import { usePathname } from 'next/navigation'
import UserButton from '@/components/auth/user-button'
import LocaleSwitcher from '@/components/locale-switcher'
const Navbar = () => {
export const Navbar = () => {
const pathname = usePathname()
//
console.log(USER_PROFILE_URL)
return (
<nav className="bg-secondary flex justify-between items-center top-0 absolute px-6 py-4 w-full shadow-sm">
<div className="flex gap-x-4">
<Button asChild variant={pathname.match(/^\/(en\/|)server/) ? 'default' : 'outline'}>
<Link href={'/server'}>
Server
</Link>
</Button>
<Button asChild variant={pathname.match(/^\/(en\/|)client/) ? 'default' : 'outline'}>
<Link href={'/client'}>
Client
</Link>
</Button>
<Button asChild variant={pathname.match(/^\/(en\/|)admin/) ? 'default' : 'outline'}>
<Link href={'/admin'}>
Admin
</Link>
</Button>
<Button asChild variant={pathname.match(/^\/(en\/|)cabinet/) ? 'default' : 'outline'}>
<Link href={USER_PROFILE_URL}>
Cabinet
</Link>
</Button>
{CABINET_ROUTES.map((route) => (
<Button asChild key={route} variant={pathname.endsWith(route) ? 'default' : 'outline'} className="border">
<Link href={route}>
{route[1]?.toUpperCase() + route.substring(2)}
</Link>
</Button>
))}
</div>
<div className="flex gap-x-2">
<LocaleSwitcher/>
<UserButton/>
</div>
</nav>
)
}
export default Navbar