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
#' @import shinydashboard
#' @import shinyWidgets
#' @noRd
#' 
app_ui <- function(request) {
  # you can build the UI in the server by
  #In Server
  ## output$name <- renderMenu({}) # whatever it is
  #In UI (here)
  ## uiOutput('name') # whatever you called it in the output
  
  # can also build tabs/pages separately as normal variables and call them ezpz
  
    # setting output$to_render in server depending on which tab has been selected
   
    
    # eventually change it all to this: probably wait until I'm mostly done with it
    #tabItem( tabname, uiOutput(change all output$to_render to individual output$blah)),
    # tabItem(nexttab, uiOutput())
    # tabItem('start_tab',
    #         uiOutput('to_render')),
    # tabItem('pca_plots',
    #         uiOutput('pca_plot_output'))
    
#  )) 
  
  
  tagList(
    golem_add_external_resources(),
    dashboardPage(
      
      # title of app; dashboardHeader ----
      dashboardHeader(title = "INCA Mouse Cage"),
      # sidebar tabs ----
      dashboardSidebar(
        sidebarMenuOutput('sidebar')
      ),
      
      # dashboard Body ----
      # using an if else to set output$to_render in the server (only will run tab when )
      dashboardBody(tabItems(
        uiOutput('to_render')
      ))
      
    )) # end tagList( xxx, dashboardPage(
}






#' 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(),
    bundle_resources(
      path = app_sys('app/www'),
      app_title = 'MouseCageApp'
    )
    # Add here other external resources
    # for example, you can add shinyalert::useShinyalert() 
  )
}
becky-work/MouseCageApp documentation built on Dec. 19, 2021, 7:43 a.m.