# Task 6: Chat Dialog Component
**File:** `www/app/(app)/transcripts/TranscriptChatModal.tsx`
**Lines:** ~90
**Dependencies:** Task 5 (hook interface)
## Objective
Create Chakra UI v3 Dialog component for chat interface.
## Implementation
```typescript
"use client"
import { useState } from "react"
import { Dialog, Box, Input, IconButton } from "@chakra-ui/react"
import { MessageCircle } from "lucide-react"
type Message = {
id: string
role: "user" | "assistant"
text: string
timestamp: Date
}
interface TranscriptChatModalProps {
open: boolean
onClose: () => void
messages: Message[]
sendMessage: (text: string) => void
isStreaming: boolean
currentStreamingText: string
}
export function TranscriptChatModal({
open,
onClose,
messages,
sendMessage,
isStreaming,
currentStreamingText,
}: TranscriptChatModalProps) {
const [input, setInput] = useState("")
const handleSend = () => {
if (!input.trim()) return
sendMessage(input)
setInput("")
}
return (
!e.open && onClose()}>
Transcript Chat
{messages.map((msg) => (
{msg.text}
))}
{isStreaming && (
{currentStreamingText}
▊
)}
setInput(e.target.value)}
onKeyDown={(e) => e.key === "Enter" && handleSend()}
placeholder="Ask about transcript..."
disabled={isStreaming}
/>
)
}
export function TranscriptChatButton({ onClick }: { onClick: () => void }) {
return (
)
}
```
## Validation
- [ ] Dialog opens/closes correctly
- [ ] Messages display (user: blue, assistant: gray)
- [ ] Streaming text shows with cursor
- [ ] Input disabled during streaming
- [ ] Enter key sends message
- [ ] Dialog scrolls with content
- [ ] Floating button positioned correctly
## Notes
- Test with mock data before connecting hook
- Verify Chakra v3 Dialog.Root API