1
0
Fork 0
polaris-task-force/src/components/frontend/blocks/NavMinigames.tsx
Z8MB1E ad2fbb167a refactor(nav): sidebar minigames group, inline admin link, hidden map entry
Move minigame links from the user dropdown into a NavMinigames sidebar group, inline the admin link in AppSidebar via a new canAccessAdminPanel helper, guard NavCore against empty groups, drop the feedback secondary link, and add an empty navMap slot with a restore comment so the World Map ships hidden while /map stays live.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-09-16 23:14:16 -04:00

83 lines
2.7 KiB
TypeScript

"use client";
import { Bird, Bomb, ChevronRight, Club, Crosshair, FileTextIcon, Gamepad2, Radio, Spade } from "lucide-react";
import Link from "next/link";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuGroup,
DropdownMenuItem,
DropdownMenuLabel,
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import {
SidebarMenuButton,
SidebarMenuItem,
useSidebar,
} from "@/components/ui/sidebar";
const coreGames = [
{ title: "Flight Simulator", url: "/minigames/flappy", icon: Bird },
{ title: "Minefield Clearance", url: "/minigames/eod", icon: Bomb },
{ title: "Radio Traffic", url: "/minigames/radio", icon: Radio },
{ title: "Qualification Course", url: "/minigames/qualification", icon: Crosshair },
{ title: "OPORD Recall", url: "/minigames/opord", icon: FileTextIcon },
];
const cardtableGames = [
{ title: "Poker", url: "/minigames/poker", icon: Spade },
{ title: "Blackjack", url: "/minigames/blackjack", icon: Club },
];
export function NavMinigames() {
const { isMobile } = useSidebar();
return (
<SidebarMenuItem>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<SidebarMenuButton size="sm">
<Gamepad2 />
<span>Minigames</span>
<ChevronRight className="ml-auto size-4 text-sidebar-foreground/50" />
</SidebarMenuButton>
</DropdownMenuTrigger>
<DropdownMenuContent
className="w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg"
side={isMobile ? "bottom" : "right"}
align="end"
sideOffset={4}
>
<DropdownMenuGroup>
<DropdownMenuLabel>Core</DropdownMenuLabel>
{coreGames.map((game) => (
<DropdownMenuItem key={game.url} asChild>
<Link href={game.url}>
<game.icon />
{game.title}
</Link>
</DropdownMenuItem>
))}
</DropdownMenuGroup>
<DropdownMenuSeparator />
<DropdownMenuGroup>
<DropdownMenuLabel className="flex flex-col">
<span>Cardtable</span>
<span className="text-xs font-normal text-muted-foreground">Earn chips to spend by playing Core minigames!</span>
</DropdownMenuLabel>
{cardtableGames.map((game) => (
<DropdownMenuItem key={game.url} asChild>
<Link href={game.url}>
<game.icon />
{game.title}
</Link>
</DropdownMenuItem>
))}
</DropdownMenuGroup>
</DropdownMenuContent>
</DropdownMenu>
</SidebarMenuItem>
);
}