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
#' @importFrom shinydashboardPlus dashboardPagePlus boxPlus
#' @importFrom shinydashboard dashboardBody tabItems tabItem
#'
#' @noRd
app_ui <- function(request) {
    # List the first level UI elements here 
    dashboardPagePlus(
      # Leave this function for adding external resources
      golem_add_external_resources(),
      enable_preloader = TRUE,
      header = dash_header,
      sidebar = dash_leftsidebar,
      body = dashboardBody(
        tabItems(
          tabItem(tabName = "catch_area_site",
                  fluidRow(
                   # mod_catch_area_site("catch_area_site_ui"),
                    mod_date_area_ui("date_area_ui"),
                    br(),
                    mod_creel_site_ui("creel_site_ui"),
                    br(),
                    mod_site_date_ui("site_date_ui")
                  )
          ),
          tabItem(tabName = "data_edits",
                  fluidRow(
                    br(),
                    br(),
                    boxPlus(
                      title = "Add or edit data",
                      closable = FALSE,
                      collapsible = TRUE,
                      solidHeader = FALSE,
                      collapsed = FALSE,
                      #survey_ui,
                      "some text",
                      width = 12
                    )
                  )
          ),
          tabItem(tabName = "sample_site",
                  fluidRow(
                    br(),
                    br(),
                    boxPlus(
                      title = "Edit creel site info",
                      closable = FALSE,
                      collapsible = TRUE,
                      solidHeader = FALSE,
                      collapsed = FALSE,
                      #reach_point_ui,
                      "some text",
                      width = 12
                    )
                  )
          ),
          tabItem(tabName = "sampler_info",
                  fluidRow(
                    br(),
                    br(),
                    boxPlus(
                      title = "Sampler info",
                      closable = FALSE,
                      collapsible = TRUE,
                      solidHeader = FALSE,
                      collapsed = FALSE,
                      #sampler_ui,
                      "some text",
                      width = 12
                    )
                  )
          ),
          tabItem(tabName = "data_query",
                  fluidRow(
                    br(),
                    br(),
                    boxPlus(
                      title = "Export data using interactive query generator (ToDo)",
                      closable = FALSE,
                      collapsible = TRUE,
                      solidHeader = FALSE,
                      collapsed = FALSE,
                      width = 12
                    )
                  )
          ),
          tabItem(tabName = "about",
                  fluidRow(
                    br(),
                    br(),
                    boxPlus(
                      title = "About (ToDo)",
                      closable = FALSE,
                      collapsible = TRUE,
                      solidHeader = FALSE,
                      collapsed = FALSE,
                      width = 12
                    )
                  )
          )
        )
      ),
      title ="Baseline data"
    )
 # )
}

#' 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 = 'BaselineData'
    ),
    # Add here other external resources
    # for example, you can add shinyalert::useShinyalert() 
    shinyjs::useShinyjs(),
    shinytoastr::useToastr()
  )
}
arestrom/BaselineData documentation built on Sept. 28, 2020, 9:38 a.m.