#' Title
#'
#' @include module_lab_submission.R module_design_run.R
#'
#' @export
ui <- function() {
shinymanager::secure_app(shiny::shinyUI(
shiny::fluidPage(
shinyjs::useShinyjs(),
theme = shinythemes::shinytheme("cosmo"),
shiny::navbarPage(
title = "covidApp",
id = "tabs",
# TAB1: Insert metadata
shiny::tabPanel(
title = "Load metadata",
value = "tab_1",
lab_submission_module_ui("tab1")
),
# TAB2: Download samples for library generation
shiny::tabPanel(
title = "Design run",
value = "tab_2",
design_run_module_ui("tab2")
)
)
)
))
}
#' Title
#'
#' @export
server <- function(){
function(input, output, session) {
res_auth <- shinymanager::secure_server(
check_credentials <- shinymanager::check_credentials(credentials)
)
## Module tab 1
lab_submission_module_server("tab1")
## Module tab 2
design_run_module_server("tab2")
## Conditional tab by user type
shiny::observe({
if (is.null(res_auth$module)) {
shiny::hideTab(inputId = "tabs", target = "tab_1")
} else {
if (res_auth$module == 1) {
shiny::showTab(inputId = "tabs", target = "tab_1")
shiny::hideTab(inputId = "tabs", target = "tab_2")
} else {
shiny::hideTab(inputId = "tabs", target = "tab_1")
shiny::showTab(inputId = "tabs", target = "tab_2")
}
}
})
}
}
#' Title
#'
#' @export
run_shiny <- function() {
shiny::runApp(list(ui = ui(), server = server()))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.