Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
jimbrig committed Nov 13, 2024
2 parents 29bf035 + 8d6428a commit 30e7f62
Show file tree
Hide file tree
Showing 300 changed files with 15,729 additions and 326 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ inst/doc
*_.new.png

config.yml
.venv/
67 changes: 62 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,83 @@ Description: Provides a Shiny dashboard and API client for interactingwith
License: file LICENSE
URL: https://github.com/noclocks/gmhdatahub
BugReports: https://github.com/noclocks/gmhdatahub/issues
Depends:
R (>= 4.1)
Imports:
bsicons,
bslib,
cli,
dplyr,
fontawesome,
golem,
htmltools,
httr2,
jsonlite,
logger,
pkgload,
purrr,
rlang (>= 1.1.0),
shiny
sass,
shiny,
shinyjs,
shinyWidgets,
stringr,
waiter
Suggests:
httptest2,
kableExtra,
knitr,
rmarkdown,
shinytest2,
spelling,
testthat (>= 3.0.0)
testthat (>= 3.0.0),
tibble,
tidyr
Remotes:
rstudio/bslib,
r-lib/httr2,
rstudio/sass
VignetteBuilder:
knitr
Config/testthat/edition: 3
Encoding: UTF-8
Language: en-US
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
Depends:
R (>= 2.10)
Config/testthat/edition: 3
Config/tests/needs:
testthat (>= 3.0.0),
spelling,
httptest2,
shinytest2
Config/coverage/needs:
covr,
covrpage
Config/pkgdown/needs:
pkgdown,
testdown,
gitdown,
covrpage
Config/database/needs:
DBI,
pool,
dbplyr,
dplyr,
RPostgres,
config
Config/api/needs:
httr2,
jsonlite,
plumber,
R6,
config
Config/shiny/needs:
shiny,
shinyjs,
shinyWidgets,
waiter,
bslib,
bsicons,
fontawesome,
sass,
golem
LazyData: true
86 changes: 86 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,29 +1,115 @@
# Generated by roxygen2: do not edit by hand

export(add_external_resources)
export(compile_styles)
export(entrata_req_auth)
export(entrata_req_body)
export(entrata_req_endpoint)
export(entrata_req_error)
export(entrata_req_log)
export(entrata_req_perform)
export(entrata_request)
export(entrata_resp_abort)
export(entrata_resp_body_json)
export(entrata_resp_check_status)
export(entrata_resp_status)
export(entrata_resp_status_desc)
export(footer_client_section)
export(footer_copyright_section)
export(footer_logo_section)
export(footer_top_section)
export(get_entrata_config)
export(get_entrata_report_info)
export(get_entrata_reports_list)
export(get_latest_report_version)
export(icon_text)
export(is_boolean_string)
export(is_integer_string)
export(is_integer_string_multi)
export(mod_footer_server)
export(mod_footer_ui)
export(mod_home_server)
export(mod_home_ui)
export(mod_properties_ui)
export(mod_sidebar_server)
export(mod_sidebar_ui)
export(pkg_sys)
export(pkg_sys_assets)
export(pkg_sys_config)
export(pkg_sys_examples)
export(pkg_sys_templates)
export(validate_entrata_config)
export(validate_entrata_endpoint_method_params)
export(validate_entrata_method_version)
export(validate_entrata_request)
export(validate_entrata_request_endpoint)
export(validate_entrata_request_endpoint_method)
export(validate_image)
importFrom(bsicons,bs_icon)
importFrom(bslib,accordion)
importFrom(bslib,accordion_panel)
importFrom(bslib,card)
importFrom(bslib,card_body)
importFrom(bslib,card_footer)
importFrom(bslib,card_title)
importFrom(bslib,layout_column_wrap)
importFrom(bslib,layout_columns)
importFrom(bslib,sidebar)
importFrom(bslib,value_box)
importFrom(cli,cli_abort)
importFrom(cli,cli_alert_danger)
importFrom(cli,cli_alert_info)
importFrom(cli,cli_alert_success)
importFrom(cli,cli_alert_warning)
importFrom(config,get)
importFrom(dplyr,filter)
importFrom(dplyr,left_join)
importFrom(dplyr,pull)
importFrom(dplyr,select)
importFrom(fontawesome,fa)
importFrom(glue,glue)
importFrom(htmltools,HTML)
importFrom(htmltools,tagList)
importFrom(htmltools,tags)
importFrom(httr2,req_auth_basic)
importFrom(httr2,req_body_json)
importFrom(httr2,req_dry_run)
importFrom(httr2,req_error)
importFrom(httr2,req_headers)
importFrom(httr2,req_method)
importFrom(httr2,req_perform)
importFrom(httr2,req_url_path_append)
importFrom(httr2,req_user_agent)
importFrom(httr2,request)
importFrom(httr2,resp_body_json)
importFrom(logger,log_info)
importFrom(purrr,list_rbind)
importFrom(purrr,map)
importFrom(purrr,pluck)
importFrom(purrr,pluck_exists)
importFrom(purrr,set_names)
importFrom(rlang,.data)
importFrom(rlang,.env)
importFrom(rlang,arg_match)
importFrom(rlang,caller_arg)
importFrom(rlang,caller_env)
importFrom(sass,output_template)
importFrom(sass,sass)
importFrom(sass,sass_file)
importFrom(sass,sass_options)
importFrom(shiny,NS)
importFrom(shiny,icon)
importFrom(shiny,includeCSS)
importFrom(shiny,moduleServer)
importFrom(shiny,reactive)
importFrom(shiny,req)
importFrom(shiny,textOutput)
importFrom(shiny,uiOutput)
importFrom(shinyWidgets,pickerInput)
importFrom(tibblify,tib_chr)
importFrom(tibblify,tib_df)
importFrom(tibblify,tib_int)
importFrom(tibblify,tib_lgl)
importFrom(tibblify,tib_row)
importFrom(tibblify,tspec_df)
importFrom(yaml,read_yaml)
36 changes: 6 additions & 30 deletions R/app_ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,6 @@
#
# ------------------------------------------------------------------------


# internal ----------------------------------------------------------------

add_external_resources <- function() {
shiny::addResourcePath(
"www",
system.file("www", package = "gmhdatahub")
)

htmltools::tags$head(
htmltools::tags$link(
rel = "shortcut icon",
type = "image/x-icon",
href = "www/favicon.ico"
),
golem::bundle_resources(
path = system.file("www", package = "gmhdatahub"),
app_title = "gmhdatahub"
),
shinyjs::useShinyjs(),
waiter::use_waiter()
)
}

# UI ----------------------------------------------------------------------

app_ui <- function(req) {
Expand All @@ -50,20 +26,20 @@ app_ui <- function(req) {
bslib::nav_panel(
title = "Home",
value = "home",
icon = shiny::icon("home")#,
# mod_home_ui("app")
icon = shiny::icon("home"),
mod_home_ui("app")
),
bslib::nav_panel(
title = "Data",
value = "data",
icon = shiny::icon("database")#,
# mod_data_ui("app")
icon = shiny::icon("database"),
mod_data_ui("app")
),
bslib::nav_panel(
title = "Analysis",
value = "analysis",
icon = shiny::icon("chart-line")#,
# mod_analysis_ui("app")
icon = shiny::icon("chart-line"),
mod_analysis_ui("app")
),
bslib::nav_spacer(),
bslib::nav_menu(
Expand Down
116 changes: 116 additions & 0 deletions R/assets.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@

# ------------------------------------------------------------------------
#
# Title : Assets
# By : Jimmy Briggs
# Date : 2024-11-11
#
# ------------------------------------------------------------------------


# add external resources --------------------------------------------------

#' Add External Resources
#'
#' @description
#' Add external resources to the shiny app.
#'
#' This function performs the following:
#'
#' - Adds this package's installed `www` folder to the shiny app resource paths
#' via [shiny::addResourcePath()].
#'
#'
#' @return NULL
#' @export
add_external_resources <- function() {

shiny::addResourcePath("www", pkg_sys("www"))

htmltools::tags$head(
htmltools::tags$link(
rel = "shortcut icon",
type = "image/x-icon",
href = "www/favicon.ico"
),
golem::bundle_resources(
path = system.file("www", package = "gmhdatahub"),
app_title = "gmhdatahub"
),
shinyjs::useShinyjs(),
waiter::use_waiter()
)
}


# compile SASS ------------------------------------------------------------

#' Compile Styles
#'
#' @description
#' Compile SASS files to CSS.
#'
#' @param path The path to the `styles` folder. Default is `pkg_sys("www", "styles")`.
#' This folder must contain a `scss` folder with a `index.scss` file.
#'
#' @return The path to the compiled CSS file.
#'
#' @export
#'
#' @examples
#' compile_styles()
#'
#' @importFrom sass sass sass_file sass_options output_template
#' @importFrom cli cli_alert_danger cli_alert_success
compile_styles <- function(
path = pkg_sys("www", "styles"),
source_map = TRUE,
cache = FALSE
) {

# paths
scss_dir <- file.path(path, "scss")
css_dir <- file.path(path, "css")

# create css directory if it doesn't exist
if (!dir.exists(css_dir)) {
dir.create(css_dir)
}

# output template
sass_output_template <- sass::output_template(
basename = "styles",
dirname = "css",
fileext = ".min.css",
path = path
)

# main scss file
scss_main <- file.path(scss_dir, "index.scss")
output_file <- file.path(css_dir, "styles.min.css")

# compile scss to css
tryCatch({
sass::sass(
sass::sass_file(scss_main),
output = sass_output_template(suffix = ""),
options = sass::sass_options(
output_style = "compressed",
include_path = list.files(
scss_dir,
full.names = TRUE
),
source_map_embed = source_map
),
cache = cache
)
}, error = function(e) {
cli::cli_alert_danger("Error compiling SASS: {e$message}")
})

cli::cli_alert_success("SASS compiled successfully: {.field {output_file}}")

# return the path to the compiled css file
return(output_file)

}
Loading

0 comments on commit 30e7f62

Please sign in to comment.