Skip to content

Commit

Permalink
Add more caffeinated drinks
Browse files Browse the repository at this point in the history
  • Loading branch information
Felixmil committed Nov 15, 2024
1 parent 305b89f commit 5ca5c27
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 25 deletions.
49 changes: 32 additions & 17 deletions app/logic/constants.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,38 @@ GENDERS <- c("male", "female")
POPULATIONS <- c("European", "White American", "Black American", "Mexican American", "Asian", "Japanese")

#' @export
COFFEE_TYPES <- list(
`Espresso` = list(caffeine = 64, water = 30),
`Americano` = list(caffeine = 77, water = 30),
`Cappuccino` = list(caffeine = 75, water = 180),
`Latte` = list(caffeine = 63, water = 300),
`Mocha` = list(caffeine = 95, water = 240),
`Macchiato` = list(caffeine = 71, water = 30),
`Ristretto` = list(caffeine = 75, water = 22),
`Long Black` = list(caffeine = 77, water = 120),
`Flat White` = list(caffeine = 77, water = 160),
`Affogato` = list(caffeine = 64, water = 30),
`Irish` = list(caffeine = 77, water = 150),
`Turkish` = list(caffeine = 95, water = 240),
`Greek` = list(caffeine = 95, water = 240),
`Vietnamese` = list(caffeine = 77, water = 150),
`Iced` = list(caffeine = 77, water = 150),
`Decaf` = list(caffeine = 2, water = 240)
DRINK_TYPES <- list(
# Coffee types
"Espresso" = list(caffeine = 64, water = 30), # Single shot (30 mL)
"Double Espresso" = list(caffeine = 128, water = 60), # Double shot (60 mL)
"Americano" = list(caffeine = 64, water = 240), # Espresso with water (240 mL)
"Latte" = list(caffeine = 64, water = 240), # Espresso with steamed milk (240 mL)
"Cappuccino" = list(caffeine = 64, water = 180), # Espresso with steamed milk & foam (180 mL)
"Flat White" = list(caffeine = 64, water = 160), # Espresso with steamed milk (160 mL)
"Mocha" = list(caffeine = 64, water = 240), # Espresso with chocolate & milk (240 mL)
"Macchiato" = list(caffeine = 64, water = 45), # Espresso with a dash of milk (45 mL)
"Ristretto" = list(caffeine = 64, water = 15), # Shorter espresso shot (15 mL)
"Lungo" = list(caffeine = 64, water = 60), # Extended espresso shot (60 mL)
"Drip Coffee" = list(caffeine = 95, water = 240), # Standard brew (240 mL)
"Cold Brew" = list(caffeine = 100, water = 240), # Coarse-ground steeped (240 mL)
"Iced Coffee" = list(caffeine = 95, water = 240), # Drip coffee served cold (240 mL)
"French Press" = list(caffeine = 80, water = 240), # Coarse-ground press (240 mL)
"Turkish Coffee" = list(caffeine = 60, water = 60), # Fine-ground simmered (60 mL)

# Decaf coffee options
"Decaf Espresso" = list(caffeine = 2, water = 30), # Single shot decaf (30 mL)
"Decaf Drip Coffee" = list(caffeine = 5, water = 240), # Standard brew decaf (240 mL)
"Decaf Americano" = list(caffeine = 2, water = 240), # Decaf espresso with water (240 mL)

# Teas
"Black Tea" = list(caffeine = 47, water = 240), # Steeped black tea (240 mL)
"Green Tea" = list(caffeine = 28, water = 240), # Steeped green tea (240 mL)
"White Tea" = list(caffeine = 15, water = 240), # Steeped white tea (240 mL)
"Oolong Tea" = list(caffeine = 37, water = 240), # Steeped oolong tea (240 mL)
"Matcha" = list(caffeine = 70, water = 60), # Fine powder green tea (60 mL)
"Chai Tea" = list(caffeine = 50, water = 240), # Spiced black tea (240 mL)
"Herbal Tea" = list(caffeine = 0, water = 240), # Herbal infusion (240 mL)
"Rooibos Tea" = list(caffeine = 0, water = 240) # Caffeine-free rooibos (240 mL)
)

#' @export
Expand Down
6 changes: 3 additions & 3 deletions app/view/edit_modal.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ box::use(

box::use(
app/view/react[edit_intake_data, edit_user_data],
app/logic/constants[COFFEE_TYPES, POPULATIONS, METABOLISM, UNITS]
app/logic/constants[DRINK_TYPES, POPULATIONS, METABOLISM, UNITS]
)

#' @export
Expand Down Expand Up @@ -66,7 +66,7 @@ server <- makeModuleServerDestroyable(
init_shiny_data = app_data$user_data,
ethinicity_options = POPULATIONS,
metabolism_options = METABOLISM,
coffee_type_options = COFFEE_TYPES,
coffee_type_options = DRINK_TYPES,
unit_options = UNITS
)
)
Expand All @@ -77,7 +77,7 @@ server <- makeModuleServerDestroyable(
edit_intake_data(
id = session$ns("edit_intake_data"),
init_shiny_data = app_data$intake_data,
coffee_type_options = COFFEE_TYPES
coffee_type_options = DRINK_TYPES
)
)
})
Expand Down
10 changes: 5 additions & 5 deletions app/view/intro_screen.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ box::use(
shiny[moduleServer, NS, tagList, observeEvent],
)
box::use(
app/logic/constants[COFFEE_TYPES, POPULATIONS, METABOLISM, UNITS],
app/logic/constants[DRINK_TYPES, POPULATIONS, METABOLISM, UNITS],
app/view/react[intro_screen_page], # Import the component.
)

Expand All @@ -16,7 +16,7 @@ ui <- makeModuleUIDestroyable(
id = ns("stepper"),
ethinicity_options = POPULATIONS,
metabolism_options = METABOLISM,
coffee_type_options = COFFEE_TYPES,
coffee_type_options = DRINK_TYPES,
unit_options = UNITS,
init_shiny_data = list(
ethnicity = "European",
Expand All @@ -30,17 +30,17 @@ ui <- makeModuleUIDestroyable(
unit = "metric",
intakes = list(
list(
type = COFFEE_TYPES["Americano"],
type = DRINK_TYPES["Americano"],
time = "08:00",
selected = TRUE
),
list(
type = COFFEE_TYPES["Latte"],
type = DRINK_TYPES["Latte"],
time = "10:00",
selected = TRUE
),
list(
type = COFFEE_TYPES["Espresso"],
type = DRINK_TYPES["Espresso"],
time = "13:30",
selected = TRUE
)
Expand Down

0 comments on commit 5ca5c27

Please sign in to comment.