Skip to content
This repository was archived by the owner on Feb 6, 2026. It is now read-only.

Commit 5087eba

Browse files
committed
Update AGENT.md with chat UI development guidelines
- Add React Router and use-mcp to tech stack - Document background animation best practices (hue-rotate, pseudo-elements) - Modal patterns for UX (click-outside, cursor-pointer, backdrop styling) - MCP server management (multiple servers, localStorage patterns, OAuth) - State persistence guidelines (localStorage vs sessionStorage) - UI indicator patterns (emoji-based, count formatting) - Component organization for stateful elements - Routing and OAuth callback implementation - Performance considerations for animations and aggregation
1 parent a3200e0 commit 5087eba

File tree

1 file changed

+49
-1
lines changed

1 file changed

+49
-1
lines changed

examples/chat-ui/AGENT.md

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,52 @@
2222
- **Styling**: Tailwind CSS classes, responsive design patterns
2323

2424
## Tech Stack
25-
React 19, TypeScript, Vite, Tailwind CSS, Hono API, Cloudflare Workers, IndexedDB
25+
React 19, TypeScript, Vite, Tailwind CSS, Hono API, Cloudflare Workers, IndexedDB, React Router, use-mcp
26+
27+
## Chat UI Specific Guidelines
28+
29+
### Background Animation
30+
- Use CSS `hue-rotate` filter for color cycling (more performant than gradient animation)
31+
- Isolate animations to `::before` pseudo-elements with `z-index: -1` to prevent inheritance
32+
- Use `background-size: 100% 100vh` and `background-repeat: repeat-y` for repeating patterns
33+
- Initialize with random animation delay using CSS custom properties
34+
35+
### Modal Patterns
36+
- Use `rgba(0,0,0,0.8)` for modal backdrops (avoid gradients that cause banding)
37+
- Implement click-outside-to-dismiss with `onClick` on backdrop and `stopPropagation` on content
38+
- Add `cursor-pointer` to all clickable elements including close buttons
39+
- Use `document.body.style.overflow = 'hidden'` to prevent background scrolling
40+
41+
### MCP Server Management
42+
- Store multiple servers in localStorage as JSON array (`mcpServers`)
43+
- Track tool counts separately (`mcpServerToolCounts`) for disabled servers
44+
- Use server-specific IDs for state management
45+
- Each MCP server gets unique `useMcp` hook instance for proper isolation
46+
- OAuth state parameter automatically handles multiple server differentiation
47+
48+
### State Persistence
49+
- Use localStorage for user preferences (model selection, server configurations)
50+
- Use sessionStorage for temporary state (single server URL in legacy components)
51+
- Clear related data when removing servers or models
52+
53+
### UI Indicators
54+
- Use emoji-based indicators (🧠 for models, 🔌 for MCP servers)
55+
- Format counts as `enabled/total` (e.g., "1/2 servers, 3/5 tools")
56+
- Place model selector on left, MCP servers on right for balance
57+
- Show "none" instead of red symbols for cleaner unconfigured states
58+
59+
### Component Organization
60+
- Keep disabled components in React tree but hidden with CSS (`{false && ...}`)
61+
- This prevents MCP connections from being destroyed when modals close
62+
- Use conditional rendering sparingly, prefer CSS visibility for stateful components
63+
64+
### Routing and OAuth
65+
- Use React Router for OAuth callback routes (`/oauth/callback`)
66+
- OAuth callback should match main app styling with loading indicators
67+
- use-mcp library handles multiple server OAuth flows automatically via state parameters
68+
69+
### Performance Considerations
70+
- Avoid animating gradients directly (causes repainting)
71+
- Use transform and filter animations (hardware accelerated)
72+
- Aggregate tools from multiple sources efficiently
73+
- Minimize localStorage reads in render loops

0 commit comments

Comments
 (0)