{"slug":"operations/UI_DEFECT_AND_REORG_PLAN","title":"UI Defect & Reorganization Plan","section":"operations","sectionLabel":"Operations","status":"unclassified","type":"document","path":"operations/UI_DEFECT_AND_REORG_PLAN.mdx","bytes":15371,"description":null,"updated":null,"source":"integratewise/Integratewise-docs-wiki","content":"\n> Complete list of every UI defect, duplicate, and missing feature.\n> This is the checklist. Nothing gets built until this is agreed.\n\n---\n\n## PHASE 1: DELETE DEAD CODE (~50 files)\n\nThese files are not imported by the active flow. Deleting them has zero risk.\n\n### 1.1 Dead Workspace Shells (5 files)\n\n| File                                       | Why dead                                                                             |\n| ------------------------------------------ | ------------------------------------------------------------------------------------ |\n| `l1/workspace-shell.tsx`                   | Old shell with CTX switcher and DEMO_ALERTS. AppShell uses `workspace-shell-new.tsx` |\n| `l1/shell/UnifiedShell.tsx`                | Another shell attempt. Not imported.                                                 |\n| `l1/shell/IntelligencePanel.tsx`           | Part of old shell. Not imported.                                                     |\n| `l1/shell/MainSidebar.tsx`                 | Part of old shell. Not imported.                                                     |\n| `l1/shell/TopBar.tsx`                      | Part of old shell. Not imported.                                                     |\n| `l1/DashboardShell.tsx`                    | Dead dashboard shell. Not imported.                                                  |\n| `common/layouts/os-shell.tsx`              | Dead shell. Not imported.                                                            |\n| `common/layouts/unified-shell.tsx`         | Dead shell. Not imported.                                                            |\n| `common/layouts/app-shell.tsx`             | Dead shell. Not imported.                                                            |\n| `common/layouts/unified-page-template.tsx` | Dead template. Not imported.                                                         |\n\n### 1.2 Dead Sidebars (4 files)\n\n| File                               | Why dead                                                              |\n| ---------------------------------- | --------------------------------------------------------------------- |\n| `l1/sidebar.tsx`                   | Old sidebar with CTX_CONFIG. workspace-shell-new has its own sidebar. |\n| `l1/navigation/sidebar.tsx`        | Duplicate sidebar.                                                    |\n| `common/layouts/ctx-sidebar.tsx`   | Old CTX sidebar.                                                      |\n| `common/layouts/smart-sidebar.tsx` | Another sidebar attempt.                                              |\n\n### 1.3 Dead Top Bars (3 files)\n\n| File                         | Why dead                                      |\n| ---------------------------- | --------------------------------------------- |\n| `l1/top-bar.tsx`             | Old top bar. workspace-shell-new has its own. |\n| `l1/navigation/top-bar.tsx`  | Duplicate.                                    |\n| `common/layouts/top-bar.tsx` | Duplicate.                                    |\n\n### 1.4 Dead Command Palette (1 file)\n\n| File                     | Why dead                                                                                                                                        |\n| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |\n| `l1/command-palette.tsx` | Standalone file. workspace-shell-new imports from `l1/command-palette/index.tsx` OR its own inline. Verify which one is used, delete the other. |\n\n### 1.5 Dead Intelligence Overlays (3 files)\n\n| File                                       | Why dead                                                            |\n| ------------------------------------------ | ------------------------------------------------------------------- |\n| `l2/intelligence-drawer.tsx`               | Old drawer. workspace-shell-new uses `intelligence-overlay-new.tsx` |\n| `l2/intelligence/intelligence-drawer.tsx`  | Duplicate in subfolder.                                             |\n| `l2/intelligence/intelligence-overlay.tsx` | Old overlay.                                                        |\n\n### 1.6 Dead Legacy Folder (entire folder)\n\n| Folder                  | Why dead                                                     |\n| ----------------------- | ------------------------------------------------------------ |\n| `legacy/legacy-engine/` | Old AI chat, loader, persona assessment. Not imported.       |\n| `legacy/os/`            | Old action bar, evidence drawer, signal strip. Not imported. |\n| `legacy/website/`       | Old website components. Not imported.                        |\n\n### 1.7 Dead Personal Folder\n\n| Folder         | Why dead                                                                                                                                        |\n| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |\n| `l1/personal/` | Old personal views (accounts, analytics, calendar, contacts, docs, etc.). Domain views live in `l1/domains/personal/`. This folder is orphaned. |\n\n### 1.8 Duplicate Onboarding Flow\n\n| File                                        | Action                                                                                                                                     |\n| ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |\n| `activation/onboarding/onboarding-flow.tsx` | Check if this is the same as `OnboardingFlow.tsx` (case difference). On macOS they're the same file. On Linux they'd conflict. Delete one. |\n\n### 1.9 Duplicate Module Registry\n\n| File                                                        | Action                                                                                                                                                                    |\n| ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `activation/onboarding/role-domain/business-ops/modules.ts` | This is imported as `genericModules` in content-router. It provides shared views (calendar, integrations, AI chat, etc.). Rename folder to `shared` or merge into bizops. |\n\n### 1.10 Duplicate Knowledge Pages\n\n| File                          | Duplicate of              |\n| ----------------------------- | ------------------------- |\n| `l2/knowledge/InboxPage.tsx`  | Same as `inbox-view.tsx`  |\n| `l2/knowledge/SearchPage.tsx` | Same as `search-view.tsx` |\n| `l2/knowledge/TopicsPage.tsx` | Same as `topics-view.tsx` |\n| `l2/knowledge/DemoPage.tsx`   | Demo only — delete        |\n| `l2/knowledge/demo-setup.tsx` | Demo only — delete        |\n\n### 1.11 Orphan View Subfolders in l1/views/\n\n| Folder                | Overlaps with                 |\n| --------------------- | ----------------------------- |\n| `l1/views/act/`       | `l2/approvals/`               |\n| `l1/views/admin/`     | `l1/admin/`                   |\n| `l1/views/cs/`        | `l1/domains/account-success/` |\n| `l1/views/entity/`    | `l1/views/Entity360View.tsx`  |\n| `l1/views/finance/`   | `l1/domains/finance/`         |\n| `l1/views/marketing/` | `l1/domains/marketing/`       |\n| `l1/views/projects/`  | `l1/domains/bizops/`          |\n| `l1/views/shared/`    | `common/shared/`              |\n| `l1/views/stubs/`     | Placeholder views             |\n\nAction: Verify none are imported. If not imported, delete.\n\n---\n\n## PHASE 2: FIX ACTIVE CODE DEFECTS\n\n### 2.1 Domain Switcher Shows All Domains for Business Users\n\n**File:** `l1/workspace/workspace-shell-new.tsx` (~line 460)\n**Problem:** When `useCase === \"business\"`, dropdown shows hardcoded list: SALES, MARKETING, CUSTOMER_SUCCESS, REVOPS, BIZOPS.\n**Fix:** Show only Personal + user's primary domain. Remove the business multi-domain dropdown entirely. BizOps users get cross-department access via BizOps modules (prefixed views like `sales--pipeline`), not via a domain switcher.\n\n### 2.2 Entity 360 View Uses Mock Data\n\n**File:** `l1/views/Entity360View.tsx`\n**Problem:** 100% hardcoded mock data. Not connected to Entity 360 API.\n**Fix:** Rewrite to call `GET /api/v1/cognitive/twin/360/:entityId`. Show 6 layers (truth, context, signals, memory, goals, relationships) + Twin insights with trust panel.\n\n### 2.3 Command Palette Has No Real Search\n\n**File:** `l1/command-palette.tsx` or `l1/command-palette/index.tsx`\n**Problem:** Command items are static/hardcoded. No entity search.\n**Fix:** Wire to `/api/v1/workspace/entities?search=` for live entity search. Results link to Entity 360 view.\n\n### 2.4 Notification System Not Wired\n\n**File:** `l1/workspace/workspace-shell-new.tsx`\n**Problem:** Bell icon exists in top bar but no notification data. Old shell had DEMO_ALERTS (hardcoded).\n**Fix:** Wire to Twin insights API. Badge count = active critical/high insights for user's entities.\n\n### 2.5 No Entity Browser\n\n**Problem:** No universal \"all entities\" view with search across accounts, contacts, deals, tickets.\n**Fix:** Build `domains/_shared/entity-browser.tsx`. Search bar + entity type filter + health filter + click-through to Entity 360.\n\n### 2.6 No Click-Through from Entity Lists to Entity 360\n\n**Problem:** `accounts-view.tsx` has a detail drawer but no \"Open Entity 360\" button. Same for contacts, deals, tickets in all domains.\n**Fix:** Add \"View 360\" button/link in every entity list row and detail drawer. Navigate to Entity 360 view with entity ID.\n\n### 2.7 Empty Dashboard on First Login\n\n**Problem:** After connecting first tool, creamy load runs in background. Dashboard is empty until data arrives.\n**Fix:** Loader needs \"priority fetch\" mode — grab first 5 records immediately (sorted by last_modified desc), then continue full sync. Dashboard shows real data within 15 seconds.\n\n### 2.8 Knowledge UI Uses Dark Theme\n\n**Problem:** `l2/knowledge/inbox-view.tsx`, `search-view.tsx`, `topics-view.tsx` use dark slate theme (bg-slate-800). Rest of app is light.\n**Fix:** Retheme to match app's light theme (bg-white, text-[#072145], borders-[#E8ECF2]).\n\n---\n\n## PHASE 3: BUILD MISSING FEATURES\n\n### 3.1 Triage Inbox (Approval-Based Personal Memory UI)\n\n**What:** UI for reviewing pending AI-generated content before it enters the knowledge base.\n**Backend:** `/v1/triage/results` (pending items), `/v1/triage/approved` (approved items)\n**Features:**\n\n- List of pending triage items with: AI source, content preview, confidence score, extracted entities\n- Approve / Reject / Edit buttons per item\n- Bulk approve for high-confidence items\n- Filter by source (Claude, GPT, MCP, etc.)\n- Shows what was auto-approved vs human-reviewed\n\n### 3.2 Memory Browser\n\n**What:** Browse all verified memories (the approved knowledge base).\n**Backend:** `/v1/knowledge/memories`, `/v1/memories?entity_id=X`\n**Features:**\n\n- List of memories with: type (decision/preference/insight/action/rule/fact), content, confidence, source AI, created date\n- Filter by type, entity, confidence level\n- Search across memories\n- Confirm / Revoke buttons (revoke removes from active knowledge)\n- Shows which entity each memory is linked to\n\n### 3.3 Entity-Linked Knowledge View\n\n**What:** When viewing Entity 360, the Context and Memory tabs pull real data.\n**Backend:** `/v1/context/:entityId`, `/v1/memories?entity_id=X`\n**Features:**\n\n- Context tab: emails, docs, meetings linked to this entity\n- Memory tab: AI memories about this entity with confidence scores\n- Integrated into Entity 360 view\n\n### 3.4 Knowledge Hub (unified entry point)\n\n**What:** Single page with tabs: Sessions | Memories | Triage | Topics | Search\n**Replaces:** The separate inbox-view, topics-view, search-view pages\n**Added:** Triage tab, Memories tab\n**Wired into:** Sidebar under every domain as \"Knowledge\" module\n\n---\n\n## PHASE 4: REORGANIZE FOLDER STRUCTURE\n\nAfter phases 1-3, reorganize to the clean structure:\n\n```\ncomponents/\n├── auth/\n├── onboarding/\n├── workspace/          (shell, sidebar, top-bar, command-palette, content-router)\n├── personal/           (personal workspace views)\n├── domains/            (12 domain folders, each with modules.ts)\n│   └── _shared/        (entity-browser, entity-360, integrations, settings, knowledge-hub)\n├── intelligence/       (L2 overlay, panels, ai-chat)\n├── hydration/          (fabric engine, providers, hooks)\n├── ui/                 (shadcn primitives)\n└── brand/              (logo)\n```\n\nThis is a rename/move operation. Use `smartRelocate` to update imports automatically.\n\n---\n\n## EXECUTION ORDER\n\n| Step | What                                                   | Risk                       | Time    |\n| ---- | ------------------------------------------------------ | -------------------------- | ------- |\n| 1    | Delete dead shells, sidebars, top bars (Phase 1.1-1.5) | Zero — not imported        | 30 min  |\n| 2    | Delete legacy folder (Phase 1.6)                       | Zero — not imported        | 5 min   |\n| 3    | Delete duplicate knowledge pages (Phase 1.10)          | Zero — duplicates          | 10 min  |\n| 4    | Fix domain switcher (Phase 2.1)                        | Low — UI change only       | 30 min  |\n| 5    | Rewrite Entity 360 View (Phase 2.2)                    | Medium — new component     | 2 hours |\n| 6    | Wire command palette search (Phase 2.3)                | Low — API call             | 1 hour  |\n| 7    | Wire notifications (Phase 2.4)                         | Low — API call             | 1 hour  |\n| 8    | Build Entity Browser (Phase 2.5)                       | Medium — new component     | 2 hours |\n| 9    | Add Entity 360 click-through (Phase 2.6)               | Low — add buttons          | 1 hour  |\n| 10   | Build Triage Inbox (Phase 3.1)                         | Medium — new component     | 2 hours |\n| 11   | Build Memory Browser (Phase 3.2)                       | Medium — new component     | 2 hours |\n| 12   | Retheme Knowledge UI (Phase 2.8)                       | Low — CSS only             | 1 hour  |\n| 13   | Build Knowledge Hub (Phase 3.4)                        | Medium — combines existing | 1 hour  |\n| 14   | Folder reorganization (Phase 4)                        | High — many file moves     | 3 hours |\n\nTotal: ~17 hours of work. Phases 1-3 can be done without Phase 4 (reorganization can happen later).\n\n---\n\n## VERIFICATION\n\nAfter all phases, verify:\n\n1. `pnpm typecheck` — 31/31\n2. `pnpm test` — 14/15 (integration tests need live servers)\n3. Login → Onboarding → Workspace renders correctly\n4. Sidebar shows only WORK (domain) + PERSONAL\n5. Entity lists have \"View 360\" click-through\n6. Entity 360 shows real data from API\n7. Command palette searches real entities\n8. Knowledge Hub shows Sessions, Memories, Triage, Topics, Search\n9. Triage Inbox shows pending AI content with approve/reject\n10. No dark-themed pages in the light-themed app\n"}