mirror of
https://github.com/D4M13N-D3V/neroshitron.git
synced 2025-03-14 10:05:04 +00:00
Update NavigationBar.tsx
This commit is contained in:
parent
b2f700280a
commit
057c20cd21
@ -1,8 +1,8 @@
|
||||
import { createClient } from "@/utils/supabase/server";
|
||||
import Link from "next/link";
|
||||
import { redirect } from "next/navigation";
|
||||
import { redirect, useRouter } from "next/navigation";
|
||||
import crypto from 'crypto';
|
||||
import { useRouter } from 'next/router';
|
||||
import { headers } from "next/headers";
|
||||
|
||||
|
||||
export default async function AuthButton() {
|
||||
@ -22,12 +22,13 @@ export default async function AuthButton() {
|
||||
|
||||
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
// ...
|
||||
|
||||
const currentPage = router.pathname;
|
||||
|
||||
const heads = headers()
|
||||
const url = heads.get('x-url')
|
||||
if(url == null) throw new Error('No URL found')
|
||||
const urlObj = new URL(url);
|
||||
|
||||
if(user){
|
||||
let email = user.email;
|
||||
if(email != null){
|
||||
@ -40,7 +41,7 @@ export default async function AuthButton() {
|
||||
<div className="flex items-center gap-2 z-10">
|
||||
<Link
|
||||
href="/gallery"
|
||||
className={`py-2 px-3 flex rounded-3xl no-underline ${currentPage === '/gallery' ? 'bg-neroshi-blue-800 hover:bg-neroshi-blue-700' : 'bg-neroshi-blue-900 hover:bg-neroshi-blue-800'}`}
|
||||
className={`py-2 px-3 flex rounded-3xl no-underline ${urlObj.pathname === '/gallery' ? 'bg-neroshi-blue-800 hover:bg-neroshi-blue-700' : 'bg-neroshi-blue-900 hover:bg-neroshi-blue-800'}`}
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" className="size-6 lg:hidden block">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="m2.25 15.75 5.159-5.159a2.25 2.25 0 0 1 3.182 0l5.159 5.159m-1.5-1.5 1.409-1.409a2.25 2.25 0 0 1 3.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 0 0 1.5-1.5V6a1.5 1.5 0 0 0-1.5-1.5H3.75A1.5 1.5 0 0 0 2.25 6v12a1.5 1.5 0 0 0 1.5 1.5Zm10.5-11.25h.008v.008h-.008V8.25Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user