Skip to content

Redesign of teal.reporter Cards #1499

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

Closed
wants to merge 77 commits into from
Closed

Redesign of teal.reporter Cards #1499

wants to merge 77 commits into from

Conversation

m7pr
Copy link
Contributor

@m7pr m7pr commented Feb 26, 2025

Companion to

Code examples of dealing with reporter
devtools::load_all("../teal.reporter")
devtools::load_all(".")

# DISABLE teal.reporter::Reporter globally
app <- init(
  data = within(teal_data(), {iris <- iris}),
  modules = example_module(label = "example teal module"),
  reporter = NULL
)
if (interactive()) {
  shinyApp(app$ui, app$server)
}

# predefined teal.reporter::Reporter with inital card

reporter <- teal.reporter::Reporter$new()
doc1 <- teal.reporter::report_document("## Header 2 text", "Regular text")
reporter$append_cards(setNames(list(doc1), "Welcome card"))

app <- init(
  data = within(teal_data(), {iris <- iris}),
  modules = example_module(label = "example teal module"),
  reporter = reporter
)
if (interactive()) {
  shinyApp(app$ui, app$server)
}

# predefined teal.reporter::Reporter
# that has a template that is always used to prepend all cards

reporter <- teal.reporter::Reporter$new()
template_fun <- function(document) {
  disclaimer <- teal.reporter::report_document("Here comes disclaimer text")
  c(disclaimer, document)
}
reporter$set_template(template_fun)

app <- init(
  data = within(teal_data(), {iris <- iris}),
  modules = example_module(label = "example teal module"),
  reporter = reporter
)
if (interactive()) {
  shinyApp(app$ui, app$server)
}

# remove reporter ADD BUTTON for a single module

app <- init(
  data = within(teal_data(), {iris <- iris}),
  modules = modules(
    example_module(label = "module with reporter"),
    example_module(label = "module without reporter") |> nullify_teal_module_report_card()
    # the same nullify_teal_module_report_card = disable_teal_module_report
    #example_module(label = "module without reporter") |> disable_teal_module_report()
  )
)
if (interactive()) {
  shinyApp(app$ui, app$server)
}

vedhav and others added 28 commits September 17, 2024 15:43
# Conflicts:
#	R/module_nested_tabs.R
#	R/module_teal.R
#	R/module_transform_data.R
# Conflicts:
#	R/module_nested_tabs.R
# Conflicts:
#	DESCRIPTION
#	R/module_data_summary.R
#	R/module_nested_tabs.R
#	R/module_teal.R
#	R/module_transform_data.R
# Conflicts:
#	R/module_teal.R
Hey @vedhav @gogonzo just letting you know that I am merging `main` into
`test@bslib@main` branch, so that on other repositories, like `tmg`, we
can install `teal` from this branch and also we can satisfy condition
for `teal` to be `>= 0.16.0`.


https://github.com/insightsengineering/teal.modules.general/blob/report_redesign_poc%40main/DESCRIPTION#L83

https://github.com/insightsengineering/teal.modules.general/blob/report_redesign_poc%40main/DESCRIPTION#L30

---------

Co-authored-by: Dony Unardi <donyunardi@gmail.com>
Co-authored-by: insights-engineering-bot <68416928+insights-engineering-bot@users.noreply.github.com>
@m7pr m7pr added the core label Feb 26, 2025
@m7pr
Copy link
Contributor Author

m7pr commented May 15, 2025

Thanks @averissimo for the thorough review! Those are all really useful updates to the current flow :)!

@m7pr
Copy link
Contributor Author

m7pr commented May 15, 2025

@averissimo the bug that you reported I was aware of

Found a 🐞 bug: Can only add 1 card
How to reproduce:

Load example shiny app
Add card with any title (e.g. "title 1")
Add second card with a different title (e.g. "title 2")
Open the reporter tab
Only 1 card is present as screenshot below shows

This is because you are adding a second card, that has the same content as the first card (they have just different names, but the content is the same). There is some reactiveVal that keeps the state of the last added card, and if a new card is added with the same name, it prevents adding this card.

If you add a new card inside the same module, and you at least specify a comment, then the content of the second card will be different and this will be possible to be added.

Signed-off-by: André Veríssimo <211358+averissimo@users.noreply.github.com>
* pr@redesign@main:
  chore: simplification of code into moduleServers
  feat: use common structure for js autofocus input and enter to submit
averissimo and others added 2 commits May 27, 2025 11:30
# Pull Request

<!--- Replace `#nnn` with your issue link for reference. -->

Companion to
insightsengineering/teal.reporter#326
@averissimo
Copy link
Contributor

As agreed we are closing this PR in favor of insightsengineering/teal.reporter#331 that is built on top of this one.

The overhead of keeping the 2 feature branches is becoming too cumbersome with multiple function renames going on.

@averissimo averissimo closed this Jun 4, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Jun 4, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
6 participants