feat: chatbox component extraction with Cypress demo#633
feat: chatbox component extraction with Cypress demo#633jeremyeder merged 6 commits intoambient-code:mainfrom
Conversation
Extract ChatInputBox into a dedicated chat component module with supporting components (AttachmentPreview, AutocompletePopover, QueuedMessageBubble, WelcomeExperience). Refactor MessagesTab to consume the new components. Key changes: - Extract useAutocomplete hook consolidating 6 state vars, eliminating duplicate filtering logic between ChatInputBox and AutocompletePopover - AutocompletePopover receives pre-filtered items (no internal filtering) - Consolidate agents/commands toolbar popovers via shared ToolbarItemList - Add useResizeTextarea hook for draggable textarea resize - Add session queue operations (updateMessage, clearMessages) - Remove dead props (showCompactMode, showTimestamps) and unused field - Convert all interface declarations to type (project guideline) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Human-paced walkthrough of the extracted chat UI components: WelcomeExperience, ChatInputBox, QueuedMessageBubble, settings dropdown, and toolbar buttons. Records to cypress/videos/ at natural typing speed. Related: ambient-code#632 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Captions at top of viewport (compact, doesn't obscure UI) - Synthetic cursor dot with blue click ripple effect - Selects "Fix a bug" workflow card, waits for Running state - Demos @agent and /command autocomplete with real workflow data - Demos file attach, message queueing, history, editing, settings - Loads .env.test in cypress config for TEST_TOKEN - Run: npx cypress run --no-runner-ui --spec cypress/e2e/chatbox-demo.cy.ts Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
Reduce pause durations (LONG 4s→3.2s, PAUSE 3s→2.4s, SHORT 2s→1.6s, typing 100ms→80ms per key) for a snappier viewing experience. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codifies the patterns from the chatbox-component demo into a reusable skill: synthetic cursor with click ripples, top-bar captions, human pacing, workflow selection with Running state wait, and dual-layout element targeting. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Claude Code ReviewSummaryThis PR implements a holistic refactoring of the chat input UI, extracting a monolithic Key Improvements:
Issues by Severity🚫 Blocker IssuesNone identified - This PR is well-structured and follows established patterns. 🔴 Critical Issues1. Type Safety: Missing Error Boundary Pattern Location: All new components ( Issue: Components don't have error boundaries or graceful error handling for edge cases. Example Risk: // ChatInputBox.tsx:259
const preview = await generatePreview(renamedFile);
// What if generatePreview throws? No try-catch wrapper.Recommendation: try {
const preview = await generatePreview(renamedFile);
setPendingAttachments((prev) => [...prev, { id: makeAttachmentId(), file: renamedFile, preview }]);
} catch (error) {
console.error('Failed to generate preview:', error);
setPendingAttachments((prev) => [...prev, { id: makeAttachmentId(), file: renamedFile, preview: undefined }]);
}2. Accessibility: Missing ARIA Labels and Keyboard Navigation Location: Issue: Resize handle has no ARIA label, limiting screen reader accessibility. 3. Memory Leak: Event Listeners Not Cleaned Up Properly Location: Issue: Event listeners are attached to 🟡 Major Issues4. Component Size: ChatInputBox Exceeds Guideline (706 lines) Location: Issue: Component is 706 lines, significantly exceeding the 200-line guideline from Recommendation: Extract sub-components:
5. Performance: Unnecessary Re-renders from useMemo Dependencies Location: Issue: 🔵 Minor Issues6. Code Quality: Inconsistent Type Exports Positive Highlights✅ Excellent Architecture: Component extraction follows single-responsibility principle perfectly. Each component has a clear, focused purpose. ✅ Standards Compliance: All type definitions use ✅ Shadcn UI Usage: Correctly uses ✅ Custom Hook Extraction: ✅ Type Safety: Comprehensive TypeScript types with proper exports. Zero ✅ User Experience: Message queue editing, attachment preview, and welcome experience significantly improve UX. ✅ Testing Investment: Cypress demo test with visual cursor and captions is exceptional for documenting new features. ✅ Code Organization: Files are properly colocated in RecommendationsHigh Priority (Before Merge)
Medium Priority (Follow-up PR)
Low Priority (Nice-to-Have)
Overall Assessment: ⭐⭐⭐⭐ (4/5 stars) This is a high-quality refactoring that significantly improves code organization and user experience. The issues identified are mostly non-blocking enhancements. With the critical issues addressed (error boundaries, memory leak, ARIA labels), this PR will be production-ready. Recommendation: Approve with minor changes - Address critical issues (#1, #2, #3) before merge. Major and minor issues can be addressed in follow-up PRs. 🔍 View AI decision process (logs available for 90 days) 📋 View memory system files loaded (click to expand)What Amber Loaded for Code ReviewAmber automatically loaded these repository standards from the memory system:
Impact: This review used your repository's specific code quality standards, security patterns, and best practices from the memory system (PRs #359, #360) - not just generic code review guidelines. |
Claude Code ReviewSummaryThis PR represents an excellent refactoring of the chat input UI, successfully decomposing a monolithic 616-line component into 5 focused, reusable components with 2 custom hooks. The code quality is exceptionally high, following all established frontend patterns and demonstrating production-ready architecture. Overall Grade: A (9.5/10) Issues by SeverityBlocker IssuesNone - This PR is ready to merge. Critical IssuesNone - No critical issues found. Major Issues1. Potential Memory Leak in AutocompletePopover (AutocompletePopover.tsx:43-55) 2. No Error Boundary for ChatInputBox 3. Missing Type Safety in Event Handler (use-resize-textarea.ts:24-28) Minor Issues
Positive HighlightsExceptional Type Safety
Perfect Adherence to Frontend Standards
Clean Architecture
Outstanding User Experience
Production-Ready Details
Testing & Documentation
Code Quality Metrics
RecommendationsFollow-up PRs (Nice-to-Have)
Security Review✅ No security concerns identified
Final VerdictApproved ✅ - Merge with Confidence This is exemplary frontend work that sets the bar for future contributions. The refactoring successfully:
Recommendation: Merge immediately. Minor issues can be addressed in follow-up PRs. Reviewed by: Claude Code (Sonnet 4.5) 🔍 View AI decision process (logs available for 90 days) 📋 View memory system files loaded (click to expand)What Amber Loaded for Code ReviewAmber automatically loaded these repository standards from the memory system:
Impact: This review used your repository's specific code quality standards, security patterns, and best practices from the memory system (PRs #359, #360) - not just generic code review guidelines. |
Skill locates a plan file, prepends repo context, and calls acp_create_session to submit it as an AgenticSession. Returns immediately with session name and follow-up commands. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Claude Code ReviewSummaryThis PR successfully extracts a monolithic 616-line MessagesTab component into 5 focused, reusable components and 2 custom hooks. The refactoring demonstrates excellent component decomposition, proper TypeScript usage, and good separation of concerns. The addition of a comprehensive Cypress demo test provides visual documentation of the new UI components. Overall Assessment: Strong refactoring with minor improvements needed before merge. Issues by Severity🚫 Blocker IssuesNone - code is functional and follows patterns. 🔴 Critical Issues1. Build Verification Required
🟡 Major Issues2. Component Size Violation
3. Missing Error Boundary
4. File Upload Without Progress Indicator
5. Memory Leak Risk
🔵 Minor Issues6. Inconsistent Type Naming
7. Magic Numbers
8. Autocomplete Filter Case Sensitivity
9. Missing ARIA Labels
10. Hardcoded Accepted File Types
Positive Highlights✅ Excellent Component Decomposition
✅ TypeScript Excellence
✅ Custom Hooks Pattern
✅ React Query Compliance
✅ Proper Shadcn UI Usage
✅ Loading States & Error Handling
✅ Comprehensive Demo Test
✅ Accessibility Considerations
Recommendations (Prioritized)Before Merge (Required)
After Merge (Nice-to-Have)
Testing Coverage✅ Cypress demo test covers:
Recommendation: Add Jest tests for custom hooks in future iteration. Architecture Compliance
Score: 8/9 standards met (89%) Security Review✅ No security concerns identified:
Final VerdictApprove with minor changes - Excellent refactoring work that significantly improves maintainability. Address the 3 required items before merge:
The component extraction is well-executed and follows established patterns. The Cypress demo is a valuable addition for visual documentation. Estimated effort to address: ~30 minutes 🤖 Generated with Claude Code 🔍 View AI decision process (logs available for 90 days) 📋 View memory system files loaded (click to expand)What Amber Loaded for Code ReviewAmber automatically loaded these repository standards from the memory system:
Impact: This review used your repository's specific code quality standards, security patterns, and best practices from the memory system (PRs #359, #360) - not just generic code review guidelines. |
Summary
New Components (
components/frontend/src/components/chat/)@agentand/commandpickerNew Hooks (
components/frontend/src/hooks/)Demo Test (
e2e/cypress/e2e/chatbox-demo.cy.ts)Records a video at natural speed showing: workspace creation → welcome cards → prompt prefill → typing → message queueing → settings dropdown → breadcrumb navigation.
Run:
npx cypress run --spec "cypress/e2e/chatbox-demo.cy.ts"Video output:
cypress/videos/chatbox-demo.cy.ts.mp4Follow-up: #632 (upload progress indicator + display settings)
Test plan
npm run buildpasses incomponents/frontend/make test-e2ecypress/videos/chatbox-demo.cy.ts.mp4plays at human-readable speed🤖 Generated with Claude Code