Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (17.1%) to scientific vocabulary
Last synced: 10 months ago
·
JSON representation
Repository
Switch Between Alternative 'shiny' UIs
Basic Info
- Host: GitHub
- Owner: shinyworks
- License: other
- Language: R
- Default Branch: main
- Homepage: https://shinyworks.github.io/scenes/
- Size: 5.37 MB
Statistics
- Stars: 16
- Watchers: 3
- Forks: 1
- Open Issues: 10
- Releases: 1
Created almost 4 years ago
· Last pushed over 1 year ago
Metadata Files
Readme
Changelog
License
Code of conduct
README.Rmd
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# scenes
[](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[](https://CRAN.R-project.org/package=scenes)
[](https://app.codecov.io/gh/shinyworks/scenes?branch=main)
[](https://github.com/shinyworks/scenes/actions/workflows/R-CMD-check.yaml)
The goal of {scenes} is to make it easy to switch a {shiny} app between alternative
UIs.
It was designed to abstract the login-wrapper concept implemented in [{shinyslack}](https://github.com/r4ds/shinyslack).
## Installation
Install the released version of {scenes} from CRAN:
``` r
install.packages("scenes")
```
Or install the development version of scenes from [GitHub](https://github.com/) with:
``` r
# install.packages("remotes")
remotes::install_github("shinyworks/scenes")
```
## Use Cases
You can see a demonstration of {scenes} [here](https://shinyworkscommunity.shinyapps.io/scenes/).
Some examples of how you might use {scenes} to switch between different UIs in a Shiny app:
- **Login Wrapper**: Use {scenes} to switch between a login page and the main content of the app. This is the original use case for {scenes}. It ws designed to abstract the login-wrapper concept implemented in [{shinyslack}](https://github.com/r4ds/shinyslack).
- **App Modes**: Use {scenes} to switch between different modes of the app, such as a view-only mode and an edit mode, via a query parameter (`yourapp.shinyapps.io?mode=edit`).
- **User Roles**: Use {scenes} to switch between different UIs based on user roles. For example, a non-admin user might see a different UI than an admin user.
The **Login Wrapper** example might look like this:
```{r login-wrapper, eval = FALSE}
library(shiny)
library(scenes)
# Define the different scenes for the app
login_ui <- fluidPage(
textInput("username", "Username"),
passwordInput("password", "Password"),
actionButton("login", "Login")
)
main_ui <- fluidPage(
h1("Welcome"),
textOutput("username")
)
# Use the `set_scene()` function to define the different scenes, and
# `change_scene()` to switch between them.
ui <- change_scene(
set_scene(
main_ui,
req_has_cookie(
"validate_login",
validation_fn = my_validation_fn
)
),
fall_through = login_ui
)
server <- function(input, output, session) {
observeEvent(input$login, {
use_cookies_package_to_save_cookie_fn(input$username, input$password)
})
output$username <- renderText({
input$username
})
}
shinyApp(ui = ui, server = server)
```
See [{shinyslack}](https://github.com/r4ds/shinyslack) for a fully implemented example.
## Similar Packages
Other packages have implemented features in this domain.
- [{brochure}](https://github.com/ColinFay/brochure): This package appears to have a great deal of overlap with {scenes}. Colin Fay's implementation appears to potentially be more robust and more complete than {scenes}, but at the cost of diverging farther from a "normal" shiny app.
- [{shiny.router}](https://appsilon.com/shiny-router-020/): This package from [Appsilon](https://appsilon.com) appears to be conceptually similar to {scenes}, but focused on routing based on URL. Of the three packages listed here, this is the only one available on CRAN.
- [{blaze}](https://github.com/nteetor/blaze): This package from Nate Teetor also focuses on routing based on URL. The resulting shiny apps are switched via the server function.
## Code of Conduct
Please note that the scenes project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/1/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.
Owner
- Name: ShinyWorks
- Login: shinyworks
- Kind: organization
- Repositories: 2
- Profile: https://github.com/shinyworks
GitHub Events
Total
- Issues event: 3
- Delete event: 1
- Issue comment event: 3
- Push event: 1
- Pull request event: 2
- Create event: 1
Last Year
- Issues event: 3
- Delete event: 1
- Issue comment event: 3
- Push event: 1
- Pull request event: 2
- Create event: 1
Issues and Pull Requests
Last synced: 10 months ago
All Time
- Total issues: 1
- Total pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 1
- Total pull request authors: 0
- Average comments per issue: 3.0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 1
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 1
- Pull request authors: 0
- Average comments per issue: 3.0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- jonthegeek (3)
- durraniu (1)
Pull Request Authors
- jonthegeek (1)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
DESCRIPTION
cran
- purrr * imports
- rlang * imports
- shiny * imports
- covr * suggests
- pkgload * suggests
- testthat >= 3.0.0 suggests
.github/workflows/R-CMD-check.yaml
actions
- actions/checkout v2 composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/merge_shinyapps.yml
actions
- actions/checkout v3 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgdown.yaml
actions
- JamesIves/github-pages-deploy-action v4.4.1 composite
- actions/checkout v3 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pr-commands.yaml
actions
- actions/checkout v2 composite
- r-lib/actions/pr-fetch v2 composite
- r-lib/actions/pr-push v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pr_shinyapps.yml
actions
- actions/checkout v3 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml
actions
- actions/checkout v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pr_shinyapps_readme.yml
actions