InviteEmail.tsx 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. // @ts-nocheck
  2. import React from "react"
  3. import { Img, Row, Html, Link, Body, Head, Button, Column, Preview, Section, Container } from "@jsx-email/all"
  4. import { Hr, Text, Fonts, SplitString, Title, A, Span, B } from "../components"
  5. import {
  6. unit,
  7. body,
  8. code,
  9. frame,
  10. medium,
  11. heading,
  12. container,
  13. headingHr,
  14. footerLink,
  15. breadcrumb,
  16. compactText,
  17. buttonPrimary,
  18. breadcrumbColonSeparator,
  19. } from "../styles"
  20. const LOCAL_ASSETS_URL = "/static"
  21. const CONSOLE_URL = "https://opencode.ai/"
  22. const DOC_URL = "https://opencode.ai/docs/zen"
  23. interface InviteEmailProps {
  24. inviter: string
  25. workspaceID: string
  26. workspaceName: string
  27. assetsUrl: string
  28. }
  29. export const InviteEmail = ({
  30. inviter = "test@anoma.ly",
  31. workspaceID = "wrk_01K6XFY7V53T8XN0A7X8G9BTN3",
  32. workspaceName = "anomaly",
  33. assetsUrl = LOCAL_ASSETS_URL,
  34. }: InviteEmailProps) => {
  35. const subject = `You've been invited to join the ${workspaceName} workspace on OpenCode Console`
  36. const messagePlain = `${inviter} invited you to join the ${workspaceName} workspace.`
  37. const url = `${CONSOLE_URL}workspace/${workspaceID}`
  38. return (
  39. <Html lang="en">
  40. <Head>
  41. <Title>{`OpenCode — ${messagePlain}`}</Title>
  42. </Head>
  43. <Fonts assetsUrl={assetsUrl} />
  44. <Preview>{messagePlain}</Preview>
  45. <Body style={body} id={Math.random().toString()}>
  46. <Container style={container}>
  47. <Section style={frame}>
  48. <Row>
  49. <Column>
  50. <A href={`${CONSOLE_URL}zen`}>
  51. <Img height="32" alt="OpenCode Logo" src={`${assetsUrl}/logo.png`} />
  52. </A>
  53. </Column>
  54. </Row>
  55. <Row style={headingHr}>
  56. <Column>
  57. <Hr />
  58. </Column>
  59. </Row>
  60. <Section style={{ padding: `${unit}px 0 0 0` }}>
  61. <Text style={{ ...compactText }}>
  62. <B>{inviter}</B> invited you to join the{" "}
  63. <Link style={medium} href={url}>
  64. <B>{workspaceName}</B>
  65. </Link>{" "}
  66. workspace in the{" "}
  67. <Link style={medium} href={`${CONSOLE_URL}zen`}>
  68. OpenCode Console
  69. </Link>
  70. .
  71. </Text>
  72. </Section>
  73. <Section style={{ padding: `${unit}px 0 0 0` }}>
  74. <Button style={buttonPrimary} href={url}>
  75. <Span style={code}>Join Workspace</Span>
  76. </Button>
  77. </Section>
  78. <Row style={headingHr}>
  79. <Column>
  80. <Hr />
  81. </Column>
  82. </Row>
  83. <Row>
  84. <Column>
  85. <Link href={`${CONSOLE_URL}zen`} style={footerLink}>
  86. Console
  87. </Link>
  88. </Column>
  89. <Column align="right">
  90. <Link style={footerLink} href={DOC_URL}>
  91. About
  92. </Link>
  93. </Column>
  94. </Row>
  95. </Section>
  96. </Container>
  97. </Body>
  98. </Html>
  99. )
  100. }
  101. export default InviteEmail