-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
812 landing popup #934
812 landing popup #934
Conversation
Code Coverage Summary
Diff against main
Results for commit: 3300979 Minimum allowed coverage is ♻️ This comment has been updated with latest results |
@donyunardi Love your suggestion! This first version looks great already! |
For short sentences/paragraphs, center would look better. But for 5 paragraphs, left-align would make more sense indeed. Could the |
Also I thought we are building a new module for this feature, instead of adding it as a new argument to |
Hey @lcd2yyz I'm not sure about the teal module approach anymore. It creates a separate tab in the app, like |
I also have second thoughts on the approach of Just made a change in this commit f973beb, and it's possible to run the app with below code R codenew_iris <- transform(iris, id = seq_len(nrow(iris)))
new_mtcars <- transform(mtcars, id = seq_len(nrow(mtcars)))
app <- init(
data = teal_data(
dataset("new_iris", new_iris),
dataset("new_mtcars", new_mtcars),
code = "
new_iris <- transform(iris, id = seq_len(nrow(iris)))
new_mtcars <- transform(mtcars, id = seq_len(nrow(mtcars)))
"
),
modules = modules(
module(
label = "data source",
server = function(input, output, session, data) {},
ui = function(id, ...) div(p("information about data source")),
datanames = "all"
),
example_module(label = "example teal module"),
module(
"Iris Sepal.Length histogram",
server = function(input, output, session, data) {
output$hist <- renderPlot(
hist(data[["new_iris"]]()$Sepal.Length)
)
},
ui = function(id, ...) {
ns <- NS(id)
plotOutput(ns("hist"))
},
datanames = "new_iris"
)
),
title = "App title",
filter = teal_slices(
teal_slice(dataname = "new_iris", varname = "Species"),
teal_slice(dataname = "new_iris", varname = "Sepal.Length"),
teal_slice(dataname = "new_mtcars", varname = "cyl"),
exclude_varnames = list(new_iris = c("Sepal.Width", "Petal.Width")),
mapping = list(
`example teal module` = "new_iris Species",
`Iris Sepal.Length histogram` = "new_iris Species",
global_filters = "new_mtcars cyl"
)
),
header = tags$h1("Sample App"),
footer = tags$p("Copyright 2017 - 2023"),
extra_server = landing_modal(
title = "Disclaimer",
text = "By agreeing to this statement you confirm you accept A, B and C.",
button = "Agree"
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
} |
Signed-off-by: Marcin <[email protected]>
Merge branch '812_landing_popup@main' of https://github.com/insightsengineering/teal into 812_landing_popup@main # Conflicts: # R/utils.R
Just moved tm_landing_popup to insightsengineering/teal.modules.general#585 with a04ee4a and 3e4f3f00 Current R codedevtools::load_all('../teal.modules.general')
devtools::load_all('.')
new_iris <- transform(iris, id = seq_len(nrow(iris)))
new_mtcars <- transform(mtcars, id = seq_len(nrow(mtcars)))
app <- init(
data = teal_data(
dataset("new_iris", new_iris),
dataset("new_mtcars", new_mtcars),
code = "
new_iris <- transform(iris, id = seq_len(nrow(iris)))
new_mtcars <- transform(mtcars, id = seq_len(nrow(mtcars)))
"
),
modules = modules(
module(
label = "data source",
server = function(input, output, session, data) {},
ui = function(id, ...) div(p("information about data source")),
datanames = "all"
),
example_module(label = "example teal module"),
module(
"Iris Sepal.Length histogram",
server = function(input, output, session, data) {
output$hist <- renderPlot(
hist(data[["new_iris"]]()$Sepal.Length)
)
},
ui = function(id, ...) {
ns <- NS(id)
plotOutput(ns("hist"))
},
datanames = "new_iris"
)
),
title = "App title",
filter = teal_slices(
teal_slice(dataname = "new_iris", varname = "Species"),
teal_slice(dataname = "new_iris", varname = "Sepal.Length"),
teal_slice(dataname = "new_mtcars", varname = "cyl"),
exclude_varnames = list(new_iris = c("Sepal.Width", "Petal.Width")),
mapping = list(
`example teal module` = "new_iris Species",
`Iris Sepal.Length histogram` = "new_iris Species",
global_filters = "new_mtcars cyl"
)
),
header = tags$h1("Sample App"),
footer = tags$p("Copyright 2017 - 2023"),
extra_server = teal.modules.general::tm_landing_popup(
title = "Welcome",
text = "A place for the welcome message or a disclaimer statement.",
button = "Proceed"
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
} |
Hey, in the end I simplified the approach and we are able to achieve every customization with
and below is a couple of customizable examples of how you can create a landing popup devtools::load_all('/teal.modules.general')
devtools::load_all('/teal')
app1 <- teal::init(
data = teal.data::dataset("iris", iris),
modules = teal::modules(
teal.modules.general::tm_front_page('A')
),
extra_server = teal.modules.general::landing_popup(
title = "Welcome",
content = "A place for the welcome message or a disclaimer statement.",
buttons = modalButton("Proceed")
)
)
if (interactive()) {
shinyApp(app1$ui, app1$server)
}
app2 <- teal::init(
data = teal.data::dataset("iris", iris),
modules = teal::modules(
teal.modules.general::tm_front_page('A')
),
extra_server = teal.modules.general::landing_popup(
title = "Welcome",
content = div(tags$b("A place for the welcome message or a disclaimer statement.", style = "color: red;")),
buttons = tagList(modalButton("Proceed"), actionButton('close', 'Read more', onclick = "window.open('http://google.com', '_blank')"))
)
)
if (interactive()) {
shinyApp(app2$ui, app2$server)
} |
I am just not sure if this should live in |
@donyunardi any recommendations on where to put |
…ngineering/teal into 812_landing_popup@main
…ngineering/teal into 812_landing_popup@main
Co-authored-by: Aleksander Chlebowski <[email protected]> Signed-off-by: Marcin <[email protected]>
Co-authored-by: Aleksander Chlebowski <[email protected]> Signed-off-by: Marcin <[email protected]>
…ngineering/teal into 812_landing_popup@main
Co-authored-by: Aleksander Chlebowski <[email protected]> Signed-off-by: Marcin <[email protected]>
Co-authored-by: Aleksander Chlebowski <[email protected]> Signed-off-by: Marcin <[email protected]>
…ngineering/teal into 812_landing_popup@main
@lcd2yyz any last words before we merge? Would love to get this merge before the end of the week. |
Just received a verbal green light by @lcd2yyz so will merge, once the tests pass |
This resolves #812
CC @lcd2yyz
This is just a frontend proposition for the landing page functionality. This could be used to present a welcome statement or a disclaimer that requires a consent. Below is a code for the simple teal app that starts with a landing page specification.
Currently this PR is build upon
shinyalert::shinyalert
function, but once this is accepted I will take out just the ingredients out of this functions and put in teal so that we don't need to include another dependency inteal
package.A user is able to customize the landing page with
title
(1),text
(2) andbutton
(3) parameters oflanging
list argument inteal::init
R code
```r new_iris <- transform(iris, id = seq_len(nrow(iris))) new_mtcars <- transform(mtcars, id = seq_len(nrow(mtcars)))app <- init(
data = teal_data(
dataset("new_iris", new_iris),
dataset("new_mtcars", new_mtcars),
code = "
new_iris <- transform(iris, id = seq_len(nrow(iris)))
new_mtcars <- transform(mtcars, id = seq_len(nrow(mtcars)))
"
),
modules = modules(
module(
label = "data source",
server = function(input, output, session, data) {},
ui = function(id, ...) div(p("information about data source")),
datanames = "all"
),
example_module(label = "example teal module"),
module(
"Iris Sepal.Length histogram",
server = function(input, output, session, data) {
output$hist <- renderPlot(
hist(data["new_iris"]$Sepal.Length)
)
},
ui = function(id, ...) {
ns <- NS(id)
plotOutput(ns("hist"))
},
datanames = "new_iris"
)
),
title = "App title",
filter = teal_slices(
teal_slice(dataname = "new_iris", varname = "Species"),
teal_slice(dataname = "new_iris", varname = "Sepal.Length"),
teal_slice(dataname = "new_mtcars", varname = "cyl"),
exclude_varnames = list(new_iris = c("Sepal.Width", "Petal.Width")),
mapping = list(
example teal module
= "new_iris Species",Iris Sepal.Length histogram
= "new_iris Species",global_filters = "new_mtcars cyl"
)
),
header = tags$h1("Sample App"),
footer = tags$p("Copyright 2017 - 2023"),
landing = list(
title = 'Disclaimer',
text = 'By agreeing to this statement you confirm you accept A, B and C.',
button = 'Agree'
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}