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

Landing page navigation buttons #17

Merged
merged 2 commits into from
Feb 21, 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 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')")
})
})
}
Loading