webui: convert SketchCallStatus to Tailwind CSS with comprehensive demo support
Convert SketchCallStatus component from shadow DOM CSS to Tailwind classes
while maintaining test compatibility and adding complete demo infrastructure.
Problems Solved:
Shadow DOM Styling Limitations:
- SketchCallStatus used CSS-in-JS with shadow DOM preventing Tailwind integration
- Custom CSS animations and styling duplicated Tailwind functionality
- Component couldn't benefit from design system consistency
- Difficult to maintain custom CSS alongside Tailwind-based components
Missing Demo Infrastructure:
- No demo fixtures for testing SketchCallStatus component states
- Component not included in demo runner for development testing
- Manual testing required for visual verification of component behavior
Test Compatibility Issues:
- Conversion to Tailwind removed semantic class names expected by tests
- Need to maintain backward compatibility with existing test suite
Solution Implementation:
Tailwind CSS Conversion:
- Changed SketchCallStatus to inherit from SketchTailwindElement
- Replaced CSS-in-JS styles with Tailwind utility classes
- Converted animations using @keyframes in inline <style> tag
- Maintained exact visual appearance while using Tailwind classes
Component State Styling:
- LLM indicator: bg-yellow-100 text-amber-500 when active, text-gray-400 when idle
- Tool indicator: bg-blue-100 text-blue-500 when active, text-gray-400 when idle
- Status banner: bg-green-50 text-green-700 (idle), bg-orange-50 text-orange-600 (working), bg-red-50 text-red-600 (disconnected)
- Gentle pulse animation preserved with animate-gentle-pulse class
Test Compatibility Maintenance:
- Added semantic CSS classes back to elements (.llm-indicator, .tool-indicator, .status-banner)
- Added .active class when indicators are in active state
- Added status state classes (status-idle, status-working, status-disconnected)
- Maintains backward compatibility with existing Playwright tests
Demo Fixtures Implementation:
- Added call-status.ts with CallStatusState interface and sample states
- Created demo fixtures: idleCallStatus, workingCallStatus, heavyWorkingCallStatus, disconnectedCallStatus, workingDisconnectedCallStatus
- Fixed TypeScript module export issues using 'export type' syntax
- Comprehensive sketch-call-status.demo.ts with interactive controls
- Added component to demo-runner.ts knownComponents list
Interactive Demo Features:
- Status variations section showing all possible states
- Interactive demo with buttons to add/remove LLM calls and tool calls
- Toggle connection state and change agent state functionality
- Reset button to return to idle state
- Real-time simulation of activity changes
Files Modified:
- sketch/webui/src/web-components/sketch-call-status.ts: Converted to SketchTailwindElement with Tailwind classes and semantic class names
- sketch/webui/src/web-components/demo/demo-fixtures/call-status.ts: Added call status demo data
- sketch/webui/src/web-components/demo/demo-fixtures/index.ts: Export call status fixtures with proper TypeScript module exports
- sketch/webui/src/web-components/demo/sketch-call-status.demo.ts: Complete demo implementation with interactive controls
- sketch/webui/src/web-components/demo/demo-framework/demo-runner.ts: Added sketch-call-status to knownComponents
Testing and Validation:
- Verified component renders correctly with Tailwind classes
- Confirmed all state variations display proper colors and animations
- Tested interactive demo controls function correctly
- Validated component appears in demo runner list
- Ensured test compatibility with semantic class preservation
The conversion maintains visual fidelity and test compatibility while enabling
better integration with the Tailwind-based design system and providing
comprehensive demo infrastructure for development and testing.
Co-Authored-By: sketch <hello@sketch.dev>
Change-ID: s3437e5020555164dk
diff --git a/webui/src/web-components/demo/demo-framework/demo-runner.ts b/webui/src/web-components/demo/demo-framework/demo-runner.ts
index 76b7085..c624cb2 100644
--- a/webui/src/web-components/demo/demo-framework/demo-runner.ts
+++ b/webui/src/web-components/demo/demo-framework/demo-runner.ts
@@ -94,6 +94,7 @@
// For now, we'll maintain a registry of known demo components
// This could be improved with build-time generation
const knownComponents = [
+ "sketch-call-status",
"sketch-chat-input",
"sketch-container-status",
"sketch-tool-calls",