diff --git a/R/app_ui.R b/R/app_ui.R index 00a38e2..671e708 100644 --- a/R/app_ui.R +++ b/R/app_ui.R @@ -95,7 +95,6 @@ app_ui <- function(request) { sidebar = bslib::sidebar( bslib::accordion( id = "sidebar_accordion", - open = FALSE, multiple = TRUE, bslib::accordion_panel( @@ -109,6 +108,11 @@ app_ui <- function(request) { icon = bsicons::bs_icon("hospital"), mod_select_strategy_ui("mod_select_strategy") ) + ), + shiny::bookmarkButton( + label = "Bookmark", + title = "Bookmark your selections and get a URL for sharing", + icon = bsicons::bs_icon("bookmark"), ) ) ) diff --git a/R/mod_select_provider.R b/R/mod_select_provider.R index 367e74f..99ee600 100644 --- a/R/mod_select_provider.R +++ b/R/mod_select_provider.R @@ -50,6 +50,15 @@ mod_select_provider_server <- function(id, selected_geography) { ) }) + shiny::onRestored(function(state) { + # Enforce loading of selection when restoring from a bookmark + shiny::updateSelectInput( + session, + "provider_select", + selected = state$input$provider_select + ) + }) + shiny::reactive(input$provider_select) }) } diff --git a/R/mod_select_strategy.R b/R/mod_select_strategy.R index f0e5c12..4ae5c49 100644 --- a/R/mod_select_strategy.R +++ b/R/mod_select_strategy.R @@ -87,6 +87,15 @@ mod_select_strategy_server <- function(id) { ) }) + shiny::onRestored(function(state) { + # Enforce loading of selection when restoring from a bookmark + shiny::updateSelectInput( + session, + "strategy_select", + selected = state$input$strategy_select + ) + }) + shiny::reactive(input$strategy_select) }) } diff --git a/inst/app/text/info-interface.md b/inst/app/text/info-interface.md index 8d4980f..9c8514d 100644 --- a/inst/app/text/info-interface.md +++ b/inst/app/text/info-interface.md @@ -1,5 +1,7 @@ You can hover over the **information symbol** for further details. +Click the **Bookmark** button to save your selections and get a shareable URL so you can return to the app with these choices loaded. + To maximise space, you can click the: *