No description
Find a file
DJP aeb1675554 Per-report dashboard SPA (V3 §10a) — 9 interactive views
Closes the last big spec gap: a single bundled React+Vite+Tailwind+Recharts
SPA that renders any report's dataset_v2.json under /api/reports/:id/dashboard/.

Spec deviation (intentional): rather than per-brief Vite builds (Netlify-
portable case), one bundle serves every report and fetches its dataset at
runtime. The portable HTML bundle (§10b) still ships per-report for offline
upload to claude.ai.

Dashboard template (v2/templates/dashboard_template):
- React 18 + Vite + TypeScript + Tailwind + Recharts. Same dark theme tokens
  as the operator app.
- 9 views: Overview, Categories, Trends explorer (filters + sort + drilldown),
  Lenses (4 sub-tabs for Hooks Library / Visual Vernacular / Audio Atlas /
  Sentiment Map), Charts (engagement-vs-reach scatter, category treemap,
  paid-vs-organic stacked bar), Compare (MoM new/returning/faded + category
  momentum), Paid creators appendix, Methodology.
- Tab-based navigation with hash-stable URLs so deep links work.

Server:
- GET /api/reports/:id/dataset returns the on-disk dataset_v2.json (auth-
  gated; 404 if Stage 10 hasn't built it yet).
- handleDashboardServe rewrite: serves (1) the explicit dashboard.html bundle,
  (2) per-report on-disk static (covers, dataset_v2.json), (3) the bundled
  SPA's assets/* and index.html with SPA fallback.

Build:
- v2/package.json workspaces re-includes templates/dashboard_template (was
  excluded after earlier cutover-prep).
- Dockerfile.v2 builds the dashboard template alongside operator-app and
  copies dist/ into the runtime image.

Local build: 838 modules transformed, 580 kB / 166 kB gzipped.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 20:06:12 -04:00
v2 Per-report dashboard SPA (V3 §10a) — 9 interactive views 2026-04-29 20:06:12 -04:00
.gitignore Stop .gitignore from swallowing src/routes/briefs/ 2026-04-29 18:44:08 -04:00
DEVELOPER_BRIEF_V2.md Add V2: multi-team social-reporting platform with manifest-gated linking 2026-04-29 17:39:07 -04:00
README.md README: document the cd /opt/social-reporting && git pull && cutover-in-place flow 2026-04-29 18:40:55 -04:00

Social Reporting

V2 lives in v2/. All commands run from there.

cd v2
docker compose -f docker-compose.v2.yml --env-file .env up -d --build
npm install
npm test                       # 62 unit tests
npm run pipe seed --report <brief-id>

For the full V2 spec see DEVELOPER_BRIEF_V2.md.

Deploying V2 over an existing V1 install

If V1 is already deployed at /opt/social-reporting, cut over in place:

ssh you@optical-dev.oliver.solutions
cd /opt/social-reporting
git pull origin main                          # pulls in v2/, removes V1 dirs
bash v2/deploy/cutover-in-place.sh            # stops V1, migrates secrets, starts V2

The script prompts before doing anything destructive, migrates APIFY/Anthropic/Azure secrets from V1's .env into a fresh v2/.env, swaps the Apache conf to V2's, and starts the V2 docker stack. It also prompts for the email that will be auto-promoted to super-admin on first SSO sign-in (BOOTSTRAP_SUPER_ADMIN_EMAIL).

The Azure-registered redirect URI https://optical-dev.oliver.solutions/social-reports/login.html is preserved by V2 (Vite base: /social-reports/, React Router basename, and an explicit /login.html route alias).

V1 archive

V1 source is preserved on the v1-archive branch (frozen at the last V1 commit) and is no longer kept on the deployed server. To roll back from V2 to V1, the rollback script will re-clone v1-archive if needed:

# On the server
export REPO_URL="https://x-token-auth:YOUR_TOKEN@bitbucket.org/zlalani/social-reporting-tool.git"
bash /opt/social-reporting-v2/v2/deploy/rollback-to-v1.sh

To inspect or check out V1 source locally:

git checkout v1-archive