Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up styles. #210

Merged
merged 10 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Imports:
rlang,
shiny,
shinyjs,
stats,
tidyr
Suggests:
here,
Expand Down
1 change: 1 addition & 0 deletions R/aaa-shared.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#' @param strName `character` The name of a field.
#' @param strSite `character` The `GroupID` of a site to focus on.
#' @param strSubjectID `character` A `SubjectID` of an individual participant.
#' @param strTitle A title to display for the overall app.
#' @param strValue `character` The value of a field.
#'
#' @name shared-params
Expand Down
52 changes: 0 additions & 52 deletions R/div_ParticipantMetadata.R

This file was deleted.

58 changes: 0 additions & 58 deletions R/div_ParticipantMetricSummary.R

This file was deleted.

8 changes: 4 additions & 4 deletions R/gsmApp_Server.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ gsmApp_Server <- function(
# Tab Contents ----

## Study Overview ----
mod_study_overview_server(
mod_StudyOverview_Server(
"study_overview",
dfResults = dfResults,
dfGroups = dfGroups,
dfMetrics = dfMetrics
)
mod_scatter_server(
mod_Scatter_Server(
"scatter",
dfResults = dfResults,
dfMetrics = dfMetrics,
Expand All @@ -95,7 +95,7 @@ gsmApp_Server <- function(
input$primary_nav_bar == "Metric Details",
{

mod_metric_details_server(
mod_MetricDetails_Server(
"metric_details",
dfResults = dfResults,
dfMetrics = dfMetrics,
Expand All @@ -105,7 +105,7 @@ gsmApp_Server <- function(
rctv_strMetricID = reactive(input$metric)
)

mod_site_details_server(
mod_SiteDetails_Server(
"site_details",
dfMetrics = dfMetrics,
dfGroups = dfGroups,
Expand Down
93 changes: 8 additions & 85 deletions R/gsmApp_UI.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,94 +3,17 @@
#' This function defines the user interface for your Shiny web application.
#' It specifies the layout of the web page and the interface elements it contains.
#'
#' @inheritParams shared-params
#' @return A Shiny UI object
gsmApp_UI <- function() {
fluidPage(
gsmApp_UI <- function(strTitle = "GSM Deep Dive") {
bslib::page_fluid(
shinyjs::useShinyjs(),
class = "bg-light",
style = "min-height: 100vh;",
title = "GSM Deep Dive",
title = strTitle,
theme = bslib::bs_theme(version = 5),
htmltools::includeCSS(
system.file("www", "styles.css", package = "gsm.app")
),
htmltools::htmlDependency(
name = "highlightTableRow",
version = "1.0.0",
src = "js",
package = "gsm.app",
script = "highlightTableRow.js"
),
htmltools::htmlDependency(
name = "tableClick",
version = "1.0.0",
src = "js",
package = "gsm.app",
script = "tableClick.js"
),
div(
class = "row", style = "padding-top: 3.5em;",
hr(style = "padding-left: .25em; padding-right: .25em;")
),
div(
class = "row",
div(
class = "col-12 col-sm-12 col-md-4 col-lg-3 col-xl-3 col-xxl-2 border-end input-div",
div(
class = "card mb-3",
div(
class = "card-body",
div(
class = "row",
div(
class = "col-12 col-sm-6 col-md-12 col-lg-12 col-xxl-12",
h5(class = "card-title", textOutput("text_output_study_id", inline = TRUE)),
h6(
class = "card-subtitle mb-2 text-muted",
textOutput("text_output_name", inline = TRUE)
),
h6(
class = "card-subtitle mb-2 text-muted",
textOutput("text_output_snapshot_date", inline = TRUE)
),
hr(),
uiOutput("meta_tag_list"),
hr()
),
div(
class = "col-12 col-sm-6 col-md-12 col-lg-12 col-xxl-12",
shinyjs::hidden(selectInput("metric", strong("Metric"), choices = c("None"), width = "100%")),
shinyjs::hidden(selectInput("site", strong("Site"), choices = c("None"), width = "100%")),
shinyjs::hidden(selectizeInput("participant", strong("Participant"), choices = "None", width = "100%")),
actionButton("reset", "Reset All", class = "btn btn-primary btn-sm")
)
)
)
)
),
div(
class = "col-12 col-sm-12 col-md-8 col-lg-9 col-xl-9 col-xxl-9",
bslib::navset_bar(
bslib::nav_panel(
title = "Study Overview",
mod_study_overview_ui("study_overview")
),
bslib::nav_panel(
title = "Metric Details",
mod_metric_details_ui("metric_details"),
mod_site_details_ui("site_details")
),
bslib::nav_panel(
title = "Participant Details",
mod_ParticipantDetails_UI("participant_details")
),
id = "primary_nav_bar",
title = "GSM Deep Dive App",
padding = c("0rem", "0rem", "0rem", "0rem"),
position = "fixed-top", # "static-top",
bg = "white"
)
)
)
html_dependency_Stylesheet(),
html_dependency_HighlightTableRow(),
html_dependency_TableClick(),
out_MainContent(strTitle = strTitle)
)
}
29 changes: 29 additions & 0 deletions R/html-dependencies.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
html_dependency_Stylesheet <- function() {
htmltools::htmlDependency(
name = "Stylesheet",
version = "1.0.0",
src = "www",
package = "gsm.app",
stylesheet = "styles.css"
)
}

html_dependency_HighlightTableRow <- function() {
htmltools::htmlDependency(
name = "HighlightTableRow",
version = "1.0.0",
src = "js",
package = "gsm.app",
script = "highlightTableRow.js"
)
}

html_dependency_TableClick <- function() {
htmltools::htmlDependency(
name = "TableClick",
version = "1.0.0",
src = "js",
package = "gsm.app",
script = "tableClick.js"
)
}
18 changes: 18 additions & 0 deletions R/mod_ActionList_Server.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
mod_ActionList_Server = function(id, rctv_chrNames) {
moduleServer(id, function(input, output, session) {
lastClickedLink <- reactiveVal(NULL)
observe({
chrNames <- rctv_chrNames()
lapply(chrNames, function(name) {
observeEvent(input[[name]], {
lastClickedLink(name)
})
})
observeEvent(
length(chrNames) == 0,
lastClickedLink(NULL)
)
})
lastClickedLink
})
}
11 changes: 11 additions & 0 deletions R/mod_ActionList_UI.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
mod_ActionList_UI = function(id, chrNames, chrLabels, intCounts) {
ns <- NS(id)
links <- purrr::map2(
chrNames,
chrLabels,
function(strName, strLabel) {
actionLink(ns(strName), label = strLabel)
}
)
out_MetadataList(chrLabels = links, chrValues = intCounts)
}
22 changes: 22 additions & 0 deletions R/mod_DataTableCard_Server.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
mod_DataTableCard_Server <- function(id, rctv_lData, rctv_strName) {
moduleServer(id, function(input, output, session) {
output$title <- renderText({
title <- gsm::MakeParamLabelsList(rctv_strName())
if (length(title)) {
return(title[[1]])
}
})
rctv_selectedTable <- reactive({
if (length(rctv_strName()) && length(rctv_lData())) {
rctv_lData()[[rctv_strName()]]
}
})
output$table <- DT::renderDT({
if (length(colnames(rctv_selectedTable()))) {
df <- rctv_selectedTable()
colnames(df) <- gsm::MakeParamLabelsList(colnames(df))
df
}
})
})
}
7 changes: 7 additions & 0 deletions R/mod_DataTableCard_UI.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
mod_DataTableCard_UI <- function(id) {
ns <- NS(id)
bslib::card(
bslib::card_title(textOutput(ns("title"), inline = TRUE)),
DT::DTOutput(ns("table"), fill = FALSE)
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#' @inheritParams shared-params
#'
#' @keywords internal
mod_metric_details_server <- function(
mod_MetricDetails_Server <- function(
id,
dfResults,
dfMetrics,
Expand Down Expand Up @@ -111,9 +111,6 @@ mod_metric_details_server <- function(
)
)
})

shinyjs::runjs("tableClick('analysis_output_table');")


})
}
Loading
Loading