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

replace dataset calls in vignettes with box imports #200

Merged
merged 2 commits into from
Aug 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 12 additions & 20 deletions vignettes/st-shiny-fluent-and-rhino.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ editor_options:
### Getting started with our development environment

Let us first install and create our `rhino` project structure.
Note: Ensure Rhino v1.4.0 or later is installed for this tutorial.

To install `rhino`, please run the following in the R console:

Expand Down Expand Up @@ -120,7 +121,7 @@ This `app/view/datatable.R` file will be used to display the data table on the U

box::use(
shiny[div, moduleServer, NS, renderUI, uiOutput],
shiny.fluent[DetailsList, Text],
shiny.fluent[DetailsList, Text, fluentSalesDeals],
)

#' @export
Expand All @@ -136,15 +137,13 @@ ui <- function(id) {
server <- function(id) {
moduleServer(id, function(input, output, session) {
output$datatable <- renderUI({
# Datasets are the only case when you need to use :: in `box`.
# This issue should be solved in the next `box` release.
DetailsList(items = shiny.fluent::fluentSalesDeals)
DetailsList(items = fluentSalesDeals)
})
})
}
```

`fluentSalesDeals` is a dataset available with the `shiny.fluent` package and to use it, we use `::` for directly fetching the dataset from the library. Datasets are the only case when you need to use `::` in `box`.
`fluentSalesDeals` is a dataset available with the `shiny.fluent` package.

So, here we are using [`DetailsList`](https://appsilon.github.io/shiny.fluent/reference/DetailsList.html) function in the server side to render the table on the UI.

Expand Down Expand Up @@ -213,7 +212,7 @@ Also, we need to mention in the `DetailsList()` function to only display the nam

box::use(
shiny[div, moduleServer, NS, renderUI, uiOutput],
shiny.fluent[DetailsList, Text],
shiny.fluent[DetailsList, Text, fluentSalesDeals],
tibble[tibble],
)

Expand All @@ -235,9 +234,8 @@ ui <- function(id) {
server <- function(id) {
moduleServer(id, function(input, output, session) {
output$datatable <- renderUI({
# Datasets are the only case when you need to use :: in `box`.
# This issue should be solved in the next `box` release.
DetailsList(items = shiny.fluent::fluentSalesDeals, columns = columns)
DetailsList(items = fluentSalesDeals, columns = columns)
})
})
}
Expand Down Expand Up @@ -267,7 +265,7 @@ So, the `app/view/datatable.R` file now is modified to -
box::use(
dplyr[filter],
shiny[div, moduleServer, NS, reactive, renderUI, uiOutput],
shiny.fluent[DetailsList, Text, Toggle.shinyInput],
shiny.fluent[DetailsList, Text, Toggle.shinyInput, fluentSalesDeals],
tibble[tibble],
)

Expand All @@ -293,9 +291,7 @@ ui <- function(id) {
server <- function(id) {
moduleServer(id, function(input, output, session) {
filtered_deals <- reactive({
# Datasets are the only case when you need to use :: in `box`.
# This issue should be solved in the next `box` release.
shiny.fluent::fluentSalesDeals |> filter(
fluentSalesDeals |> filter(
is_closed | input$includeOpen
)
})
Expand Down Expand Up @@ -350,7 +346,7 @@ We will also style the data table area. The following code does the following -
box::use(
dplyr[filter],
shiny[div, moduleServer, NS, reactive, renderUI, span, uiOutput],
shiny.fluent[DetailsList, Stack, Text, Toggle.shinyInput],
shiny.fluent[DetailsList, Stack, Text, Toggle.shinyInput, fluentSalesDeals],
tibble[tibble],
)

Expand Down Expand Up @@ -380,9 +376,7 @@ ui <- function(id) {
server <- function(id) {
moduleServer(id, function(input, output, session) {
filtered_deals <- reactive({
# Datasets are the only case when you need to use :: in `box`.
# This issue should be solved in the next `box` release.
shiny.fluent::fluentSalesDeals |> filter(
fluentSalesDeals |> filter(
is_closed | input$includeOpen
)
})
Expand Down Expand Up @@ -446,7 +440,7 @@ These modules will be called from the main file.
box::use(
dplyr[filter],
shiny[div, moduleServer, NS, reactive],
shiny.fluent[Text, Toggle.shinyInput],
shiny.fluent[Text, Toggle.shinyInput, fluentSalesDeals],
)

#' @export
Expand All @@ -462,9 +456,7 @@ ui <- function(id) {
server <- function(id) {
moduleServer(id, function(input, output, session) {
filtered_deals <- reactive({
# Datasets are the only case when you need to use :: in `box`.
# This issue should be solved in the next `box` release.
shiny.fluent::fluentSalesDeals |> filter(
fluentSalesDeals |> filter(
is_closed | input$includeOpen
)
})
Expand Down