Files
metabuilder/fakemui/react/components/email/surfaces/ComposeWindow.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

91 lines
2.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// fakemui/react/components/email/surfaces/ComposeWindow.tsx
import React, { forwardRef, useState } from 'react'
import { Box, BoxProps, Button, Card } from '..'
import { useAccessible } from '../../../src/utils/useAccessible'
import { EmailAddressInput, RecipientInput, BodyEditor } from '../inputs'
export interface ComposeWindowProps extends BoxProps {
onSend?: (data: { to: string[]; cc?: string[]; bcc?: string[]; subject: string; body: string }) => void
onClose?: () => void
testId?: string
}
export const ComposeWindow = forwardRef<HTMLDivElement, ComposeWindowProps>(
({ onSend, onClose, testId: customTestId, ...props }, ref) => {
const [to, setTo] = useState<string[]>([])
const [cc, setCc] = useState<string[]>([])
const [bcc, setBcc] = useState<string[]>([])
const [subject, setSubject] = useState('')
const [body, setBody] = useState('')
const accessible = useAccessible({
feature: 'email',
component: 'compose',
identifier: customTestId || 'compose'
})
const handleSend = () => {
if (to.length > 0 && subject && body) {
onSend?.({ to, cc, bcc, subject, body })
}
}
return (
<Card
ref={ref}
className="compose-window"
{...accessible}
{...props}
>
<Box className="compose-header">
<h2>Compose Email</h2>
<button onClick={onClose} className="close-btn">
×
</button>
</Box>
<Box className="compose-body">
<RecipientInput
recipientType="to"
recipients={to}
onRecipientsChange={setTo}
placeholder="To:"
/>
<RecipientInput
recipientType="cc"
recipients={cc}
onRecipientsChange={setCc}
placeholder="Cc:"
/>
<RecipientInput
recipientType="bcc"
recipients={bcc}
onRecipientsChange={setBcc}
placeholder="Bcc:"
/>
<input
type="text"
placeholder="Subject"
value={subject}
onChange={(e) => setSubject(e.target.value)}
className="compose-subject"
/>
<BodyEditor
value={body}
onChange={(e) => setBody(e.target.value)}
/>
</Box>
<Box className="compose-footer">
<Button variant="primary" onClick={handleSend}>
Send
</Button>
<Button variant="outline" onClick={onClose}>
Cancel
</Button>
</Box>
</Card>
)
}
)
ComposeWindow.displayName = 'ComposeWindow'