Skip to content

Commit

Permalink
Merge pull request #110 from USEPA/fix-epa-style
Browse files Browse the repository at this point in the history
add css file
  • Loading branch information
cristinamullin authored Oct 25, 2023
2 parents b5dff06 + f5af4a5 commit a9bc505
Show file tree
Hide file tree
Showing 29 changed files with 1,309 additions and 1,227 deletions.
37 changes: 18 additions & 19 deletions R/app_config.R
Original file line number Diff line number Diff line change
@@ -1,41 +1,40 @@
#'
#' NOTE: If you manually change your package name in the DESCRIPTION,
#' don't forget to change it here too, and in the config file.
#'
#' NOTE: If you manually change your package name in the DESCRIPTION,
#' don't forget to change it here too, and in the config file.
#' For a safer name change mechanism, use the `golem::set_golem_name()` function.
#'
#' @param ... character vectors, specifying subdirectory and file(s)
#' within your package. The default, none, returns the root of the app.
#'
#'
#' @param ... character vectors, specifying subdirectory and file(s)
#' within your package. The default, none, returns the root of the app.
#'
#' @noRd
app_sys <- function(...){
app_sys <- function(...) {
system.file(..., package = "TADAShiny")
}


#' Read App Config
#'
#' @param value Value to retrieve from the config file.
#' @param config GOLEM_CONFIG_ACTIVE value. If unset, R_CONFIG_ACTIVE.
#'
#' @param value Value to retrieve from the config file.
#' @param config GOLEM_CONFIG_ACTIVE value. If unset, R_CONFIG_ACTIVE.
#' If unset, "default".
#' @param use_parent Logical, scan the parent directory for config file.
#'
#'
#' @noRd
get_golem_config <- function(
value,
value,
config = Sys.getenv(
"GOLEM_CONFIG_ACTIVE",
Sys.getenv(
"R_CONFIG_ACTIVE",
"default"
)
),
use_parent = TRUE
){
),
use_parent = TRUE) {
config::get(
value = value,
config = config,
value = value,
config = config,
# Modify this if your config file is somewhere else:
file = app_sys("golem-config.yml"),
file = app_sys("golem-config.yml"),
use_parent = use_parent
)
}
48 changes: 23 additions & 25 deletions R/app_server.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

# Below increases the max data upload size from the Shiny default of 5MB per file
# to 30MB for file
options(shiny.maxRequestSize=30*1024^2)
options(shiny.maxRequestSize = 30 * 1024^2)

app_server <- function(input, output, session) {
# Your application server logic
tadat = shiny::reactiveValues() # create a list object that holds reactive values passed between modules
tadat <- shiny::reactiveValues() # create a list object that holds reactive values passed between modules
mod_filtering_server("filtering_1", tadat)
mod_query_data_server("query_data_1", tadat) # server call to the module servers with the name of the module and any dependencies (this one uses the tadat reactive values object)
mod_data_flagging_server("data_flagging_1", tadat)
Expand All @@ -22,7 +22,7 @@ app_server <- function(input, output, session) {
mod_review_data_server("review_data_1", tadat)
mod_figures_server("figures_1", tadat)
mod_TADA_summary_server("TADA_summary_1", tadat)

# this ensures all tabs except Upload are disabled upon app start
shinyjs::disable(selector = '.nav li a[data-value="Overview"]')
shinyjs::disable(selector = '.nav li a[data-value="Flag"]')
Expand All @@ -31,42 +31,40 @@ app_server <- function(input, output, session) {
shinyjs::disable(selector = '.nav li a[data-value="Harmonize"]')
shinyjs::disable(selector = '.nav li a[data-value="Figures"]')
shinyjs::disable(selector = '.nav li a[data-value="Review"]')

# switch to overview tab when tadat$new changes and provide user with window letting them know how many records were automatically flagged for removal upon upload
# move this to query_data?
shiny::observeEvent(tadat$new,{
shiny::showModal(shiny::modalDialog(
title = "Data Loaded",
"Your data were successfully loaded into the app and are displayed on the Overview tab. See summary information about your dataset in the gray box at the bottom of the app."
))
shiny::updateTabsetPanel(session=session, inputId="tabbar", selected="Overview")
tadat$new = NULL
shiny::observeEvent(tadat$new, {
shiny::showModal(shiny::modalDialog(
title = "Data Loaded",
"Your data were successfully loaded into the app and are displayed on the Overview tab. See summary information about your dataset in the gray box at the bottom of the app."
))
shiny::updateTabsetPanel(session = session, inputId = "tabbar", selected = "Overview")
tadat$new <- NULL
})

# update the master 'Remove' column anytime data is added to the 'remove' table
shiny::observeEvent(tadat$removals,{
if(dim(tadat$removals)[2]>0){
tadat$raw$TADA.Remove = apply(tadat$removals, 1, any)
shiny::observeEvent(tadat$removals, {
if (dim(tadat$removals)[2] > 0) {
tadat$raw$TADA.Remove <- apply(tadat$removals, 1, any)
}
})
# this observes when the user switches tabs and adds the current tab they're on as a column to their dataset.

# this observes when the user switches tabs and adds the current tab they're on as a column to their dataset.
shiny::observe({
shiny::req(tadat$raw)
tadat$raw$TADAShiny.tab = input$tabbar
tadat$tab = input$tabbar
tadat$raw$TADAShiny.tab <- input$tabbar
tadat$tab <- input$tabbar
})

# switch to tab user left off on when tadat$reup changes, which only happens when someone uploads a workbook with the column "Removed" in it
shiny::observeEvent(tadat$reup,{
shiny::observeEvent(tadat$reup, {
shiny::showModal(shiny::modalDialog(
title = "Data Loaded",
"Your working dataset has been uploaded and the app switched to the tab where you left off."
))
# the switch tab command
shiny::updateTabsetPanel(session=session, inputId="tabbar", selected=unique(tadat$raw$tab))
tadat$reup = NULL
shiny::updateTabsetPanel(session = session, inputId = "tabbar", selected = unique(tadat$raw$tab))
tadat$reup <- NULL
})


}
83 changes: 48 additions & 35 deletions R/app_ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,58 +17,71 @@ css <- "
app_ui <- function(request) {
tagList(
# Leave this function for adding external resources
# This function automatically incorporates the epa styles.css file included
# in the www folder. Downloaded from https://www.epa.gov/web-policies-and-procedures/web-standards-look-and-feel-template
# styles.css hosted locally in this app includes a fix (for compatibility with leaflet and plotly)
golem_add_external_resources(),
# Your application UI logic
shiny::fluidPage(
tags$html(class = "no-js", lang="en"),
tags$html(class = "no-js", lang = "en"),
HTML("<div id='eq-disclaimer-banner' class='padding-1 text-center text-white bg-secondary-dark'><strong>EPA development environment:</strong> The
content on this page is not production ready. This site is being used
for <strong>development</strong> and/or <strong>testing</strong> purposes
only.</div>"),
epa_header,
#shiny::includeHTML(app_sys("app/www/header.html")),
# adds epa header html from here: https://www.epa.gov/themes/epa_theme/pattern-lab/patterns/pages-standalone-template/pages-standalone-template.rendered.html
shiny::includeHTML(app_sys("app/www/header.html")),
shinyjs::useShinyjs(),
shinyjs::inlineCSS(css),
htmltools::br(),
shiny::headerPanel(title = "Tools for Automated Data Analysis (TADA) Module 1: Water Quality Portal Data Discovery and Cleaning"),
htmltools::br(),
shiny::tabsetPanel( # create a navbar page with tabs at the top
id = "tabbar",
shiny::tabPanel("1. Load", value = "Load",# each tabPanel represents a tab page at the top of the navbar
htmltools::br(),
mod_query_data_ui("query_data_1")), #,
shiny::tabPanel("2. Overview", value = "Overview",
htmltools::br(),
mod_overview_ui("overview_1")),
# htmltools::hr()),
# mod_summary_ui("summary_1")),
shiny::tabPanel("3. Flag", value = "Flag",
htmltools::br(),
mod_data_flagging_ui("data_flagging_1")),

shiny::tabPanel("4. Filter", value ="Filter",
htmltools::br(),
mod_filtering_ui("filtering_1")),
# shiny::tabPanel("Harmonize"),
shiny::tabPanel("5. Censored Data", value = "Censored",
htmltools::br(),
mod_censored_data_ui("censored_data_1")),
shiny::tabPanel("6. Harmonize and Calculate", value = "Harmonize",
htmltools::br(),
mod_harmonize_np_ui("harmonize_np_1")),
shiny::tabPanel("7. Explore", value = "Figures",
htmltools::br(),
mod_figures_ui("figures_1")),
shiny::tabPanel("8. Review", value = "Review",
htmltools::br(),
mod_review_data_ui("review_data_1"))#,
# shiny::tabPanel("Explore"),
# shiny::tabPanel("User Guide")

shiny::tabPanel("1. Load",
value = "Load", # each tabPanel represents a tab page at the top of the navbar
htmltools::br(),
mod_query_data_ui("query_data_1")
), # ,
shiny::tabPanel("2. Overview",
value = "Overview",
htmltools::br(),
mod_overview_ui("overview_1")
),
shiny::tabPanel("3. Flag",
value = "Flag",
htmltools::br(),
mod_data_flagging_ui("data_flagging_1")
),
shiny::tabPanel("4. Filter",
value = "Filter",
htmltools::br(),
mod_filtering_ui("filtering_1")
),
shiny::tabPanel("5. Censored Data",
value = "Censored",
htmltools::br(),
mod_censored_data_ui("censored_data_1")
),
shiny::tabPanel("6. Harmonize and Calculate",
value = "Harmonize",
htmltools::br(),
mod_harmonize_np_ui("harmonize_np_1")
),
shiny::tabPanel("7. Explore",
value = "Figures",
htmltools::br(),
mod_figures_ui("figures_1")
),
shiny::tabPanel("8. Review",
value = "Review",
htmltools::br(),
mod_review_data_ui("review_data_1")
)
),
htmltools::hr(),
mod_TADA_summary_ui("TADA_summary_1"),
#shiny::includeHTML(app_sys("app/www/footer.html"))
# adds epa footer html
shiny::includeHTML(app_sys("app/www/footer.html"))
)
)
}
Expand Down
126 changes: 0 additions & 126 deletions R/epa_markup.R

This file was deleted.

2 changes: 1 addition & 1 deletion R/fct_helpers.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' helpers
#' helpers
#'
#' @description A fct function
#'
Expand Down
2 changes: 1 addition & 1 deletion R/golem_utils_ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#' @examples
#' list_to_li(c("a", "b"))
#' @importFrom shiny tags tagAppendAttributes tagList
#'
#'

list_to_li <- function(list, class = NULL) {
if (is.null(class)) {
Expand Down
Loading

0 comments on commit a9bc505

Please sign in to comment.