"use client";
import { ChevronRight, Gamepad2, Trophy } from "lucide-react";
import Link from "next/link";
import { minigameIcon } from "@/components/frontend/minigames/minigameIcon";
import { UpcomingCountdown } from "@/components/frontend/minigames/UpcomingCountdown";
import type { RegistryGame } from "@/lib/minigames/registry";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuGroup,
DropdownMenuItem,
DropdownMenuLabel,
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import {
SidebarMenuButton,
SidebarMenuItem,
useSidebar,
} from "@/components/ui/sidebar";
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
/**
* Minigames sidebar dropdown. The groups and entries come from the minigames
* registry (resolved on the server and passed in), so retiring a game or
* reordering the list is an admin-data change, not a code change.
*
* Retired games are hidden. `upcoming` games are shown greyed out and are not
* links: they render as a plain hoverable row rather than a disabled
* `DropdownMenuItem`, because that item sets `pointer-events: none` when
* disabled, which would suppress the hover that reveals the tooltip.
*/
export function NavMinigames({ games }: { games: RegistryGame[] }) {
const { isMobile } = useSidebar();
const visible = games.filter((game) => game.status !== "retired");
const coreGames = visible.filter((game) => game.category === "core");
const cardtableGames = visible.filter((game) => game.category === "cardtable");
const renderGame = (game: RegistryGame) => {
const Icon = minigameIcon(game.icon);
if (game.status === "upcoming") {
return (
{game.label}
Upcoming
);
}
return (
{game.label}
);
};
return (
MinigamesCore
{coreGames.map(renderGame)}
CardtableEarn chips to spend by playing Core minigames!
{cardtableGames.map(renderGame)}
Leaderboards
);
}