-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathui.R
177 lines (134 loc) · 6.62 KB
/
ui.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
library(shinyalert)
library(shinydashboard)
library(dplyr)
library(readr)
# xml2::write_html(rvest::html_node(xml2::read_html("details.html"), "body"), file = "details_fixed.html")
brands <- read_csv("data/raw_water_Romania.csv") %>%
pull(Brand)
ui <- dashboardPage(
dashboardHeader(title = "Water for Coffee", titleWidth = 230),
dashboardSidebar(
sidebarMenu(
menuItem("Calculator", tabName = "manual_calc", icon = icon("calculator")),
menuItem("Find waters", tabName = "target_calc", icon = icon("bar-chart"))
# menuItem("Details", tabName = "details", icon = icon("info"))
)
),
dashboardBody(
useShinyalert(),
tabItems(
tabItem(tabName = "manual_calc",
h2("Waters calculator"),
h4("Select bottled waters from the list and choose proportions (they must sum up to 100%)."),
br(),
fluidRow(
tags$head(tags$style(HTML('
.estimation_button {background-color: #33CE67; width: 100%}
.estimation_button:hover {background-color: #1DAA4C}
'))),
box(
width = 3,
title = "First water",
status = "primary",
solidHeader = TRUE,
selectInput("first_water", label = NULL, choices = brands, selected = "Smart Water"),
numericInput("first_coef", label = "Proportion %", 20, min = 0, max = 100, step = 1)
),
box(
width = 3,
title = "Second water",
status = "primary",
solidHeader = TRUE,
selectInput("second_water", label = NULL, choices = brands, selected = "Bucovina"),
numericInput("second_coef", label = "Proportion %", 50, min = 0, max = 100, step = 1)
),
box(
width = 3,
title = "Third water",
status = "primary",
solidHeader = TRUE,
selectInput("third_water", label = NULL, choices = brands, selected = "Izvorul Minunilor"),
numericInput("third_coef", label = "Proportion %", 30, min = 0, max = 100, step = 1)
),
box(
width = 3,
status = "success",
solidHeader = TRUE,
actionButton("calc_recipe", icon("calculator"), label = "Calculate recipe", class = "estimation_button"),
downloadButton("save_recipe", "Save recipe to CSV", class = "estimation_button")
)
),
fluidRow(
valueBoxOutput("alkalinity", width = 2),
valueBoxOutput("hardness", width = 2),
valueBoxOutput("calcium", width = 2),
valueBoxOutput("magnesium", width = 2),
valueBoxOutput("tds", width = 2),
valueBoxOutput("ph", width = 2)
),
fluidRow(
box(
title = "Compare to starting waters",
solidHeader = TRUE,
status = "primary",
width = 6,
plotOutput("plot_ingredients")
),
box(
title = "Compare to SCA standards and CDH Ideal Zone",
solidHeader = TRUE,
status = "primary",
width = 6,
plotOutput("plot_sca_range")
)
)
),
tabItem(
tabName = "target_calc",
h2("Waters with specific alkalinity and hardness"),
br(),
fluidRow(
box(
width = 3,
title = "Alkalinity",
status = "primary",
solidHeader = TRUE,
numericInput("target_alk", label = NULL, 40, min = 20, max = 100, step = 5)
),
box(
width = 3,
title = "Min Hardness",
status = "primary",
solidHeader = TRUE,
numericInput("min_hard", label = NULL, 68, min = 0, max = 220, step = 10)
),
box(
width = 3,
title = "Max Hardness",
status = "primary",
solidHeader = TRUE,
numericInput("max_hard", label = NULL, 70, min = 0, max = 220, step = 12)
),
box(
width = 3,
status = "success",
solidHeader = TRUE,
actionButton("find_recipe", icon = icon("search"), label = "Find recipes", class = "estimation_button"),
downloadButton("save_found_recipes", "Save recipes to CSV", class = "estimation_button")
)
),
fluidRow(
box(
width = 12,
DT::DTOutput("recipe_table")
)
)
)
# tabItem(
#
# tabName = "details",
# includeHTML("details_fixed.html")
# )
)
)
)