Perf8:18 PM · ZRosserMcIntosh
optimize build for Vercel Turbo (30-CPU)
- next.config.ts: add experimental parallelServerCompiles, parallelServerBuildTraces, optimizePackageImports, compress, AVIF/WebP images
- tsconfig.json: narrow includes from **/*.ts to src/**/*.ts (skip 13 script files from TS check)
- package.json: remove dead postgres dep, move supabase CLI to devDeps (-89MB from prod)
- Remove empty tailwind.config.ts (Tailwind v4 uses CSS-based config)
- workerThreads disabled (DataCloneError with Next.js 16 static gen workers)
Chore7:04 PM · ZRosserMcIntosh
remove stray route.ts.new file
Refactor7:03 PM · ZRosserMcIntosh
Phase 4 Priority 4 — extract components from maintenance, jobs, integrations pages and aiSummaryService
- types.ts: 5 interfaces (MaintenancePlan, Subscription, Customer, Property, SubscriptionWithDetails)
- icons.tsx: 7 icons (PlusIcon, UsersIcon, CurrencyIcon, CalendarIcon, DocumentIcon, EyeIcon, CheckCircleIcon)
- components.tsx: StatCard, NewPlanModal, NewSubscriptionModal
- types.ts: JobWithDetails, CustomerOption, PropertyOption interfaces
- icons.tsx: 6 icons (PlusIcon, CalendarIcon, TruckIcon, PlayIcon, CheckIcon, ChevronIcon)
- helpers.tsx: StatCard, StatusBadge, PriorityBadge, formatDateTime
- NewJobModal.tsx: Full job creation modal with address resolution
- types.ts: Integration, SyncRun interfaces
- icons.tsx: 19 icons (utility + integration-specific brand icons)
- components.tsx: IntegrationCard, StatusBadge, formatDateTime
- Fixed Tailwind v4: bg-gradient-to-r → bg-linear-to-r, flex-shrink-0 → shrink-0
- aiSummaryPdf.ts: PDF generation (generateSummaryPDF, buildPDFHTML, SummaryResult type)
- aiTechHandoff.ts: Tech handoff (generateTechHandoffSummary, TechHandoffResponse type)
- Re-exports maintained for backward compatibility
Refactor6:38 PM · ZRosserMcIntosh
extract estimates/[id] and hr-metrics page components
- Extracted: types.ts (5 interfaces), icons.tsx (4 icons), components.tsx (AddItemModal + AddOptionModal)
- Extracted: helpers.ts (HRTabType, getHRTabLabel, getInitials, getStatusColor, findMetric)
- Extracted: components.tsx (MetricCard, MetricRow, InfoRow, StatusBadge)
- Extracted: tabs.tsx (9 tab components: Overview, Employment, Time, Leave, Performance, Training, Safety, Assets, Audit)
Refactor6:14 PM · ZRosserMcIntosh
break up Square webhook (956 → 146 lines)
- shared.ts: types, config, supabase client, signature verification, logging, notifications, status mappers
- handlers/payment.ts: payment.completed/updated/failed (deposit + invoice matching)
- handlers/refund.ts: refund.created/updated (payment + invoice reversal)
- handlers/customer.ts: customer.created/updated (upsert to customers table)
- handlers/invoice.ts: invoice.created/updated/payment_made/canceled
- handlers/dispute.ts: dispute.created/state.updated (critical alerts, fund tracking)
- handlers/index.ts: barrel re-exports
- route.ts: thin dispatcher with signature verification + idempotency
6:04 PM · ZRosserMcIntosh
delete 1,736 lines of dead code
- ChatWidget.tsx (656 lines) — superseded by ChatWidget/ directory, zero imports
- types-servicetitan.ts (1,035 lines) — zero imports anywhere in codebase
- portal-auth.ts (0 bytes) — empty file, .tsx version is the real one
- contacts-redirect/page.tsx — duplicate of contacts/page.tsx redirect
- contacts/page-redirect.tsx — triple duplicate of same redirect
- invoices-redirect/page.tsx — duplicate of invoices/page.tsx redirect
Refactor5:20 PM · ZRosserMcIntosh
Round 2 god file breakups — 5 files decomposed
- customers/[id]/page.tsx: 1,332 → 865 lines (6 tab components extracted)
- customers/page.tsx: 1,075 → 532 lines (modal, contacts view, icons extracted)
- chatService.ts: 1,244 → 44 lines (6 domain modules under lib/chat/)
- ChatWidgetEnhanced.tsx: 1,121 → 10 lines (ChatWidget/ directory)
- developer/page.tsx: 1,116 → 966 lines (types, icons, helpers extracted)
Chore3:31 PM · ZRosserMcIntosh
remove stale employees/page-new.tsx (959 lines dead code)
Docs3:30 PM · ZRosserMcIntosh
V1 tables deprecated — SQL migration complete (Feb 27, 2026)
- Audit results: contacts=1 orphan (dup email, deleted), jobs/invoices/payments=0 orphans
- Scripts 03-05 skipped (V1 tables empty)
- Script 06 verification: all PASS
- Script 07 executed: V1 tables renamed to _deprecated_*, contacts view created
- Drop deadline: March 28, 2026
Docs3:18 PM · ZRosserMcIntosh
update V2_MIGRATION_LOG — Phase 3 God File Breakup complete (6/6)
Refactorpayments3:17 PM · ZRosserMcIntosh
decompose god file — 1,311→362 lines (72% reduction)
- types.ts: 6 interfaces (Payment, Customer, Invoice, PaymentWithDetails, etc.)
- helpers.tsx: formatCurrency, formatDate, getStatusBadgeClass, getMethodIcon
- components/icons.tsx: 7 icon components
- components/StatCard.tsx: reusable stat card with color variants
- components/InvoicesView.tsx: invoice table with filter/actions
- components/DepositsView.tsx: deposit management with record/cancel/resend
- components/RecordPaymentModal.tsx: payment recording form with auto-balance
- components/index.ts: barrel exports
Refactorestimates3:01 PM · ZRosserMcIntosh
decompose god file — 1,380→450 lines (67% reduction)
- types.ts: Customer, Contact, EstimateWithRelations, EstimateLineItemWithTotal
- helpers.ts: getStatusBadge, formatCurrency, formatDate, calculateTotal, generateEstimateNumber
- components/icons.tsx: PlusIcon, ChevronIcon, XIcon, DollarIcon, CheckCircleIcon
- components/CreateEstimateModal.tsx: estimate creation form with line items
- components/EstimateCard.tsx: expandable estimate row with line items table + actions
- components/CollectDepositModal.tsx: deposit collection with template support, fee preview, Square integration
- components/index.ts: barrel export
Refactorjobs/[id]2:48 PM · ZRosserMcIntosh
decompose god file — 1,697→862 lines (49% reduction)
- types.ts: Job, Customer, Employee, TimeEntry, Invoice, Attachment interfaces
- helpers.ts: formatDate, formatDateTime, formatCurrency, badge class helpers
- components/icons.tsx: 17 icon components (ArrowLeft, Clock, User, etc.)
- components/EditJobModal.tsx: job editing form modal
- components/ScheduleModal.tsx: schedule & assign with email confirmation
- components/PhotoGallery.tsx: photo grid + PhotoDetailModal with notes
- components/AttachmentsPanel.tsx: file upload w/ OCR progress + management
- components/OcrSuccessModal.tsx: Maverick Vision OCR success feedback
- components/index.ts: barrel export
- flex-shrink-0 → shrink-0
- bg-gradient-to-r → bg-linear-to-r
Refactor2:33 PM · ZRosserMcIntosh
break up employees/page.tsx god file (1845→582 lines, 68%)
- types.ts: TabType, TimeEntryWithEmployee, EmployeePayConfig, PayPeriod, PayrollItem, PTOBalance, PTORequest interfaces
- helpers.ts: formatDate, formatTime, formatHours, formatCurrency utilities
- components/badges.tsx: RoleBadge, StatusBadge, PayPeriodStatusBadge, PayrollItemStatusBadge shared badge components
- components/ElapsedTime.tsx: live elapsed timer + NoteIcon
- components/EmployeesTab.tsx: team member listing with invite button
- components/TimeTrackingTab.tsx: clock in/out, notes modal, entries table
- components/TimeApprovalsTab.tsx: manager approval/rejection of time entries
- components/PayrollTab.tsx: payroll overview, pay configs, run payroll (owner-only sub-tabs)
- components/PTOTab.tsx: PTO balances, request management, manager actions
- components/index.ts: barrel export
- customers/[id]/page.tsx: 2144→1331 (38%)
- DispatchMessenger.tsx: 1951→898 (54%)
- employees/page.tsx: 1845→582 (68%) ← this commit
Refactor2:20 PM · ZRosserMcIntosh
break up DispatchMessenger.tsx god file (1951→898 lines)
- types.ts: 8 interfaces (Conversation, Message, Customer, Employee, etc.)
- icons.tsx: 19 icon components (Search, Send, Phone, Email, etc.)
- helpers.tsx: 6 utility functions (formatTime, getChannelIcon, etc.)
- CustomerInfoPanel.tsx: customer sidebar with job/invoice history
- JobScheduleModal.tsx: job creation form from conversation
- EditCustomerModal.tsx: customer info editor
- index.ts: barrel export preserving import path
- All state management and hooks
- Supabase realtime subscriptions (3 channels)
- Message sending with optimistic updates + race condition fix
- Conversation list and message view JSX
- Column resize handlers
Refactor3:30 AM · ZRosserMcIntosh
break up customers/[id]/page.tsx god file (2144→1331 lines)
- types.ts: 9 shared interfaces (Customer, Property, Asset, Job, etc.)
- components/icons.tsx: 12 icon components
- components/QuickStat.tsx: stat card component
- components/AddPropertyModal.tsx: property creation form
- components/AddAssetModal.tsx: asset creation form
- components/EditCustomerModal.tsx: customer edit form
- components/NewJobModal.tsx: job creation form with job number generation
- components/index.ts: barrel export
- Data loading (loadCustomerData with 8 Supabase queries)
- Utility functions (formatCurrency, formatDate, handleFileUpload, getAttachmentUrl)
- Main layout JSX with tabs
- Tab components (inline, tightly coupled to page state)
- Attachment upload/viewer modals (tightly coupled to upload state)
Feature2:34 AM · ZRosserMcIntosh
SQL data migration pipeline for V1→V2 table consolidation
- 01: Audit V1 vs V2 row counts, find orphaned records
- 02: Migrate contacts → customers (name split, address mapping)
- 03: Migrate jobs → jobs_v2 (status/type enum→text mapping)
- 04: Migrate invoices → invoices_v2 (+ line items, FK validation)
- 05: Migrate payments → payments_v2 (contact_id→customer_id)
- 06: Verification (zero-orphan check, financial totals, verdict)
- 07: Deprecate V1 tables (rename to _deprecated_*, create views)
1:44 AM · ZRosserMcIntosh
Update migration log with Steps 7-8 completion status
1:43 AM · ZRosserMcIntosh
Deduplicate conversation routes + delete archive dead code
- Created /api/conversations/[id]/close/route.ts (canonical location)
- Updated DispatchMessenger to call /api/conversations/*/close instead of /api/chat/conversations/*/close
- Deleted /api/chat/conversations/* tree (5 files, ~635 lines of duplicated code)
- Only /api/chat/start/route.ts remains (not a duplicate)
- Deleted src/app/dashboard/_archive/ (4 dead files: contacts-page-old, contacts-page.backup, employees-page-old, invoices-page-old)
- Clean build verified after .next cache clear