Package Type: Shiny UI Module
Version: 0.9.3
See Also: Global guidance in D:/workspace/.agents/AGENTS.*.md
Exemplar: modGallery (D:/workspace/platform/app/modGallery)
This file contains requirements specific to modBrowse and other Artalytics Shiny module (mod) and app (app) packages. General R package requirements are documented in the global AGENTS files.
Before Starting Work
-
Read global guidance files:
D:/workspace/.agents/AGENTS.organization.mdD:/workspace/.agents/AGENTS.style.coding.mdD:/workspace/.agents/AGENTS.style.naming.md
Check README.md for environment variables required.
-
Review vignettes for module integration context:
-
vignettes/modBrowse.qmd- Overview and ecosystem -
vignettes/developer-guide.qmd- Integration workflow -
vignettes/module-architecture.qmd- Internal design
-
modBrowse Sub-Modules
modBrowse includes these sub-modules:
| Module | Files | Purpose |
|---|---|---|
| enhancedStats | mod-enhancedStats.R | Premium value box display |
| collectionInfo | mod-collectionInfo.R | Collection summary statistics |
Both sub-modules are exported for potential reuse.
Exported Helpers
| Function | Purpose |
|---|---|
createCollectionLabelBadge() |
Collection name badge with truncation |
artDisplayCard() |
Artwork card with thumbnails and badges |
These helpers are exported to support custom browse layouts.
Reactive Data Structure
The r parameter expects:
r <- reactiveValues(
artist = "746bxxxx-...", # Artist UUID (set by parent app)
artwork = "99xxxxxx-...", # Artwork UUID (managed by module)
appdata = list( # From artutils::get_appdata()
artist = list(
info = list(...),
stats = list(...),
collections = character(), # Named vector of collection UUIDs
artDT = data.table(...) # All artist artworks with metadata
)
)
)Key columns in artDT: - art_uuid, art_title - Artwork identification - collection_uuid, collection_name - Collection assignment - is_nft, is_print, is_listed - Status flags - n_variants, brush_strokes, drawing_hours - Metrics - created_utc - Creation timestamp
Environment Variables
Inherited from dependencies (verify against artcore README.md):
Database (via artcore): - ART_PGHOST, ART_PGPORT, ART_PGUSER, ART_PGPASS
CDN (via artcore): - ART_BUCKETS_KEY_ID, ART_BUCKETS_KEY_SECRET
Key Development Patterns
Badge Asset Fallback
The .onLoad() function registers local badge assets as fallback when CDN or artutils fails. This ensures badge overlays display even in degraded conditions.
Filter Synchronization
Desktop checkbox filters and mobile select filters are synchronized bidirectionally with a syncing flag to prevent infinite loops. See app-server.R lines 321-403.
Naming Convention
TODO: Standardize function naming per AGENTS.style.naming.md: - Shiny module functions: camelCase (modBrowseUI, modBrowseServer) - Utility functions: snake_case - Internal functions: snake_case with leading dot (.addBadgeNFT)
Current code uses mixed conventions. Future work should standardize.
Modernization Pattern for Other Packages
This package demonstrates the documentation modernization pattern for other mod* packages. Key steps:
- Phase 0: Update DESCRIPTION (VignetteBuilder, Suggests), export useful helpers
- Phase 1: Enhance all roxygen (description, params, return, family, examples)
- Phase 2: Create _pkgdown.yml and 3+ vignettes (narrative workflow style)
- Phase 3: Rewrite README.md with env vars, quick example, hierarchy
- Phase 4: Backfill NEWS.md with all version entries
- Phase 5: Replace AGENTS.md with this template pattern
- Phase 6: Run devtools::document(), devtools::check(), pkgdown::build_site()
Study modBrowse and modGallery as exemplars when modernizing other packages.
Testing
# Run tests
devtools::test()
# Run standalone app for testing
modBrowse::run_app(artist = "746b8207-72f5-4ab6-8d19-a91d03daec3d")
# Build documentation
devtools::document()
pkgdown::build_site()