Skip to content

Commit

Permalink
Updated design elements and minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin-Jung committed Nov 1, 2023
1 parent 72a74ab commit dfaefa5
Show file tree
Hide file tree
Showing 23 changed files with 475 additions and 305 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
.httr-oauth
.DS_Store
.quarto
tests/testthat/*.pdf
13 changes: 2 additions & 11 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: ODPSCP
Title: A standard reporting protocol for conservation planning
Version: 1.0
Version: 0.1
Authors@R: person('Martin', 'Jung', email = 'jung@iiasa.ac.at', role = c('cre', 'aut'))
Description: This repository contains the environment and shiny code underlying the reporting protocol.
License: CC BY 4.0
Expand All @@ -12,25 +12,16 @@ Imports:
shiny (>= 1.7.5),
yaml,
assertthat,
mapdeck,
shinyWidgets,
shinyjs,
shinydashboard,
shinyFeedback,
rsconnect,
sever,
fresh,
DT,
bs4Dash,
waiter,
dplyr,
htmltools,
markdown,
qs,
readr,
credentials,
tidyverse,
pkgload
readr
Encoding: UTF-8
Language: en-US
LazyData: true
Expand Down
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

8 changes: 8 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,23 @@ import(fresh)
import(shiny)
import(waiter)
import(yaml)
importFrom(bs4Dash,insertTab)
importFrom(bs4Dash,tabItem)
importFrom(bs4Dash,tabItems)
importFrom(golem,activate_js)
importFrom(golem,add_resource_path)
importFrom(golem,bundle_resources)
importFrom(golem,favicon)
importFrom(golem,with_golem_options)
importFrom(shiny,HTML)
importFrom(shiny,NS)
importFrom(shiny,actionButton)
importFrom(shiny,column)
importFrom(shiny,observe)
importFrom(shiny,observeEvent)
importFrom(shiny,shinyApp)
importFrom(shiny,tabsetPanel)
importFrom(shiny,tagAppendAttributes)
importFrom(shiny,tagList)
importFrom(shiny,tags)
importFrom(utils,write.csv)
4 changes: 1 addition & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
## News and updates

### Version 0.1
## Version 0.1

* Initial Publication of the protocol and elicitation of expert feedback.
11 changes: 7 additions & 4 deletions R/app_server.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@ app_server <- function(input, output, session) {
sever::sever()

# fake reload at start
observeEvent(input$reload, {
shiny::observeEvent(input$reload, {
session$reload()
})

# Define overall protocol results
# to modify a global variable use <<- instead of <- or =
results <- reactiveValues()
results <- shiny::reactiveValues()

# title page --------------------------------------------------------------
observeEvent(input$start_new_protocol, {
updateTabItems(session,inputId = "sidebarmenu", selected = "Overview")
shiny::observeEvent(input$start_new_protocol, {
bs4Dash::updateTabItems(session,
inputId = "sidebarmenu", selected = "Overview")
})

# Adding module server code
Expand All @@ -37,5 +38,7 @@ app_server <- function(input, output, session) {
mod_Import_server("Import_1")
mod_Export_server("Export_1", results)

# Automatically stop a Shiny app when closing the browser tab
session$onSessionEnded(stopApp)
}

56 changes: 29 additions & 27 deletions R/app_ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,30 @@
#' @noRd
app_ui <- function(request) {

tagList(
shiny::tagList(
# Leave this function for adding external resources
golem_add_external_resources(),
# --- #
# Add the overall dashboard
bs4Dash::dashboardPage(
# Preloader using waiter
preloader = list(html = tagList(spin_1(), "Loading ..."), color = "#3c8dbc"),
# freshTheme = dark_theme(), # Theme designed with fresh
preloader = list(html = shiny::tagList(
waiter::spin_1(), "Loading ..."), color = "#3c8dbc"),
# freshTheme = odpscp_theme(), # Theme designed with fresh
# Other options
dark = FALSE,
scrollToTop = TRUE,
fullscreen = FALSE,
help = NULL, # Default enable tooltips
# controlbar = dashboardControlbar(),
# controlbar = bs4Dash::dashboardControlbar(),
# Define header and footer
header = bs4Dash::dashboardHeader(
title = dashboardBrand(
title = bs4Dash::dashboardBrand(
title = "A Protocol for SCP",
color = "primary",
opacity = 0,
href = NULL,
image = "logo.png"
image = "www/logo.png"
),
status = "white",
border = TRUE,
Expand All @@ -39,20 +40,21 @@ app_ui <- function(request) {
),
footer = bs4Dash::dashboardFooter(
fixed = FALSE,
left = tagList(
p("Protocol version: ", get_protocol_version(),
left = shiny::tagList(
div("Protocol version: ", get_protocol_version(),
style = "padding-top: 10px; font-size: 14px; font-weight:bold;")
# HTML("&nbsp; &nbsp; &nbsp; &nbsp;")
# "(",format(Sys.Date(),"%Y"),")"
# a(
# href = "https://github.com/iiasa/ODPSCP",
# target = "_blank",
# "Github"
# )
),
right = tagList(
"IIASA BEC",
"(",format(Sys.Date(),"%Y"),")",
img(
href = "www/iiasa-logo.png",
right = shiny::tagList(
shiny::img(
src = "www/iiasa-logo.png",
title = "IIASA", height = "40px",
target = "_blank"
)
)
Expand All @@ -75,7 +77,7 @@ app_ui <- function(request) {
bs4Dash::menuItem(
"Home",
tabName = "Home",
icon = icon("home")
icon = shiny::icon("home")
),
bs4Dash::menuItem(
text = "Protocol",
Expand All @@ -84,64 +86,64 @@ app_ui <- function(request) {
bs4Dash::menuSubItem(
"Overview",
tabName = "Overview",
icon = icon("file-lines")
icon = shiny::icon("file-lines")
),
bs4Dash::menuSubItem(
"Design",
tabName = "Design",
icon = icon("object-group")
icon = shiny::icon("object-group")
),
bs4Dash::menuSubItem(
"Specification",
tabName = "Specification",
icon = icon("tree")
icon = shiny::icon("tree")
),
bs4Dash::menuSubItem(
"Context",
tabName = "Context",
icon = icon("users-rectangle")
icon = shiny::icon("users-rectangle")
),
bs4Dash::menuSubItem(
"Prioritization",
tabName = "Prioritization",
icon = icon("map")
icon = shiny::icon("map")
)
),
sidebarHeader("Import/Export"),
bs4Dash::sidebarHeader("Import/Export"),
bs4Dash::menuItem(
"Import protocol",
tabName = "Import",
icon = icon("upload")
icon = shiny::icon("upload")
),
bs4Dash::menuItem(
"Export protocol",
tabName = "Export",
icon = icon("download")
icon = shiny::icon("download")
),
sidebarHeader("Info"),
bs4Dash::sidebarHeader("Info"),
bs4Dash::menuItem(
"News",
tabName = "News",
icon = icon("newspaper")
icon = shiny::icon("newspaper")
),
bs4Dash::menuItem(
"Issues and Feedback",
href = "https://github.com/iiasa/ODPSCP/issues",
newTab = TRUE,
icon = icon("question")
icon = shiny::icon("question")
),
bs4Dash::menuItem(
"Source code",
href = "https://github.com/iiasa/ODPSCP",
newTab = TRUE,
icon = icon("code")
icon = shiny::icon("code")
)
)
), # Sidebar end
#### Body with sidebar menu ----
body = bs4Dash::dashboardBody(
# title page --------------------------------------------------------------
tabItems(
bs4Dash::tabItems(
# Starting site
mod_Home_ui("Home_1"),
# Protocol
Expand Down
62 changes: 16 additions & 46 deletions R/fct_theme.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#'
#' @details
#' https://dreamrs.github.io/fresh/articles/vars-bs4dash.html
#' https://unleash-shiny.rinterface.com/beautify-with-fresh.html
#'
#' @return Returns a css object to be used in the dashboard.
#'
Expand All @@ -13,72 +14,41 @@
odpscp_theme <- function(){
# Create theme
tt <- fresh::create_theme(
fresh::bs4dash_vars(
bs4dash_vars(
navbar_light_color = "#bec5cb",
navbar_light_active_color = "#FFF",
navbar_light_hover_color = "#FFF"
),
fresh::bs4dash_yiq(
bs4dash_yiq(
contrasted_threshold = 10,
text_dark = "#FFF",
text_light = "#272c30"
),
fresh::bs4dash_layout(
main_bg = "#353c42"
bs4dash_layout(
main_bg = "grey95"
),
fresh::bs4dash_sidebar_light(
bg = "#272c30",
bs4dash_sidebar_dark(
bg = "#FFF",
color = "#bec5cb",
hover_color = "#FFF",
hover_color = "#006994",
submenu_bg = "#272c30",
submenu_color = "#FFF",
submenu_hover_color = "#FFF"
),
fresh::bs4dash_status(
primary = "#5E81AC", danger = "#BF616A", light = "#272c30"
),
fresh::bs4dash_color(
gray_900 = "#FFF"
)
)
return(tt)
}


#' Dark theme used for styling the package
#'
#' @description This function creates a theme for the protocol.
#' To be used in a bs4dashboard.
#'
#' @details
#' https://unleash-shiny.rinterface.com/beautify-with-fresh.html
#'
#' @return Returns a css object to be used in the dashboard.
#'
#' @import fresh
#' @noRd
dark_theme <- function(){
create_theme(
bs4dash_vars(
navbar_light_color = "#bec5cb",
navbar_light_active_color = "#FFF",
navbar_light_hover_color = "#FFF"
),
bs4dash_yiq(
contrasted_threshold = 10,
text_dark = "#FFF",
text_light = "#272c30"
),
bs4dash_layout(main_bg = "#353c42"),
bs4dash_sidebar_dark(
bg = "#272c30",
color = "#bec5cb",
hover_color = "#FFF",
hover_color = "#006994",
submenu_bg = "#272c30",
submenu_color = "#FFF",
submenu_hover_color = "#FFF"
),
bs4dash_status(dark = "#272c30"),
bs4dash_color(gray_900 = "#FFF", white = "#272c30")
bs4dash_status(
primary = "#5E81AC", danger = "#BF616A", light = "#272c30"
),
bs4dash_color(
gray_900 = "#FFF"
)
)
return(tt)
}
7 changes: 0 additions & 7 deletions R/fct_uistyles.R

This file was deleted.

Loading

0 comments on commit dfaefa5

Please sign in to comment.