Skip to content

Commit

Permalink
add grassland info page + whole folder /grassland restructure
Browse files Browse the repository at this point in the history
  • Loading branch information
osalamon committed Apr 5, 2024
1 parent 174dac2 commit 6764484
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 29 deletions.
8 changes: 4 additions & 4 deletions app/main.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ box::use(
box::use(
app / view / info[mod_info_ui],
app / view / honeybee / honeybee_main[honeybee_ui, honeybee_server],
app / view / grassland / grassland_main[grassland_main_ui, grassland_main_server],
app / view / grassland / grassland_main[grassland_ui, grassland_server],
)

# App theme ----
Expand Down Expand Up @@ -81,8 +81,8 @@ ui <- function(id) {
),
bslib::nav_panel(
title = "Grassland dynamics",
grassland_main_ui(
ns("grassland_main"),
grassland_ui(
ns("grassland"),
theme = biodt_theme
)
),
Expand Down Expand Up @@ -121,6 +121,6 @@ server <- function(id) {
r
)
# Grassland pDT ----
grassland_main_server("grassland_main", r)
grassland_server("grassland", r)
})
}
43 changes: 43 additions & 0 deletions app/view/grassland/grassland_app.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
box::use(
shiny[NS, tagList, moduleServer],
bslib[page_fluid, layout_sidebar, navset_tab],
)

box::use(
app/view/grassland/grassland_inputmap[mod_grassland_inputmap_ui, mod_grassland_inputmap_server],
app/view/grassland/grassland_location[mod_grassland_location_ui, mod_grassland_location_server],
app/view/grassland/grassland_outputplot[mod_grassland_outputplot_ui, mod_grassland_outputplot_server],
)

#' @export
grassland_app_ui <- function(id, theme) {
ns <- shiny::NS(id)


bslib::page_fluid(
theme = theme,
class = "p-0",
navset_tab(
bslib::layout_sidebar(
border = FALSE,
mod_grassland_location_ui(ns("grassland_location"))
),
mod_grassland_inputmap_ui(ns("grassland_inputmap")),
mod_grassland_outputplot_ui(ns("grassland_outputplot"))
)
)
}

#' @export
grassland_app_server <- function(id, r) {
shiny::moduleServer(
id,
function(input, output, session) {
ns <- session$ns

mod_grassland_location_server(ns("grassland_location"), r)
mod_grassland_inputmap_server(ns("grassland_inputmap"), r)
mod_grassland_outputplot_server(ns("grassland_outputplot"), r)
}
)
}
4 changes: 2 additions & 2 deletions app/view/grassland/grassland_info.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ grassland_info_ui <- function(id) {
class = "greeting display-4 font-weight-bold",
"GRASSLAND"
),
tags$h6("Background - scientific breakthroughs"),
tags$h6("Background - scientific breakthroughs:"),
tags$p(
class = "pt-3",
"Describe temporal biodiversity dynamics for different local grassland sites by a regionally transferable model (GRASSMIND), i.e. with a generic parameterization such that separate site-specific model calibration is avoided ('biodiversity' represented in the model by 4 plant functional groups: grasses, small herbs, tall herbs, legumes)."
Expand All @@ -43,6 +43,6 @@ grassland_info_ui <- function(id) {
#' @export
grassland_info_server <- function(id) {
moduleServer(id, function(input, output, session) {

})
}
55 changes: 32 additions & 23 deletions app/view/grassland/grassland_main.R
Original file line number Diff line number Diff line change
@@ -1,41 +1,50 @@
box::use(shiny[NS, tagList],
bslib[page_fluid, layout_sidebar])
box::use(
shiny,
bslib[navset_tab, nav_panel]
)

box::use(
app/main[biodt_theme],
app/view/grassland/grassland_location[mod_grassland_location_ui, mod_grassland_location_server],
app/view/grassland/grassland_inputmap[mod_grassland_inputmap_ui, mod_grassland_inputmap_server],
app/view/grassland/grassland_outputplot[mod_grassland_outputplot_ui, mod_grassland_outputplot_server],
app/view/grassland/grassland_app[grassland_app_ui, grassland_app_server],
app/view/grassland/grassland_info[grassland_info_ui, grassland_info_server],
)

#' @export
grassland_main_ui <- function(id, theme) {
grassland_ui <- function(id, theme) {
ns <- shiny::NS(id)
shiny::tagList(
bslib::page_fluid(
theme = theme,
class = "p-0",
bslib::layout_sidebar(
border = FALSE,

mod_grassland_location_ui(ns("grassland_location"))
),
mod_grassland_inputmap_ui(ns("grassland_inputmap")),
mod_grassland_outputplot_ui(ns("grassland_outputplot"))

shiny::tagList(
navset_tab(
# Info Page ---
nav_panel(
title = "Info",
value = "Info",
icon = shiny$icon("circle-info"),
grassland_info_ui(
ns("grassland_info")
)
),
# Grassland Case ----
nav_panel(
title = "Grassland Dynamics",
icon = shiny$icon("leaf"),
grassland_app_ui(
ns("grassland_app"),
theme
)
)
)
)
)
}

#' @export
grassland_main_server <- function(id, r) {
grassland_server <- function(id, r) {
shiny::moduleServer(
id,
function(input, output, session) {
ns <- session$ns

mod_grassland_location_server(ns("grassland_location"), r)
mod_grassland_inputmap_server(ns("grassland_inputmap"), r)
mod_grassland_outputplot_server(ns("grassland_outputplot"), r)
grassland_info_server("grassland_info", r)
grassland_app_server("grassland_app", r)
}
)
}

0 comments on commit 6764484

Please sign in to comment.