Files
metabuilder/fakemui/react/components/email/surfaces/MessageThread.tsx
johndoe6345789 89f83a7476 Organize fakemui folder: email components complete, docs consolidated
- Email components (Phase 2 COMPLETE):
  * Fixed 18 broken imports: @metabuilder/fakemui/hooks → ../../../src/utils/useAccessible
  * Renamed email-wip/ → email/ (production-ready)
  * Enabled exports in react/components/index.ts
  * All 22 email components now production-ready (1244 lines)

- Cleanup:
  * Removed wip/ directory (duplicate of src/utils/accessibility)
  * Preserved 15 Python/PyQt6 implementation files (full implementations, not stubs)
  * Moved 7 markdown files to fakemui/docs/ (better organization)

- Documentation:
  * Updated CLAUDE.md: Phase 2 email complete, added deletion safety gotcha
  * Created plan: txt/FAKEMUI_REORGANIZATION_PLAN_2026-02-01.txt

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 20:18:49 +00:00

55 lines
1.5 KiB
TypeScript

// fakemui/react/components/email/surfaces/MessageThread.tsx
import React, { forwardRef } from 'react'
import { Box, BoxProps, Typography, Card } from '..'
import { useAccessible } from '../../../src/utils/useAccessible'
export interface MessageThreadProps extends BoxProps {
messages: Array<{
id: string
from: string
subject: string
body: string
receivedAt: number
isStarred?: boolean
}>
testId?: string
}
export const MessageThread = forwardRef<HTMLDivElement, MessageThreadProps>(
({ messages, testId: customTestId, ...props }, ref) => {
const accessible = useAccessible({
feature: 'email',
component: 'thread',
identifier: customTestId || 'thread'
})
return (
<Box
ref={ref}
className="message-thread"
{...accessible}
{...props}
>
{messages.map((message, index) => (
<Card
key={message.id}
className={`message-item ${index === messages.length - 1 ? 'message-item--latest' : ''}`}
>
<Box className="message-header">
<Typography variant="subtitle2">{message.from}</Typography>
<Typography variant="caption">
{new Date(message.receivedAt).toLocaleString()}
</Typography>
</Box>
<Typography variant="body2" className="message-body">
{message.body}
</Typography>
</Card>
))}
</Box>
)
}
)
MessageThread.displayName = 'MessageThread'