Skip to content

Commit

Permalink
Add help text
Browse files Browse the repository at this point in the history
  • Loading branch information
nfrerebeau committed Oct 18, 2024
1 parent 1f7cf19 commit f26e214
Show file tree
Hide file tree
Showing 7 changed files with 170 additions and 69 deletions.
129 changes: 129 additions & 0 deletions R/help.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# HELP TEXT

help_warranty <- function(...) {
tags$p(
"This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY."
)
}

help_cite <- function(...) {
pkg <- switch (
get_app_name(),
seriate = "kairos",
source = "nexus",
ternary = "isopleuros",
NULL
)

list(
tags$p(
"If you use this application in your research, you must report",
"and cite it properly to ensure transparency of your results.",
"Moreover, authors and maintainers of this project are more likely",
"to continue their work if they see that it's being used and valued",
"by the research community."
),
tags$p("To cite in your publications, please use:"),
cite_package(pkg)
)
}

help_license <- function(...) {
list(
h3("License"),
tags$p(
"This app is distributed as a free and open source",
tags$a("R package", href = url_tesselle("kinesis"),
target = "_blank", rel = "external", .noWS = "after"), "."
),
tags$p(
"You can redistribute it and/or modify it under the terms",
"of the GNU General Public License as published",
"by the Free Software Foundation, either version 3 of the License,",
"or (at your option) any later version."
)
)
}

help_tesselle <- function(...) {
list(
h3("What is", tags$em("tesselle", .noWS = "after"), "?"),
tags$p(
"This app is a part of the", tags$strong("tesselle"), "project,",
"a collection of packages for research and teaching in archaeology.",
"The", tags$strong("tesselle"), "packages focus on quantitative",
"analysis methods developed for archaeology. They can be used to",
"explore and analyze common data types in archaeology: count data,",
"compositional data and chronological data."
),
tags$p(
"For more information and relevant links see:",
tags$a("tesselle.org", href = url_tesselle(),
target = "_blank", rel = "external", .noWS = "after"), "."
)
# h3("Who is", tags$em("tesselle"), "for?")
)
}

help_overview <- function(...) {
switch (
get_app_name(),
source = .help_overview_source(),
tags$p()
)
}

.help_overview_source <- function(...) {
list(
tags$p(
"Provenance studies rely on the identification of probable sources,",
"such that the variability between two sources is greater than",
"the internal variability of a single source",
"(the so-called", tags$em("provenance postulate", .noWS = "after"), ").",
"This assumes that a unique signature can be identified for each source",
"on the basis of several criteria."
),
tags$p(
"This application is designed for chemical fingerprinting",
"and source tracking of ancient materials. It provides provides tools",
"for the exploration, visualization and analysis of compositional data",
"in the framework of",
cite_article(author = "Aitchison", year = "1986", after = ".")
)
)
}

help_workflow <- function(...) {
def <- .help_workflow_panel()
tab <- switch (
get_app_name(),
source = c("Data", "Composition", "Transform", "Statistics", "Plot", "Analysis"),
ternary = c("Data", "Plot"),
"Data"
)

txt <- def[tab]
# dl <- mapply(
# dt = names(txt),
# dd = txt,
# FUN = function(dt, dd) { list(tags$dt(dt), tags$dd(dd)) }
# )
# tags$dl(ol)
ol <- mapply(
dt = names(txt),
dd = txt,
FUN = function(dt, dd) { list(tags$li(tags$strong(dt, .noWS = "after"), ".", dd)) }
)
tags$ol(ol)
}

.help_workflow_panel <- function(...) {
list(
Data = "Import your data and perform basic data cleansing and preparation steps.",
Composition = "Coerce your data to compositions and define (reference) groups.",
Transform = "Compute log-ratio transformations of compositional data.",
Statistics = "Data summary and descriptive statistics.",
Plot = "Visualize your data.",
Analysis = "Perform multivariate data analysis."
)
}
67 changes: 17 additions & 50 deletions R/home.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#' @family page modules
#' @keywords internal
#' @export
home_ui <- function(id, name = NULL) {
home_ui <- function(id) {
# Create a namespace function using the provided id
ns <- NS(id)

Expand All @@ -16,68 +16,35 @@ home_ui <- function(id, name = NULL) {
sidebar = sidebar(
width = 400,
h5("Workflow"),
help_workflow()
), # sidebar
navset_card_pill(
placement = "above",
nav_panel(
title = "How to use",
h3("Overview"),
tags$p(
get_option("description")
),
tags$p(
"This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY."
),
title = "Overview",
help_overview(),
help_warranty(),
tags$p(
class = "logo",
tags$a(href = "https://www.archeosciences-bordeaux.fr", rel = "external",
tags$img(src = "static/logo-archeosciences.svg")),
tags$a(href = "https://www.huma-num.fr", rel = "external",
tags$img(src = "static/logo-humanum.svg"))
),
h3("Metadata"),
textInput(inputId = ns("user"), label = "User name"),
textInput(inputId = ns("project"), label = "Project ID")
)
),
nav_panel(
title = "How to cite",
help_cite()
),
nav_panel(
title = "About",
h3("How to cite"),
tags$p(
"If you use this application in your research, you must report
and cite it properly to ensure transparency of your results.
Moreover, authors and maintainers of this project are more likely to
continue their work if they see that it's being used and valued
by the research community."
),
tags$p("To cite in your publications, please use:"),
cite_package(name),
h3("What is", tags$i("tesselle", .noWS = "after"), "?"),
tags$p(
"This app is a part of the", tags$strong("tesselle"), "project,",
"a collection of packages for research and teaching in archaeology.
The", tags$strong("tesselle"), "packages focus on quantitative
analysis methods developed for archaeology. They can be used to
explore and analyze common data types in archaeology: count data,
compositional data and chronological data."
),
tags$p(
"For more information and relevant links see:",
tags$a("tesselle.org", href = url_tesselle(),
target = "_blank", rel = "external", .noWS = "after"), "."
),
# h3("Who is", tags$i("tesselle"), "for?"),
h3("License"),
tags$p(
"This app is distributed as a free and open source",
tags$a("R package", href = url_tesselle("kinesis"),
target = "_blank", rel = "external", .noWS = "after"), "."
),
tags$p(
"You can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option)
any later version."
)
help_tesselle(),
help_license()
),
nav_panel(
title = "Metadata",
textInput(inputId = ns("user"), label = "User name"),
textInput(inputId = ns("project"), label = "Project ID")
)
) # navset_card_pill
) # layout_sidebar
Expand Down
5 changes: 5 additions & 0 deletions R/run.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ run_app <- function(app = c("seriate", "source", "ternary"),
## Bundling the options inside the shinyApp object
kinesis_options <- get_config(app)
obj$appOptions$kinesis_options <- kinesis_options
obj$appOptions$app_name <- app

obj
}
Expand Down Expand Up @@ -74,3 +75,7 @@ get_option <- function(name = NULL, default = NULL) {
shiny::getShinyOption("kinesis_options")[[name]] %||% default
}
}

get_app_name <- function(...) {
shiny::getShinyOption("app_name")
}
2 changes: 1 addition & 1 deletion inst/seriate/ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ shiny_ui <- function(request) {
lang = "en",
bslib::page_navbar(
title = "seriate",
kinesis::home_ui("home", name = "kairos"),
kinesis::home_ui("home"),
bslib::nav_panel(
title = "Data",
kinesis::import_ui("import")
Expand Down
32 changes: 16 additions & 16 deletions inst/source/ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ shiny_ui <- function(request) {
lang = "en",
bslib::page_navbar(
title = "source",
kinesis::home_ui("home", name = "nexus"),
kinesis::home_ui("home"),
bslib::nav_panel(
title = "Data",
kinesis::import_ui("import")
Expand All @@ -18,21 +18,6 @@ shiny_ui <- function(request) {
title = "Composition",
kinesis::coda_ui("coda")
),
bslib::nav_panel(
title = "Statistics",
kinesis::coda_summary_ui("coda_summary")
),
bslib::nav_menu(
title = "Plot",
bslib::nav_panel(
title = "Bar plot",
kinesis::coda_plot_ui("barplot")
),
bslib::nav_panel(
title = "Ternary plot",
kinesis::ternary_ui("ternary")
)
),
bslib::nav_menu(
title = "Transform",
bslib::nav_panel(
Expand All @@ -56,6 +41,21 @@ shiny_ui <- function(request) {
kinesis::logratio_ui("plr")
)
),
bslib::nav_panel(
title = "Statistics",
kinesis::coda_summary_ui("coda_summary")
),
bslib::nav_menu(
title = "Plot",
bslib::nav_panel(
title = "Bar plot",
kinesis::coda_plot_ui("barplot")
),
bslib::nav_panel(
title = "Ternary plot",
kinesis::ternary_ui("ternary")
)
),
bslib::nav_menu(
title = "Analysis",
# bslib::nav_panel(
Expand Down
2 changes: 1 addition & 1 deletion inst/ternary/ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ shiny_ui <- function(request) {
lang = "en",
bslib::page_navbar(
title = "ternary",
kinesis::home_ui("home", name = "isopleuros"),
kinesis::home_ui("home"),
bslib::nav_panel(
title = "Data",
kinesis::import_ui("import")
Expand Down
2 changes: 1 addition & 1 deletion man/home_ui.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f26e214

Please sign in to comment.