---
title: "Publishing a glasstabs Workflow to Posit Connect"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Publishing a glasstabs Workflow to Posit Connect}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(eval = FALSE)
```

## Overview

`runGlassExample("connect-workflow")` opens a Shiny page designed to be
published to Posit Connect. It demonstrates a practical review workflow:

- filters define the active queue with `glassSelect()` and
  `glassMultiSelect()`
- `glassTabsUI(orientation = "vertical", indicator = "solid")` guides users
  through intake, exploration, and approval
- `updateGlassTabBadge()` keeps tab badges aligned with the filtered data
- `updateGlassTabsUI()` moves reviewers to the next stage from server actions
- `theme = "auto"` follows Bootstrap 5 / bslib light and dark modes

## Run locally

```{r}
library(glasstabs)

if (interactive()) {
  runGlassExample("connect-workflow")
}
```

## Manifest

The example folder ships with a `manifest.json` generated by
`rsconnect::writeManifest()`. The app adapts to the installed `glasstabs`
version: it uses the enhanced `indicator`, `orientation`, and `theme = "auto"`
arguments when available, and falls back to the CRAN-compatible tab API when
Connect restores the CRAN package from the manifest. Regenerate the manifest
after changing the app or its dependencies:

```{r}
rsconnect::writeManifest(appDir = "inst/examples/connect-workflow")
```

## Deploy to Posit Connect

The example is a self-contained Shiny app folder with `app.R` and
`manifest.json`. In a package checkout, deploy it directly:

```{r}
rsconnect::deployApp(
  appDir = "inst/examples/connect-workflow",
  appName = "glasstabs-connect-workflow",
  appTitle = "glasstabs Connect Workflow"
)
```

If you are deploying from an installed package, copy the example folder first:

```{r}
example_dir <- system.file("examples", "connect-workflow", package = "glasstabs")
file.copy(example_dir, "connect-workflow", recursive = TRUE)

rsconnect::deployApp(
  appDir = "connect-workflow",
  appName = "glasstabs-connect-workflow",
  appTitle = "glasstabs Connect Workflow"
)
```

## Workflow pattern

The page uses a common Connect pattern: make the first screen the actual work
surface, keep controls near the content they affect, and expose state through
badges and compact metrics. That makes the app useful as a scheduled report,
review queue, or operational handoff page without adding a separate landing
screen.
