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(),
    
    # Your application UI logic 
    bs4Dash::dashboardPage(
      
      # for the fancy preloader as the app loads
      preloader = list(html = tagList(waiter::spin_1(), "Loading ..."), color = "#3c8dbc"),
      
      
      bs4Dash::dashboardHeader(title = "Social Astronomy",
                               rightUi = tags$li(class = "dropdown", 
                                                 actionButton(
                                                   "sign_out",
                                                   "Sign Out",
                                                   icon = icon("sign-out-alt"),
                                                   class = "pull-right"
                                                 ) )
                               #, background_image = "www/images/milky_way.jpeg"
      ),
      
      bs4Dash::dashboardSidebar(
        
        bs4Dash::sidebarMenuOutput("sidebar_menu") 
        
      ),
      
      bs4Dash::dashboardBody(
        
        bs4Dash::tabItems(
          bs4Dash::tabItem(
            tabName = "about",
            bs4Dash::box(width = 12,
                         title = "Welcome to Social Astronomy!",
                         bs4Dash::accordion(
                           id = "about_accordion",
                           #   ,
                           bs4Dash::accordionItem(
                             title ="What is this site?",
                             "This is an online web application that provides a suite of 
                    tools for collecting, analyzing, and visualizing data from
                    social media sites.",
                             "Right now, this site is in", tags$em("early alpha pre-release"),
                             ", which means it's experimental and under active development.
                    Expect things to change, and save your work often!"
                           ),
                           bs4Dash::accordionItem(
                             title = "How do I use this site?",
                             "The toolbar on the left lists all available options. Right
                    now there's only one, for searching, viewing, analyzing,
                    and downloading Reddit comments. More tools will show up
                    as they're built."
                           ),
                           bs4Dash::accordionItem(
                             title = "Who made this site?",
                             "This site is maintained by Christopher Belanger. Please
                    send any comments, suggestions, or bug reports to",
                             tags$a(href = "mailto:christopher@belangeranalytics.com",
                                    "christopher@belangeranalytics.com"),
                             "."
                           )
                         )
            )
            
            
            # p(),
            # hr(),
            # h3(),
            # p(),
            # hr(),
            # h3(),
            # p()
            
            
            
          )
          
          ,bs4Dash::tabItem(tabName = "reddit",
                            mod_reddit_ui("reddit_module")
          )
          
          ,bs4Dash::tabItem(tabName = "user_data",
                            h2("User Data"),
                            verbatimTextOutput("user_out")
          )
          
        )
        
        
      )
      
    )
  ) 
}

#' 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 = 'socialastronomy.pbs4dash'
    )
    # Add here other external resources
    # for example, you can add shinyalert::useShinyalert() 
  )
}
BelangerAnalytics/socialastronomy.pbs4dash documentation built on Feb. 15, 2022, 8:06 a.m.