Skip to content

EntreesPage

Vin.ce edited this page Dec 8, 2024 · 1 revision

Overview

The EntreesPage component displays a list of available entrees and allows the user to increment or decrement the quantity of each item. It also provides a summary of selected entrees and their total price.

Key Features

  • Dynamic Entree List: Displays a list of entrees fetched via an API (tRPC).
  • Quantity Adjustment: Users can adjust the quantity of each entree and remove them if the quantity reaches zero.
  • Order Summary: The component summarizes the user's selected entrees and their total price.

Usage

<EntreesPage user="customer" category="entrees" setSelectedCategory={setSelectedCategory} addComboToCart={addComboToCart} />

This component handles loading and error states, fetches entree items via the api.menu.getMenuItemsByType query, and manages state for the selected entrees using useState.

Functions

  • incrementItem: Increments the quantity of an entree.
  • decrementItem: Decreases the quantity of an entree or removes it from the selection if the quantity is 0.

Clone this wiki locally