Use rhino::init()
to create a new Rhino app in task1
directory.
- Enable automatic reloading with
shiny::devmode()
. - Run the app with
shiny::runApp()
. - Edit the displayed message in
app/main.R
and see how the app automatically reloads.
Copy over the following code to main.R
:
box::use(
shiny,
shiny.fluent[...],
)
#' @export
ui = function(id) {
ns <- shiny$NS(id)
shiny$tagList(
ColorPicker.shinyInput(ns("color"), value="#0000FF"),
shiny$verbatimTextOutput(ns("text")))
}
#' @export
server <- function(id) {
shiny$moduleServer(id, function(input, output, session) {
output$text <- shiny$renderText({
paste("Color:", input$color)
})
})
}
Install the missing dependencies with
rhino::pkg_install()
and run the app.
- Lint the project with
rhino::lint_r()
. - Format the code with
rhino::format_r()
. - Lint the project again and fix remaining errors.
Rename main.R
to app.R
and copy over the following code:
library(shiny)
library(shiny.fluent)
ui <- div(
Calendar.shinyInput("date"),
verbatimTextOutput("text"),
)
server <- function(input, output, session) {
output$text <- renderText({
paste("Date:", input$date)
})
}
shinyApp(ui = ui, server = server)
Set legacy_entrypoint: app_dir
in rhino.yml
and rerun the app.
- Rename
app/app.R
back toapp/main.R
. - Remove the
shinyApp(ui = ui, server = server)
line. - Set
legacy_entrypoint: source
and rerun the app.
- Replace
library()
calls withbox::use()
. - Set
legacy_entrypoint: box_top_level
and rerun the app.
- Modify the
ui
andserver
to make them into a Shiny module. - Remove the
legacy_entrypoint
setting and rerun the app.