R/app_ui.R

Defines functions golem_add_external_resources app_ui

#' The application User-Interface
#'
#' @param request Internal parameter for `{shiny}`.
#'     DO NOT REMOVE.
#' @import shiny
#' @noRd
app_ui <- function(request) {
  tagList(
    navbarPage(
      "<CoCo> Cancer Omics Explorer",
      id = "navbar",
      collapsible = TRUE,
      # Leave this function for adding external resources in header
      header = golem_add_external_resources(),
      footer = tags$footer(
        tags$hr(),
        HTML('<a href="https://github.com/ShixiangWang/coco">Copyright &copy; 2022 - Coco team</a>')
      ),
      theme = bslib::bs_theme(bootswatch = "united",
                              font_scale = 1,
                              `enable-gradients` = TRUE,
                              `enable-shadows` = TRUE,
                              version = 5),
      tabPanel("Query",
               icon = icon("database"),
               fluidPage(
                 #titlePanel("Select Dataset for Analysis and Visualization"),
                 div(class = "db-title", reactableOutput("db")),
                 verbatimTextOutput("db_selected")
               )),
      tabPanel("Visualization",
               icon = icon("buromobelexperte")),
      tabPanel("Analysis",
               icon = icon("angle-double-down")),
      tabPanel("Global Setting",
               icon = icon("cogs")),
      tabPanel("About",
               icon = icon("question-circle"))
    )
  )
}

#' Add external Resources to the Application
#'
#' This function is internally used to add external
#' resources inside the Shiny application.
#'
#' @import shiny
#' @importFrom golem add_resource_path activate_js favicon bundle_resources
#' @noRd
golem_add_external_resources <- function() {
  add_resource_path(
    "www",
    app_sys("app/www")
  )

  tags$head(
    favicon(ext = 'png'),
    bundle_resources(
      path = app_sys("app/www"),
      app_title = "coco"
    ),
    use_waiter(),
    waiter_on_busy(html = spin_3k(), color = transparent(0.7)),
    useShinyjs(),
    useShinyalert(force = TRUE)
  )
}
ShixiangWang/coco documentation built on July 9, 2022, 4:43 a.m.