add clipboard
All checks were successful
Build / build (push) Successful in 3m28s

This commit is contained in:
2025-04-08 00:23:36 +02:00
parent f28c2defc4
commit edc575b153
8 changed files with 104 additions and 6 deletions

View File

@@ -4,6 +4,7 @@ import { useState } from "react";
import React from "react";
import { navBarFont } from "./fonts";
import {
ADMIN_PAGES,
PAGES,
Pages,
pathNameFromSelectedPage,
@@ -11,7 +12,7 @@ import {
} from "./pages";
import { usePathname, useRouter } from "next/navigation";
export default function Navbar() {
export default function Navbar({ isLoggedIn }: { isLoggedIn: boolean }) {
const [hoveredPage, setHoveredPage] = useState<Pages | null>(null);
const pathName = usePathname();
@@ -41,7 +42,10 @@ export default function Navbar() {
justifyContent: "center",
}}
>
{PAGES.map((page, index) => (
{PAGES.filter((p) => {
if (!isLoggedIn && ADMIN_PAGES.includes(p)) return false;
return true;
}).map((page, index) => (
<React.Fragment key={page}>
<div
style={navbarItem(page)}

View File

@@ -1,5 +1,6 @@
export type Pages = "home" | "about" | "links" | "contact" | "blog";
export const PAGES: Pages[] = ["home", "about", "blog", "links", "contact"];
export type Pages = "home" | "about" | "links" | "contact" | "blog" | "clipboard";
export const PAGES: Pages[] = ["home", "about", "blog", "links", "contact", "clipboard"];
export const ADMIN_PAGES: Pages[] = ["clipboard"]
export function selectedPageFromPathName(pathName: string): Pages {
if (pathName === "/") {