Skip to content

Commit

Permalink
added targeting of value box hrefs
Browse files Browse the repository at this point in the history
  • Loading branch information
fdefalco committed May 20, 2024
1 parent d29d015 commit 8f16b69
Showing 1 changed file with 34 additions and 16 deletions.
50 changes: 34 additions & 16 deletions R/about-main.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,24 @@ aboutViewer <- function(id = 'homepage') {
)
}

targetedValueBox <- function(
value,
subtitle,
icon,
color,
href,
target = "_new"
) {
valueBox <- shinydashboard::valueBox(
value = value,
subtitle = subtitle,
icon = icon,
color = color,
href = href
)
shiny::tagAppendAttributes(valueBox,.cssSelector="a", target=target)
}

#' The module server for the shiny app home
#'
#' @details
Expand Down Expand Up @@ -105,15 +123,15 @@ aboutServer <- function(id = 'homepage',
output$datasourcesBox <-
shinydashboard::renderValueBox({
if ("DataSources" %in% tab_names) {
shinydashboard::valueBox(
targetedValueBox(
value = "Data Sources",
subtitle = "Data sources used in this analysis",
icon = shiny::icon("database"),
color = "aqua",
href = "https://ohdsi.github.io/OhdsiShinyModules/articles/DataSources.html"
)
} else {
shinydashboard::valueBox(
targetedValueBox(
value = "Data Sources",
subtitle = "This module was not included in this analysis",
icon = shiny::icon("database"),
Expand All @@ -126,15 +144,15 @@ aboutServer <- function(id = 'homepage',
output$cohortsBox <-
shinydashboard::renderValueBox({
if ("Cohorts" %in% tab_names) {
shinydashboard::valueBox(
targetedValueBox(
value = "Cohorts",
subtitle = "Cohorts included in this analysis",
icon = shiny::icon("user-gear"),
color = "purple",
href = "https://ohdsi.github.io/OhdsiShinyModules/articles/Cohorts.html"
)
} else {
shinydashboard::valueBox(
targetedValueBox(
value = "Cohorts",
subtitle = "This module was not included in this analysis",
icon = shiny::icon("user-gear"),
Expand All @@ -147,15 +165,15 @@ aboutServer <- function(id = 'homepage',
output$characterizationBox <-
shinydashboard::renderValueBox({
if ("Characterization" %in% tab_names) {
shinydashboard::valueBox(
targetedValueBox(
value = "Characterization",
subtitle = "Characterization results for this analysis",
icon = shiny::icon("table"),
color = "teal",
href = "https://ohdsi.github.io/OhdsiShinyModules/articles/Characterization.html"
)
} else {
shinydashboard::valueBox(
targetedValueBox(
value = "Characterization",
subtitle = "This module was not included in this analysis",
icon = shiny::icon("table"),
Expand All @@ -168,15 +186,15 @@ aboutServer <- function(id = 'homepage',
output$cohortDiagnosticsBox <-
shinydashboard::renderValueBox({
if ("CohortDiagnostics" %in% tab_names) {
shinydashboard::valueBox(
targetedValueBox(
value = "Cohort Diagnostics",
subtitle = "Cohort Diagnostics results for the cohorts included in this analysis",
icon = shiny::icon("users"),
color = "yellow",
href = "https://ohdsi.github.io/OhdsiShinyModules/articles/CohortDiagnostics.html"
)
} else {
shinydashboard::valueBox(
targetedValueBox(
value = "Cohort Diagnostics",
subtitle = "This module was not included in this analysis",
icon = shiny::icon("users"),
Expand All @@ -190,15 +208,15 @@ aboutServer <- function(id = 'homepage',
output$cohortMethodBox <-
shinydashboard::renderValueBox({
if ("CohortMethod" %in% tab_names) {
shinydashboard::valueBox(
targetedValueBox(
value = "Cohort Method",
subtitle = "Cohort Method results for this analysis",
icon = shiny::icon("chart-column"),
color = "maroon",
href = "https://ohdsi.github.io/OhdsiShinyModules/articles/CohortMethod.html"
)
} else {
shinydashboard::valueBox(
targetedValueBox(
value = "Cohort Method",
subtitle = "This module was not included in this analysis",
icon = shiny::icon("chart-column"),
Expand All @@ -211,15 +229,15 @@ aboutServer <- function(id = 'homepage',
output$predictionBox <-
shinydashboard::renderValueBox({
if ("Prediction" %in% tab_names) {
shinydashboard::valueBox(
targetedValueBox(
value = "Prediction",
subtitle = "Patient-level Prediction results for this analysis",
icon = shiny::icon("chart-line"),
color = "blue",
href = "https://ohdsi.github.io/OhdsiShinyModules/articles/Prediction.html"
)
} else {
shinydashboard::valueBox(
targetedValueBox(
value = "Prediction",
subtitle = "This module was not included in this analysis",
icon = shiny::icon("chart-line"),
Expand All @@ -232,15 +250,15 @@ aboutServer <- function(id = 'homepage',
output$sccsBox <-
shinydashboard::renderValueBox({
if ("SCCS" %in% tab_names) {
shinydashboard::valueBox(
targetedValueBox(
value = "SCCS",
subtitle = "Self-Controlled Case Series results for this analysis",
icon = shiny::icon("people-arrows"),
color = "red",
href = "https://ohdsi.github.io/OhdsiShinyModules/articles/SelfControlledCaseSeries.html"
)
} else {
shinydashboard::valueBox(
targetedValueBox(
value = "SCCS",
subtitle = "This module was not included in this analysis",
icon = shiny::icon("people-arrows"),
Expand All @@ -253,15 +271,15 @@ aboutServer <- function(id = 'homepage',
output$evidenceSynthesisBox <-
shinydashboard::renderValueBox({
if ("Meta" %in% tab_names) {
shinydashboard::valueBox(
targetedValueBox(
value = "Meta",
subtitle = "Meta Analysis results for this analysis",
icon = shiny::icon("sliders"),
color = "olive",
href = "https://ohdsi.github.io/OhdsiShinyModules/articles/EvidenceSynthesis.html"
)
} else {
shinydashboard::valueBox(
targetedValueBox(
value = "Meta",
subtitle =
"This module was not included in this analysis",
Expand Down

0 comments on commit 8f16b69

Please sign in to comment.