Skip to content

Commit

Permalink
start shinylive
Browse files Browse the repository at this point in the history
  • Loading branch information
DivadNojnarg committed Sep 26, 2024
1 parent 040ebde commit 77e4334
Show file tree
Hide file tree
Showing 73 changed files with 4,288 additions and 6,785 deletions.
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@
^pkgdown$
^\.github$
^CODE_OF_CONDUCT\.md$
^README\.Rmd$
^index\.Rmd$
^index\.md$
52 changes: 17 additions & 35 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
#
# NOTE: This workflow is overkill for most R packages and
# check-standard.yaml is likely a better choice.
# usethis::use_github_action("check-standard") will install it.
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: R-CMD-check
name: R-CMD-check.yaml

permissions: read-all

jobs:
R-CMD-check:
Expand All @@ -22,49 +20,33 @@ jobs:
fail-fast: false
matrix:
config:
- {os: macOS-latest, r: 'release'}

- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
# Use 3.6 to trigger usage of RTools35
- {os: windows-latest, r: '3.6'}

# Use older ubuntu to maximise backward compatibility
- {os: ubuntu-18.04, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-18.04, r: 'release'}
- {os: ubuntu-18.04, r: 'oldrel-1'}
- {os: ubuntu-18.04, r: 'oldrel-2'}
- {os: ubuntu-18.04, r: 'oldrel-3'}
- {os: ubuntu-18.04, r: 'oldrel-4'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v1
- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v1
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v1
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: rcmdcheck

- uses: r-lib/actions/check-r-package@v1

- name: Show testthat output
if: always()
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash
extra-packages: any::rcmdcheck
needs: check

- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
- uses: r-lib/actions/check-r-package@v2
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
58 changes: 29 additions & 29 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: master
branches: [main, master]
pull_request:
branches: [main, master]
release:
types: [published]
workflow_dispatch:

name: pkgdown

jobs:
pkgdown:
runs-on: macOS-latest
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-r@master
- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-pandoc@master

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- name: Cache R packages
uses: actions/cache@v1
- uses: r-lib/actions/setup-r-dependencies@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
extra-packages: any::pkgdown, local::.
needs: website

- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE)
install.packages("pkgdown")
- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Install package
run: R CMD INSTALL .

- name: Deploy package
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)'
- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/[email protected]
with:
clean: false
branch: gh-pages
folder: docs
9 changes: 5 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ Description: 'R' interface to the 'Tabler' HTML template. See more here <https:/
is available at <https://dgranjon.shinyapps.io/shinyMons/>.
URL: https://rinterface.github.io/tablerDash/, https://github.com/RinteRface/tablerDash/
BugReports: https://github.com/RinteRface/tablerDash/issues
Imports: shiny, htmltools, knitr
Suggests: shinyWidgets, shinyEffects, echarts4r
Imports: shiny, htmltools
Suggests: shinyWidgets, shinyEffects, echarts4r, knitr
License: GPL (>= 2)
Encoding: UTF-8
LazyData: true
RoxygenNote: 6.1.1
RoxygenNote: 7.3.2
Depends:
R (>= 2.10)
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# tablerDash 0.1.5.9000

## Documentation
- Upgrade pkgdown setup.
- Added shinylive support.

## Bug Fix
- Resizing a `tablerCard()` triggers the shown javascript event, telling shiny to
update the size of the contained object.
Expand Down
Binary file added R/sysdata.rda
Binary file not shown.
43 changes: 43 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,46 @@ validateTabName <- function(name) {
stop("tabName must not have a '.' in it.")
}
}

#' Create shinylive iframe
#'
#' Useful for pkgdown website
#'
#' @param url app url. A shinylive link.
#' @param mode How to display the shinylive app. Default to app mode.
#' @param header Whether to display the shinylive header. Default to TRUE.
#' @keywords internal
create_app_link <- function(url, mode = c("app", "editor"), header = TRUE) {
mode <- match.arg(mode)

if (mode != "editor") url <- gsub("editor", mode, url)

if (!header) {
url <- paste0(url, "&h=0")
}

shiny::tags$iframe(
# To allow the content to fill the full screen card
class = "html-fill-item",
src = url,
height = "700",
width = "100%",
style = "border: 1px solid rgba(0,0,0,0.175); border-radius: .375rem;",
allowfullscreen = "",
allow = "autoplay",
`data-external` = "1"
)
}

code_chunk <- function(output, language = "r") {
cat(paste0("```", language))
cat(output)
cat("\n```\n")
}

print_r_code <- function(name) {
path <- system.file(sprintf("examples/shinylive/%s/app.R", name), package = "shiny386")
lines <- readLines(path)
to_remove <- grep("webr::", lines)
code_chunk(cat(paste(lines[-to_remove], collapse = "\n")))
}
71 changes: 71 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
output: github_document
---

<!-- README.md is generated from README.Rmd. Please edit that file -->

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```

# tablerDash <img src="https://rinterface.com/inst/images/tablerDash.svg" width=200 align="right" />

<!-- badges: start -->
[![R build status](https://github.com/RinteRface/tablerDash/workflows/R-CMD-check/badge.svg)](https://github.com/RinteRface/tablerDash/actions)
[![CRAN status](https://www.r-pkg.org/badges/version/tablerDash)](https://cran.r-project.org/package=tablerDash)
[![lifecycle](https://img.shields.io/badge/lifecycle-maturing-ff69b4.svg)](https://www.tidyverse.org/lifecycle/#maturing)
[![cranlogs](https://cranlogs.r-pkg.org/badges/tablerDash)](https://cran.r-project.org/package=tablerDash)
[![total](https://cranlogs.r-pkg.org/badges/grand-total/tablerDash)](https://www.rpackages.io/package/tablerDash)
[![R-CMD-check](https://github.com/RinteRface/tablerDash/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/RinteRface/tablerDash/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->

> Tabler dashboard template for shiny with Bootstrap 4
See [https://tabler.io](https://tabler.io) for the original template.

## Installation

This package is on CRAN:

```r
# latest devel version
devtools::install_github("RinteRface/tablerDash")
# CRAN version
install.packages("tablerDash")
```

## Demo

`{tablerDash}` works on all the RStudio products. See a demo [on shinyapps.io](https://dgranjon.shinyapps.io/tablerDashDemo/).


<div class="row">
<div class="card">
<a href="https://community.rstudio.com/t/shiny-contest-submission-gotta-catch-em-almost-all/25284" target="_blank"><img src="https://community.rstudio.com/uploads/default/optimized/2X/6/626cbb941e2c3dfe543abde05f7e4097186811c6_2_690x431.png"></a>
</div>
</div>

<br>

<div class="row">
<div class="card">
<a href="https://community.rstudio.com/t/shiny-contest-submission-gotta-catch-em-almost-all/25284" target="_blank"><img src="https://community.rstudio.com/uploads/default/optimized/2X/3/33061a47390f6fa1515302d7f05e05c1b6f3e458_2_690x431.jpeg"></a>
</div>
</div>

<br>


## Issues

Issues are listed [here](https://github.com/RinteRface/tablerDash/issues).

## Code of Conduct

Please note that the tablerDash project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.

40 changes: 30 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@

<!-- README.md is generated from README.Rmd. Please edit that file -->

# tablerDash <img src="https://rinterface.com/inst/images/tablerDash.svg" width=200 align="right" />

[![R build status](https://github.com/RinteRface/tablerDash/workflows/R-CMD-check/badge.svg)](https://github.com/RinteRface/tablerDash/actions)
[![CRAN status](https://www.r-pkg.org/badges/version/tablerDash)](https://cran.r-project.org/package=tablerDash)
<!-- badges: start -->

[![R build
status](https://github.com/RinteRface/tablerDash/workflows/R-CMD-check/badge.svg)](https://github.com/RinteRface/tablerDash/actions)
[![CRAN
status](https://www.r-pkg.org/badges/version/tablerDash)](https://cran.r-project.org/package=tablerDash)
[![lifecycle](https://img.shields.io/badge/lifecycle-maturing-ff69b4.svg)](https://www.tidyverse.org/lifecycle/#maturing)
[![cranlogs](https://cranlogs.r-pkg.org/badges/tablerDash)](https://cran.r-project.org/package=tablerDash)
[![total](https://cranlogs.r-pkg.org/badges/grand-total/tablerDash)](https://www.rpackages.io/package/tablerDash)
[![R-CMD-check](https://github.com/RinteRface/tablerDash/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/RinteRface/tablerDash/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->

> Tabler dashboard template for shiny with Bootstrap 4
See [https://tabler.io](https://tabler.io) for the original template.
See <https://tabler.io> for the original template.

## Installation

This package is on CRAN:

```r
``` r
# latest devel version
devtools::install_github("RinteRface/tablerDash")
# CRAN version
Expand All @@ -23,30 +32,41 @@ install.packages("tablerDash")

## Demo

`{tablerDash}` works on all the RStudio products. See a demo [on shinyapps.io](https://dgranjon.shinyapps.io/tablerDashDemo/).

`{tablerDash}` works on all the RStudio products. See a demo [on
shinyapps.io](https://dgranjon.shinyapps.io/tablerDashDemo/).

<div class="row">

<div class="card">

<a href="https://community.rstudio.com/t/shiny-contest-submission-gotta-catch-em-almost-all/25284" target="_blank"><img src="https://community.rstudio.com/uploads/default/optimized/2X/6/626cbb941e2c3dfe543abde05f7e4097186811c6_2_690x431.png"></a>

</div>

</div>

<br>

<div class="row">

<div class="card">

<a href="https://community.rstudio.com/t/shiny-contest-submission-gotta-catch-em-almost-all/25284" target="_blank"><img src="https://community.rstudio.com/uploads/default/optimized/2X/3/33061a47390f6fa1515302d7f05e05c1b6f3e458_2_690x431.jpeg"></a>

</div>

</div>

<br>


## Issues

Issues are listed [here](https://github.com/RinteRface/tablerDash/issues).
Issues are listed
[here](https://github.com/RinteRface/tablerDash/issues).

## Code of Conduct

Please note that the tablerDash project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.

Please note that the tablerDash project is released with a [Contributor
Code of
Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html).
By contributing to this project, you agree to abide by its terms.
Loading

0 comments on commit 77e4334

Please sign in to comment.