πŸ‘¨β€πŸ’Ό The muffin shop wants a simple dashboard for a single order so the team can double-check totals before handing it off.
πŸ“œ This example uses React + Vite, but everything React-related is already done for you. You only need the workshop skills: numbers, strings, booleans, variables, functions, if/else, switch statements, loops, and never.
🐨 Open
src/muffin-utils.ts
and complete the following tasks:
  1. Format money with a template literal.
  2. Add the (GF) label for gluten-free items.
  3. Sum the subtotal with a loop.
  4. Apply the member discount.
  5. Calculate tax and tip.
  6. Calculate the final total.
  7. Return the pickup fee with a switch statement.
  8. Return the pickup label with a switch statement.
  9. Format the special note when it's empty.
  10. Log the ready message.
  11. Implement assertNever.
πŸ’° Toggle memberStatus or pickupMethod in
src/app.tsx
to see different outputs.

Try next

  • 🐨 Add another OrderItem and watch the totals change.
  • 🐨 Add a rushOrder boolean and increase the tip when it is true.
  • 🐨 Add a itemCount helper that uses a loop to count total quantity.
  • 🐨 Add a happyHour boolean and reduce the muffin price when true.
  • 🐨 Add a memberMessage string in app.tsx using an if check.
  • πŸ’° Change specialNote to a real note and confirm the fallback logic.

Please set the playground first

Loading "Muffin Shop Dashboard"
Login to get access to the exclusive discord channel.
Loading Discord Posts