The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
chore: standardize forms more
Jonathan Summers-Muir3441b5f2ca64
diff --git a/studio/components/ui/Forms/AutoSchemaForm.tsx b/studio/components/interfaces/Auth/AutoSchemaForm.tsxsimilarity index 89%rename from studio/components/ui/Forms/AutoSchemaForm.tsxrename to studio/components/interfaces/Auth/AutoSchemaForm.tsxindex 503b5de9a90..0dcde33f588 100644--- a/studio/components/ui/Forms/AutoSchemaForm.tsx+++ b/studio/components/interfaces/Auth/AutoSchemaForm.tsx@@ -1,5 +1,4 @@-import { Button, Form, Input, InputNumber, Toggle } from '@supabase/ui'-+import { Form, Input, InputNumber, Toggle } from '@supabase/ui'import { useStore } from 'hooks'import React from 'react'import { boolean, number, object, string } from 'yup'@@ -10,10 +9,10 @@ import {FormSection,FormSectionContent,FormSectionLabel,-} from './'+} from '../../ui/Forms'const AutoSchemaForm = () => {- const { authConfig } = useStore()+ const { authConfig, ui } = useStore()const INITIAL_VALUES = {DISABLE_SIGNUP: !authConfig.config.DISABLE_SIGNUP,@@ -45,8 +44,16 @@ const AutoSchemaForm = () => {setSubmitting(true)await authConfig.update(payload)setSubmitting(false)+ ui.setNotification({+ category: 'success',+ message: `Updated settings`,+ })resetForm({ values: values, initialValues: values })} catch (error) {+ ui.setNotification({+ category: 'error',+ message: `Failed to update settings`,+ })setSubmitting(false)}}}@@ -56,25 +63,21 @@ const AutoSchemaForm = () => {const hasChanges = JSON.stringify(values) !== JSON.stringify(initialValues)return (<>- <Button onClick={() => handleReset()} htmlType="button">- reset form- </Button><FormHeadertitle="General settings"description={`URLs that auth providers are permitted to redirect to post authentication`}/>-<FormPaneldisabled={true}footer={- <>+ <div className="flex justify-between py-4 px-8"><FormActionshandleReset={handleReset}isSubmitting={isSubmitting}hasChanges={hasChanges}+ helper={'Learn more about global Auth settings'}/>- {hasChanges && 'Need to save changes'}- </>+ </div>}><FormSection header={<FormSectionLabel>User Signups</FormSectionLabel>}>diff --git a/studio/components/ui/Forms/FormActions.tsx b/studio/components/ui/Forms/FormActions.tsxindex 875f4ef5181..5fb2e8dcd20 100644--- a/studio/components/ui/Forms/FormActions.tsx+++ b/studio/components/ui/Forms/FormActions.tsx@@ -9,25 +9,34 @@ interface Props {* Handling a reset/cancel of the form*/handleReset: () => void-+ /**+ * Disables submit button if false+ */hasChanges: boolean | undefined+ /**+ * Helper text to show alongside actions+ */+ helper?: React.ReactNode}-const FormActions = ({ isSubmitting, handleReset, hasChanges = undefined }: Props) => {+const FormActions = ({ isSubmitting, handleReset, hasChanges = undefined, helper }: Props) => {return (- <div className="flex justify-end gap-2 py-3 px-6">- <Button type="default" htmlType="reset" onClick={() => handleReset()}>- Cancel- </Button>- <Button- disabled={!hasChanges && hasChanges !== undefined}- loading={isSubmitting}- type="primary"- htmlType="submit"- form="auth-config-general-form"- >- Save- </Button>+ <div className="flex w-full items-center justify-between gap-2">+ {helper && <span className="text-scale-900 text-xs">{helper}</span>}+ <div className="flex justify-between gap-2">+ <Button type="default" htmlType="reset" onClick={() => handleReset()}>+ Cancel+ </Button>+ <Button+ disabled={!hasChanges && hasChanges !== undefined}+ loading={isSubmitting}+ type="primary"+ htmlType="submit"+ form="auth-config-general-form"+ >+ Save+ </Button>+ </div></div>)}diff --git a/studio/components/ui/Forms/index.tsx b/studio/components/ui/Forms/index.tsxindex 900d9963b4f..9f129950e45 100644--- a/studio/components/ui/Forms/index.tsx+++ b/studio/components/ui/Forms/index.tsx@@ -1,5 +1,5 @@export * from './FormsContainer'-export * from './AutoSchemaForm'+export * from '../../interfaces/Auth/AutoSchemaForm'export * from './FormHeader'export * from './FormSection'export * from './FormPanel'diff --git a/studio/pages/project/[ref]/auth/settings-new-all.tsx b/studio/pages/project/[ref]/auth/settings-new-all.tsxindex b2f58aee8c4..1420dff35e1 100644--- a/studio/pages/project/[ref]/auth/settings-new-all.tsx+++ b/studio/pages/project/[ref]/auth/settings-new-all.tsx@@ -15,7 +15,7 @@ import {Toggle,} from '@supabase/ui'import { AuthLayout } from 'components/layouts'-import AutoSchemaForm from 'components/ui/Forms/AutoSchemaForm'+import AutoSchemaForm from 'components/interfaces/Auth/AutoSchemaForm'import { withAuth } from 'hooks'import { observer } from 'mobx-react-lite'import React, { useReducer, useState } from 'react'diff --git a/studio/pages/project/[ref]/auth/templates-new.tsx b/studio/pages/project/[ref]/auth/templates-new.tsxindex 7ce5ea5c41d..2d6156c1129 100644--- a/studio/pages/project/[ref]/auth/templates-new.tsx+++ b/studio/pages/project/[ref]/auth/templates-new.tsx@@ -15,7 +15,7 @@ import {Toggle,} from '@supabase/ui'import { AuthLayout } from 'components/layouts'-import AutoSchemaForm from 'components/ui/Forms/AutoSchemaForm'+import AutoSchemaForm from 'components/interfaces/Auth/AutoSchemaForm'import { withAuth } from 'hooks'import { observer } from 'mobx-react-lite'import React, { useReducer, useState } from 'react'