InviteEmail.tsx 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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 } 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. workspace: string
  25. assetsUrl: string
  26. }
  27. export const InviteEmail = ({ workspace, assetsUrl = LOCAL_ASSETS_URL }: InviteEmailProps) => {
  28. const subject = `Join the ${workspace} workspace`
  29. const messagePlain = `You've been invited to join the ${workspace} workspace in the OpenCode Zen Console.`
  30. const url = `${CONSOLE_URL}workspace/${workspace}`
  31. return (
  32. <Html lang="en">
  33. <Head>
  34. <Title>{`OpenCode Zen — ${messagePlain}`}</Title>
  35. </Head>
  36. <Fonts assetsUrl={assetsUrl} />
  37. <Preview>{messagePlain}</Preview>
  38. <Body style={body} id={Math.random().toString()}>
  39. <Container style={container}>
  40. <Section style={frame}>
  41. <Row>
  42. <Column>
  43. <A href={CONSOLE_URL}>
  44. <Img height="32" alt="OpenCode Zen Logo" src={`${assetsUrl}/zen-logo.png`} />
  45. </A>
  46. </Column>
  47. <Column align="right">
  48. <Button style={buttonPrimary} href={url}>
  49. <Span style={code}>Join Workspace</Span>
  50. </Button>
  51. </Column>
  52. </Row>
  53. <Row style={headingHr}>
  54. <Column>
  55. <Hr />
  56. </Column>
  57. </Row>
  58. <Section>
  59. <Text style={{ ...compactText, ...breadcrumb }}>
  60. <Span>OpenCode Zen</Span>
  61. <Span style={{ ...code, ...breadcrumbColonSeparator }}>:</Span>
  62. <Span>{workspace}</Span>
  63. </Text>
  64. <Text style={{ ...heading, ...compactText }}>
  65. <Link href={url}>
  66. <SplitString text={subject} split={40} />
  67. </Link>
  68. </Text>
  69. </Section>
  70. <Section style={{ padding: `${unit}px 0 0 0` }}>
  71. <Text style={{ ...compactText }}>
  72. You've been invited to join the{" "}
  73. <Link style={medium} href={url}>
  74. {workspace}
  75. </Link>{" "}
  76. workspace in the{" "}
  77. <Link style={medium} href={CONSOLE_URL}>
  78. OpenCode Zen Console
  79. </Link>
  80. .
  81. </Text>
  82. </Section>
  83. <Row style={headingHr}>
  84. <Column>
  85. <Hr />
  86. </Column>
  87. </Row>
  88. <Row>
  89. <Column>
  90. <Link href={CONSOLE_URL} style={footerLink}>
  91. Console
  92. </Link>
  93. </Column>
  94. <Column align="right">
  95. <Link style={footerLink} href={DOC_URL}>
  96. About
  97. </Link>
  98. </Column>
  99. </Row>
  100. </Section>
  101. </Container>
  102. </Body>
  103. </Html>
  104. )
  105. }
  106. export default InviteEmail