diff --git a/R/tm_landing_popup.R b/R/tm_landing_popup.R index 3ff1e0c03..7317ddc12 100644 --- a/R/tm_landing_popup.R +++ b/R/tm_landing_popup.R @@ -1,24 +1,23 @@ #' Landing Popup Module #' -#' @description This module creates a simple landing welcome popup for `teal` applications. +#' @description This module creates a landing welcome popup for `teal` applications. #' -#' @details If you use this module with a default label `"Landing Popup"`, it will be used as a first module in -#' a `teal` application and there will not be a tab provided for this module in the application. +#' @details If you use this module in `teal::init(modules = )`, it will not be wrapped in a tab in `teal` application. +#' See `teal::module(type = 'teal_module_landing')`. #' -#' @inheritParams teal::module +#' @param label `character(1)` the label of the module. #' @param title `character(1)` the text to be displayed as a title of the popup. #' @param content `character(1)` the content of the popup. Passed to `...` of `shiny::modalDialog`. Can be a `character` #' or a text input control (like `textInput`) or a list of `shiny` tags. See examples. #' @param buttons `shiny` tag or a list of tags (`tagList`). Typically a `modalButton` or `actionButton`. See examples. #' -#' @return A `teal` module to be used in `teal` applications. +#' @return A `teal_module_landing` module to be used in `teal` applications. #' #' @examples #' app1 <- teal::init( #' data = teal.data::dataset("iris", iris), #' modules = teal::modules( #' teal.modules.general::tm_landing_popup( -#' title = "Welcome", #' content = "A place for the welcome message or a disclaimer statement.", #' buttons = modalButton("Proceed") #' ), @@ -66,27 +65,18 @@ tm_landing_popup <- module( label = label, - server = srv_landing_popup, - ui = ui_landing_popup, - ui_args = NULL, - server_args = list(title = title, content = content, buttons = buttons), - datanames = NULL - ) - } - -srv_landing_popup <- function(id, title, content, buttons) { - moduleServer(id, function(input, output, session) { - showModal( - modalDialog( - id = "landingpopup", - title = title, - content, - footer = buttons - ) + type = "teal_module_landing", + server = function(id) { + moduleServer(id, function(input, output, session) { + showModal( + modalDialog( + id = "landingpopup", + title = title, + content, + footer = buttons + ) + ) + }) + } ) - }) -} - -ui_landing_popup <- function(id, ...) { - NULL } diff --git a/man/tm_landing_popup.Rd b/man/tm_landing_popup.Rd index 6530aa0e6..1d1189fd8 100644 --- a/man/tm_landing_popup.Rd +++ b/man/tm_landing_popup.Rd @@ -12,8 +12,7 @@ tm_landing_popup( ) } \arguments{ -\item{label}{(\code{character(1)}) Label shown in the navigation item for the module. Any label possible except -\code{"global_filters"} - read more in \code{mapping} argument of \link[teal]{teal_slices}.} +\item{label}{\code{character(1)} the label of the module.} \item{title}{\code{character(1)} the text to be displayed as a title of the popup.} @@ -23,21 +22,20 @@ or a text input control (like \code{textInput}) or a list of \code{shiny} tags. \item{buttons}{\code{shiny} tag or a list of tags (\code{tagList}). Typically a \code{modalButton} or \code{actionButton}. See examples.} } \value{ -A \code{teal} module to be used in \code{teal} applications. +A \code{teal_module_landing} module to be used in \code{teal} applications. } \description{ -This module creates a simple landing welcome popup for \code{teal} applications. +This module creates a landing welcome popup for \code{teal} applications. } \details{ -If you use this module with a default label \code{"Landing Popup"}, it will be used as a first module in -a \code{teal} application and there will not be a tab provided for this module in the application. +If you use this module in \code{teal::init(modules = )}, it will not be wrapped in a tab in \code{teal} application. +See \code{teal::module(type = 'teal_module_landing')}. } \examples{ app1 <- teal::init( data = teal.data::dataset("iris", iris), modules = teal::modules( teal.modules.general::tm_landing_popup( - title = "Welcome", content = "A place for the welcome message or a disclaimer statement.", buttons = modalButton("Proceed") ),