// @flow import * as React from "react"; import { Table, TBody, TR, TD } from "oy-vey"; import { User, Document, Revision, Team, Collection } from "../models"; import EmailTemplate from "./components/EmailLayout"; import Body from "./components/Body"; import Button from "./components/Button"; import Heading from "./components/Heading"; import Header from "./components/Header"; import Footer from "./components/Footer"; import EmptySpace from "./components/EmptySpace"; import { compactedDiff } from "../utils/diff"; import theme from "../../shared/styles/theme"; export type Props = { actor: User, team: Team, document: Document, previous: Revision, collection: Collection, eventName: string, unsubscribeUrl: string, }; export const documentNotificationEmailText = ({ actor, team, document, collection, eventName = "published", }: Props) => ` "${document.title}" ${eventName} ${actor.name} ${eventName} the document "${document.title}", in the ${ collection.name } collection. Open Document: ${team.url}${document.url} `; export const DocumentNotificationEmail = ({ actor, team, document, previous, collection, eventName = "published", unsubscribeUrl, }: Props) => { const diffHtml = compactedDiff( previous ? previous.toMarkdown() : "", document.toMarkdown() ); return (
"{document.title}" {eventName} {!!diffHtml && ( )}
{actor.name} {eventName} the document