Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore: add variables helper text

Jonathan Summers-Muir9c4d862f04ff
diff --git a/studio/components/interfaces/Auth/EmailTemplates.tsx b/studio/components/interfaces/Auth/EmailTemplates.tsx
index 6f6ce831ecf..6eb68ecb67b 100644
--- a/studio/components/interfaces/Auth/EmailTemplates.tsx
+++ b/studio/components/interfaces/Auth/EmailTemplates.tsx
@@ -1,5 +1,6 @@
-import { Alert, Form, Input, InputNumber, Loading, Tabs, Toggle } from '@supabase/ui'
+import { Alert, Form, IconInfo, Input, InputNumber, Loading, Tabs, Toggle } from '@supabase/ui'
import CodeEditor from 'components/ui/CodeEditor'
+import InformationBox from 'components/ui/InformationBox'
import { useStore } from 'hooks'
import { toJS } from 'mobx'
import { observer } from 'mobx-react-lite'
@@ -168,18 +169,35 @@ const EmailTemplates = observer(() => {
})}
</FormSectionContent>
</FormSection>
- <FormSection className="grid-cols-12 !border-t-0">
+ <FormSection className="!mt-0 grid-cols-12 !border-t-0 !pt-0">
<FormSectionContent loading={!isLoaded} fullWidth>
{messageProperty && (
- <CodeEditor
- id="code-id"
- loading={!isLoaded}
- language="html"
- className="h-96 overflow-hidden rounded border"
- defaultValue={authConfig?.config?.[messageSlug] || ''}
- onInputChange={(e) => console.log(e)}
- options={{ wordWrap: 'off', contextmenu: false }}
- />
+ <>
+ <FormSectionLabel>
+ <span>{messageProperty.title}</span>
+ </FormSectionLabel>
+ <InformationBox
+ title={'Message variables'}
+ hideCollapse={false}
+ defaultVisibility={true}
+ description={
+ messageProperty.description && (
+ <ReactMarkdown>{messageProperty.description}</ReactMarkdown>
+ )
+ }
+ />
+ <div className="relative">
+ <CodeEditor
+ id="code-id"
+ loading={!isLoaded}
+ language="html"
+ className="!mb-0 h-96 overflow-hidden rounded border"
+ defaultValue={authConfig?.config?.[messageSlug] || ''}
+ onInputChange={(e) => console.log(e)}
+ options={{ wordWrap: 'off', contextmenu: false }}
+ />
+ </div>
+ </>
)}
<div className="col-span-12 flex w-full justify-between">
<FormActions
diff --git a/studio/components/ui/InformationBox.tsx b/studio/components/ui/InformationBox.tsx
index 7f3aa8e2dfa..27c3d0522cc 100644
--- a/studio/components/ui/InformationBox.tsx
+++ b/studio/components/ui/InformationBox.tsx
@@ -36,7 +36,7 @@ const InformationBox: FC<Props> = ({
<div className="flex flex-col px-4">
<div className="flex items-center justify-between">
<div className="flex w-full space-x-3 lg:items-center">
- <span className="text-scale-900">{icon}</span>
+ {icon && <span className="text-scale-900">{icon}</span>}
<div className="flex-grow">
<h5 className="text-scale-1200 text-sm">{title}</h5>
</div>
diff --git a/studio/stores/authConfig/schema/AuthProviders/AuthTemplatesValidation.tsx b/studio/stores/authConfig/schema/AuthProviders/AuthTemplatesValidation.tsx
index dba4447c81e..c452fe7b4bd 100644
--- a/studio/stores/authConfig/schema/AuthProviders/AuthTemplatesValidation.tsx
+++ b/studio/stores/authConfig/schema/AuthProviders/AuthTemplatesValidation.tsx
@@ -14,8 +14,12 @@ export const CONFIRMATION: FormSchema = {
type: 'string',
},
MAILER_TEMPLATES_CONFIRMATION_CONTENT: {
- title: 'Message',
+ title: 'Message body',
+ descriptionOptional: 'HTML body of your email',
type: 'code',
+ description: `
+- \`{{ .ConfirmationURL }}\` : URL to confirm the message
+`,
},
},
validationSchema: object().shape({
@@ -39,8 +43,12 @@ export const INVITE: FormSchema = {
type: 'string',
},
MAILER_TEMPLATES_INVITE_CONTENT: {
- title: 'Message',
+ title: 'Message body',
+ descriptionOptional: 'HTML body of your email',
type: 'code',
+ description: `
+- \`{{ .ConfirmationURL }}\` : URL to confirm the message
+`,
},
},
validationSchema: object().shape({
@@ -64,8 +72,12 @@ export const MAGIC_LINK: FormSchema = {
type: 'string',
},
MAILER_TEMPLATES_MAGIC_LINK_CONTENT: {
- title: 'Message',
+ title: 'Message body',
+ descriptionOptional: 'HTML body of your email',
type: 'code',
+ description: `
+- \`{{ .ConfirmationURL }}\` : URL to confirm the message
+`,
},
},
validationSchema: object().shape({
@@ -89,8 +101,12 @@ export const EMAIL_CHANGE: FormSchema = {
type: 'string',
},
MAILER_TEMPLATES_EMAIL_CHANGE_CONTENT: {
- title: 'Message',
+ title: 'Message body',
+ descriptionOptional: 'HTML body of your email',
type: 'code',
+ description: `
+- \`{{ .ConfirmationURL }}\` : URL to confirm the email change
+`,
},
},
validationSchema: object().shape({
@@ -114,8 +130,12 @@ export const RECOVERY: FormSchema = {
type: 'string',
},
MAILER_TEMPLATES_RECOVERY_CONTENT: {
- title: 'Message',
+ title: 'Message body',
+ descriptionOptional: 'HTML body of your email',
type: 'code',
+ description: `
+- \`{{ .ConfirmationURL }}\` : URL to confirm the password reset
+`,
},
},
validationSchema: object().shape({
@@ -134,17 +154,13 @@ export const SMS: FormSchema = {
type: 'object',
title: 'SMS Message',
properties: {
- SMS_VONAGE_FROM: {
- title: 'Subject heading',
- type: 'string',
- },
SMS_TEMPLATE: {
title: 'Message',
type: 'string',
+ description: 'To format the OPT code use `{{ .Code }}`',
},
},
validationSchema: object().shape({
- SMS_VONAGE_FROM: string().required('"Subject heading is required.'),
SMS_TEMPLATE: string().required('"SMS template is required.'),
}),
misc: {