Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ImLukzy/ChefDash/llms.txt

Use this file to discover all available pages before exploring further.

MainMapView is the level-selection hub of ChefDash. It presents all 20 kitchen levels as a scrollable vertical path styled like a classic arcade board, with each level node connected by a painted path segment. Players tap an unlocked node to open a full-screen pre-game overlay where they can equip purchased upgrades before committing to a round. The view becomes active when gameState.activeTab is set to "map.fill".

Layout Overview

The screen is a ZStack with two layers: the scrollable level path beneath and the pre-game overlay on top. The overlay is only rendered when showPreGameSheet == true.

Header HUD

Displays the Mapa de Cocinas title with the RUTA DE APRENDIZAJE label in orangeAccent, and the player’s current coin balance (🪙 gameState.coins) in a neonYellow capsule on the right.

Scrollable Level Path

A ScrollView containing a VStack of alternating level nodes and path connectors. Bottom padding of 120 pt clears the floating CustomTabBar.

Level Node Layout — Zigzag Pattern

Levels are rendered using ForEach(Array(gameState.levels.enumerated()), id: \.element.id). The horizontal alignment of each node alternates based on its index:
let isLeftAligned = index % 2 == 0
  • Even index (0, 2, 4 …) → node aligns to the left side of the screen
  • Odd index (1, 3, 5 …) → node aligns to the right side of the screen
This creates the signature zigzag path common to mobile level-select maps.

Level Node States

Each circular node is 70×70 pt and visually distinguishes locked from unlocked levels:
StateFill ColourIcon
UnlockedorangeAccent with 30% white strokeLevel number (24 pt black rounded)
LockedlockedGray (0.22, 0.22, 0.26)lock.fill icon at 18 pt, 30% opacity
Alongside the circle, an info card shows the level name (uppercased monospaced font). Unlocked levels display a 3-star row using star.fill / star system images in neonYellow; locked levels show a greyed-out “Bloqueado” label instead.

Path Connectors

Between every pair of adjacent nodes, a thin Rectangle acts as the connecting path segment:
Rectangle()
    .fill(isUnlocked ? orangeAccent.opacity(0.6) : lockedGray)
    .frame(width: 6, height: 32)
    .padding(.vertical, 4)
The connector reflects the unlock state of the next level — orange when unlocked, lockedGray when still locked.

Tapping a Level Node

Tapping an unlocked node runs the following logic:
if level.isUnlocked {
    if gameState.isHapticsEnabled {
        UIImpactFeedbackGenerator(style: .medium).impactOccurred()
    }
    gameState.selectedLevelIndex = index
    selectedLevelForPreview = level
    showPreGameSheet = true
}
The button is .disabled(!level.isUnlocked) so locked nodes register no touch interaction. Haptics fire at .medium style on a valid tap.

Pre-Game Overlay Modal

When showPreGameSheet is true, a full-screen dimmed overlay (Color.black.opacity(0.6)) appears over the map. Tapping the dim area closes the modal without starting the round. The modal card itself is a rounded rectangle (cornerRadius: 24) with a dark fill (0.12, 0.12, 0.15).
1

Mission Header

Displays the MISIÓN DISPONIBLE label, the selected level’s name (uppercased), and the target order count: "Meta: Servir X comandas." where X is level.targetOrders.
2

Upgrade Equipment Panel

Iterates gameState.shopInventory and renders one upgradeRow per item. Each row shows the item’s emoji, title, and current quantityOwned.
3

Start Round Button

The ¡EMPEZAR REVOLUCIÓN! button closes the modal, calls gameState.startNewRound(), then navigates to the kitchen:
gameState.activeTab = "kitchen_round"

Upgrade Row Buttons

The toggle state of each item is stored in gameState.selectedUpgradesForRound, which is a Set<String> of item IDs:
quantityOwnedButton LabelBehaviour
> 0, not selectedUSAR (orange capsule)Inserts item.id into selectedUpgradesForRound
> 0, selectedLISTO (green capsule)Removes item.id from selectedUpgradesForRound
== 0Comprar en Tienda (orange text capsule)Closes modal, navigates to gameState.activeTab = "cart.fill"
selectedUpgradesForRound is cleared automatically inside gameState.startNewRound() after the equipped items have their quantityOwned decremented. Items are consumed when the round starts, not when they are toggled.

Build docs developers (and LLMs) love