Skip to content

Commit 0b0f650

Browse files
committed
fix: update variable browser based on the new UI changes
1 parent d735da6 commit 0b0f650

File tree

1 file changed

+30
-52
lines changed

1 file changed

+30
-52
lines changed

R/tm_variable_browser.R

Lines changed: 30 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -141,24 +141,20 @@ ui_variable_browser <- function(id,
141141
post_output = NULL) {
142142
ns <- NS(id)
143143

144-
tagList(
144+
tags$div(
145145
include_css_files("custom"),
146146
shinyjs::useShinyjs(),
147147
teal.widgets::standard_layout(
148-
output = fluidRow(
148+
output = tags$div(
149149
htmlwidgets::getDependency("sparkline"), # needed for sparklines to work
150-
column(
151-
6,
152-
# variable browser
150+
bslib::layout_column_wrap(
151+
width = 0.5,
153152
teal.widgets::white_small_well(
154153
uiOutput(ns("ui_variable_browser")),
155154
shinyjs::hidden({
156155
checkboxInput(ns("show_parent_vars"), "Show parent dataset variables", value = FALSE)
157156
})
158-
)
159-
),
160-
column(
161-
6,
157+
),
162158
teal.widgets::white_small_well(
163159
### Reporter
164160
teal.reporter::simple_reporter_ui(ns("simple_reporter")),
@@ -331,41 +327,35 @@ srv_variable_browser <- function(id,
331327
varname <- plot_var$variable[[dataname]]
332328
df <- data()[[dataname]]
333329

334-
numeric_ui <- tagList(
335-
fluidRow(
336-
tags$div(
337-
class = "col-md-4",
338-
tags$br(),
339-
shinyWidgets::switchInput(
340-
inputId = session$ns("display_density"),
341-
label = "Show density",
330+
numeric_ui <- bslib::page_fluid(
331+
bslib::layout_columns(
332+
col_widths = c(8, 4),
333+
bslib::layout_columns(
334+
col_widths = c(6, 6, 12),
335+
style = bslib::css(grid_row_gap = 0),
336+
bslib::input_switch(
337+
id = session$ns("display_density"),
338+
label = tags$div(
339+
"Show density:",
340+
bslib::tooltip(
341+
trigger = icon("circle-info"),
342+
tags$span(
343+
"Show kernel density estimation with gaussian kernel and bandwidth function bw.nrd0 (R default)"
344+
)
345+
)
346+
),
342347
value = `if`(is.null(isolate(input$display_density)), TRUE, isolate(input$display_density)),
343-
width = "50%",
344-
labelWidth = "100px",
345-
handleWidth = "50px"
346-
)
347-
),
348-
tags$div(
349-
class = "col-md-4",
350-
tags$br(),
351-
shinyWidgets::switchInput(
352-
inputId = session$ns("remove_outliers"),
348+
width = "100%"
349+
),
350+
bslib::input_switch(
351+
id = session$ns("remove_outliers"),
353352
label = "Remove outliers",
354353
value = `if`(is.null(isolate(input$remove_outliers)), FALSE, isolate(input$remove_outliers)),
355-
width = "50%",
356-
labelWidth = "100px",
357-
handleWidth = "50px"
358-
)
354+
width = "100%"
355+
),
356+
uiOutput(session$ns("ui_outlier_help"))
359357
),
360-
tags$div(
361-
class = "col-md-4",
362-
uiOutput(session$ns("outlier_definition_slider_ui"))
363-
)
364-
),
365-
tags$div(
366-
class = "ml-4",
367-
uiOutput(session$ns("ui_density_help")),
368-
uiOutput(session$ns("ui_outlier_help"))
358+
uiOutput(session$ns("outlier_definition_slider_ui"))
369359
)
370360
)
371361

@@ -455,18 +445,6 @@ srv_variable_browser <- function(id,
455445
)
456446
})
457447

458-
output$ui_density_help <- renderUI({
459-
req(is.logical(input$display_density))
460-
if (input$display_density) {
461-
tags$small(helpText(paste(
462-
"Kernel density estimation with gaussian kernel",
463-
"and bandwidth function bw.nrd0 (R default)"
464-
)))
465-
} else {
466-
NULL
467-
}
468-
})
469-
470448
output$ui_outlier_help <- renderUI({
471449
req(is.logical(input$remove_outliers), input$outlier_definition_slider)
472450
if (input$remove_outliers) {

0 commit comments

Comments
 (0)