Files
botsmann/docs/archive/WORKSPACE_DASHBOARD_GUIDE.md
g-butandClaude Opus 4.6 2d5dc85501 refactor: remove dead code, archive historical docs, fix README
- Remove duplicate ApiResponse, apiSuccess, apiError, withErrorHandling,
  requireAuth, ERROR_MESSAGES from lib/api-utils.ts — only verifyUser
  was actually imported anywhere. Response utils SSOT is lib/api/responses.ts
- Archive 14 historical LEX-era design docs to docs/archive/ — docs/
  now has only 9 active reference files (down from 29)
- Remove mock data and placeholder images from Amazon/Ricardo platform
  integrations — functions return [] until real APIs are implemented
- Update platform tests to match actual behavior
- Fix README.md: update backend tech (Groq/OpenRouter), add Supabase
  to prerequisites

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 10:46:04 +01:00

15 KiB

Lex Workspace Dashboard - Complete Guide

🎯 Overview

The Workspace Dashboard is Lex's flagship feature - a full-screen, immersive collaborative environment where clients, lawyers, and teams work together on legal cases. Think of it as a "mission control" for legal work.


✨ Key Features

1. Full-Screen Portal Experience

  • Opens in dedicated full-screen view (separate from main demo flow)
  • Dark theme with animated gradient backgrounds for premium feel
  • Smooth entrance animations (fade + scale)
  • Persistent state management

2. Multi-View Navigation

Five main views accessible via sidebar:

🏠 Overview

  • Welcome banner with case summary
  • Quick action cards (Files, Chat, Timeline, Settings)
  • File categories preview
  • Usage statistics

📁 Files

  • Category-based organization (8 categories)
  • File visibility controls (Private, Lawyer Only, Team, Public)
  • Drag-and-drop upload anywhere
  • File actions: View, Delete, Change visibility
  • Real-time status indicators

💬 Chat

  • Live messaging with AI + Lawyer
  • Typing indicators
  • Message history with timestamps
  • Context-aware AI responses
  • No appointments needed

📅 Timeline

  • Complete audit trail
  • Every action logged (messages, uploads, changes)
  • Chronological order
  • Filter by type

⚙️ Settings

  • Access control management
  • User permissions (Owner, Attorney, Paralegal, Advisor)
  • Notification preferences
  • Security settings

3. File Management System

Categories (Auto-organized by AI)

  1. 📎 Evidence & Documentation - Photos, recordings, proof
  2. 📄 Contracts & Agreements - Legal contracts, MOUs
  3. ✉️ Correspondence - Emails, letters, messages
  4. ⚖️ Court Filings - Motions, briefs, court orders
  5. 🪪 ID & Credentials - Passports, licenses, certifications
  6. 💰 Financial Records - Bank statements, invoices
  7. 🏥 Medical Records - Health records, medical reports
  8. 📁 Other Documents - Miscellaneous files

Visibility Levels

  • 🔒 Private - Only you can see
  • 👨‍⚖️ Lawyer Only - You + your attorney
  • 👥 Team - You + attorney + paralegals/advisors
  • 🌐 Public - Everyone with access to data room

File Operations

  • Upload: Drag-and-drop anywhere in workspace
  • View: Preview in browser
  • Delete: Remove file (with confirmation)
  • Change Visibility: Adjust who can see the file
  • Download: Save to device (coming soon)
  • Annotate: Add comments (coming soon)

4. Real-Time Chat

Participants

  • 🤖 Lex AI - Available 24/7, instant responses
  • 👨‍⚖️ Human Lawyer - Your assigned attorney, joins when needed

Message Features

  • Typing indicators (animated dots)
  • Timestamps
  • Avatar identification
  • Message history
  • Smart AI responses based on context

AI Capabilities

  • Document analysis questions
  • Legal research
  • Deadline tracking
  • File summaries
  • Precedent matching

5. Security & Privacy

Encryption

  • End-to-end encryption (client-to-client)
  • TLS 1.3 for all connections
  • Zero-knowledge architecture
  • AES-256 at rest

Access Control

  • Role-based permissions
  • Granular file access
  • Temporary access (time-limited)
  • IP restrictions (optional)
  • Two-factor authentication

Compliance

  • GDPR compliant
  • HIPAA ready
  • Attorney-client privilege protected
  • SOC 2 certified (planned)

🏗️ Technical Architecture

Component Structure

WorkspaceDashboard.tsx (Main Portal)
├── Header
│   ├── Logo & branding
│   ├── Lawyer info panel
│   └── Close button
│
├── Sidebar Navigation
│   ├── Overview (🏠)
│   ├── Files (📁) - with badge count
│   ├── Chat (💬) - with message count
│   ├── Timeline (📅)
│   ├── Settings (⚙️)
│   └── Quick stats footer
│
└── Main Content Area
    ├── OverviewView
    ├── FilesView
    ├── ChatView
    ├── TimelineView
    └── SettingsView

State Management

// Main component state
const [viewMode, setViewMode] = useState<ViewMode>('overview');
const [selectedFile, setSelectedFile] = useState<string | null>(null);
const [isDragging, setIsDragging] = useState(false);
const [messages, setMessages] = useState<Message[]>([]);
const [inputMessage, setInputMessage] = useState('');
const [isTyping, setIsTyping] = useState(false);

// Passed from parent (DemoSection)
interface WorkspaceDashboardProps {
  files: UploadedFile[];
  lawyer: LawyerProfile;
  caseDescription: string;
  onClose: () => void;
  onFileUpload: (files: UploadedFile[]) => void;
  onFileDelete: (fileId: string) => void;
  onFileVisibilityChange: (fileId: string, visibility: string) => void;
}

Data Flow

DemoSection (Parent)
    ↓ (props)
WorkspaceDashboard
    ↓ (callbacks)
DemoSection (updates state)
    ↓ (re-renders)
WorkspaceDashboard (reflects changes)

File Upload Flow

1. User drags file over workspace
   → isDragging = true
   → Visual overlay appears

2. User drops file
   → File extracted from event
   → UploadedFile object created
   → status: 'uploading'

3. Simulated upload
   → setTimeout (1 second per file)
   → status: 'processing'

4. AI categorization
   → Category assigned based on file type/name
   → status: 'completed'

5. State update
   → onFileUpload callback fired
   → Parent updates caseContext.files
   → Dashboard re-renders with new file

Chat Message Flow

1. User types message
   → inputMessage state updated

2. User sends (Enter or button click)
   → User message added to messages array
   → inputMessage cleared
   → UI shows user's message

3. AI processing
   → isTyping = true
   → Typing indicator appears
   → setTimeout (2 seconds)

4. AI response
   → isTyping = false
   → getAIResponse() generates contextual reply
   → AI message added to messages array
   → UI shows AI response

5. (Optional) Lawyer notification
   → Complex queries trigger lawyer involvement
   → Lawyer joins chat
   → Lawyer message appears

🎨 Design System

Color Palette

Dark Theme Base

  • Background: slate-900 to slate-800 gradient
  • Borders: slate-700
  • Cards: slate-800/50 with backdrop blur

Accent Colors

  • Primary: Blue-to-Cyan gradient (from-blue-600 to-cyan-600)
  • Success: Green (green-500)
  • Warning: Orange (orange-500)
  • Error: Red (red-500)

Category Colors

  • Files: from-blue-500 to-cyan-500
  • Chat: from-purple-500 to-pink-500
  • Timeline: from-green-500 to-emerald-500
  • Settings: from-orange-500 to-red-500

Typography

  • Headings: Bold, White text
  • Body: slate-300 to slate-400
  • Emphasis: White or gradient text

Spacing

  • Padding: p-4 to p-8 (16px - 32px)
  • Gap: gap-4 to gap-6 (16px - 24px)
  • Margin: mb-6 to mb-12 (24px - 48px)

Animations

Entrance (Workspace opens)

@keyframes workspaceEnter {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

Background Pulse

  • Animated gradient blobs
  • Opacity: 20%
  • Blur: blur-3xl

Hover Effects

  • Scale: hover:scale-105 to hover:scale-110
  • Shadow: hover:shadow-lg to hover:shadow-xl
  • Border: hover:border-slate-600

Transitions

  • Default: transition-all
  • Duration: 200ms - 300ms
  • Easing: cubic-bezier(0.4, 0, 0.2, 1)

📱 Responsive Design

Breakpoints

  • Mobile: Base (< 640px)
  • Tablet: sm: (640px+)
  • Desktop: lg: (1024px+)
  • Wide: xl: (1280px+)

Adaptations

Mobile (< 640px)

  • Sidebar: Icon-only (20px width)
  • Stats: Hidden
  • Chat: Full width
  • Files: Single column
  • Touch targets: 44x44px minimum

Tablet (640px - 1024px)

  • Sidebar: Shows labels (64px width)
  • Stats: Visible
  • Chat: 2-column layout
  • Files: 2-column grid

Desktop (1024px+)

  • Sidebar: Full width (256px)
  • All features visible
  • Multi-column layouts
  • Hover effects enabled

🔌 Integration Points

From Demo Flow

Step 3 → Workspace Dashboard

// DemoSection.tsx
const handleProceed = () => {
  if (step === 'workspace') {
    setShowWorkspace(true); // Opens dashboard
  }
};

{showWorkspace && selectedLawyer && (
  <WorkspaceDashboard
    files={caseContext.files}
    lawyer={MOCK_LAWYERS.find(l => l.id === selectedLawyer)!}
    caseDescription={caseContext.description}
    onClose={() => setShowWorkspace(false)}
    onFileUpload={handleFilesUploaded}
    onFileDelete={handleFileDelete}
    onFileVisibilityChange={handleFileVisibilityChange}
  />
)}

Callbacks

File Upload

const handleFilesUploaded = (newFiles: UploadedFile[]) => {
  setCaseContext((prev) => ({
    ...prev,
    files: [...prev.files, ...newFiles.filter((nf) => !prev.files.some((pf) => pf.id === nf.id))],
  }));
};

File Delete

const handleFileDelete = (fileId: string) => {
  setCaseContext((prev) => ({
    ...prev,
    files: prev.files.filter((f) => f.id !== fileId),
  }));
};

Visibility Change

const handleFileVisibilityChange = (fileId: string, visibility: string) => {
  setCaseContext((prev) => ({
    ...prev,
    files: prev.files.map((f) => (f.id === fileId ? { ...f, visibility: visibility as any } : f)),
  }));
};

🚀 User Journey

Opening Workspace

  1. User completes Step 1-2 (Case input + Lawyer match)
  2. Step 3: AI Workspace preview
    • Files auto-organized
    • Access control explained
    • "Open Workspace Dashboard" button appears
  3. User clicks button
    • Full-screen workspace opens with animation
    • Welcome banner appears
    • Overview shown by default
  4. User explores views
    • Navigates via sidebar
    • Uploads files
    • Chats with AI/lawyer
    • Reviews timeline

Typical Workflow

First Time User

Overview → Files (upload docs) → Chat (ask AI) → Timeline (review)

Returning User

Chat → Files (check new uploads) → Settings (manage access)

During Case

Chat (discuss with lawyer) → Files (review evidence) → Timeline (track progress)

🧪 Demo Features (Current Implementation)

Simulated Behaviors

AI Responses

  • Context-aware based on keywords
  • Predefined responses for common queries
  • 2-second typing delay for realism

File Processing

  • 1-second upload simulation per file
  • Auto-categorization based on file type
  • Mock AI insights

Lawyer Presence

  • Welcome message on workspace open
  • Joins chat when complex query detected
  • "Online" status indicator

Real Implementation (Production)

AI Integration

  • OpenAI GPT-4 / Anthropic Claude API
  • Vector database for case context
  • Real-time document analysis

WebSocket Chat

  • Socket.io for live communication
  • Presence detection
  • Read receipts
  • Typing indicators

File Storage

  • AWS S3 / Azure Blob Storage
  • Virus scanning
  • OCR for scanned documents
  • Version control

Authentication

  • Auth0 / Firebase Auth
  • 2FA support
  • Session management
  • Single Sign-On (SSO)

📊 Performance Considerations

Optimizations

Lazy Loading

  • Views loaded on demand
  • Messages paginated (20 per load)
  • Files loaded incrementally

Memoization

  • React.memo for expensive components
  • useMemo for computed values
  • useCallback for event handlers

Bundle Size

  • Code splitting by view
  • Dynamic imports
  • Tree shaking

Animations

  • GPU-accelerated (transform, opacity)
  • Will-change hints
  • RequestAnimationFrame for smooth 60fps

Metrics

Target Performance

  • Initial load: < 2 seconds
  • View switch: < 200ms
  • Message send: < 100ms
  • File upload: < 1 second (per MB)

🔒 Security Best Practices

Client-Side

  1. Never store sensitive data in localStorage

    • Use sessionStorage or memory only
    • Clear on logout
  2. Validate all user input

    • File types checked
    • File size limits enforced
    • Message length validation
  3. Sanitize content

    • XSS prevention
    • SQL injection protection (backend)
    • File upload validation

Server-Side (Production)

  1. Authentication & Authorization

    • JWT tokens with short expiry
    • Refresh token rotation
    • Role-based access control (RBAC)
  2. Encryption

    • End-to-end for messages
    • At-rest for files
    • TLS 1.3 for transport
  3. Audit Logging

    • All actions logged
    • Immutable audit trail
    • Compliance reporting

🎯 Future Enhancements

Phase 1 (Q1 2025)

  • Video consultation integration
  • Voice messages
  • File annotations
  • @mentions in chat

Phase 2 (Q2 2025)

  • E-signature workflow
  • Court filing automation
  • Calendar integration
  • Mobile apps (iOS/Android)

Phase 3 (Q3 2025+)

  • AI document drafting
  • Predictive analytics
  • Smart contracts
  • Blockchain audit trail

🛠️ Developer Guide

Adding a New View

  1. Create view component
const MyNewView: React.FC<any> = ({ data }) => (
  <div className="space-y-6 animate-fadeIn">
    <h2 className="text-2xl font-bold text-white">My New View</h2>
    {/* Your content */}
  </div>
);
  1. Add to ViewMode type
type ViewMode = 'overview' | 'files' | 'chat' | 'timeline' | 'settings' | 'mynew';
  1. Add navigation item
{ id: 'mynew', icon: '🎨', label: 'My New View' }
  1. Render conditionally
{viewMode === 'mynew' && <MyNewView data={data} />}

Adding File Category

  1. Update constants.ts
export const FILE_CATEGORIES = [
  // ... existing
  {
    id: 'mynew',
    title: 'My New Category',
    icon: '🎨',
    description: 'Description here',
  },
];
  1. Files auto-categorize based on ID

Custom AI Response

function getAIResponse(message: string): string {
  const lowerMsg = message.toLowerCase();

  if (lowerMsg.includes('mynew')) {
    return 'Custom response for my new feature!';
  }

  return responses.default;
}


The Workspace Dashboard is where the magic happens. This is where clients and lawyers collaborate, where AI meets human expertise, and where legal work becomes transparent, efficient, and accessible.


Last Updated: January 2026 Version: 2.0.0 Status: Production-Ready (Demo Mode)