"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
t[p[i]] = s[p[i]];
return t;
};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const gloss_1 = require("gloss");
const React = __importStar(require("react"));
const RoundButtonSmall_1 = require("../buttons/RoundButtonSmall");
const Space_1 = require("../Space");
const DateFormat_1 = require("../text/DateFormat");
const HighlightText_1 = require("../text/HighlightText");
const Text_1 = require("../text/Text");
function ThreadMessage({ date, participants, body }) {
return (React.createElement(Message, null,
React.createElement(Text_1.Text, { fontWeight: 500, size: 0.9, alpha: 0.8 },
React.createElement(DateFormat_1.DateFormat, { date: new Date(date) })),
React.createElement(Space_1.Space, null),
React.createElement(MessageHeader, null, participants
.filter(x => x.type === 'from')
.map(({ name, email }, index) => (React.createElement(React.Fragment, { key: index },
React.createElement(RoundButtonSmall_1.RoundButtonSmall, { key: index, tooltip: email, tooltipProps: {
noHoverOnChildren: false,
} }, name),
React.createElement(Space_1.Space, null))))),
React.createElement(Space_1.Space, null),
React.createElement(MailBody, null, body)));
}
exports.ThreadMessage = ThreadMessage;
const Message = gloss_1.gloss({
padding: 15,
borderBottom: [1, 'dotted', '#eee'],
});
const Paragraph = gloss_1.gloss(HighlightText_1.HighlightText, {
marginBottom: '0.35rem',
userSelect: 'auto',
});
Paragraph.defaultProps = {
className: 'markdown',
};
const MessageHeader = gloss_1.gloss({
flexFlow: 'row',
});
const Block = gloss_1.gloss({
display: 'block',
'& div': {
display: 'block',
},
});
const MailBody = (_a) => {
var { children } = _a, props = __rest(_a, ["children"]);
return (React.createElement(Text_1.Text, null,
React.createElement(Block, Object.assign({ className: "gmail-body" }, props, { dangerouslySetInnerHTML: { __html: children } }))));
};
//# sourceMappingURL=ThreadMessage.js.map