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.
#' @importFrom shiny tagList fluidRow
#' @import bslib
#' @noRd
app_ui <- function(request) {
  tagList(
    tags$html(lang="en"),
    # Leave this function for adding external resources
    golem_add_external_resources(),
    # Your application UI logic
    fluidPage(
      class = "main",
      theme = bs_theme(version = 4, bootswatch = "minty"),
      navbarPage(
        "Matrix (Server) Statistics",
        theme = bs_theme(version = 4, bootswatch = "minty"),
        tabPanel("Statistics",
                 fluidPage(mod_charts_ui("charts"))),
        tabPanel("Clients", fluidPage(mod_client_stats_ui("client_stats"))),
        tabPanel("WorldMap", fluidPage(mod_servers_map_ui("servers_map")))
      )
    ),
    tags$footer(class = "footer",
                tags$div(class = "container",
                         span(
                           a("Join the Community", href = "https://matrix.to/#/#server_stats:nordgedanken.dev")
                         )))
  )
}

#' 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(
    golem::activate_js(),
    favicon(ico = "VoyagerLogo", ext = "png"),
    bundle_resources(
      path = app_sys('app/www'),
      app_title = 'Matrix (Server) Statistics'
    )
    # Add here other external resources
    # for example, you can add shinyalert::useShinyalert() 
  )
}
mx-serverstats/server_stats_web_statistics documentation built on Dec. 21, 2021, 11:06 p.m.