From afe25e4131eed43dd7dd5b4e7203ceb7110d3528 Mon Sep 17 00:00:00 2001 From: Russ Hyde Date: Fri, 23 Feb 2024 15:44:30 +0000 Subject: [PATCH] refac: extract function for cluster-stats UI --- R/app_ui.R | 28 +--------------------------- R/module_cluster_stats.R | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 27 deletions(-) create mode 100644 R/module_cluster_stats.R diff --git a/R/app_ui.R b/R/app_ui.R index b705e93..5034af1 100644 --- a/R/app_ui.R +++ b/R/app_ui.R @@ -26,33 +26,7 @@ app_ui = function(request) { shiny::tabPanel( title = "Data", shiny::fluidRow( - shiny::column( - 12, - # use details and summary to create expandable section - htmltools::tags$details( - # preview of expandable section - htmltools::tags$summary("Cluster statistics (click to expand)"), - shiny::br(), - - # text to print choice - shiny::textOutput("select_text"), - shiny::br(), - - # output options - shiny::tabsetPanel( - id = "plot_tabs", - - # Tables tab - tablesUI("table1"), - - # Plots tab - plotsUI("plot1"), - - # RDS tab - rdsUI("rds1") - ) - ) - ) + shiny::column(12, clusterStatsUI(id = NULL)) ), # end fluid row # Bottom row - show tree (static html output from tfpscanner) diff --git a/R/module_cluster_stats.R b/R/module_cluster_stats.R new file mode 100644 index 0000000..ac82940 --- /dev/null +++ b/R/module_cluster_stats.R @@ -0,0 +1,28 @@ +clusterStatsUI = function(id) { + ns = NS(id) + + # use details and summary to create expandable section + htmltools::tags$details( + # preview of expandable section + htmltools::tags$summary("Cluster statistics (click to expand)"), + shiny::br(), + + # text to print choice + shiny::textOutput(ns("select_text")), + shiny::br(), + + # output options + shiny::tabsetPanel( + id = ns("plot_tabs"), + + # Tables tab + tablesUI(ns("table1")), + + # Plots tab + plotsUI(ns("plot1")), + + # RDS tab + rdsUI(ns("rds1")) + ) + ) +}