import { lazy, Suspense } from "react"; import { Box, Button, Flex, Loader, SimpleGrid, Stack, Text, UnstyledButton, } from "@mantine/core"; import { Icon } from "@phosphor-icons/react"; import { ListDashes, ListIcon, TreeStructureIcon, UsersIcon, } from "@phosphor-icons/react"; import { useNavigate } from "@tanstack/react-router"; import Sheet from "@/components/sheet/sheet"; import { useSheet } from "@/hooks/use-sheet"; import TeamList from "@/features/teams/components/team-list"; import WizardOrbIcon from "@/components/wizard-orb-icon"; import { Tournament } from "../../../types"; import classes from "./nav-grid.module.css"; const RulesContent = lazy( () => import("../../upcoming-tournament/rules-content") ); interface NavTileProps { label: string; Icon: Icon; onClick: () => void; } /** A single square-ish nav tile with icon-over-label and press feedback. */ const NavTile = ({ label, Icon, onClick }: NavTileProps) => ( {label} ); interface NavGridProps { tournament: Tournament; isAdmin: boolean; hasGroupStage: boolean; isPredictable: boolean; predictionsLocked: boolean; hasSubmitted: boolean; } /** * Consolidates the old stack of full-width ListLinks into a compact icon grid * so it no longer dominates the page. Every original destination stays * reachable with identical conditional visibility. Teams and Rules open sheets; * everything else navigates. */ const NavGrid = ({ tournament, isAdmin, hasGroupStage, isPredictable, predictionsLocked, hasSubmitted, }: NavGridProps) => { const navigate = useNavigate(); const teamsSheet = useSheet(); const rulesSheet = useSheet(); return ( {isAdmin && ( navigate({ to: `/admin/tournaments/${tournament.id}` }) } /> )} {hasGroupStage && ( navigate({ to: `/tournaments/${tournament.id}/groups` }) } /> )} navigate({ to: `/tournaments/${tournament.id}/bracket` }) } /> {isPredictable && !predictionsLocked && ( navigate({ to: `/tournaments/${tournament.id}/predictions/make` }) } /> )} {isPredictable && (predictionsLocked || hasSubmitted) && ( navigate({ to: `/tournaments/${tournament.id}/predictions` }) } /> )} } > ); }; export default NavGrid;