import Placeholder from "react-bootstrap/Placeholder"; import React from "react"; import Stack from "react-bootstrap/Stack"; import Client from "./client/Client"; import { IAccount, IEmail } from "./client/types"; type EmailContentProps = { account: IAccount | null; client: Client | null; email: IEmail | null; emailId: string; }; type EmailContentState = {}; class EmailContent extends React.Component< EmailContentProps, EmailContentState > { componentDidMount() { this.ensureData(); } componentDidUpdate() { this.ensureData(); } ensureData() { if (this.props.account == null) return; if (this.props.client == null) return; this.props.client.ensureEmailContent( this.props.account.id, this.props.emailId, ); } render() { const email = this.props.email; if (email == null || email.bodyValues == null) { return ; } else if (email.textBody != null) { return (
  • {email.receivedAt}
  • {email.textBody.map((t) => t.partId === undefined ? ( ) : (
    ), )} ); } else if (email.htmlBody != null) { return ( {email.htmlBody.map((h) => h.partId === undefined ? ( ) : (
    ), )} ); } else { return

    Nothing to display :/

    ; } } } export default EmailContent;