courrier clean 2

This commit is contained in:
alma 2025-04-26 11:52:42 +02:00
parent 638a2ee895
commit 6bacfa28da

View File

@ -83,7 +83,7 @@ export default function ComposeEmail({
onSend, onSend,
onCancel onCancel
}: ComposeEmailProps) { }: ComposeEmailProps) {
const [sending, setSending] = useState(false); const [isSending, setIsSending] = useState(false);
const editorRef = useRef<HTMLDivElement>(null); const editorRef = useRef<HTMLDivElement>(null);
const fileInputRef = useRef<HTMLInputElement>(null); const fileInputRef = useRef<HTMLInputElement>(null);
const composeBodyRef = useRef<HTMLDivElement>(null); const composeBodyRef = useRef<HTMLDivElement>(null);
@ -307,7 +307,7 @@ export default function ComposeEmail({
<div className="flex gap-2"> <div className="flex gap-2">
<Button <Button
variant="outline" variant="outline"
onClick={handleFileSelection} onClick={() => fileInputRef.current?.click()}
className="flex items-center gap-1 bg-white" className="flex items-center gap-1 bg-white"
> >
<Paperclip className="h-4 w-4" /> <Paperclip className="h-4 w-4" />
@ -322,26 +322,21 @@ export default function ComposeEmail({
/> />
</div> </div>
<Button <Button
onClick={async () => { onClick={handleSend}
setSending(true); disabled={isSending || !composeTo.trim()}
try {
await handleSend();
onCancel();
} catch (error) {
console.error('Error sending email:', error);
} finally {
setSending(false);
}
}}
disabled={sending || !composeTo.trim()}
className="flex items-center gap-2" className="flex items-center gap-2"
> >
{sending ? ( {isSending ? (
<Loader2 className="h-4 w-4 animate-spin" /> <>
<Loader2 className="h-4 w-4 mr-1 animate-spin" />
Sending...
</>
) : ( ) : (
<SendHorizontal className="h-4 w-4" /> <>
<SendHorizontal className="h-4 w-4 mr-1" />
Send
</>
)} )}
Send
</Button> </Button>
</CardFooter> </CardFooter>
</Card> </Card>