Skip to content

Commit

Permalink
Merge pull request #17 from CNAG-Biomedical-Informatics/landing_page_…
Browse files Browse the repository at this point in the history
…navigation_buttons

Landing page navigation buttons
  • Loading branch information
IvoLeist authored Feb 21, 2024
2 parents 87ea85b + aa7c561 commit 1bf828f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
1 change: 1 addition & 0 deletions phenoRankeR/NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ importFrom(shinyjs,click)
importFrom(shinyjs,extendShinyjs)
importFrom(shinyjs,hideElement)
importFrom(shinyjs,js)
importFrom(shinyjs,runjs)
importFrom(shinyjs,showElement)
importFrom(shinyjs,useShinyjs)
importFrom(shinyvalidate,InputValidator)
Expand Down
5 changes: 5 additions & 0 deletions phenoRankeR/R/app_server.R
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ app_server <- function(input, output, session) {
print("dbDriver")
print(db_driver)

mod_landing_page_server(
"landing_page",
session
)

mod_sim_mode_server(
"sim_mode",
session,
Expand Down
27 changes: 22 additions & 5 deletions phenoRankeR/R/mod_landing_page.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#' @importFrom gridlayout grid_container grid_card grid_place
#' @importFrom bslib card_header card_body
#' @importFrom shiny NS actionButton
#' @importFrom shinyjs runjs

mod_landing_page_ui <- function(id){
ns <- NS(id)
Expand Down Expand Up @@ -43,7 +44,7 @@ mod_landing_page_ui <- function(id){
diseases, phenotypic features and treatments that you would like to be included in the simulated data.
"),
actionButton(
"navigateButton",
ns("navigateToSimulator"),
"Simulate BFF/PXF",
style = "width: 100%;"
),
Expand All @@ -57,7 +58,7 @@ mod_landing_page_ui <- function(id){
as well as more complex ones with nested fields
"),
actionButton(
"navigateButton2",
ns("navigateToConverter"),
"ConvertCSVs",
style = "width: 100%;"
),
Expand Down Expand Up @@ -88,7 +89,7 @@ mod_landing_page_ui <- function(id){
reference cohort according to their similarity to your patient.
"),
actionButton(
"navigateButton3",
ns("navigateToPatientMode"),
"Individual vs Reference Cohort(s)",
style = "width: 100%;"
),
Expand Down Expand Up @@ -120,7 +121,7 @@ mod_landing_page_ui <- function(id){
)
),
actionButton(
"navigateButton4",
ns("navigateToCohortMode"),
"Intra-/Inter-cohort comparison",
style = "width: 100%;"
)
Expand All @@ -131,6 +132,22 @@ mod_landing_page_ui <- function(id){

mod_landing_page_server <- function(id, session){
moduleServer(id, function(input, output, session){
ns <- session$ns
print("Landing Page Server")
observeEvent(input$navigateToSimulator, {
print("Navigate to simulator")
runjs("window.history.pushState(null, '', '/?mode=sim')")
})
observeEvent(input$navigateToConverter, {
print("Navigate to converter")
runjs("window.history.pushState(null, '', '/?mode=conv')")
})
observeEvent(input$navigateToPatientMode, {
print("Navigate to patient mode")
runjs("window.history.pushState(null, '', '/?mode=patient')")
})
observeEvent(input$navigateToCohortMode, {
print("Navigate to cohort mode")
runjs("window.history.pushState(null, '', '/?mode=cohort')")
})
})
}

0 comments on commit 1bf828f

Please sign in to comment.