Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

3.5 KB
Raw Blame
import { DUB_WORDMARK, formatDate, pluralize } from "@dub/utils";
import {
  Body,
  Column,
  Container,
  Head,
  Heading,
  Html,
  Img,
  Link,
  Preview,
  Row,
  Section,
  Tailwind,
  Text,
} from "@react-email/components";
import { Footer } from "../components/footer";

export default function DomainRenewed({
  email = "[email protected]",
  workspace = {
    slug: "acme",
  },
  domains = [
    {
      slug: "getacme.link",
    },
    {
      slug: "example.link",
    },
  ],
  expiresAt = new Date(),
}: {
  email: string;
  workspace: {
    slug: string;
  };
  domains: {
    slug: string;
  }[];
  expiresAt: Date;
}) {
  const hasSingleDomain = domains.length === 1;

  return (
    <Html>
      <Head />
      <Preview>{pluralize("Domain", domains.length)} renewed</Preview>
      <Tailwind>
        <Body className="mx-auto my-auto bg-white font-sans">
          <Container className="mx-auto my-10 max-w-[600px] px-5 py-5">
            <Section className="mt-8">
              <Img src={DUB_WORDMARK} height="32" alt="Dub" />
            </Section>

            <Heading className="mx-0 mb-5 mt-10 p-0 text-lg font-semibold text-neutral-800">
              {pluralize("Domain", domains.length)} renewed
            </Heading>

            <Text className="text-sm leading-6 text-neutral-600">
              The following {pluralize("domain", domains.length)}{" "}
              {hasSingleDomain ? "has" : "have"} been successfully renewed for 1
              year:
            </Text>

            <Section>
              {domains.map((domain, index) => (
                <div key={index}>
                  <Row>
                    <Column align="left" className="text-sm font-medium">
                      <Link
                        href={`https://${domain.slug}`}
                        className="font-semibold text-black underline"
                      >
                        {domain.slug}
                      </Link>
                    </Column>
                  </Row>

                  {index !== domains.length - 1 && (
                    <div className="my-2 w-full" />
                  )}
                </div>
              ))}
            </Section>

            <Text className="text-sm leading-6 text-neutral-600">
              {hasSingleDomain ? "This domain is" : "These domains are"} now
              active until{" "}
              <span className="font-semibold text-black">
                {formatDate(expiresAt)}
              </span>
              .
            </Text>

            <Text className="text-sm leading-6 text-neutral-600">
              No further action is needed. If you don't want to renew your{" "}
              {pluralize("domain", domains.length)} next year, you can turn off
              auto-renewal in your{" "}
              <Link
                href={`https://app.dub.co/${workspace.slug}/settings/domains`}
                className="font-semibold text-black underline"
              >
                domain settings page
              </Link>
              .
            </Text>

            <Section className="my-10">
              <Link
                className="rounded-lg bg-black px-6 py-3 text-center text-[12px] font-semibold text-white no-underline"
                href={`https://app.dub.co/${workspace.slug}/settings/domains`}
              >
                Manage your {pluralize("domain", domains.length)}
              </Link>
            </Section>

            <Footer email={email} />
          </Container>
        </Body>
      </Tailwind>
    </Html>
  );
}