# ISIS v2 WS11-004: Context-Sensitive Navigation

## Scope

`WS11-004` introduces context-sensitive navigation modes for:

- creators,
- reviewers,
- operators.

Navigation now adapts to persona context while remaining permission-aware.

## Research and Existing Implementation Alignment

Implementation is grounded in:

- ISIS auth/permission contracts: `apps/isis/web/src/auth/rbac.ts`,
  `apps/isis/web/src/auth/AuthContext.tsx`
- existing shell routing architecture:
  `apps/isis/web/src/components/AppLayout.tsx`
- WS11-001 through WS11-003 creative workflow direction and layout model.

## Deliverables

1. Reworked `AppLayout` navigation model:

- Added context taxonomy (`creator`, `reviewer`, `operator`).
- Added role/permission-aware context availability calculation.
- Added route-based context inference (`/workflows` -> creator, `/outputs` ->
  reviewer, default operator).
- Added persisted context preference in local storage.

2. Added context switcher UI:

- Accessible tablist for context switching.
- Context description rail explaining current navigation mode.
- Automatic route handoff when current route is outside selected context.

3. Added context-specific sectioned nav groups:

- Creator: authoring/iteration/contracts.
- Reviewer: review queue/quality.
- Operator: operations/infrastructure/API parity.

4. Updated shell styling for context navigation:

- context-switcher container and tab buttons,
- sectioned nav cards and labels,
- responsive behavior for mobile context controls.

5. Added/updated tests:

- `apps/isis/web/src/components/AppLayout.spec.tsx` now validates context tabs
  alongside accessibility checks.

## Verification Commands

```bash
pnpm --filter @isis/web exec vitest run src/components/AppLayout.spec.tsx src/components/CreativeWorkflowFrame.spec.tsx --reporter=dot
pnpm --filter @isis/web run typecheck
node scripts/isis/generate-remediation-backlog-v2.mjs
node scripts/isis/validate-v2-compliance-gate.mjs
```

## Verification Notes

- AppLayout and creative frame tests pass.
- Workspace typecheck remains red due pre-existing unrelated typing/rootDir
  issues in current repository state.
