mirror of
https://github.com/documenso/documenso.git
synced 2025-11-10 04:22:32 +10:00
Improve the email sent to invite a user to approve/sign/assist/view a document. The current links "Reject Document" / "Sign Document" confuse some users as they think the document will be rejected/signed just by clicking on these buttons. This change makes it more clear that they will have a chance to view the document before they can reject/sign.
112 lines
3.9 KiB
TypeScript
112 lines
3.9 KiB
TypeScript
import { useLingui } from '@lingui/react';
|
|
import { Trans } from '@lingui/react/macro';
|
|
import { OrganisationType, RecipientRole } from '@prisma/client';
|
|
import { P, match } from 'ts-pattern';
|
|
|
|
import { RECIPIENT_ROLES_DESCRIPTION } from '@documenso/lib/constants/recipient-roles';
|
|
|
|
import { Button, Section, Text } from '../components';
|
|
import { TemplateDocumentImage } from './template-document-image';
|
|
|
|
export interface TemplateDocumentInviteProps {
|
|
inviterName: string;
|
|
inviterEmail: string;
|
|
documentName: string;
|
|
signDocumentLink: string;
|
|
assetBaseUrl: string;
|
|
role: RecipientRole;
|
|
selfSigner: boolean;
|
|
teamName?: string;
|
|
includeSenderDetails?: boolean;
|
|
organisationType?: OrganisationType;
|
|
}
|
|
|
|
export const TemplateDocumentInvite = ({
|
|
inviterName,
|
|
documentName,
|
|
signDocumentLink,
|
|
assetBaseUrl,
|
|
role,
|
|
selfSigner,
|
|
teamName,
|
|
includeSenderDetails,
|
|
organisationType,
|
|
}: TemplateDocumentInviteProps) => {
|
|
const { _ } = useLingui();
|
|
|
|
const { actionVerb } = RECIPIENT_ROLES_DESCRIPTION[role];
|
|
|
|
return (
|
|
<>
|
|
<TemplateDocumentImage className="mt-6" assetBaseUrl={assetBaseUrl} />
|
|
|
|
<Section>
|
|
<Text className="text-primary mx-auto mb-0 max-w-[80%] text-center text-lg font-semibold">
|
|
{match({ selfSigner, organisationType, includeSenderDetails, teamName })
|
|
.with({ selfSigner: true }, () => (
|
|
<Trans>
|
|
Please {_(actionVerb).toLowerCase()} your document
|
|
<br />"{documentName}"
|
|
</Trans>
|
|
))
|
|
.with(
|
|
{
|
|
organisationType: OrganisationType.ORGANISATION,
|
|
includeSenderDetails: true,
|
|
teamName: P.string,
|
|
},
|
|
() => (
|
|
<Trans>
|
|
{inviterName} on behalf of "{teamName}" has invited you to{' '}
|
|
{_(actionVerb).toLowerCase()}
|
|
<br />"{documentName}"
|
|
</Trans>
|
|
),
|
|
)
|
|
.with({ organisationType: OrganisationType.ORGANISATION, teamName: P.string }, () => (
|
|
<Trans>
|
|
{teamName} has invited you to {_(actionVerb).toLowerCase()}
|
|
<br />"{documentName}"
|
|
</Trans>
|
|
))
|
|
.otherwise(() => (
|
|
<Trans>
|
|
{inviterName} has invited you to {_(actionVerb).toLowerCase()}
|
|
<br />"{documentName}"
|
|
</Trans>
|
|
))}
|
|
</Text>
|
|
|
|
<Text className="my-1 text-center text-base text-slate-400">
|
|
{match(role)
|
|
.with(RecipientRole.SIGNER, () => <Trans>Continue by signing the document.</Trans>)
|
|
.with(RecipientRole.VIEWER, () => <Trans>Continue by viewing the document.</Trans>)
|
|
.with(RecipientRole.APPROVER, () => <Trans>Continue by approving the document.</Trans>)
|
|
.with(RecipientRole.CC, () => '')
|
|
.with(RecipientRole.ASSISTANT, () => (
|
|
<Trans>Continue by assisting with the document.</Trans>
|
|
))
|
|
.exhaustive()}
|
|
</Text>
|
|
|
|
<Section className="mb-6 mt-8 text-center">
|
|
<Button
|
|
className="bg-documenso-500 text-sbase inline-flex items-center justify-center rounded-lg px-6 py-3 text-center font-medium text-black no-underline"
|
|
href={signDocumentLink}
|
|
>
|
|
{match(role)
|
|
.with(RecipientRole.SIGNER, () => <Trans>View Document to sign</Trans>)
|
|
.with(RecipientRole.VIEWER, () => <Trans>View Document</Trans>)
|
|
.with(RecipientRole.APPROVER, () => <Trans>View Document to approve</Trans>)
|
|
.with(RecipientRole.CC, () => '')
|
|
.with(RecipientRole.ASSISTANT, () => <Trans>View Document to assist</Trans>)
|
|
.exhaustive()}
|
|
</Button>
|
|
</Section>
|
|
</Section>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default TemplateDocumentInvite;
|