Skip to contents

Overview

artshiny provides shared Shiny UI components and helpers for the Artalytics platform. This package centralizes common interface patterns used across multiple app modules, ensuring consistency and reducing code duplication.

Installation

# Install from GitHub
pak::pkg_install("artalytics/artshiny")

Key Components

Reactive App Data

The reactive_appdata() function is the primary way to initialize reactive state for module development. It creates a reactiveValues object with pre-loaded artist and artwork context:

library(artshiny)

# In a module's run_app() function
run_app <- function(artist) {
  ui <- fluidPage(
    myModuleUI("mod")
  )

  server <- function(input, output, session) {
    # Initialize reactive state with artist context
    r <- reactive_appdata(artist)

    # Pass to module server
    myModuleServer("mod", r)
  }

  shiny::shinyApp(ui, server)
}

The returned reactiveValues contains:

  • r$artist - Artist UUID
  • r$artwork - Artwork UUID (randomly selected if not specified)
  • r$appdata - Full app data from artutils::get_appdata()

Stats Box Module

Display statistics with icons in a responsive card layout:

# UI
statsBoxUI("artworks", icon = "palette")

# Server
statsBoxServer(
  "artworks",
  r_stat_value = reactive(nrow(artist_artworks())),
  stat_label = "Total Artworks"
)

The module includes self-contained CSS with:

  • White background with subtle shadow
  • Circular blue icon container
  • Large bold number display
  • Responsive flex layout

Loading Screens

Create artwork-themed loading screens for waiter integration:

library(waiter)

# Get waiter HTML
loading <- wait_art_html(
  msg = "Loading artwork details...",
  type = "designs", # or "artworks"
  which = 1
)

# Use with waiter
waiter <- Waiter$new(
  html = loading$html,
  color = loading$color
)
waiter$show()

Package Hierarchy

artshiny sits in the application layer of the Artalytics ecosystem:

appPlatform / mod* packages
        |
    artshiny (shared UI components)
        |
    artutils (data access)
        |
    artcore (low-level infrastructure)

See Also