InviteEmail.tsx 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. // @ts-nocheck
  2. import React from "react"
  3. import {
  4. Img,
  5. Row,
  6. Html,
  7. Link,
  8. Body,
  9. Head,
  10. Button,
  11. Column,
  12. Preview,
  13. Section,
  14. Container,
  15. } from "@jsx-email/all"
  16. import { Text, Fonts, Title, A, Span } from "../components"
  17. import {
  18. unit,
  19. body,
  20. frame,
  21. headingText,
  22. container,
  23. contentText,
  24. button,
  25. contentHighlightText,
  26. linkText,
  27. buttonText,
  28. } from "../styles"
  29. const CONSOLE_URL = "https://opencode.ai/"
  30. interface InviteEmailProps {
  31. inviter: string
  32. workspaceID: string
  33. workspaceName: string
  34. assetsUrl: string
  35. }
  36. export const InviteEmail = ({
  37. inviter = "test@anoma.ly",
  38. workspaceID = "wrk_01K6XFY7V53T8XN0A7X8G9BTN3",
  39. workspaceName = "anomaly",
  40. assetsUrl = `${CONSOLE_URL}email`,
  41. }: InviteEmailProps) => {
  42. const messagePlain = `${inviter} invited you to join the ${workspaceName} workspace.`
  43. const url = `${CONSOLE_URL}workspace/${workspaceID}`
  44. return (
  45. <Html lang="en">
  46. <Head>
  47. <Title>{`OpenCode — ${messagePlain}`}</Title>
  48. </Head>
  49. <Fonts assetsUrl={assetsUrl} />
  50. <Preview>{messagePlain}</Preview>
  51. <Body style={body} id={Math.random().toString()}>
  52. <Container style={container}>
  53. <Section style={frame}>
  54. <Row>
  55. <Column>
  56. <A href={`${CONSOLE_URL}zen`}>
  57. <Img height="32" alt="OpenCode Logo" src={`${assetsUrl}/logo.png`} />
  58. </A>
  59. </Column>
  60. </Row>
  61. <Section style={{ padding: `${unit * 2}px 0 0 0` }}>
  62. <Text style={headingText}>Join your team's OpenCode workspace</Text>
  63. <Text style={contentText}>
  64. You have been invited by <Span style={contentHighlightText}>{inviter}</Span> to join
  65. the <Span style={contentHighlightText}>{workspaceName}</Span> workspace on OpenCode.
  66. </Text>
  67. </Section>
  68. <Section style={{ padding: `${unit}px 0 0 0` }}>
  69. <Button style={button} href={url}>
  70. <Text style={buttonText}>
  71. Join workspace
  72. <Img
  73. width="24"
  74. height="24"
  75. src={`${assetsUrl}/right-arrow.png`}
  76. alt="Arrow right"
  77. />
  78. </Text>
  79. </Button>
  80. </Section>
  81. <Section style={{ padding: `${unit}px 0 0 0` }}>
  82. <Text style={contentText}>Button not working? Copy the following link...</Text>
  83. <Link href={url}>
  84. <Text style={linkText}>{url}</Text>
  85. </Link>
  86. </Section>
  87. </Section>
  88. </Container>
  89. </Body>
  90. </Html>
  91. )
  92. }
  93. export default InviteEmail