Skip to content
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

Add teal app modifiers and deprecate init args #1440

Merged
merged 52 commits into from
Jan 17, 2025
Merged

Conversation

vedhav
Copy link
Contributor

@vedhav vedhav commented Jan 7, 2025

Closes #1310 and #1143

Changes

  • The title, header, and footer are soft deprecated in favor of using add_title, add_header, add_footer, and add_landing_popup
  • Adds a new add_custom_server modifier to add custom server logic to the main shiny app.
  • Reverts the usage of landing_popup_module to the previous way by passing it inside the modules
  • Bumps R version to 4.1 to start using native pipe |>

Example app with the new app modifiers.

devtools::load_all("teal")

app <- init(
  data = teal_data(IRIS = iris, MTCARS = mtcars),
  modules = modules(
    example_module("Module 1"),
    example_module("Module 2")
  ),
  filter = teal_slices(
    teal_slice(dataname = "IRIS", varname = "Species", selected = "setosa")
  )
) |>
  modify_title("Custom title") |>
  modify_header(
    tags$div(
      h3("Header with a button that can be observed!"),
      actionButton("notify", "Show notification")
    )
  ) |>
  modify_footer("Custom footer") |>
   add_landing_popup(
      content = "Popup content",
      buttons = modalButton("Proceed")
   ) |>
  add_custom_server(function(input, output, session) {
    observeEvent(input$notify, {
      showNotification("Yes, the button works!")
    })
  })

shinyApp(app$ui, app$server)

@vedhav vedhav added the core label Jan 7, 2025
Copy link
Contributor

github-actions bot commented Jan 7, 2025

Unit Tests Summary

  1 files   28 suites   10m 39s ⏱️
276 tests 272 ✅ 4 💤 0 ❌
538 runs  534 ✅ 4 💤 0 ❌

Results for commit 62e836f.

♻️ This comment has been updated with latest results.

Copy link
Contributor

github-actions bot commented Jan 7, 2025

Unit Test Performance Difference

Test Suite $Status$ Time on main $±Time$ $±Tests$ $±Skipped$ $±Failures$ $±Errors$
module_session_info 👶 $+17.15$ $+3$ $0$ $0$ $0$
module_teal 💚 $156.79$ $-25.92$ $-3$ $0$ $0$ $0$
shinytest2-filter_panel 💚 $43.46$ $-1.42$ $0$ $0$ $0$ $0$
shinytest2-landing_popup 💔 $45.44$ $+1.61$ $0$ $0$ $0$ $0$
shinytest2-module_bookmark_manager 💔 $36.06$ $+1.01$ $0$ $0$ $0$ $0$
Additional test case details
Test Suite $Status$ Time on main $±Time$ Test Case
module_session_info 👶 $+17.14$ creation_process_is_invoked_for_teal.lockfile.mode_enabled_and_snapshot_is_copied_to_teal_app.lock_and_removed_after_session_ended
module_session_info 👶 $+0.02$ creation_process_is_not_invoked_for_teal.lockfile.mode_disabled_
module_teal 💚 $4.33$ $-1.12$ clicking_reset_button_restores_initial_filters_state_when_module_specific
module_teal 💀 $17.80$ $-17.80$ creation_process_is_invoked_for_teal.lockfile.mode_enabled_and_snapshot_is_copied_to_teal_app.lock_and_removed_after_session_ended
module_teal 💀 $0.07$ $-0.07$ creation_process_is_not_invoked_for_teal.lockfile.mode_disabled_

Results for commit 24910e0

♻️ This comment has been updated with latest results.

@vedhav vedhav marked this pull request as draft January 7, 2025 08:10
@vedhav vedhav force-pushed the 1310-simplify-init-args branch from 1fb5028 to aa60c14 Compare January 10, 2025 07:59
Copy link
Contributor

@gogonzo gogonzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some room for improvement

R/init.R Outdated Show resolved Hide resolved
R/init.R Outdated Show resolved Hide resolved
R/init.R Outdated Show resolved Hide resolved
R/init.R Outdated Show resolved Hide resolved
R/init.R Outdated Show resolved Hide resolved
R/init.R Outdated Show resolved Hide resolved
R/init.R Outdated Show resolved Hide resolved
R/init.R Outdated Show resolved Hide resolved
@vedhav vedhav force-pushed the 1310-simplify-init-args branch from ef65f87 to 0af8a67 Compare January 10, 2025 09:39
R/init.R Outdated Show resolved Hide resolved
R/init.R Outdated Show resolved Hide resolved
vedhav and others added 2 commits January 10, 2025 20:27
R/init.R Outdated Show resolved Hide resolved
R/init.R Outdated Show resolved Hide resolved
R/TealAppDriver.R Outdated Show resolved Hide resolved
R/TealAppDriver.R Show resolved Hide resolved
@gogonzo gogonzo self-assigned this Jan 13, 2025
Copy link
Contributor

@gogonzo gogonzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ui_teal shouldn't have header, footer, title arguments. Deprecation in init only is a half-measure. Please use add_header and add_title in teal::init body instead of passing arguments to ui_teal.

Edit: Same applies to module_teal_with_splash

R/init.R Show resolved Hide resolved
R/init.R Outdated Show resolved Hide resolved
R/init.R Outdated Show resolved Hide resolved
R/init.R Outdated Show resolved Hide resolved
@vedhav vedhav enabled auto-merge (squash) January 17, 2025 10:20
R/init.R Outdated Show resolved Hide resolved
R/init.R Outdated Show resolved Hide resolved
R/module_session_info.R Outdated Show resolved Hide resolved
R/module_teal_with_splash.R Outdated Show resolved Hide resolved
R/teal_modifiers.R Outdated Show resolved Hide resolved
R/teal_modifiers.R Outdated Show resolved Hide resolved
R/teal_modifiers.R Show resolved Hide resolved
R/teal_modifiers.R Show resolved Hide resolved
R/module_teal.R Show resolved Hide resolved
R/module_teal.R Outdated Show resolved Hide resolved
R/teal_modifiers.R Outdated Show resolved Hide resolved
R/landing_popup_module.R Outdated Show resolved Hide resolved
R/init.R Show resolved Hide resolved
@vedhav vedhav force-pushed the 1310-simplify-init-args branch from 9334e2c to 489a28c Compare January 17, 2025 13:06
Copy link
Contributor

@gogonzo gogonzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍

@vedhav vedhav merged commit 32f1eba into main Jan 17, 2025
29 checks passed
@vedhav vedhav deleted the 1310-simplify-init-args branch January 17, 2025 13:54
@github-actions github-actions bot locked and limited conversation to collaborators Jan 17, 2025
tags$title("teal app"),
tags$link(
rel = "icon",
href = "https://raw.githubusercontent.com/insightsengineering/hex-stickers/main/PNG/nest.png",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

tags$title("teal app"),
tags$link(
rel = "icon",
href = "https://raw.githubusercontent.com/insightsengineering/hex-stickers/main/PNG/nest.png",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R/init.R Show resolved Hide resolved
R/init.R Show resolved Hide resolved
R/init.R Show resolved Hide resolved
NEWS.md Show resolved Hide resolved
NAMESPACE Show resolved Hide resolved
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move landing popup feature back to the modules argument
4 participants