Skip to content

Commit 59326f7

Browse files
committed
[style] settings page
1 parent 98bbfd4 commit 59326f7

File tree

3 files changed

+140
-108
lines changed

3 files changed

+140
-108
lines changed

R_scripts/functions/fun_ui.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ buttonStyles = function(type = "blue"){
5252
}
5353
if (type == "red")
5454
{#orange: #F07221 #red:cc0000
55-
return("color: #fff; background-color: #F07221; border-color: #990000; margin-bottom: 2rem; margin-top: 2rem")
55+
return("color: #fff; background-color: #F07221; border-color: #990000; margin-bottom: 2rem; margin-top: 1rem")
5656
}
5757
if (type == "green")
5858
{
@@ -74,7 +74,7 @@ numericInputRow <- function(inputId, label, value = ""){
7474
menuOutput = function(){
7575
return(list(
7676
menuItem("About", tabName = "about", icon = icon("th")),
77-
menuItem("Project Settings", tabName = "sett", icon = icon("circle-notch")),
77+
menuItem("Settings", tabName = "sett", icon = icon("circle-notch")),
7878
menuItem("Data", tabName = "data", icon = icon("circle-notch"),
7979
menuSubItem("Upload", tabName = "dat_upl"),
8080
menuSubItem("Filter", tabName = "dat_filter"),

R_scripts/functions/fun_ui_settings.R

+133-105
Original file line numberDiff line numberDiff line change
@@ -9,118 +9,146 @@ themes <- list("Bw" = theme_bw(),
99
################
1010
### SETTINGS ###
1111
################
12-
settingsOutput = function(){
13-
return(
14-
fluidRow(
15-
column(7,
16-
fluidRow(
17-
box(title = "Project",
18-
status = "warning", solidHeader = F, #height = 300,
19-
collapsible = T, width = 12,
20-
21-
p("Please select a project or create a new folder:"),
22-
23-
shinyDirButton('folder',
24-
'Folder select',
25-
'Please select a folder',
26-
# multiple = FALSE,
27-
style = buttonStyles("red"),
28-
icon = icon("folder-open")),
29-
actButton("crtPrj", "Create/set project", "create"),
30-
br(), br(),
31-
h4("Current project"),
32-
verbatimTextOutput("prjName"),
33-
h4("Current project directory"),
34-
verbatimTextOutput("prjDir")
35-
),
36-
box(title = "Measuring environment",
37-
status = "warning",
38-
collapsible = T, width = 12,
39-
h4("Wood properties"),
40-
fluidRow(
41-
column(4, numericInput("stemCircumference",
42-
"Stem circumference (cm)",
43-
value = 0.0)),
44-
column(4, numericInput("stemDiameter",
45-
"Stem diameter (cm)",
46-
value = 0.0)),
47-
column(4, numericInput("barkThickness",
48-
"Bark thickness (cm)",
49-
value = 0.0))
50-
),
12+
settingsOutput = function() {
13+
return(list(fluidRow(
14+
box(
15+
title = "Measuring environment",
16+
status = "warning",
17+
collapsible = T,
18+
width = 7,
19+
box.settings_measuring()
20+
),
21+
box(
22+
title = "Project",
23+
status = "info",
24+
solidHeader = F,
25+
collapsible = T,
26+
width = 5,
27+
box.settings_project()
28+
29+
),
30+
box(
31+
title = "File output (optional)",
32+
status = "info",
33+
solidHeader = F,
34+
collapsible = T,
35+
collapsed = T,
36+
width = 5,
37+
box.setting_files()
38+
),
39+
40+
box(
41+
title = "Visualization (optional)",
42+
status = "info",
43+
solidHeader = F,
44+
collapsible = T,
45+
collapsed = T,
46+
width = 5,
47+
box.setting_visualization()
48+
)
49+
)))
50+
}
5151

52-
fluidRow(
53-
column(4, numericInput("sapWoodDepth",
54-
"Sap wood depth (cm)",
55-
value = 0.0)),
56-
column(4, numericInput("heartWoodDepth",
57-
"Heart wood depth (cm)",
58-
value = 0.0))
59-
),
60-
61-
62-
fluidRow(
63-
column(4, checkboxInput("swExact", "Use exact sap-/ heartwood values*",
64-
F)),
65-
column(6, p("* If enabled wood attributes, i.e. R, Aring, Cring, are calculated using
66-
the sum of sapwood and heartwood depth"))
67-
),
68-
69-
70-
71-
numericInput("ThermalDiffusivity",
72-
HTML("Thermal diffusivity (cm<sup>2</sup> s <sup>-1</sup>)"),
73-
value = 0.0025),
74-
52+
box.settings_project = function(){
53+
return(list(
54+
p("1. Select or create a new folder to store files generated with this app."),
55+
shinyDirButton('folder',
56+
'Folder select',
57+
'Please select a folder',
58+
# multiple = FALSE,
59+
style = buttonStyles("red"),
60+
icon = icon("folder-open", style="margin-right:.5em")),
61+
62+
p("2. Create your project directory."),
63+
actButton("crtPrj", "Create/set project", "create"),
64+
# br(), br(),
65+
h4("Current project"),
66+
verbatimTextOutput("prjName"),
67+
h4("Current project directory"),
68+
verbatimTextOutput("prjDir")
69+
))
70+
}
7571

76-
box.settings_sensor()
77-
)
78-
)),
79-
column(5,
80-
fluidRow(
81-
box(title = "File output",
82-
status = "warning", solidHeader = F,
83-
collapsible = T, width = 12,
84-
p(em("(Optional inputs)")),
85-
selectInput("figFor", "Figure format",
86-
c("jpg" = "jpg",
87-
"rdata" = "rdata",
88-
"pdf" = "pdf")),
89-
90-
textInput("figTitle", "Figure title",
91-
placeholder = "e.g. tree species"),
92-
radioButtons("fileAppend", "String added to file names",
93-
choices = c("Input file name" = "inputName",
94-
"Manual" = "manual",
95-
"None" = "none")),
96-
conditionalPanel(condition = "input.fileAppend == `manual`",
97-
textInput("fileAppendName", "File name",
98-
placeholder = "e.g. summer_22"))),
99-
100-
box(title = "Visualization",
101-
status = "warning", solidHeader = F,
102-
collapsible = T, width = 12,
103-
selectInput("figTheme", "Figure theme (ggplot)",
104-
choices = names(themes),
105-
selected = themes["Light"]),
106-
uiOutput('theme_output'),
107-
textInput("fillColors", "Fill colors for discrete data*",
108-
placeholder = 'Hex colors, comma delimited: #CD5C5C, #FFBF00, #6495ED'),
109-
textInput("gradientColors", "Colors for gradient color scale**",
110-
placeholder = 'Hex colors, comma delimited: #CD5C5C, #FFBF00'),
111-
p("* Colors can be either hex colors or a RColorBrewer palette,
112-
e.g. 'Blues'"),
113-
p("** Two colors representing low and high values."),
114-
115-
)))
116-
)
117-
)
72+
box.setting_files = function(){
73+
return(list(
74+
selectInput("figFor", "Figure format",
75+
c("jpg" = "jpg",
76+
"rdata" = "rdata",
77+
"pdf" = "pdf")),
78+
79+
textInput("figTitle", "Figure title",
80+
placeholder = "e.g. tree species"),
81+
radioButtons("fileAppend", "String added to file names",
82+
choices = c("Input file name" = "inputName",
83+
"Manual" = "manual",
84+
"None" = "none")),
85+
conditionalPanel(condition = "input.fileAppend == `manual`",
86+
textInput("fileAppendName", "File name",
87+
placeholder = "e.g. summer_22"))
88+
))
11889
}
11990

91+
box.setting_visualization = function(){
92+
return(list(
93+
selectInput("figTheme", "Figure theme (ggplot)",
94+
choices = names(themes),
95+
selected = themes["Light"]),
96+
uiOutput('theme_output'),
97+
textInput("fillColors", "Fill colors for discrete data*",
98+
placeholder = 'Hex colors, comma delimited: #CD5C5C, #FFBF00, #6495ED'),
99+
textInput("gradientColors", "Colors for gradient color scale**",
100+
placeholder = 'Hex colors, comma delimited: #CD5C5C, #FFBF00'),
101+
p("* Colors can be either hex colors or a RColorBrewer palette,
102+
e.g. 'Blues'"),
103+
p("** Two colors representing low and high values.")
104+
))
105+
}
120106

107+
box.settings_measuring = function(){
108+
return(list(
109+
h3(strong("Wood properties")),
110+
fluidRow(
111+
column(4, numericInput("stemCircumference",
112+
"Stem circumference (cm)",
113+
value = 0.0)),
114+
column(4, numericInput("stemDiameter",
115+
"Stem diameter (cm)",
116+
value = 0.0)),
117+
column(4, numericInput("barkThickness",
118+
"Bark thickness (cm)",
119+
value = 0.0))
120+
),
121+
122+
fluidRow(
123+
column(4, numericInput("sapWoodDepth",
124+
"Sap wood depth (cm)",
125+
value = 0.0)),
126+
column(4, numericInput("heartWoodDepth",
127+
"Heart wood depth (cm)",
128+
value = 0.0))
129+
),
130+
131+
132+
fluidRow(
133+
column(4, checkboxInput("swExact", "Use exact sap-/ heartwood values*",
134+
F)),
135+
column(6, p("* If enabled wood attributes, i.e. R, Aring, Cring, are calculated using
136+
the sum of sapwood and heartwood depth"))
137+
),
138+
139+
140+
141+
numericInput("ThermalDiffusivity",
142+
HTML("Thermal diffusivity (cm<sup>2</sup> s <sup>-1</sup>)"),
143+
value = 0.0025),
144+
145+
146+
box.settings_sensor()
147+
))
148+
}
121149
box.settings_sensor = function(){
122150
return(list(
123-
h4("Sensor properties"),
151+
h3(strong("Sensor properties")),
124152
fluidRow(
125153
column(6, numericInput("dist2first",
126154
"Distance to first thermometer (mm)",

server.R

+5-1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ shinyServer(function(input, output, session) {
100100
projectPath()
101101
})
102102

103+
#' Show string as default
104+
output$prjName <- renderPrint({
105+
cat("No project chosen")
106+
})
103107

104108
#### Buttons ####
105109

@@ -129,7 +133,7 @@ shinyServer(function(input, output, session) {
129133
type = "message")
130134
}
131135
output$prjName <- renderPrint({
132-
projectName()
136+
cat(projectName())
133137
})
134138
})
135139

0 commit comments

Comments
 (0)