- 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>
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)
- 📎 Evidence & Documentation - Photos, recordings, proof
- 📄 Contracts & Agreements - Legal contracts, MOUs
- ✉️ Correspondence - Emails, letters, messages
- ⚖️ Court Filings - Motions, briefs, court orders
- 🪪 ID & Credentials - Passports, licenses, certifications
- 💰 Financial Records - Bank statements, invoices
- 🏥 Medical Records - Health records, medical reports
- 📁 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-900toslate-800gradient - Borders:
slate-700 - Cards:
slate-800/50with 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-300toslate-400 - Emphasis: White or gradient text
Spacing
- Padding:
p-4top-8(16px - 32px) - Gap:
gap-4togap-6(16px - 24px) - Margin:
mb-6tomb-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-105tohover:scale-110 - Shadow:
hover:shadow-lgtohover: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
- User completes Step 1-2 (Case input + Lawyer match)
- Step 3: AI Workspace preview
- Files auto-organized
- Access control explained
- "Open Workspace Dashboard" button appears
- User clicks button
- Full-screen workspace opens with animation
- Welcome banner appears
- Overview shown by default
- 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
-
Never store sensitive data in localStorage
- Use sessionStorage or memory only
- Clear on logout
-
Validate all user input
- File types checked
- File size limits enforced
- Message length validation
-
Sanitize content
- XSS prevention
- SQL injection protection (backend)
- File upload validation
Server-Side (Production)
-
Authentication & Authorization
- JWT tokens with short expiry
- Refresh token rotation
- Role-based access control (RBAC)
-
Encryption
- End-to-end for messages
- At-rest for files
- TLS 1.3 for transport
-
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
- 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>
);
- Add to ViewMode type
type ViewMode = 'overview' | 'files' | 'chat' | 'timeline' | 'settings' | 'mynew';
- Add navigation item
{ id: 'mynew', icon: '🎨', label: 'My New View' }
- Render conditionally
{viewMode === 'mynew' && <MyNewView data={data} />}
Adding File Category
- Update constants.ts
export const FILE_CATEGORIES = [
// ... existing
{
id: 'mynew',
title: 'My New Category',
icon: '🎨',
description: 'Description here',
},
];
- 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;
}
📚 Related Documentation
- Main README - Project overview
- Technical Architecture - System design
- Data Room Guide - User manual
- Mobile Improvements - UX decisions
- Implementation Summary - What we built
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)