Skip to content

Commit 39d74ac

Browse files
committed
feat: UI tweaks
- Hide example buttons behind a toggle panel - Add disclaimer about postratification upload in special modules
1 parent 3ebb6b2 commit 39d74ac

File tree

2 files changed

+35
-26
lines changed

2 files changed

+35
-26
lines changed

R/mod_analyze_upload.R

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -89,31 +89,27 @@ mod_analyze_upload_ui <- function(id) {
8989
),
9090
# Example data label
9191
tags$div(class = "mt-4",
92-
conditionalPanel(
93-
condition = "output.special_case == 'covid'",
94-
tags$p(tags$u("Example"), ": COVID-19 hospital test records")
95-
),
96-
conditionalPanel(
97-
condition = "output.special_case == 'poll'",
98-
tags$p(tags$u("Example"), ": 2018 Cooperative Congressional Election Study")
99-
),
100-
conditionalPanel(
101-
condition = "output.special_case === null",
102-
tags$p(tags$u("Example data"))
92+
actionButton(
93+
inputId = ns("example_popover_btn"),
94+
label = "Example Data",
95+
icon = icon("chevron-down"),
96+
class = "btn btn-sm btn-secondary"
10397
),
104-
conditionalPanel(
105-
condition = "output.family != 'normal'",
106-
tags$div(
107-
class = "d-flex gap-2 mb-3",
108-
actionButton(ns("use_indiv_example"), "Individual-level", icon("table")),
109-
actionButton(ns("use_agg_example"), "Aggregated", icon("table"))
98+
tags$div(id = ns("example_popover"),
99+
class = "mt-2",
100+
conditionalPanel(
101+
condition = "output.family != 'normal'",
102+
tags$div(
103+
class = "d-flex gap-2 mb-3",
104+
actionButton(ns("use_indiv_example"), "Individual-level", icon("table")),
105+
actionButton(ns("use_agg_example"), "Aggregated", icon("table"))
106+
)
107+
),
108+
conditionalPanel(
109+
condition = "output.family == 'normal'",
110+
actionButton(ns("use_indiv_example"), "Individual-level", icon("table"), class = "w-100")
110111
)
111-
),
112-
conditionalPanel(
113-
condition = "output.family == 'normal'",
114-
actionButton(ns("use_indiv_example"), "Individual-level", icon("table"), class = "w-100")
115-
),
116-
112+
)
117113
)
118114
),
119115
bslib::accordion_panel(
@@ -134,13 +130,18 @@ mod_analyze_upload_ui <- function(id) {
134130
),
135131
conditionalPanel(
136132
condition = "output.special_case !== null",
137-
tags$p("Provide information for linking the input data to the ACS data.",
133+
tags$p("Provide information for linking the input data to the American Community Survey (ACS) data. Poststratification data upload is not supported for this special",
134+
actionLink(
135+
inputId = ns("show_pstrat_guide"),
136+
label = "module"
137+
),
138+
".",
138139
class = "small"
139-
),
140+
)
140141
),
141142
conditionalPanel(
142143
condition = "output.special_case === null",
143-
tags$p("Provide information for linking the input data to the ACS data or upload poststratification data.",
144+
tags$p("Provide information for linking the input data to the American Community Survey (ACS) data or upload poststratification data.",
144145
class = "small"
145146
),
146147
),
@@ -309,6 +310,10 @@ mod_analyze_upload_server <- function(id, global){
309310
shinyjs::toggle(id = "sample_spec_popover")
310311
})
311312

313+
observeEvent(input$example_popover_btn, {
314+
shinyjs::toggle(id = "example_popover")
315+
})
316+
312317

313318
# --------------------------------------------------------------------------
314319
# Show feedback about input data
@@ -577,6 +582,9 @@ mod_analyze_upload_server <- function(id, global){
577582
.show_guide("upload")
578583
})
579584

585+
observeEvent(input$show_pstrat_guide, {
586+
.show_guide("upload")
587+
})
580588

581589
# navigate to Learn > Preprocess
582590
observeEvent(input$to_preprocess, {

R/utils_server.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
# reset popover states
2525
shinyjs::show("sample_spec_popover")
26+
shinyjs::hide("example_popover")
2627
shinyjs::show("link_acs_popover")
2728
shinyjs::hide("pstrat_upload_popover")
2829
}

0 commit comments

Comments
 (0)