import { useEffect, useRef, useState } from 'react'; import { useQuery, useQueryClient } from '@tanstack/react-query'; import { Mail, Reply } from 'lucide-react'; import { FileViewerProvider, FileViewerHeader, FileViewerBody } from 'officerdev'; import { Dialog, DialogContent, DialogTitle } from '@/components/ui/dialog'; import { useClient } from 'hooks/useClient'; import { useGlobal } from 'hooks/useGlobal'; import type { EmailMessage } from 'types'; import { useComposer, replyDraft } from './Compose'; type OpenAttachment = { filePath: string; fileName: string; root: string; }; const HtmlBody = ({ html }: { html: string }) => { const iframeRef = useRef(null); useEffect(() => { const iframe = iframeRef.current; if (!iframe) return; const doc = iframe.contentDocument; if (!doc) return; doc.open(); doc.write(` ${html} `); doc.close(); }, [html]); return