ShopView is ChefDash’s in-game economy screen, where players convert the coins they earn from completing burger orders into single-use power-ups called consumables. Each consumable grants a specific in-round advantage — more time on the clock, a head-start combo multiplier, or extra coins per perfect serve — and stacks in the player’s inventory until equipped in the pre-game modal on MainMapView. The screen becomes active whenDocumentation 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.
gameState.activeTab is set to "cart.fill".
Header
The header uses the same two-columnHStack pattern seen on the Map screen. On the left, a monospaced SUMINISTROS DISPONIBLES label sits above the Tienda de Mejoras title. On the right, a neonYellow capsule shows the live coin balance from gameState.coins, updating immediately as purchases are made.
Shop Items
The three items are seeded directly intogameState.shopInventory at GameState.init() and rendered via ForEach(state.shopInventory). Each card is a rounded rectangle (cornerRadius: 18) with a cardBackground fill (0.14, 0.14, 0.18).
Available Items
| Item | Emoji | ID | Price | UpgradeType | Effect |
|---|---|---|---|---|---|
| Horno Industrial | 🌋 | oven | 50 🪙 | .extraTime | +15 s extra time for the current round |
| Cuchillo Afilado | 🔪 | knife | 30 🪙 | .comboBooster | Start the round with combo ×2 |
| Salsa Secreta | 🥫 | sauce | 40 🪙 | .instantServe | +10 coins per perfect burger served |
The
UpgradeType enum has an instantServe case, but in GameState.triggerSuccess() the Salsa Secreta bonus is applied by checking shopInventory directly for a non-zero quantityOwned on the "sauce" item — it grants +10 coins per perfect order on top of the base 25-coin reward, multiplied by the current combo.Shop Row Layout
Each row is built by the privateshopRow(for:state:) view builder and contains four elements from left to right:
- Emoji icon — 34 pt inside a 64×64 pt
RoundedRectangletile with a dark background - Text stack —
item.titleuppercased in white monospaced,item.descriptionin 50% white, and"En inventario: X"count inorangeAccent - Spacer
- Buy button — shows the label COMPRAR and the price (
X 🪙)
Purchase Logic
The buy button is disabled when the player cannot afford the item:canAffordItem is false, the button background switches from orangeAccent to Color.white.opacity(0.05) and the drop shadow is removed, giving clear visual feedback that the item is unaffordable. The purchase writes directly to state.shopInventory[index].quantityOwned inline — no separate method is called on GameState.
Haptics on Purchase
IfgameState.isHapticsEnabled is true, a .medium style UIImpactFeedbackGenerator fires on every successful purchase. This is the same style used for level node taps on the map.
ShopItem Model
Items are defined by the ShopItem struct in ShopItem.swift:
quantityOwned is the only mutable property — all other fields are constants set at initialisation in GameState. There is no upper limit enforced on how many copies of a single item can be purchased.