2:I[7012,["4765","static/chunks/4765-f5afdf8061f456f3.js","9856","static/chunks/9856-3b185291364d9bef.js","6687","static/chunks/app/docs/%5B...slug%5D/page-e07536548216bee4.js"],"MarkdownRenderer"] 4:I[9856,["4765","static/chunks/4765-f5afdf8061f456f3.js","9856","static/chunks/9856-3b185291364d9bef.js","6687","static/chunks/app/docs/%5B...slug%5D/page-e07536548216bee4.js"],""] 5:I[4126,[],""] 7:I[9630,[],""] 8:I[4278,["9856","static/chunks/9856-3b185291364d9bef.js","8172","static/chunks/8172-b3a2d6fe4ae10d40.js","3185","static/chunks/app/layout-2814fa5d15b84fe4.js"],"HeadingProvider"] 9:I[1476,["9856","static/chunks/9856-3b185291364d9bef.js","8172","static/chunks/8172-b3a2d6fe4ae10d40.js","3185","static/chunks/app/layout-2814fa5d15b84fe4.js"],"Header"] a:I[3167,["9856","static/chunks/9856-3b185291364d9bef.js","8172","static/chunks/8172-b3a2d6fe4ae10d40.js","3185","static/chunks/app/layout-2814fa5d15b84fe4.js"],"Sidebar"] b:I[7409,["9856","static/chunks/9856-3b185291364d9bef.js","8172","static/chunks/8172-b3a2d6fe4ae10d40.js","3185","static/chunks/app/layout-2814fa5d15b84fe4.js"],"PageFrame"] 3:T953e, # VoiceAssist Design System Implementation Plan ## Executive Summary This plan outlines a comprehensive approach to modernizing the VoiceAssist frontend design while maintaining all existing functionality. The implementation follows a phased approach to minimize risk and ensure continuous integration. **Current State:** - Monorepo architecture with pnpm + Turborepo - React 18 + TypeScript with Tailwind CSS - Partial design tokens implementation - Inconsistent styling between web-app and admin-panel - Good accessibility foundation (WCAG 2.1 AA) **Goal State:** - Unified, modern design system across all applications - Professional healthcare-focused visual design - Enhanced UX with improved navigation and layouts - Consistent component library - Maintained/improved accessibility - Responsive across all devices --- ## Phase 1: Design System Foundation (Week 1-2) ### 1.1 Enhance Design Tokens **Location:** `/packages/design-tokens/src/` #### Tasks: **A. Update Color Palette** - **File:** `colors.ts` - **Changes:** - Replace pure black backgrounds with softer healthcare-appropriate colors - Add calming blues and greens palette - Ensure WCAG AA contrast ratios (4.5:1 for text, 3:1 for UI components) - Add semantic color tokens for states (success, error, warning, info) - **Create both light and dark mode variants** (even if shipping only light mode initially) - Structure tokens to support easy theme switching in future - Document color usage guidelines for both modes ```typescript // Example structure: export const colors = { // Healthcare primary - Calming blue primary: { 50: "#E6F2FF", 100: "#CCE5FF", // ... through to 950 DEFAULT: "#0066CC", // Main brand color }, // Healthcare secondary - Calming green secondary: { 50: "#E6F9F5", 100: "#CCF3EB", // ... through to 950 DEFAULT: "#00A67E", }, // Neutral - Soft grays instead of harsh black neutral: { 50: "#F8FAFC", 100: "#F1F5F9", // ... 900: "#1E293B", // Darkest, not pure black }, // Semantic colors success: { /* ... */ }, error: { /* ... */ }, warning: { /* ... */ }, info: { /* ... */ }, }; ``` **B. Update Typography** - **File:** `typography.ts` - **Changes:** - Adopt modern sans-serif (Inter or Roboto) - Define font scales for headings (h1-h6), body, captions - Set consistent font weights for hierarchy - Define line-heights for readability ```typescript export const typography = { fontFamily: { sans: ["Inter", "system-ui", "-apple-system", "BlinkMacSystemFont", "Segoe UI", "Roboto", "sans-serif"], mono: ["JetBrains Mono", "Menlo", "Monaco", "Courier New", "monospace"], }, fontSize: { xs: ["0.75rem", { lineHeight: "1rem" }], sm: ["0.875rem", { lineHeight: "1.25rem" }], base: ["1rem", { lineHeight: "1.5rem" }], lg: ["1.125rem", { lineHeight: "1.75rem" }], xl: ["1.25rem", { lineHeight: "1.75rem" }], "2xl": ["1.5rem", { lineHeight: "2rem" }], "3xl": ["1.875rem", { lineHeight: "2.25rem" }], "4xl": ["2.25rem", { lineHeight: "2.5rem" }], }, fontWeight: { light: "300", normal: "400", medium: "500", semibold: "600", bold: "700", }, }; ``` **C. Update Spacing System** - **File:** `spacing.ts` - **Review and ensure:** 4px/8px grid system is comprehensive - Add component-specific spacing tokens **D. Create Component Variants** - **New File:** `components.ts` - Define variant tokens for buttons, cards, inputs, etc. ```typescript export const components = { button: { sizes: { sm: { padding: "0.5rem 1rem", fontSize: "0.875rem" }, md: { padding: "0.75rem 1.5rem", fontSize: "1rem" }, lg: { padding: "1rem 2rem", fontSize: "1.125rem" }, }, variants: { primary: { /* colors */ }, secondary: { /* colors */ }, outline: { /* colors */ }, ghost: { /* colors */ }, danger: { /* colors */ }, }, }, card: { padding: { /* ... */ }, shadow: { /* ... */ }, radius: { /* ... */ }, }, // ... more components }; ``` ### 1.2 Create Theme Provider System **Location:** `/packages/ui/src/providers/` #### Tasks: **A. Create Theme Context** - **New File:** `ThemeProvider.tsx` - Manage light/dark mode - Expose theme switching function - Store preference in localStorage - Sync with system preferences ```typescript interface ThemeContextValue { theme: "light" | "dark"; setTheme: (theme: "light" | "dark") => void; toggleTheme: () => void; } ``` **B. Create CSS Variables Bridge** - **New File:** `theme-variables.css` - Export design tokens as CSS custom properties - Support both light and dark modes ```css :root { /* Light mode */ --color-primary: #0066cc; --color-background: #ffffff; /* ... */ } [data-theme="dark"] { /* Dark mode */ --color-primary: #3399ff; --color-background: #1e293b; /* ... */ } ``` **C. Update Tailwind Configuration** - **File:** `/packages/config/tailwind.js` - Integrate new design tokens - Configure dark mode: 'class' strategy - Add CSS variables to theme ### 1.3 Add Inter Font **Location:** `/apps/web-app/index.html` and `/apps/admin-panel/index.html` #### Tasks: **A. Add Google Fonts Link** ```html ``` **B. Update Global Styles** - Apply Inter as default font family ### 1.4 Documentation **New File:** `/docs/design-system/README.md` - Document color palette with visual swatches - Typography scale examples - Spacing guidelines - Usage examples --- ## Phase 2: Shared Component Library (Week 2-3) ### 2.1 Build Core Components **Location:** `/packages/ui/src/components/` Currently only has 5 components - need to expand significantly. #### Components to Build: **A. Button** (enhance existing) - **File:** `Button/Button.tsx` - Add all variants: primary, secondary, outline, ghost, danger - Add all sizes: sm, md, lg - Add loading state with spinner - Add icon support (left/right) - Ensure ARIA attributes **B. Card** - **New File:** `Card/Card.tsx` - Variants: default, bordered, elevated - Support header, body, footer sections - Responsive padding **C. Input** - **New File:** `Input/Input.tsx` - Text, email, password, number types - States: default, error, disabled, focused - Support label, helper text, error message - Icon support (prefix/suffix) **D. Select** - **New File:** `Select/Select.tsx` - Build on Radix UI Select (already installed) - Searchable variant - Multi-select support - Consistent styling with Input **E. Table** - **New File:** `Table/Table.tsx` - Sortable columns - Selectable rows - Pagination - Empty state - Loading skeleton **F. Modal/Dialog** (enhance existing) - **File:** `Dialog/Dialog.tsx` - Sizes: sm, md, lg, xl, full - Header with close button - Footer with actions - Scrollable body **G. Toast** (enhance existing) - **File:** `Toast/Toast.tsx` - Variants: success, error, warning, info - Action button support - Auto-dismiss with progress bar **H. Dropdown Menu** (enhance existing) - Consistent styling - Icon support - Dividers - Keyboard navigation **I. Avatar** - **File:** `Avatar/Avatar.tsx` - User initials fallback - Online status indicator - Sizes: xs, sm, md, lg, xl **J. Badge** - **New File:** `Badge/Badge.tsx` - Variants: default, primary, secondary, success, error, warning - Sizes: sm, md, lg - Dot variant **K. Spinner/Loader** - **New File:** `Spinner/Spinner.tsx` - Sizes: sm, md, lg - Color variants - Overlay variant **L. Skeleton** - **New File:** `Skeleton/Skeleton.tsx` - For loading states - Shapes: text, circle, rectangle - Animated **M. Tabs** (enhance existing) - **File:** `Tabs/Tabs.tsx` - Variants: line, enclosed, pills - Icon support - Keyboard navigation **N. Tooltip** (enhance existing) - **File:** `Tooltip/Tooltip.tsx` - Positions: top, bottom, left, right - Arrow indicator **O. IconButton** - **New File:** `IconButton/IconButton.tsx` - Same variants as Button - Circular and square shapes - Sizes: xs, sm, md, lg **P. Navigation Components** - **New File:** `Sidebar/Sidebar.tsx` - Collapsible sidebar navigation - **New File:** `Navbar/Navbar.tsx` - Top navigation bar - **New File:** `Breadcrumb/Breadcrumb.tsx` - Breadcrumb navigation ### 2.2 Icon System **Location:** `/packages/ui/src/icons/` #### Tasks: **A. Choose Icon Library** - **Recommendation:** Lucide React (clean, consistent, MIT license) - **Alternative:** Keep Heroicons but standardize **B. Create Icon Wrapper** - **New File:** `Icon/Icon.tsx` - Standardize sizes - Color variants - Accessibility labels **C. Export Common Icons** - **New File:** `icons/index.ts` - Export commonly used icons with consistent naming - Examples: HomeIcon, ChatIcon, DocumentIcon, UserIcon, SettingsIcon, etc. ### 2.3 Component Testing **Location:** `/packages/ui/src/components/**/__tests__/` #### Tasks: - Create test file for each component - Test all variants and states - Test accessibility (keyboard navigation, ARIA) - Test responsive behavior - Visual regression tests (Storybook chromatic) ### 2.4 Storybook Setup **Location:** `/packages/ui/.storybook/` #### Tasks: **A. Install Storybook** ```bash pnpm add -D @storybook/react-vite @storybook/addon-essentials @storybook/addon-a11y ``` **B. Configure Storybook** - **New File:** `.storybook/main.ts` - **New File:** `.storybook/preview.ts` - Add Tailwind CSS support - Add theme switcher addon **C. Create Stories** - Story for each component - Document all variants - Interactive controls - Accessibility checks --- ## Phase 3: Web App UI Redesign (Week 3-5) ### 3.1 Replace Splash Screen with Dashboard **Current:** Large padlock/microphone splash **New:** Clean dashboard layout after login #### Tasks: **A. Redesign HomePage** - **File:** `/apps/web-app/src/pages/HomePage.tsx` - Create dashboard layout instead of splash - Add welcome header with user info - Create action cards grid **B. Create Dashboard Cards** - **New Component:** `/apps/web-app/src/components/dashboard/DashboardCard.tsx` - Cards for: "Start Chat", "Voice Mode", "Documents", "Clinical Context" - Each card: - Icon (from icon library) - Title - Description (concise) - Click action (navigate to page) - Hover state with elevation **C. Add Recent Activity Section** - Show recent conversations - Show recently uploaded documents - Quick access links **D. Layout Structure** ```tsx
Good morning, Dr. [Name]
} title="Start Chat" ... /> } title="Voice Mode" ... /> } title="Documents" ... /> } title="Clinical Context" ... /> } title="History" ... /> } title="Settings" ... />
``` ### 3.2 Improve Main Layout & Navigation **File:** `/apps/web-app/src/components/layout/MainLayout.tsx` #### Tasks: **A. Add Header Bar** - VoiceAssist logo (left) - Breadcrumb navigation (center) - User account menu (right) - Profile - Settings - Sign out - Theme toggle button **B. Redesign Sidebar** - Current: Conversations list sidebar - Enhance: - Add collapsible functionality - Add clear section headers - Improve conversation item styling - Add search/filter - Add new conversation button (prominent) **C. Add Mobile Navigation** - Hamburger menu for mobile - Bottom navigation bar (alternative) - Responsive breakpoints **D. Layout Structure** ```tsx
{/* React Router outlet */} {" "} {/* For citations, clinical context */} {/* Dynamic based on route */}
``` ### 3.3 Redesign Chat Page **File:** `/apps/web-app/src/pages/ChatPage.tsx` #### Tasks: **A. Improve Layout** - Clean, spacious design - Clear visual hierarchy - Ample white space **B. Update Message Components** - **File:** `/apps/web-app/src/components/chat/MessageBubble.tsx` - Use Card component from UI library - Add subtle shadows - Improve typography (line-height, letter-spacing) - Better differentiation between user/assistant messages - Add timestamps (subtle) **C. Update Message Input** - **File:** `/apps/web-app/src/components/chat/MessageInput.tsx` - Use Input component from UI library - Add prominent send button - Add file attachment button - Add voice toggle button - Show character count (if limit exists) - Multi-line support with auto-resize **D. Add Mode Toggles** - Text/Voice mode toggle (prominent) - Settings quick access - Clear visual indicators for active mode **E. Improve Streaming Indicator** - **File:** `/apps/web-app/src/components/chat/StreamingIndicator.tsx` - Use Spinner component - Add "AI is thinking..." text - Animated typing indicator **F. Improve Citations Display** - **File:** `/apps/web-app/src/components/chat/CitationDisplay.tsx` - Use Card/Badge components - Better formatting - Click to expand inline - Highlight in sidebar ### 3.4 Redesign Documents Page **File:** `/apps/web-app/src/pages/DocumentsPage.tsx` #### Tasks: **A. Create Table View** - Use Table component from UI library - Columns: Name, Type, Size, Upload Date, Actions - Sortable columns - Row selection for bulk actions - File type icons **B. Create Card/Grid View** - Alternative view mode - Document cards with: - File type icon/thumbnail - File name - Metadata (size, date) - Quick actions (download, delete) **C. Add Upload Area** - Drag-and-drop zone - Or click to browse - Progress indicators for uploads - Error handling with clear messages **D. Add Search & Filter** - Search by filename - Filter by file type - Filter by date range - Sort options **E. Add Toolbar** - View toggle (table/grid) - Upload button (prominent) - Bulk actions (delete selected) - Search input ### 3.5 Add Clinical Context Page **File:** `/apps/web-app/src/pages/ClinicalContextPage.tsx` #### Tasks: **A. Create Form Layout** - Use Card components for sections - Clear section headers - Responsive form grid **B. Update Form Components** - Use Input, Select, Textarea from UI library - Proper labels and helper text - Validation error display - Save indicators **C. Add Context History** - Show previously saved contexts - Load context functionality - Delete old contexts ### 3.6 Improve Profile Page **File:** `/apps/web-app/src/pages/ProfilePage.tsx` #### Tasks: **A. Redesign Layout** - Use Card components - Avatar upload section - Form sections (Personal Info, Security, Preferences) **B. Add Settings** - Theme preference (light/dark/auto) - Language preference - Notification preferences - Accessibility preferences ### 3.7 Responsive Design **Apply to all pages** #### Tasks: **A. Define Breakpoints** - Mobile: < 640px - Tablet: 640px - 1024px - Desktop: > 1024px **B. Test & Adjust** - Navigation collapses on mobile - Cards stack on mobile - Tables become scrollable or transform - Forms adjust layout - No horizontal scrollbars --- ## Phase 4: Admin Panel Redesign (Week 5-6) ### 4.1 Fix JSON Parsing Error **Investigation needed** #### Tasks: **A. Identify Issue** - Check admin API endpoints - Verify Content-Type headers - Check for HTML error pages being returned **B. Fix Backend** - Ensure all admin endpoints return JSON - Add proper error handling - Return JSON error responses **C. Fix Frontend** - Add proper error handling in fetch calls - Validate response Content-Type - Show user-friendly error messages ### 4.2 Migrate to Shared Design System **All admin panel components** #### Tasks: **A. Replace Direct Tailwind with Design Tokens** - Use `@voiceassist/design-tokens` colors - Update all hardcoded colors (slate-950, etc.) - Apply consistent spacing **B. Use Shared Components** - Replace custom buttons with Button from `@voiceassist/ui` - Replace custom inputs with Input from `@voiceassist/ui` - Use Card, Table, Modal, etc. **C. Update Color Scheme** - Transition from dark slate to healthcare palette - Maintain dark mode option - Ensure sufficient contrast ### 4.3 Replace Emoji Icons **Current:** Emoji icons (📊, 👥, etc.) **New:** Vector icons from icon library #### Tasks: **A. Icon Mapping** - Create mapping of emoji to proper icons - Ensure consistent icon usage **B. Update Components** - Replace all emoji with Icon components - Ensure proper sizing - Add aria-labels for accessibility ### 4.4 Redesign Admin Layout **File:** `/apps/admin-panel/src/components/AdminLayout.tsx` #### Tasks: **A. Update Sidebar** - Use Sidebar component from UI library - Clear section groupings - Icon + label for each nav item - Active state highlighting - Collapsible on mobile **B. Navigation Items** - Dashboard (HomeIcon) - Users (UsersIcon) - Knowledge Base (DatabaseIcon) - Analytics (ChartIcon) - System Config (SettingsIcon) **C. Add Header** - Admin panel branding - User info (logged in admin) - Logout button - System status indicator **D. Improve Main Content Area** - Add page headers with breadcrumbs - Consistent padding - Use max-width for readability ### 4.5 Redesign Dashboard Page **File:** `/apps/admin-panel/src/pages/DashboardPage.tsx` #### Tasks: **A. Create Stats Cards** - Use Card component - Key metrics: - Total users - Active users (today/week) - Total conversations - Knowledge base documents - System health **B. Update Charts** - Use Recharts with new color scheme - User activity over time - Popular features - Error rates **C. Add Quick Actions** - Common admin tasks - Recent activity feed ### 4.6 Redesign Users Page **File:** `/apps/admin-panel/src/pages/UsersPage.tsx` #### Tasks: **A. Create Users Table** - Use Table component - Columns: Avatar, Name, Email, Role, Status, Created, Actions - Sortable columns - Search functionality - Filter by role/status - Pagination **B. Add User Actions** - Dropdown menu for each user: - View details - Edit user - Reset password - Disable/Enable - Delete user - Confirmation modals for destructive actions **C. Create User Modal/Form** - "Create User" button opens modal - Form fields: Name, Email, Role, Password - Validation - Success/error feedback **D. Add Bulk Actions** - Select multiple users - Bulk disable/enable - Bulk delete (with confirmation) ### 4.7 Redesign Knowledge Base Page **File:** `/apps/admin-panel/src/pages/KnowledgeBasePage.tsx` #### Tasks: **A. Create Documents Table/Grid** - Use Table component - Columns: Title, Type, Size, Upload Date, Status, Actions - Search and filter - Upload button **B. Add Document Management** - Upload new documents - Edit metadata - Delete documents - View indexing status - Re-index action **C. Add Statistics** - Total documents - Total size - Index status - Last updated ### 4.8 Redesign Analytics Page **File:** `/apps/admin-panel/src/pages/AnalyticsPage.tsx` #### Tasks: **A. Update Charts** - Apply new color scheme - Use consistent chart types - Add legends and labels - Responsive sizing **B. Add Date Range Selector** - Quick ranges (Today, Week, Month, Year) - Custom date range picker **C. Add Metrics** - User engagement - Feature usage - Response times - Error rates - Most common queries ### 4.9 Redesign System Page **File:** `/apps/admin-panel/src/pages/SystemPage.tsx` #### Tasks: **A. Create Configuration Sections** - Use Card components for each section - API settings - Security settings - Email settings - Feature flags **B. Add System Health** - Backend status - Database status - External services status - Version info **C. Add Action Buttons** - Clear cache - Restart services (with confirmation) - Export logs - Backup database ### 4.10 Add Loading & Feedback States **All admin pages** #### Tasks: **A. Add Loading States** - Use Spinner/Skeleton components - Loading overlays for actions - Disable buttons during loading **B. Add Toast Notifications** - Success messages - Error messages - Warning messages - Info messages **C. Add Empty States** - When no data exists - Helpful messaging - Call-to-action (e.g., "Create your first user") --- ## Phase 5: Accessibility & Responsiveness (Week 6-7) ### 5.1 Accessibility Audit #### Tasks: **A. Semantic HTML** - Audit all components for proper semantic elements - Use `