--- phase: 04-marketplace-portal-navigation plan: 01 subsystem: ui tags: [react, vitest, zustand, next-intl, marketplace, testing-library] requires: - phase: 03-module-system-domaincheck provides: /modules and /modules/active API endpoints, module-registry CRUD provides: - Vitest test infrastructure for apps/web (jsdom + testing-library) - MarketplaceCard component with activation controls - /marketplace page with parallel fetch, activation Map, role gate - marketplace-store (Zustand) with sidebarRefreshKey + selectedTenantId - marketplace i18n namespace (DE/EN) with full copywriting contract affects: [04-02 filters/detail, 04-03 sidebar, 04-04 navigation] tech-stack: added: [vitest, @testing-library/react, @testing-library/jest-dom, @testing-library/user-event, jsdom, @vitejs/plugin-react] patterns: [TDD red-green, parallel fetch with activation Map, Zustand cross-component signaling] key-files: created: - apps/web/vitest.config.ts - apps/web/src/test/setup.ts - apps/web/src/lib/stores/marketplace-store.ts - apps/web/src/app/(portal)/marketplace/page.tsx - apps/web/src/app/(portal)/marketplace/components/MarketplaceCard.tsx - apps/web/src/app/(portal)/marketplace/components/MarketplaceCard.test.tsx - apps/web/src/app/(portal)/marketplace/marketplace.test.tsx modified: - apps/web/package.json - apps/web/src/messages/de.json - apps/web/src/messages/en.json key-decisions: - "TDD red-green workflow: tests first, then implementation" - "Parallel fetch (Promise.all) with client-side activation Map instead of per-card fetch" - "marketplace-store signals sidebar refresh via sidebarRefreshKey counter" patterns-established: - "Vitest + testing-library + jsdom for React component tests" - "next-intl mock pattern: vi.mock returning key lookup function" - "Zustand store mock pattern for isolated component testing" requirements-completed: [MRKT-01, MRKT-02, MRKT-04] duration: 15min completed: 2026-06-23 --- # Plan 04-01: Marketplace Browse + Activate Summary **Vitest test infra, MarketplaceCard component, and /marketplace page with parallel fetch, activation Map, and role-gated card grid — 9 tests green** ## Performance - **Duration:** ~15 min (across 2 sessions, paused after RED phase) - **Started:** 2026-06-22T12:45:00Z - **Completed:** 2026-06-23T06:52:00Z - **Tasks:** 3 - **Files modified:** 10 ## Accomplishments - Vitest + testing-library test infrastructure operational in apps/web - MarketplaceCard with icon, name, localized description, category badge, status badge, activate/deactivate button - /marketplace page with Promise.all parallel fetch, activation Map, admin role gate, empty state, responsive 1/2/3/4-col grid - marketplace-store with sidebarRefreshKey signal for sidebar re-fetch after activation - Full marketplace i18n namespace (DE/EN) with all copywriting contract keys ## Task Commits 1. **Task 1: Vitest test infrastructure** - `e50b3c7` (chore) 2. **Task 2: MarketplaceCard + i18n** - `a64f889` (test/RED), `1e494b3` (feat/GREEN) 3. **Task 3: Marketplace page + store** - `0b7cf66` (test/RED), `fb6a340` (feat/GREEN) ## Files Created/Modified - `apps/web/vitest.config.ts` - Vitest config with jsdom + react plugin - `apps/web/src/test/setup.ts` - jest-dom matcher registration - `apps/web/src/lib/stores/marketplace-store.ts` - Zustand store for sidebar refresh signal + tenant context - `apps/web/src/app/(portal)/marketplace/page.tsx` - Marketplace grid page with fetch + role gate - `apps/web/src/app/(portal)/marketplace/components/MarketplaceCard.tsx` - Module card component - `apps/web/src/app/(portal)/marketplace/components/MarketplaceCard.test.tsx` - 5 card unit tests - `apps/web/src/app/(portal)/marketplace/marketplace.test.tsx` - 4 page tests - `apps/web/src/messages/de.json` - marketplace namespace added - `apps/web/src/messages/en.json` - marketplace namespace added ## Decisions Made - Followed plan as specified, no significant deviations - Used admin/modules/page.tsx as direct analog for fetch + Map pattern ## Deviations from Plan None - plan executed exactly as written. ## Issues Encountered - pnpm install needed at session start (node_modules not present from fresh checkout) ## User Setup Required None - no external service configuration required. ## Next Phase Readiness - Plan 04-02 (filters, search, detail view, tenant context) can start — marketplace page and store are in place - marketplace-store.selectedTenantId ready for tenant dropdown in 04-02 - sidebarRefreshKey ready for sidebar subscription in 04-03 --- *Phase: 04-marketplace-portal-navigation* *Completed: 2026-06-23*