From 975a58957c566299fb7945271ad32849e87c8106 Mon Sep 17 00:00:00 2001 From: Matt Dray <18232097+matt-dray@users.noreply.github.com> Date: Fri, 6 Feb 2026 14:44:33 +0000 Subject: [PATCH 1/2] Add bookmarking functionality and button --- R/app_ui.R | 6 +++++- R/mod_select_provider.R | 9 +++++++++ R/mod_select_strategy.R | 9 +++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) 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) }) } From 4f5e687ceb9ea877fbdb776c59cbe318f0e1a31e Mon Sep 17 00:00:00 2001 From: Matt Dray <18232097+matt-dray@users.noreply.github.com> Date: Fri, 6 Feb 2026 16:16:49 +0000 Subject: [PATCH 2/2] Add note to interface card about bookmarks --- inst/app/text/info-interface.md | 2 ++ 1 file changed, 2 insertions(+) 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: *