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(
    # Leave this function for adding external resources
    golem_add_external_resources(),
    # List the first level UI elements here 
    mod_splash_module_ui("splash_module_ui_1"),
    hidden(
      div(id = "dash",
          # Add UI elements that are consistent across tabs
          shinydashboardPlus::dashboardPagePlus(
            useShinyjs(),
            tags$script(HTML("$('body').addClass('fixed');")),
            
            
            #   Header -----------------------------------------------------------------
            header = dashboardHeaderPlus(
              #Add logos
              title = tagList(
                img(class = "logo-mini", src = "www/logo_short_wt.png", height = "50px", width = "52.5px", align = "centre"), 
                img(class = "logo-lg", src = "www/logo_long_wt.png", height = "50px", width = "230px", align = "left")),
              enable_rightsidebar = F,
              rightSidebarIcon = "cog"
            ),
            
            
            #   Left Sidebar -----------------------------------------------------------
            #      div(id = "test",
            sidebar = dashboardSidebar(
              width = 300,
              #uiOutput('style_tag'),
              #collapsed = TRUE,
              
              # Sidebar menu
              
              sidebarMenu(
                id = "sidebar",
                menuItem("Upload Data", tabName = "upload", icon = icon("file-upload")),
                menuItem("Analyse Upload", tabName = "Dashboard", icon = icon("chart-area")),
                menuItem("Database", tabName = "Database", icon = icon("database")),
                div( id = 'sidebar_cr',
                     conditionalPanel(condition = "input.sidebar === 'Database'",
                                      actionButton("db_csv", "Download Database as csv", width = 200)
                     )),
                menuItem("Longitudinal Dashboard", tabName = "Longitudinal_Analysis", icon = icon("chart-line")),
                menuItem("Squad Dashboard", tabName = "Squad_Dashboard", icon = icon("users")),
                menuItem("Session Dashboard", tabName = "Session_Dashboard", icon = icon("chart-bar"))          
                
              )
              
              
              
              #menuItem("Database", tabName = "Database", icon = icon("th")),
              #menuItem("Daily Report", tabName = "DailyReport", icon = icon("chart-line"))
              
              #     )
            ),
            
            #  #   - Right Sidebar -----------------------------------------------------------
            #  
            #  rightsidebar =  rightSidebar(
            #    width = 250,
            #    rightSidebarTabContent(
            #      id = 1,
            #      icon = "desktop",
            #      active = TRUE,
            #      title = 
            #        "Welcome to OpenTrack. If you're just getting started, check out the user guide which can be found at https://github.com/joseph-shaw/OpenTrack"
            #    ),
            #    rightSidebarTabContent(
            #      id = 2,
            #      title = "Filter Settings",
            #      radioButtons("filtertype", "Select filter type:", choices = c("Butterworth", "Moving Average"), selected = "Butterworth"),
            #      numericInput("cutofffreq", "Cutoff frequency/window size", min = 1, max = 100, step = 1, value = 12)
            #    ),
            #    rightSidebarTabContent(
            #      id = 3,
            #      icon = "paint-brush",
            #      title = "About",
            #      numericInput("obs", "Observations:", 10, min = 1, max = 100)
            #    )
            #  ),
            #  
            #   - Dashboard Body ----------------------------------------------------------
            
            body = dashboardBody(
              theme_light(),
              shinydashboard::tabItems(
                shinydashboard::tabItem("upload", mod_upload_page_ui("upload_page_ui_1")),
                shinydashboard::tabItem("Dashboard", mod_analyse_page_ui("analyse_page_ui_1"), mod_dashboard_page_ui("dashboard_page_ui_1")),
                #shinydashboard::tabItem("Dashboard2", mod_dashboard_page_ui("dashboard_page_ui_1")),
                shinydashboard::tabItem("Database", mod_database_page_ui("database_page_ui_1")),
                shinydashboard::tabItem("Longitudinal_Analysis", mod_longitudinal_page_ui("longitudinal_page_ui_1")),
                shinydashboard::tabItem("Squad_Dashboard", mod_squad_dashboard_ui("squad_dashboard_ui_1")),
                shinydashboard::tabItem("Session_Dashboard", mod_session_dashboard_ui("session_dashboard_ui_1"))
                
                
                
              ) 
            )
          )
      )
    )
  )
}

#' 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 = 'OpenTrack'
    )
    # Add here other external resources
    # for example, you can add shinyalert::useShinyalert() 
  )
}
joseph-shaw/OpenTrack documentation built on Dec. 1, 2022, 9:54 a.m.