R/ui.R

#' User interface at shinyStat
#'
#' Generate the HTML of the application
#'
#' @author elh


###################
# Loading ----
loadingBar <- tags$div(class="progress progress-striped active",
                       tags$div(class="bar", style="width: 100%;"))

loadingMsg <- tags$div(class="modal", tabindex="-1", role="dialog",
                       "aria-labelledby"="myModalLabel", "aria-hidden"="true",
                       tags$div(class="modal-header",
                                tags$h3(id="myModalHeader", "Loading...")),
                       tags$div(class="modal-footer",
                                loadingBar))

loadingPanel <- conditionalPanel(paste("input.goButton > 0 &&",
                                       "$('html').hasClass('shiny-busy')"),
                                 loadingMsg)

###################
# Header ----
hd <- dashboardHeader(title = tags$a(href='http://ensimag.grenoble-inp.fr/',
                                     tags$img(src='ensimag.png', height='50', width='100')))

###################
# Sidebar ----
select_data_set <- selectInput("select_data_set", "Pick a data set", dir(datapath()))

sd_datatable <- menuItem("Database", tabName = "sd_datatable", icon = icon("database"))

sd_main <- menuItem("Main", tabName = "sd_main", icon = icon("main"))

sd_menu <- sidebarMenu(
  sd_main,
  sd_datatable
)

sd <- dashboardSidebar(select_data_set, sd_menu)

###################
# Body ----
market_data <- DT::dataTableOutput("market_data")

pathChart <- plotly::plotlyOutput("pathChart")
basicStat <- DT::dataTableOutput("basicStat")

ti_main <- tabItem("sd_main", loadingPanel, pathChart, basicStat)
ti_datatable <- tabItem("sd_datatable", loadingPanel, market_data)

ti <- tabItems(
  ti_main,
  ti_datatable
)

bd <- dashboardBody(
  tags$head(
    tags$style(
      HTML(
        paste0(
          setLogoColour("AAAAB5"),
          setLogoHoverColour("ffAA00"),
          setNavBarColour("AAAAB5"),
          setSideBarColour("AAAAB5"),
          setActiveTabColour("BBBBC5","000000"),
          setTabColour("AAAAB5", "000000"),
          setTabHoverColour("ffAA00", "000000"),
          setToggleHoveColour("ffAA00"),
          setContentColour("AAAAB5")
        )
      )
    )
  ),
  ti
)

###################
# User interface ----
ui <- dashboardPage(hd, sd, bd)
gaspardcc/PMMMF documentation built on March 22, 2018, 6:52 a.m.