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) {
  shiny::fluidPage(
    theme = bslib::bs_theme(version = 5,
                            bg = "#333333", # 626C70
                            fg = "White",
                            primary = "Cyan",
                            heading_font = bslib::font_google("Prompt"),
                            base_font = bslib::font_google("Prompt"),
                            code_font = bslib::font_google("JetBrains Mono"),
                            "progress-bar-bg" = "lime"),
    golem_add_external_resources(),
    # UI logic
    shiny::fluidRow(shiny::column(8, titlePanel("Strategic Portfolio Asset Mix")),
                    shiny::column(4, align = "right",tags$h5(
                      tags$span(style = "color:White;;font-size:0.8em;font-style:italic", "created by pcote@ualberta.ca"),
                      tags$a(href = "https://www.linkedin.com/in/philippe-cote-88b1769/", icon("linkedin", "My Profile", target = "_blank"))
                    ))),
    shiny::fluidRow(
      tags$ul(
        tags$li(tags$span(style = "color:lime;font-size:1.0em", "A tool to support Decision Quality for asset mix decision where users can define their own forward environment through simulations.")),
        tags$li(tags$span(style = "color:lime;font-size:1.0em", "The default environment is a proxy for the historical environment since 2019.")),
        tags$li(tags$span(style = "color:lime;font-size:1.0em", "For all assets, the values simulated are the net variable costs economics of the relevant spreads:")),
        tags$ul(
          tags$li(tags$span(style = "color:lime;font-size:0.8em", "The West Coast arb, wc, is the variable cost economics of selling FOB Burnaby.")),
          tags$li(tags$span(style = "color:lime;font-size:0.8em", "The Edmonton, edm, asset represent the value of boxed storage economics on grade MSW as a proxy.")),
          tags$li(tags$span(style = "color:lime;font-size:0.8em", "...")),
        ),
      )),
    mod_compute_ui("compute_1"),
    shiny::tabsetPanel(
      type = "tabs",
      shiny::tabPanel("Context", mod_context_ui("context_1")),
      shiny::tabPanel("Efficient Frontier", mod_markowitz_ui("markowitz_1")),
      shiny::tabPanel("NPV@Risk", mod_npvAtRisk_ui("npvAtRisk_1")),
      shiny::tabPanel("Optimal Portfolio", mod_portfolio_ui("portfolio_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(),
    bundle_resources(
      path = app_sys("app/www"),
      app_title = "RTLappStrat"
    )
    # Add here other external resources
    # for example, you can add shinyalert::useShinyalert()
  )
}
risktoollib/RTLappStrat documentation built on Sept. 11, 2022, 10:27 p.m.