Studio Module Upgrade: Reusable Components, Funnel & Heatmap Charts, Schema Tests, Full i18n
Major Studio upgrade β EntityActions reusable component replaces 6 duplicated CRUD components, ChartRenderer gains funnel and heatmap chart types, ChartExportButton exports to PNG/SVG, StudioSidebar gets collapsible sections, 286 new tests across 16 test files, and 100+ i18n keys added for full en/id coverage.
Major quality and feature upgrade for Gigaviz Studio β better architecture, more chart types, improved testing, and full bilingual coverage.
## What shipped
### π§© EntityActions Reusable Component
- **Single component** replaces 6 near-identical CRUD action components (DashboardActions, DocumentActions, ImageActions, VideoActions, MusicActions, WorkflowActions)
- Configurable fields, accent colors, extra actions slot, and extraPatchFields
- Each entity-specific component is now ~20 lines instead of ~150 lines
- Consistent UX for edit/delete/confirm across all Studio content types
### π Two New Chart Types
- **Funnel Chart** β conversion funnel visualization with labeled stages, color-coded bars, and tooltips
- **Heatmap** β CSS-grid based heat matrix with dynamic color gradient (blue β cyan β yellow β red), row/column labels, and value tooltips
- ChartRenderer now supports 8 chart types: bar, line, pie, area, scatter, radar, funnel, heatmap
### π€ Chart Export Button
- Export any Recharts chart to **PNG (2x retina)** or **SVG** with one click
- Dark background preserved in PNG export
- Dropdown menu with format selector
- Works on all chart types including the new funnel and heatmap
### π§ StudioSidebar Upgrade
- **Collapsible sections** β Office, Graph, and Tracks sections now expand/collapse with chevron indicators
- **Quick Status Bar** β module access status (Office β
/ Graph β
/ Tracks β
) visible at a glance
- **Sticky positioning** β sidebar stays visible while scrolling content
- **Live badges** β updated badge system with "live", "new", "beta", "soon" states
- **Active item detection** β improved matching skips anchor links
### π Shared Auth Helper
- **Single auth function** for all Studio API routes handles authentication + entitlement checks
- Resolves workspace context, fetches subscription, checks feature key (`office`, `graph`, `tracks`)
- Returns context and database client on success, null on access denied β no boilerplate duplication
### π Template CRUD API
- `GET /api/studio/office/templates` β list with search, category filter, pagination
- `POST /api/studio/office/templates` β create with auto-slug generation
- `GET/PATCH/DELETE /api/studio/office/templates/[templateId]` β full detail CRUD
- All routes use `requireStudioAccess("office")` + `withErrorHandler`
### ποΈ DB Enum Fixes
- Added `radar` and `heatmap` to chart type constraint
- Added `database` and `csv` to data source constraint
- Added `invoice` and `report` to document and template category constraints
- Database migration applied with new enum values
## Testing improvements
- **+286 test assertions** across 16 new test files (1,099 β 1,385 total)
- **Studio schema tests**: 49+ tests for Image/Video/Music create & update Zod schemas (styles, formats, dimensions, durations, BPM, key signatures)
- **Inbox module tests**: 37 tests covering time formatting, class utilities, badge coloring, skill routing configuration, category inference, team routing, and auto-routing for inbound messages
- **Helper module tests**: 36 tests for AI system prompt handling, identity fallback patterns, intent allowlisting, intent validation, and webhook payload signing
## i18n coverage
- **100+ new translation keys** in both English and Indonesian
- Studio namespace: sidebar sections, nav items, badge labels, chart detail, export button, quick actions, recent activity
- Meta Hub namespace: 20+ keys for locked state, WhatsApp Command Center, outbox, param-defs, send jobs
- All Studio enum labels translated: 10 image styles, 8 video styles, 12 music genres
## Platform hardening
- **cron/billing route** wrapped with `withErrorHandler` (was the last unwrapped API route)
- **HealthDashboard ESLint fix** β `useCallback` for stable `fetchHealth` reference
- **8 auth routes** now have loading/error boundaries (login, register, forgot-password, reset-password, verify-email, invite, data-deletion, link redirect)
## By the numbers
| Metric | Before | After |
|--------|--------|-------|
| Test files | 52 | 68 |
| Test assertions | 1,099 | 1,385 |
| ESLint warnings | 1 | 0 |
| Studio components | ~2,300 lines | ~900 lines (61% reduction via EntityActions) |
| Chart types | 6 | 8 |
| i18n keys | ~1,600 | ~1,700+ |
| Routes with loading/error | ~51 | ~59 |