From: Naeem Model Date: Mon, 6 Jan 2025 23:55:43 +0000 (+0000) Subject: Update web app entry point X-Git-Url: https://git.nmode.ca/Rnaught/commitdiff_plain/e920b3e514e717fc05ed524267d3b53e272fec51 Update web app entry point - Rename 'app' -> 'web' - Return shiny app object in entry point function --- diff --git a/NAMESPACE b/NAMESPACE index 1557cc1..140ea5f 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,9 +1,9 @@ # Generated by roxygen2: do not edit by hand -export(app) export(id) export(idea) export(seq_bayes) +export(web) export(wp) importFrom(stats,pgamma) importFrom(stats,qgamma) diff --git a/R/app.R b/R/web.R similarity index 56% rename from R/app.R rename to R/web.R index 23e32ab..ecfd501 100644 --- a/R/app.R +++ b/R/web.R @@ -1,17 +1,35 @@ #' Launch the Rnaught Web Application #' +#' This is the entry point of the Rnaught web application, which creates and +#' returns a Shiny app object. When invoked directly, the web application is +#' launched. +#' +#' The following dependencies are required to run the application: +#' * [shiny](https://shiny.posit.co) +#' * [bslib](https://rstudio.github.io/bslib) +#' * [DT](https://rstudio.github.io/DT) +#' * [plotly](https://plotly-r.com) +#' +#' If any of the above packages are missing during launch, a prompt will appear +#' to install them. +#' +#' To configure settings such as the port, host or default browser, set Shiny's +#' global options (see [shiny::runApp()]). +#' +#' @return A Shiny app object for the Rnaught web application. +#' #' @importFrom utils install.packages #' #' @export -app <- function() { +web <- function() { missing_pkgs <- c() # Check for any missing, required packages. - if (!requireNamespace("bslib", quietly = TRUE)) { - missing_pkgs <- c(missing_pkgs, "bslib") - } if (!requireNamespace("shiny", quietly = TRUE)) { missing_pkgs <- c(missing_pkgs, "shiny") } + if (!requireNamespace("bslib", quietly = TRUE)) { + missing_pkgs <- c(missing_pkgs, "bslib") + } if (!requireNamespace("DT", quietly = TRUE)) { missing_pkgs <- c(missing_pkgs, "DT") } @@ -35,5 +53,5 @@ app <- function() { } } - shiny::runApp(appDir = system.file("app", package = "Rnaught")) + shiny::shinyAppDir(appDir = system.file("web", package = "Rnaught")) } diff --git a/inst/app/app.R b/inst/web/app.R similarity index 100% rename from inst/app/app.R rename to inst/web/app.R diff --git a/inst/app/index.html b/inst/web/index.html similarity index 100% rename from inst/app/index.html rename to inst/web/index.html diff --git a/inst/app/scripts/data.R b/inst/web/scripts/data.R similarity index 100% rename from inst/app/scripts/data.R rename to inst/web/scripts/data.R diff --git a/inst/app/scripts/estimators.R b/inst/web/scripts/estimators.R similarity index 100% rename from inst/app/scripts/estimators.R rename to inst/web/scripts/estimators.R diff --git a/inst/app/templates/content.html b/inst/web/templates/content.html similarity index 100% rename from inst/app/templates/content.html rename to inst/web/templates/content.html diff --git a/inst/app/templates/content/about.html b/inst/web/templates/content/about.html similarity index 100% rename from inst/app/templates/content/about.html rename to inst/web/templates/content/about.html diff --git a/inst/app/templates/content/data.html b/inst/web/templates/content/data.html similarity index 100% rename from inst/app/templates/content/data.html rename to inst/web/templates/content/data.html diff --git a/inst/app/templates/content/data/enter-data.html b/inst/web/templates/content/data/enter-data.html similarity index 100% rename from inst/app/templates/content/data/enter-data.html rename to inst/web/templates/content/data/enter-data.html diff --git a/inst/app/templates/content/data/enter-data/load-samples.html b/inst/web/templates/content/data/enter-data/load-samples.html similarity index 100% rename from inst/app/templates/content/data/enter-data/load-samples.html rename to inst/web/templates/content/data/enter-data/load-samples.html diff --git a/inst/app/templates/content/data/enter-data/manual-entry.html b/inst/web/templates/content/data/enter-data/manual-entry.html similarity index 100% rename from inst/app/templates/content/data/enter-data/manual-entry.html rename to inst/web/templates/content/data/enter-data/manual-entry.html diff --git a/inst/app/templates/content/data/enter-data/required-format.html b/inst/web/templates/content/data/enter-data/required-format.html similarity index 100% rename from inst/app/templates/content/data/enter-data/required-format.html rename to inst/web/templates/content/data/enter-data/required-format.html diff --git a/inst/app/templates/content/data/enter-data/upload-data.html b/inst/web/templates/content/data/enter-data/upload-data.html similarity index 100% rename from inst/app/templates/content/data/enter-data/upload-data.html rename to inst/web/templates/content/data/enter-data/upload-data.html diff --git a/inst/app/templates/content/data/view-data.html b/inst/web/templates/content/data/view-data.html similarity index 100% rename from inst/app/templates/content/data/view-data.html rename to inst/web/templates/content/data/view-data.html diff --git a/inst/app/templates/content/data/view-data/data-plots.html b/inst/web/templates/content/data/view-data/data-plots.html similarity index 100% rename from inst/app/templates/content/data/view-data/data-plots.html rename to inst/web/templates/content/data/view-data/data-plots.html diff --git a/inst/app/templates/content/data/view-data/data-table.html b/inst/web/templates/content/data/view-data/data-table.html similarity index 100% rename from inst/app/templates/content/data/view-data/data-table.html rename to inst/web/templates/content/data/view-data/data-table.html diff --git a/inst/app/templates/content/estimation.html b/inst/web/templates/content/estimation.html similarity index 100% rename from inst/app/templates/content/estimation.html rename to inst/web/templates/content/estimation.html diff --git a/inst/app/templates/content/estimation/about-estimators.html b/inst/web/templates/content/estimation/about-estimators.html similarity index 100% rename from inst/app/templates/content/estimation/about-estimators.html rename to inst/web/templates/content/estimation/about-estimators.html diff --git a/inst/app/templates/content/estimation/about-estimators/id.html b/inst/web/templates/content/estimation/about-estimators/id.html similarity index 100% rename from inst/app/templates/content/estimation/about-estimators/id.html rename to inst/web/templates/content/estimation/about-estimators/id.html diff --git a/inst/app/templates/content/estimation/about-estimators/idea.html b/inst/web/templates/content/estimation/about-estimators/idea.html similarity index 100% rename from inst/app/templates/content/estimation/about-estimators/idea.html rename to inst/web/templates/content/estimation/about-estimators/idea.html diff --git a/inst/app/templates/content/estimation/about-estimators/panel.html b/inst/web/templates/content/estimation/about-estimators/panel.html similarity index 100% rename from inst/app/templates/content/estimation/about-estimators/panel.html rename to inst/web/templates/content/estimation/about-estimators/panel.html diff --git a/inst/app/templates/content/estimation/about-estimators/seq_bayes.html b/inst/web/templates/content/estimation/about-estimators/seq_bayes.html similarity index 100% rename from inst/app/templates/content/estimation/about-estimators/seq_bayes.html rename to inst/web/templates/content/estimation/about-estimators/seq_bayes.html diff --git a/inst/app/templates/content/estimation/about-estimators/wp.html b/inst/web/templates/content/estimation/about-estimators/wp.html similarity index 100% rename from inst/app/templates/content/estimation/about-estimators/wp.html rename to inst/web/templates/content/estimation/about-estimators/wp.html diff --git a/inst/app/templates/content/estimation/estimates.html b/inst/web/templates/content/estimation/estimates.html similarity index 100% rename from inst/app/templates/content/estimation/estimates.html rename to inst/web/templates/content/estimation/estimates.html diff --git a/inst/app/templates/content/estimation/estimates/add-estimators.html b/inst/web/templates/content/estimation/estimates/add-estimators.html similarity index 100% rename from inst/app/templates/content/estimation/estimates/add-estimators.html rename to inst/web/templates/content/estimation/estimates/add-estimators.html diff --git a/inst/app/templates/content/estimation/estimates/add-estimators/id.html b/inst/web/templates/content/estimation/estimates/add-estimators/id.html similarity index 100% rename from inst/app/templates/content/estimation/estimates/add-estimators/id.html rename to inst/web/templates/content/estimation/estimates/add-estimators/id.html diff --git a/inst/app/templates/content/estimation/estimates/add-estimators/idea.html b/inst/web/templates/content/estimation/estimates/add-estimators/idea.html similarity index 100% rename from inst/app/templates/content/estimation/estimates/add-estimators/idea.html rename to inst/web/templates/content/estimation/estimates/add-estimators/idea.html diff --git a/inst/app/templates/content/estimation/estimates/add-estimators/mu.html b/inst/web/templates/content/estimation/estimates/add-estimators/mu.html similarity index 100% rename from inst/app/templates/content/estimation/estimates/add-estimators/mu.html rename to inst/web/templates/content/estimation/estimates/add-estimators/mu.html diff --git a/inst/app/templates/content/estimation/estimates/add-estimators/parameters.html b/inst/web/templates/content/estimation/estimates/add-estimators/parameters.html similarity index 100% rename from inst/app/templates/content/estimation/estimates/add-estimators/parameters.html rename to inst/web/templates/content/estimation/estimates/add-estimators/parameters.html diff --git a/inst/app/templates/content/estimation/estimates/add-estimators/seq_bayes.html b/inst/web/templates/content/estimation/estimates/add-estimators/seq_bayes.html similarity index 100% rename from inst/app/templates/content/estimation/estimates/add-estimators/seq_bayes.html rename to inst/web/templates/content/estimation/estimates/add-estimators/seq_bayes.html diff --git a/inst/app/templates/content/estimation/estimates/add-estimators/wp.html b/inst/web/templates/content/estimation/estimates/add-estimators/wp.html similarity index 100% rename from inst/app/templates/content/estimation/estimates/add-estimators/wp.html rename to inst/web/templates/content/estimation/estimates/add-estimators/wp.html diff --git a/inst/app/templates/content/estimation/estimates/estimates-table.html b/inst/web/templates/content/estimation/estimates/estimates-table.html similarity index 100% rename from inst/app/templates/content/estimation/estimates/estimates-table.html rename to inst/web/templates/content/estimation/estimates/estimates-table.html diff --git a/inst/app/templates/content/help.html b/inst/web/templates/content/help.html similarity index 100% rename from inst/app/templates/content/help.html rename to inst/web/templates/content/help.html diff --git a/inst/app/templates/content/help/panel.html b/inst/web/templates/content/help/panel.html similarity index 100% rename from inst/app/templates/content/help/panel.html rename to inst/web/templates/content/help/panel.html diff --git a/inst/app/templates/content/help/serial-interval.html b/inst/web/templates/content/help/serial-interval.html similarity index 100% rename from inst/app/templates/content/help/serial-interval.html rename to inst/web/templates/content/help/serial-interval.html diff --git a/inst/app/templates/footer.html b/inst/web/templates/footer.html similarity index 100% rename from inst/app/templates/footer.html rename to inst/web/templates/footer.html diff --git a/inst/app/templates/navbar.html b/inst/web/templates/navbar.html similarity index 100% rename from inst/app/templates/navbar.html rename to inst/web/templates/navbar.html diff --git a/inst/app/templates/tabs.html b/inst/web/templates/tabs.html similarity index 100% rename from inst/app/templates/tabs.html rename to inst/web/templates/tabs.html diff --git a/inst/app/www/script.js b/inst/web/www/script.js similarity index 100% rename from inst/app/www/script.js rename to inst/web/www/script.js diff --git a/inst/app/www/styles.css b/inst/web/www/styles.css similarity index 100% rename from inst/app/www/styles.css rename to inst/web/www/styles.css diff --git a/man/app.Rd b/man/app.Rd deleted file mode 100644 index f558dc9..0000000 --- a/man/app.Rd +++ /dev/null @@ -1,11 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/app.R -\name{app} -\alias{app} -\title{Launch the Rnaught Web Application} -\usage{ -app() -} -\description{ -Launch the Rnaught Web Application -} diff --git a/man/web.Rd b/man/web.Rd new file mode 100644 index 0000000..36bce07 --- /dev/null +++ b/man/web.Rd @@ -0,0 +1,31 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/web.R +\name{web} +\alias{web} +\title{Launch the Rnaught Web Application} +\usage{ +web() +} +\value{ +A Shiny app object for the Rnaught web application. +} +\description{ +This is the entry point of the Rnaught web application, which creates and +returns a Shiny app object. When invoked directly, the web application is +launched. +} +\details{ +The following dependencies are required to run the application: +\itemize{ +\item \href{https://shiny.posit.co}{shiny} +\item \href{https://rstudio.github.io/bslib}{bslib} +\item \href{https://rstudio.github.io/DT}{DT} +\item \href{https://plotly-r.com}{plotly} +} + +If any of the above packages are missing during launch, a prompt will appear +to install them. + +To configure settings such as the port, host or default browser, set Shiny's +global options (see \code{\link[shiny:runApp]{shiny::runApp()}}). +}