import Placeholder from "react-bootstrap/Placeholder";
import React from "react";
import Stack from "react-bootstrap/Stack";

import { IAccount, IEmail, IMailbox } from "./client/types";
import Client from "./client/Client";
import EmailContent from "./EmailContent";
import EmailList from "./EmailList";

type EmailContentTextProps = {
	email: IEmail;
};

const EmailContentText: React.FC<EmailContentTextProps> = (props) => {
	const email = props.email;
	if (email.textBody == null) {
		return <Placeholder />;
	}
	return (
		<Stack>
			<pre>
				{email.textBody.map((t) =>
					t.partId === undefined ? (
						<Placeholder />
					) : (
						<div
							key={t.partId}
							dangerouslySetInnerHTML={{
								__html: email.bodyValues![t.partId].value,
							}}
						/>
					),
				)}
			</pre>
		</Stack>
	);
};
export default EmailContentText;
