The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat: add email template preview (#20681)
Kang Mingcdf1159b3f08
diff --git a/apps/studio/components/interfaces/Auth/EmailTemplates/TemplateEditor.tsx b/apps/studio/components/interfaces/Auth/EmailTemplates/TemplateEditor.tsxindex 6041dbbf9f1..d43a845da55 100644--- a/apps/studio/components/interfaces/Auth/EmailTemplates/TemplateEditor.tsx+++ b/apps/studio/components/interfaces/Auth/EmailTemplates/TemplateEditor.tsx@@ -2,7 +2,16 @@ import { PermissionAction } from '@supabase/shared-types/out/constants'import { observer } from 'mobx-react-lite'import { useMemo, useState } from 'react'import ReactMarkdown from 'react-markdown'-import { Form, Input } from 'ui'+import {+ Form,+ IconCode,+ IconMonitor,+ Tabs,+ Input,+ Alert_Shadcn_,+ IconInfo,+ AlertTitle_Shadcn_,+} from 'ui'import CodeEditor from 'components/ui/CodeEditor'import { FormActions, FormSection, FormSectionContent, FormSectionLabel } from 'components/ui/Forms'@@ -38,7 +47,6 @@ const TemplateEditor = ({ template, authConfig }: TemplateEditorProps) => {const messageSlug = `MAILER_TEMPLATES_${id}_CONTENT`const messageProperty = properties[messageSlug]const [bodyValue, setBodyValue] = useState((authConfig && authConfig[messageSlug]) ?? '')-const onSubmit = (values: any, { resetForm }: any) => {const payload = { ...values }@@ -130,17 +138,35 @@ const TemplateEditor = ({ template, authConfig }: TemplateEditorProps) => {}/></div>- <div className="relative h-96">- <CodeEditor- id="code-id"- language="html"- isReadOnly={!canUpdateConfig}- className="!mb-0 h-96 overflow-hidden rounded border"- onInputChange={(e: string | undefined) => setBodyValue(e ?? '')}- options={{ wordWrap: 'off', contextmenu: false }}- value={bodyValue}- />- </div>+ <Tabs defaultActiveId="source" type="underlined" size="tiny">+ <Tabs.Panel id={'source'} icon={<IconCode />} label="Source">+ <div className="relative h-96">+ <CodeEditor+ id="code-id"+ language="html"+ isReadOnly={!canUpdateConfig}+ className="!mb-0 h-96 overflow-hidden rounded border"+ onInputChange={(e: string | undefined) => setBodyValue(e ?? '')}+ options={{ wordWrap: 'off', contextmenu: false }}+ value={bodyValue}+ />+ </div>+ </Tabs.Panel>+ <Tabs.Panel id={'preview'} icon={<IconMonitor />} label="Preview">+ <Alert_Shadcn_ className="mb-2" variant="default">+ <IconInfo strokeWidth={1.5} />+ <AlertTitle_Shadcn_>+ The preview may differ slightly from the actual rendering in the email+ client.+ </AlertTitle_Shadcn_>+ </Alert_Shadcn_>+ <iframe+ className="!mb-0 overflow-hidden h-96 w-full rounded border"+ title={id}+ srcDoc={bodyValue}+ />+ </Tabs.Panel>+ </Tabs></>)}<div className="col-span-12 flex w-full">