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 dplyr %>%
#' @noRd
app_ui <- function(request) {
  tagList(
    # Leave this function for adding external resources
    golem_add_external_resources(),
    # List the first level UI elements here 
    shinypanels::panelsPage(
               shinypanels::panel(title = shi18ny::ui_("upload_data"),
                     width = 200,
                     body = mod_data_upload_ui("data_upload_ui")),
               shinypanels::panel(title = shi18ny::ui_("dataset"),
                     width = 300,
                     body = mod_data_selection_ui("data_selection_ui")),
               shinypanels::panel(title = shi18ny::ui_("options"),
                     width = 250,
                     color = "chardonnay",
                     body = div(mod_data_processing_ui("data_processing_ui"),
                                uiOutput("controls"))),
                                # mod_viz_config_ui("viz_config_ui"))),
               shinypanels::panel(title = shi18ny::ui_("viz"),
                     title_plugin = mod_save_publish_ui("save_publish_ui"),
                     color = "chardonnay",
                     can_collapse = FALSE,
                     body =  mod_viz_display_ui("viz_display_ui")))
  )
}

#' 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(){
  
  # mount file path inst/app/www so that www can be accessed from the app
  add_resource_path(
    'www', app_sys('app/www')
  )
  add_resource_path(
    'parmesan', app_sys('app/parmesan')
  )
  add_resource_path(
    'locale', app_sys('app/locale')
  )
  
  tags$head(
    favicon(),
    # automatically bundles custom css or js files in the www folder to the app
    bundle_resources(
      path = app_sys('app/www'),
      app_title = 'DSAppTemplate'
    ),
    tags$link(rel="stylesheet", type="text/css", href="www/custom.css"),
    
    # initialize shi18ny translations
    mod_internationalization_ui("internationalization_ui"),
    
    # include disconnect message
    shinydisconnect::disconnectMessage(
      text = "Tu sesión ha finalizado, si tienes algún problema trabajando con la app por favor contáctanos y cuéntanos qué ha sucedido // Your session has ended, if you have any problem working with the app please contact us and tell us what happened.",
      refresh = "REFRESH",
      background = "#ffffff",
      colour = "#435b69",
      size = 14,
      overlayColour = "#2a2e30",
      overlayOpacity = 0.85,
      refreshColour = "#ffffff",
      css = "padding: 4.8em 3.5em !important; box-shadow: 0 1px 10px 0 rgba(0, 0, 0, 0.1) !important;"
    ),
    
    # include busy start up symbol
    shinybusy::busy_start_up(
      loader = tags$img(
        src = "www/img/loading_gris.gif",
        width = 100), 
      mode = "auto",
      color = "#435b69",
      background = "#FFF")
  )
}
datasketch/DSAppTemplate documentation built on March 4, 2021, 12:49 a.m.