## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment  = "#>",
  eval     = FALSE
)

## ----setup--------------------------------------------------------------------
# library(bs4Dashkit)

## -----------------------------------------------------------------------------
# rightUi = tagList(
#   dash_nav_item(dash_nav_refresh_button("refresh")),
#   dash_nav_item(dash_nav_help_button("help"))
# )

## -----------------------------------------------------------------------------
# dash_nav_refresh_button("refresh")                      # default label + icon
# dash_nav_refresh_button("refresh", label = "Reload")    # custom label
# dash_nav_refresh_button("refresh", label = "")          # icon only
# dash_nav_refresh_button("refresh", icon = "arrows-rotate")

## -----------------------------------------------------------------------------
# observeEvent(input$refresh, {
#   session$reload()
# })

## -----------------------------------------------------------------------------
# dash_nav_help_button("help")                     # default label + icon
# dash_nav_help_button("help", label = "Support")  # custom label
# dash_nav_help_button("help", label = "")         # icon only
# dash_nav_help_button("help", icon = "circle-info")

## -----------------------------------------------------------------------------
# observeEvent(input$help, {
#   showModal(modalDialog(
#     title     = "Help",
#     "Add your instructions here.",
#     easyClose = TRUE,
#     footer    = modalButton("Close")
#   ))
# })

## -----------------------------------------------------------------------------
# observeEvent(input$help, {
#   showModal(modalDialog(
#     title = "Help & Documentation",
#     tagList(
#       h4("Getting started"),
#       p("Describe the dashboard purpose here."),
#       h4("Data sources"),
#       p("Describe where data comes from."),
#       h4("Contact"),
#       p("Email: support@yourorg.gov")
#     ),
#     size      = "l",
#     easyClose = TRUE,
#     footer    = modalButton("Close")
#   ))
# })

## -----------------------------------------------------------------------------
# dash_nav_title(
#   title    = "DASHBOARDS",
#   subtitle = "Critical & Main",
#   icon     = icon("shield-halved"),
#   align    = "center"                    # "center" | "left" | "right"
# )

## -----------------------------------------------------------------------------
# rightUi = tagList(
#   dash_nav_title(
#     "DASHBOARDS", "Critical & Main",
#     icon  = icon("shield-halved"),
#     align = "center"
#   ),
#   dash_nav_item(dash_nav_refresh_button("refresh")),
#   dash_nav_item(dash_nav_help_button("help"))
# )

## -----------------------------------------------------------------------------
# rightUi = tagList(
#   dash_nav_item(dash_nav_refresh_button("refresh")),
#   dash_nav_item(dash_nav_help_button("help")),
#   dash_nav_title(
#     "DASHBOARDS", "Critical & Main",
#     icon  = icon("shield-halved"),
#     align = "right"
#   )
# )

## -----------------------------------------------------------------------------
# rightUi = tagList(
#   dash_nav_title(
#     "DASHBOARDS", "Critical & Main",
#     icon  = icon("shield-halved"),
#     align = "left"
#   ),
#   dash_nav_item(dash_nav_refresh_button("refresh")),
#   dash_nav_item(dash_nav_help_button("help"))
# )

## -----------------------------------------------------------------------------
# dash_user_menu(
#   dropdownMenu(
#     type = "notifications",
#     notificationItem("Profile"),
#     notificationItem("Logout")
#   )
# )

## -----------------------------------------------------------------------------
# dash_user_menu(
#   dropdownMenu(
#     type = "notifications",
#     notificationItem("Profile"),
#     notificationItem("Logout")
#   )
# )

## -----------------------------------------------------------------------------
# # Example only: you control the real sign-out logic
# observeEvent(input$logout, { ... })

## -----------------------------------------------------------------------------
# bs4DashNavbar(
#   title = ttl$brand,
#   skin  = "light",
#   rightUi = tagList(
#     dash_nav_title(
#       "DASHBOARDS",
#       "Critical & Main",
#       icon  = icon("shield-halved"),
#       align = "center"
#     ),
#     dash_nav_item(dash_nav_refresh_button("refresh")),
#     dash_nav_item(dash_nav_help_button("help")),
#     dash_user_menu(
#       dropdownMenu(
#         type = "notifications",
#         notificationItem("Profile"),
#         notificationItem("Sign out")
#       )
#     )
#   )
# )

## -----------------------------------------------------------------------------
# server <- function(input, output, session) {
#   observeEvent(input$refresh, session$reload())
# 
#   observeEvent(input$help, {
#     showModal(modalDialog("Help content.", easyClose = TRUE))
#   })
# 
#   observeEvent(input$logout, {
#     showModal(modalDialog(
#       title  = "Sign out",
#       "Are you sure?",
#       footer = tagList(
#         modalButton("Cancel"),
#         actionButton("logout_confirm", "Sign out", class = "btn btn-danger")
#       )
#     ))
#   })
# 
#   observeEvent(input$logout_confirm, {
#     removeModal()
#     session$reload()
#   })
# }

