Skip to content

Trade Barriers tracker UI: /trade-barriers + per-agreement pages#10

Open
xrendan wants to merge 2 commits intomainfrom
trade-barriers-tracker
Open

Trade Barriers tracker UI: /trade-barriers + per-agreement pages#10
xrendan wants to merge 2 commits intomainfrom
trade-barriers-tracker

Conversation

@xrendan
Copy link
Copy Markdown
Member

@xrendan xrendan commented Apr 28, 2026

Summary

Companion to BuildCanada/york_factory#33. Renders the interprovincial trade barriers tracker against the new york_factory CMS endpoints. Replaces the old Supabase-backed BuildCanada/TradeBarriers standalone app — frontend lives here, CMS lives in york_factory.

  • Index page at `/trade-barriers`: status overview cards + progress bar, activity chart (chart.js), KPI cards (stale agreements / recent negotiations YoY), filterable list of agreements, FAQ modal.
  • Detail page at `/trade-barriers/`: agreement summary, description, jurisdiction status table with per-jurisdiction history, status timeline. Replaces the original `AgreementModal` with a real page so each agreement has a stable URL, sitemap entry, and SEO metadata.
  • SEO: `generateMetadata` on detail pages produces per-agreement title, description, OG tags, and canonical URL. Shared OG image at `/public/trade-barriers/og.png`. Sitemap includes `/trade-barriers` plus one entry per agreement slug (gracefully skipped if API unavailable at build).
  • Data layer in `src/lib/api/trade-barriers.ts` wraps:
    • `GET /api/v1/trade_barriers/agreements`
    • `GET /api/v1/trade_barriers/agreements/`
    • `GET /api/v1/trade_barriers/themes`
    • `GET /api/v1/warehouse/jurisdictions`
  • Build: pages are `dynamic = "force-dynamic"` so the build does not depend on york_factory#33 being deployed first. They SSR at request time once the API is live.
  • Reused deps: chart.js / react-chartjs-2 / lucide-react / @base-ui/react Dialog — all already in TradingPost. No new dependencies. Did not port the shadcn-heavy UI from the source repo; replaced with simple Tailwind-based equivalents.
  • Intentionally dropped: `SimpleAnalytics`, `AgreementForm`, `AddAgreement`, `EditAgreement`, `ProtectedRoute`, `ThemeManagement`, `AgreementModal` (admin lives in york_factory; modal replaced by detail page).

To surface on /projects

`/projects` is data-driven by york_factory's tools API. After york_factory#33 deploys, add a Tool entry via admin with `externalUrl=/trade-barriers` to surface the tracker on the projects grid. No code change needed here.

Test plan

  • `pnpm build` clean (tested locally — both `/trade-barriers` and `/trade-barriers/[slug]` build as ƒ Dynamic).
  • TypeScript clean.
  • Lint clean on new files (the 1 unrelated lint error in `tracker/commitments/page.tsx` is pre-existing).
  • After york_factory#33 deploys: visit `/trade-barriers` — verify KPIs, filters, list, chart render. Click a card → detail page renders with SEO metadata.
  • `/sitemap.xml` includes `/trade-barriers` and per-slug entries.

Sequencing

york_factory#33 should merge + deploy before this lands so the API endpoints exist when this hits prod. (Build is decoupled, but runtime requests will 404 until then.)

🤖 Generated with Claude Code

xrendan and others added 2 commits April 28, 2026 12:50
Companion to york_factory#33. Renders the interprovincial trade
barriers tracker against the new york_factory CMS endpoints.

- Index at /trade-barriers: KPIs, status overview, activity chart,
  filterable list of agreements, FAQ modal.
- Detail page at /trade-barriers/<slug>: agreement summary, description,
  jurisdiction status table, history timeline. Per-agreement SEO
  metadata via generateMetadata. Replaces the original Supabase
  AgreementModal with a real page.
- src/lib/api/trade-barriers.ts wraps the new york_factory endpoints
  (/api/v1/trade_barriers/{agreements,themes}, /api/v1/warehouse/jurisdictions)
  via the existing apiFetch client.
- Pages are force-dynamic so the build does not depend on the API
  being live yet; they SSR at request time once york_factory deploys.
- Sitemap includes /trade-barriers and per-slug entries (silently
  skipped if the API is unavailable at build).
- Components reuse TradingPost's existing chart.js/lucide-react/base-ui
  deps and avoid pulling in shadcn primitives the project does not
  ship. AgreementForm/Modal/auth/SimpleAnalytics from the source repo
  are intentionally omitted.

To surface this on /projects, add a Tool entry in york_factory admin
with externalUrl=/trade-barriers — the projects grid is data-driven.
Reuses the memos list layout (featured + latest, search, results grid)
with author info hidden and category filter disabled. Posts have their
own detail page without author card or key messages.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant