# InsuWiki Task List

## 1. Core System & Auth
- [x] Initial Project Setup
- [x] Firebase Authentication Integration
- [x] Mobile Login Fix (In-app Browser 403)

## 2. Editor & Viewer
- [x] Tiptap Editor Integration
- [x] WikiLink System ([[Overview]])
- [x] Hierarchical Numbering System (1.1.1.)
- [x] Mobile Indentation Optimization

## 3. Deployment
- [x] Vercel Deployment (Frontend)
- [x] Production Environment Setup

## 4. Content Visibility Strategy (Approved)
- [x] Analyze current data model & security
- [x] Agent Strategy Meeting (Reflect Pattern)
- [x] **Implementation: Private/Public System**
    - [x] **Step 1**: Update `types/firestore.ts` (Add `visibility` field)
    - [x] **Step 2**: Update `firestore.rules` (Enforce access control)
    - [x] **Step 3**: Frontend UI - Visibility Toggle in Editor
    - [x] **Step 4**: Frontend Logic - Filter Logic in Lists
    - [x] **Step 5**: Migration (Backfill existing docs as Public) - *Handled via Rules*
    - [x] **Step 6**: Verify Access Control

## 5. Refining & Reorganization (In Progress)
- [x] **Mobile Login Fix**: Enable account selection on logout/login
- [x] **Structure Reorganization**: Wiki, My, Daily separation (Analysis & Implementation)
- [x] **Deployment**: Push to Vercel & Verify Production

## 6. Mobile UI Refinement (In Progress)
- [x] **Agent Meeting**: Analyze screenshots & Plan fixes
- [x] **Header Optimization**: Compact design for mobile
- [x] **List View Repair**: Fix indentation & badge overlap
- [x] **Deployment**: Re-deploy fixes

## 7. Header UI Redesign (In Progress)
- [x] **Dropdown Menu**: Implement User Avatar dropdown for Logout
- [x] **Cleanup**: Remove explicit Logout button to save space
- [x] **Deployment**: Deploy Header Fix

## 8. Document Toolbar Fix (In Progress)
- [x] **Analysis**: Identify overcrowding elements in doc viewer
- [x] **Refinement**: Move Delete/Share to dropdown or compact icons
- [x] **Deployment**: Deploy Toolbar Fix

## 9. Debugging & Error Fixes
- [x] **Index Fix**: Create `firestore.indexes.json` for missing queries
- [x] **Preview Fix**: Handle permission errors in `WikiLinkPreview`
- [x] **Permission Fix**: Update `firestore.rules` to allow reading non-existent docs (Phantom/404)
- [x] **Navigation Fix**: Ensure `GlobalHeader` reflects correct tab (My/Wiki/Daily) in document detail view
- [x] **Bug Fix**: Ensure 'New Private Document' defaults to Private visibility (deployed)
- [x] **Bug Fix**: Fix 'category: undefined' error when saving Daily/Private docs
- [x] **Enhancement**: WikiLink (`[[...]]`) inherits parent doc's visibility (Private -> Private)
- [x] **Bug Fix**: Resolve Console Errors (Firestore Index 400, Tiptap Duplicate Extension)
- [ ] **Bug Fix**: Fix unresponsive Top Navigation (Header/Tabs) on Detail pages
- [ ] **Deployment**: Deploy Indexes & Fixes

## 10. Multi-User Architecture (Phase 1)
- [x] **Spec**: Define ID Strategy & Conflict Rules (`docs/specs/multi-user-architecture.md`)
- [x] Daily Note ID Refactor (Format: `daily-YYYY-MM-DD-UID`)
- [x] **Shadow Indicator UI**
    - [x] Create `ShadowIndicator` component (Alert box)
    - [x] Add logic to `page.tsx` to check `private` docs against existing `public` docs
    - [x] Show alert if name collision exists
- [x] **Conflict Check**
    - [x] Block "Private -> Public" toggle if name collision exists
    - [x] Show "Duplicate Name Exists" error

## 11. Multi-User Architecture (Phase 2: Data Governance)
- [x] **Privatization Loophole**: Block "Public -> Private" if multiple contributors exist
- [x] **Vandalism Protection**: Restrict "Delete" on Public docs to Admin only
- [ ] **Version History**: Implement `history` subcollection for rollback (Foundation)

## 12. Multi-User Architecture (Phase 3: Communication)
- [ ] **Comments System**: Block-level or Document-level comments
- [ ] **Reactions**: Emoji reactions for docs
- [ ] **Notifications**: Alerts for mentions/comments
- [ ] **User Profile**: Contribution stats & bio
