first commit
This commit is contained in:
36
components/navigationbar/adminnavigation.tsx
Normal file
36
components/navigationbar/adminnavigation.tsx
Normal file
@ -0,0 +1,36 @@
|
||||
"use client";
|
||||
import Link from "next/link";
|
||||
|
||||
import { usePathname } from "next/navigation";
|
||||
|
||||
const NAV_ITEMS = [
|
||||
{ href: "/admin/home", label: "Home" },
|
||||
{ href: "/admin/unlock", label: "Unlock User" },
|
||||
{ href: "/admin/extraction", label: "Extract Game Files" },
|
||||
];
|
||||
|
||||
const AdminSubNavigation = () => {
|
||||
const pathname = usePathname();
|
||||
|
||||
return (
|
||||
<nav className="grid gap-4 text-sm text-muted-foreground">
|
||||
{NAV_ITEMS.map(({ href, label }) => {
|
||||
const isActive = pathname === href;
|
||||
|
||||
return (
|
||||
<Link
|
||||
key={href}
|
||||
href={href}
|
||||
className={`${
|
||||
isActive ? "font-semibold text-primary" : "text-muted-foreground"
|
||||
} text-sm`}
|
||||
>
|
||||
{label}
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</nav>
|
||||
);
|
||||
};
|
||||
|
||||
export default AdminSubNavigation;
|
36
components/navigationbar/desktopNavBar.tsx
Normal file
36
components/navigationbar/desktopNavBar.tsx
Normal file
@ -0,0 +1,36 @@
|
||||
"use client";
|
||||
import Link from "next/link";
|
||||
|
||||
import { usePathname } from "next/navigation";
|
||||
|
||||
const NAV_ITEMS = [
|
||||
{ href: "/home", label: "Home" },
|
||||
{ href: "/chunithm", label: "Chunithm" },
|
||||
{ href: "/maimai", label: "Maimai" },
|
||||
];
|
||||
|
||||
const NavigationMenuDesktop = () => {
|
||||
const pathname = usePathname();
|
||||
|
||||
return (
|
||||
<nav className="hidden flex-col gap-6 text-lg font-medium md:flex md:flex-row md:items-center md:gap-5 md:text-sm lg:gap-6">
|
||||
{NAV_ITEMS.map(({ href, label }) => {
|
||||
const isActive = pathname === href;
|
||||
|
||||
return (
|
||||
<Link
|
||||
key={href}
|
||||
href={href}
|
||||
className={`${
|
||||
isActive ? "font-semibold text-primary" : "text-muted-foreground"
|
||||
} text-sm`}
|
||||
>
|
||||
{label}
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</nav>
|
||||
);
|
||||
};
|
||||
|
||||
export default NavigationMenuDesktop;
|
36
components/navigationbar/mobileNavBar.tsx
Normal file
36
components/navigationbar/mobileNavBar.tsx
Normal file
@ -0,0 +1,36 @@
|
||||
"use client";
|
||||
import Link from "next/link";
|
||||
|
||||
import { usePathname } from "next/navigation";
|
||||
|
||||
const NAV_ITEMS = [
|
||||
{ href: "/home", label: "Home" },
|
||||
{ href: "/chunithm", label: "Chunithm" },
|
||||
{ href: "/maimai", label: "Maimai" },
|
||||
];
|
||||
|
||||
const NavigationMenuMobile = () => {
|
||||
const pathname = usePathname();
|
||||
|
||||
return (
|
||||
<nav className="grid gap-6 text-lg font-medium">
|
||||
{NAV_ITEMS.map(({ href, label }) => {
|
||||
const isActive = pathname === href;
|
||||
|
||||
return (
|
||||
<Link
|
||||
key={href}
|
||||
href={href}
|
||||
className={`${
|
||||
isActive ? "font-semibold text-primary" : "text-muted-foreground"
|
||||
} text-sm`}
|
||||
>
|
||||
{label}
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</nav>
|
||||
);
|
||||
};
|
||||
|
||||
export default NavigationMenuMobile;
|
94
components/navigationbar/navigationbar.tsx
Normal file
94
components/navigationbar/navigationbar.tsx
Normal file
@ -0,0 +1,94 @@
|
||||
import React from "react";
|
||||
import Link from "next/link";
|
||||
import { CircleUser, Menu, Search } from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuLabel,
|
||||
DropdownMenuSeparator,
|
||||
DropdownMenuTrigger,
|
||||
} from "@/components/ui/dropdown-menu";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Sheet, SheetContent, SheetTrigger } from "@/components/ui/sheet";
|
||||
import { getAuth } from "@/auth/queries/getauth";
|
||||
import NavigationMenuDesktop from "./desktopNavBar";
|
||||
import NavigationMenuMobile from "./mobileNavBar";
|
||||
import { signOut } from "@/auth/components/signout";
|
||||
const HeaderNavigation = async () => {
|
||||
const { user } = await getAuth();
|
||||
|
||||
return (
|
||||
<>
|
||||
{user && (
|
||||
<header className="sticky top-0 flex h-16 items-center gap-4 border-b bg-background px-4 md:px-6">
|
||||
<NavigationMenuDesktop />
|
||||
<Sheet>
|
||||
<SheetTrigger asChild>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="icon"
|
||||
className="shrink-0 md:hidden"
|
||||
>
|
||||
<Menu className="h-5 w-5" />
|
||||
<span className="sr-only">Toggle navigation menu</span>
|
||||
</Button>
|
||||
</SheetTrigger>
|
||||
<SheetContent side="left">
|
||||
<NavigationMenuMobile />
|
||||
</SheetContent>
|
||||
</Sheet>
|
||||
<div className="flex w-full items-center gap-4 md:ml-auto md:gap-2 lg:gap-4">
|
||||
<form className="ml-auto flex-1 sm:flex-initial">
|
||||
<div className="relative">
|
||||
<Search className="absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" />
|
||||
<Input
|
||||
type="search"
|
||||
placeholder="Search"
|
||||
className="pl-8 sm:w-[300px] md:w-[200px] lg:w-[300px]"
|
||||
/>
|
||||
</div>
|
||||
</form>
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button
|
||||
variant="secondary"
|
||||
size="icon"
|
||||
className="rounded-full"
|
||||
>
|
||||
<CircleUser className="h-5 w-5" />
|
||||
<span className="sr-only">Toggle user menu</span>
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end">
|
||||
<DropdownMenuLabel>My Account</DropdownMenuLabel>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem>
|
||||
<Link className="text-primary" href="/settings/home">
|
||||
Settings
|
||||
</Link>
|
||||
</DropdownMenuItem>
|
||||
{user.role === "ADMIN" && (
|
||||
<DropdownMenuItem>
|
||||
<Link className="text-primary" href="/admin/home">
|
||||
Admin
|
||||
</Link>
|
||||
</DropdownMenuItem>
|
||||
)}
|
||||
<DropdownMenuSeparator />
|
||||
<form action={signOut}>
|
||||
<Button className="bg-transparent text-primary hover:bg-transparent pl-2 font-normal">
|
||||
Logout
|
||||
</Button>
|
||||
</form>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
</header>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default HeaderNavigation;
|
35
components/navigationbar/settingsnavigation.tsx
Normal file
35
components/navigationbar/settingsnavigation.tsx
Normal file
@ -0,0 +1,35 @@
|
||||
"use client";
|
||||
import Link from "next/link";
|
||||
|
||||
import { usePathname } from "next/navigation";
|
||||
|
||||
const NAV_ITEMS = [
|
||||
{ href: "/settings/home", label: "General" },
|
||||
{ href: "/settings/security", label: "Security" },
|
||||
];
|
||||
|
||||
const SettingsSubMenuNavigation = () => {
|
||||
const pathname = usePathname();
|
||||
|
||||
return (
|
||||
<nav className="grid gap-4 text-sm text-muted-foreground">
|
||||
{NAV_ITEMS.map(({ href, label }) => {
|
||||
const isActive = pathname === href;
|
||||
|
||||
return (
|
||||
<Link
|
||||
key={href}
|
||||
href={href}
|
||||
className={`${
|
||||
isActive ? "font-semibold text-primary" : "text-muted-foreground"
|
||||
} text-sm`}
|
||||
>
|
||||
{label}
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</nav>
|
||||
);
|
||||
};
|
||||
|
||||
export default SettingsSubMenuNavigation;
|
Reference in New Issue
Block a user