Skip to content

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

Update sign in animation

Joshen Lim905bded8d292
diff --git a/studio/components/interfaces/SignIn/SignUpForm.tsx b/studio/components/interfaces/SignIn/SignUpForm.tsx
index f51fea6ff94..f477257c42f 100644
--- a/studio/components/interfaces/SignIn/SignUpForm.tsx
+++ b/studio/components/interfaces/SignIn/SignUpForm.tsx
@@ -1,12 +1,12 @@
+import * as yup from 'yup'
+import { useRef, useState } from 'react'
import HCaptcha from '@hcaptcha/react-hcaptcha'
+import { Alert, Button, Form, IconEye, IconEyeOff, Input } from 'ui'
+
import { useStore } from 'hooks'
import { post } from 'lib/common/fetch'
import { API_URL } from 'lib/constants'
import { passwordSchema } from 'lib/schemas'
-import { useRouter } from 'next/router'
-import { useRef, useState } from 'react'
-import { Button, Form, IconEye, IconEyeOff, Input } from 'ui'
-import * as yup from 'yup'
import PasswordConditionsHelper from './PasswordConditionsHelper'
const signUpSchema = passwordSchema.shape({
@@ -15,10 +15,10 @@ const signUpSchema = passwordSchema.shape({
const SignUpForm = () => {
const { ui } = useStore()
- const router = useRouter()
-
- const [captchaToken, setCaptchaToken] = useState<string | null>(null)
const captchaRef = useRef<HCaptcha>(null)
+ const [isSubmitted, setIsSubmitted] = useState(false)
+ const [passwordHidden, setPasswordHidden] = useState(true)
+ const [captchaToken, setCaptchaToken] = useState<string | null>(null)
const onSignUp = async ({ email, password }: { email: string; password: string }) => {
const toastId = ui.setNotification({
@@ -45,13 +45,7 @@ const SignUpForm = () => {
const error = response.error
if (!error) {
- ui.setNotification({
- id: toastId,
- category: 'success',
- message: `Signed successfully! Please confirm your email before signing in`,
- })
-
- await router.push('/sign-up/success')
+ setIsSubmitted(true)
} else {
setCaptchaToken(null)
captchaRef.current?.resetCaptcha()
@@ -64,76 +58,89 @@ const SignUpForm = () => {
}
}
- const [passwordHidden, setPasswordHidden] = useState(true)
-
return (
- <Form
- validateOnBlur
- id="signUp-form"
- initialValues={{ email: '', password: '' }}
- validationSchema={signUpSchema}
- onSubmit={onSignUp}
- >
- {({ isSubmitting, values }: { isSubmitting: boolean; values: any }) => {
- return (
- <div className="flex flex-col gap-4">
- <Input
- id="email"
- name="email"
- type="email"
- label="Email"
- placeholder="[email protected]"
- disabled={isSubmitting}
- autoComplete="email"
- />
-
- <Input
- id="password"
- name="password"
- type={passwordHidden ? 'password' : 'text'}
- label="Password"
- placeholder="&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;"
- disabled={isSubmitting}
- autoComplete="new-password"
- actions={
- <Button
- icon={passwordHidden ? <IconEye /> : <IconEyeOff />}
- type="default"
- onClick={() => setPasswordHidden((prev) => !prev)}
- />
- }
- />
-
- <PasswordConditionsHelper password={values.password} />
+ <div className="relative">
+ <div
+ className={`absolute top-0 duration-500 delay-300 w-full ${
+ isSubmitted ? 'opacity-100' : 'opacity-0'
+ }`}
+ >
+ <Alert className="w-full" withIcon variant="success" title="Successfully signed up">
+ Please check your email to confirm your account before signing in to the Supabase
+ dashboard
+ </Alert>
+ </div>
+ <Form
+ validateOnBlur
+ id="signUp-form"
+ className={`w-full py-1 transition-all overflow-y-hidden duration-500 ${
+ isSubmitted ? 'max-h-[100px] opacity-0 pointer-events-none' : 'max-h-[1000px] opacity-100'
+ }`}
+ initialValues={{ email: '', password: '' }}
+ validationSchema={signUpSchema}
+ onSubmit={onSignUp}
+ >
+ {({ isSubmitting, values }: { isSubmitting: boolean; values: any }) => {
+ return (
+ <div className="flex flex-col gap-4">
+ <Input
+ id="email"
+ name="email"
+ type="email"
+ label="Email"
+ placeholder="[email protected]"
+ disabled={isSubmitting}
+ autoComplete="email"
+ />
- <div className="self-center">
- <HCaptcha
- ref={captchaRef}
- sitekey={process.env.NEXT_PUBLIC_HCAPTCHA_SITE_KEY!}
- size="invisible"
- onVerify={(token) => {
- setCaptchaToken(token)
- }}
- onExpire={() => {
- setCaptchaToken(null)
- }}
+ <Input
+ id="password"
+ name="password"
+ type={passwordHidden ? 'password' : 'text'}
+ label="Password"
+ placeholder="&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;"
+ disabled={isSubmitting}
+ autoComplete="new-password"
+ actions={
+ <Button
+ icon={passwordHidden ? <IconEye /> : <IconEyeOff />}
+ type="default"
+ onClick={() => setPasswordHidden((prev) => !prev)}
+ />
+ }
/>
- </div>
- <Button
- block
- form="signUp-form"
- htmlType="submit"
- size="large"
- disabled={isSubmitting}
- loading={isSubmitting}
- >
- Sign Up
- </Button>
- </div>
- )
- }}
- </Form>
+ <PasswordConditionsHelper password={values.password} />
+
+ <div className="self-center">
+ <HCaptcha
+ ref={captchaRef}
+ sitekey={process.env.NEXT_PUBLIC_HCAPTCHA_SITE_KEY!}
+ size="invisible"
+ onVerify={(token) => {
+ setCaptchaToken(token)
+ }}
+ onExpire={() => {
+ setCaptchaToken(null)
+ }}
+ />
+ </div>
+
+ <Button
+ block
+ form="signUp-form"
+ htmlType="submit"
+ size="large"
+ disabled={isSubmitting}
+ loading={isSubmitting}
+ >
+ Sign Up
+ </Button>
+ </div>
+ )
+ }}
+ </Form>
+ </div>
)
}
diff --git a/studio/pages/sign-up/index.tsx b/studio/pages/sign-up.tsx
similarity index 100%
rename from studio/pages/sign-up/index.tsx
rename to studio/pages/sign-up.tsx
diff --git a/studio/pages/sign-up/success.tsx b/studio/pages/sign-up/success.tsx
deleted file mode 100644
index 0a491df7e8e..00000000000
--- a/studio/pages/sign-up/success.tsx
+++ /dev/null
@@ -1,195 +0,0 @@
-import { ForgotPasswordLayout } from 'components/layouts'
-import Link from 'next/link'
-import { PropsWithChildren } from 'react'
-import { NextPageWithLayout } from 'types'
-import { IconCheckCircle, IconExternalLink } from 'ui'
-
-const SignUpSuccess: NextPageWithLayout = () => {
- return (
- <div className="flex flex-col gap-8">
- <div>
- <h1 className="text-2xl lg:text-3xl mt-8 mb-2 flex items-center gap-2">
- <IconCheckCircle /> Signed up successfully
- </h1>
- <h2 className="text-scale-1100 text-sm">Please confirm your email before signing in</h2>
- </div>
-
- <div className="flex flex-wrap justify-between items-center gap-2">
- {/* Gmail */}
- <EmailIconLink href="https://mail.google.com/mail/u/0/#inbox">
- {GMAIL_SVG_ICON}
- </EmailIconLink>
-
- {/* Outlook */}
- <EmailIconLink href="https://outlook.live.com/mail/0/">{OUTLOOK_SVG_ICON}</EmailIconLink>
-
- {/* Yahoo */}
- <EmailIconLink href="https://mail.yahoo.com/">{YAHOO_SVG_ICON}</EmailIconLink>
- </div>
-
- <div className="text-sm">
- <span className="text-scale-1100">Return to</span>{' '}
- <Link href="/sign-in">
- <a className="underline hover:text-scale-1100 transition">Sign In</a>
- </Link>
- </div>
- </div>
- )
-}
-
-SignUpSuccess.getLayout = (page) => (
- <ForgotPasswordLayout
- heading="Signed up successfully"
- subheading="Please confirm your email before signing in"
- showHeadings={false}
- >
- {page}
- </ForgotPasswordLayout>
-)
-
-export default SignUpSuccess
-
-type EmailIconLinkProps = {
- href: string
-}
-
-const EmailIconLink = ({ href, children }: PropsWithChildren<EmailIconLinkProps>) => {
- return (
- <a
- href={href}
- target="_blank"
- rel="noopener noreferrer"
- className="relative border border-scale-700 rounded py-3 px-6 bg-scale-300 shadow transition-all hover:shadow-lg hover:bg-scale-500"
- >
- <IconExternalLink
- width={14}
- height={14}
- className="absolute top-0.5 right-0.5 text-scale-1000"
- />
- {children}
- </a>
- )
-}
-
-const GMAIL_SVG_ICON = (
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="52 42 88 66" className="w-14 h-14">
- <path fill="#4285f4" d="M58 108h14V74L52 59v43c0 3.32 2.69 6 6 6" />
- <path fill="#34a853" d="M120 108h14c3.32 0 6-2.69 6-6V59l-20 15" />
- <path fill="#fbbc04" d="M120 48v26l20-15v-8c0-7.42-8.47-11.65-14.4-7.2" />
- <path fill="#ea4335" d="M72 74V48l24 18 24-18v26L96 92" />
- <path fill="#c5221f" d="M52 51v8l20 15V48l-5.6-4.2C60.46 39.35 52 43.58 52 51" />
- </svg>
-)
-
-const OUTLOOK_SVG_ICON = (
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1831.085 1703.335" className="w-14 h-14">
- <path
- fill="#0A2767"
- d="M1831.083 894.25a40.879 40.879 0 00-19.503-35.131h-.213l-.767-.426-634.492-375.585a86.175 86.175 0 00-8.517-5.067 85.17 85.17 0 00-78.098 0 86.37 86.37 0 00-8.517 5.067l-634.49 375.585-.766.426c-19.392 12.059-25.337 37.556-13.278 56.948a41.346 41.346 0 0014.257 13.868l634.492 375.585a95.617 95.617 0 008.517 5.068 85.17 85.17 0 0078.098 0 95.52 95.52 0 008.517-5.068l634.492-375.585a40.84 40.84 0 0020.268-35.685z"
- ></path>
- <path
- fill="#0364B8"
- d="M520.453 643.477h416.38v381.674h-416.38V643.477zM1745.917 255.5V80.908c1-43.652-33.552-79.862-77.203-80.908H588.204C544.552 1.046 510 37.256 511 80.908V255.5l638.75 170.333L1745.917 255.5z"
- ></path>
- <path fill="#0078D4" d="M511 255.5h425.833v383.25H511V255.5z"></path>
- <path
- fill="#28A8EA"
- d="M1362.667 255.5H936.833v383.25L1362.667 1022h383.25V638.75l-383.25-383.25z"
- ></path>
- <path fill="#0078D4" d="M936.833 638.75h425.833V1022H936.833V638.75z"></path>
- <path fill="#0364B8" d="M936.833 1022h425.833v383.25H936.833V1022z"></path>
- <path fill="#14447D" d="M520.453 1025.151h416.38v346.969h-416.38v-346.969z"></path>
- <path fill="#0078D4" d="M1362.667 1022h383.25v383.25h-383.25V1022z"></path>
- <linearGradient
- id="a"
- x1="1128.458"
- x2="1128.458"
- y1="811.083"
- y2="1.998"
- gradientTransform="matrix(1 0 0 -1 0 1705.333)"
- gradientUnits="userSpaceOnUse"
- >
- <stop offset="0" stopColor="#35b8f1"></stop>
- <stop offset="1" stopColor="#28a8ea"></stop>
- </linearGradient>
- <path
- fill="url(#a)"
- d="M1811.58 927.593l-.809.426-634.492 356.848c-2.768 1.703-5.578 3.321-8.517 4.769a88.437 88.437 0 01-34.407 8.517l-34.663-20.27a86.706 86.706 0 01-8.517-4.897L447.167 906.003h-.298l-21.036-11.753v722.384c.328 48.196 39.653 87.006 87.849 86.7h1230.914c.724 0 1.363-.341 2.129-.341a107.79 107.79 0 0029.808-6.217 86.066 86.066 0 0011.966-6.217c2.853-1.618 7.75-5.152 7.75-5.152a85.974 85.974 0 0034.833-68.772V894.25a38.323 38.323 0 01-19.502 33.343z"
- ></path>
- <path
- fill="#0A2767"
- d="M1797.017 891.397v44.287l-663.448 456.791-686.87-486.174a.426.426 0 00-.426-.426l-63.023-37.899v-31.938l25.976-.426 54.932 31.512 1.277.426 4.684 2.981s645.563 368.346 647.267 369.197l24.698 14.478c2.129-.852 4.258-1.703 6.813-2.555 1.278-.852 640.879-360.681 640.879-360.681l7.241.427z"
- opacity="0.5"
- ></path>
- <path
- fill="#1490DF"
- d="M1811.58 927.593l-.809.468-634.492 356.848c-2.768 1.703-5.578 3.321-8.517 4.769a88.96 88.96 0 01-78.098 0 96.578 96.578 0 01-8.517-4.769l-634.49-356.848-.766-.468a38.326 38.326 0 01-20.057-33.343v722.384c.305 48.188 39.616 87.004 87.803 86.7h1229.64c48.188.307 87.5-38.509 87.807-86.696V894.25a38.33 38.33 0 01-19.504 33.343z"
- ></path>
- <path
- d="M1185.52 1279.629l-9.496 5.323a92.806 92.806 0 01-8.517 4.812 88.173 88.173 0 01-33.47 8.857l241.405 285.479 421.107 101.476a86.785 86.785 0 0026.7-33.343l-637.729-372.604z"
- opacity="0.1"
- ></path>
- <path
- d="M1228.529 1255.442l-52.505 29.51a92.806 92.806 0 01-8.517 4.812 88.173 88.173 0 01-33.47 8.857l113.101 311.838 549.538 74.989a86.104 86.104 0 0034.407-68.815v-9.326l-602.554-351.865z"
- opacity="0.05"
- ></path>
- <path
- fill="#28A8EA"
- d="M514.833 1703.333h1228.316a88.316 88.316 0 0052.59-17.033l-697.089-408.331a86.706 86.706 0 01-8.517-4.897L447.125 906.088h-.298l-20.993-11.838v719.914c-.048 49.2 39.798 89.122 88.999 89.169-.001 0-.001 0 0 0z"
- ></path>
- <path
- d="M1022 418.722v908.303c-.076 31.846-19.44 60.471-48.971 72.392a73.382 73.382 0 01-28.957 5.962H425.833V383.25H511v-42.583h433.073c43.019.163 77.834 35.035 77.927 78.055z"
- opacity="0.1"
- ></path>
- <path
- d="M979.417 461.305v908.302a69.36 69.36 0 01-6.388 29.808c-11.826 29.149-40.083 48.273-71.54 48.417H425.833V383.25h475.656a71.493 71.493 0 0135.344 8.943c26.104 13.151 42.574 39.883 42.584 69.112z"
- opacity="0.2"
- ></path>
- <path
- d="M979.417 461.305v823.136c-.208 43-34.928 77.853-77.927 78.225H425.833V383.25h475.656a71.493 71.493 0 0135.344 8.943c26.104 13.151 42.574 39.883 42.584 69.112z"
- opacity="0.2"
- ></path>
- <path
- d="M936.833 461.305v823.136c-.046 43.067-34.861 78.015-77.927 78.225H425.833V383.25h433.072c43.062.023 77.951 34.951 77.927 78.013a.589.589 0 01.001.042z"
- opacity="0.2"
- ></path>
- <linearGradient
- id="b"
- x1="162.747"
- x2="774.086"
- y1="1383.074"
- y2="324.259"
- gradientTransform="matrix(1 0 0 -1 0 1705.333)"
- gradientUnits="userSpaceOnUse"
- >
- <stop offset="0" stopColor="#1784d9"></stop>
- <stop offset="0.5" stopColor="#107ad5"></stop>
- <stop offset="1" stopColor="#0a63c9"></stop>
- </linearGradient>
- <path
- fill="url(#b)"
- d="M78.055 383.25h780.723c43.109 0 78.055 34.947 78.055 78.055v780.723c0 43.109-34.946 78.055-78.055 78.055H78.055c-43.109 0-78.055-34.947-78.055-78.055V461.305c0-43.108 34.947-78.055 78.055-78.055z"
- ></path>
- <path
- fill="#FFF"
- d="M243.96 710.631a227.05 227.05 0 0189.17-98.495 269.56 269.56 0 01141.675-35.515 250.91 250.91 0 01131.114 33.683 225.014 225.014 0 0186.742 94.109 303.751 303.751 0 0130.405 138.396 320.567 320.567 0 01-31.299 144.783 230.37 230.37 0 01-89.425 97.388 260.864 260.864 0 01-136.011 34.578 256.355 256.355 0 01-134.01-34.067 228.497 228.497 0 01-87.892-94.28 296.507 296.507 0 01-30.745-136.735 329.29 329.29 0 0130.276-143.845zm95.046 231.227a147.386 147.386 0 0050.163 64.812 131.028 131.028 0 0078.353 23.591 137.244 137.244 0 0083.634-24.358 141.156 141.156 0 0048.715-64.812 251.594 251.594 0 0015.543-90.404 275.198 275.198 0 00-14.649-91.554 144.775 144.775 0 00-47.182-67.537 129.58 129.58 0 00-82.91-25.55 135.202 135.202 0 00-80.184 23.804 148.626 148.626 0 00-51.1 65.365 259.759 259.759 0 00-.341 186.728l-.042-.085z"
- ></path>
- <path fill="#50D9FF" d="M1362.667 255.5h383.25v383.25h-383.25V255.5z"></path>
- </svg>
-)
-
-const YAHOO_SVG_ICON = (
- <svg
- xmlns="http://www.w3.org/2000/svg"
- width="1000"
- height="277.324"
- viewBox="0 0 264.583 73.375"
- className="w-14 h-14 scale-125"
- >
- <g fill="#5f01d1" transform="translate(260.955 41.214)">
- <path d="M-260.955-23.352h15.74l9.166 23.45 9.285-23.45h15.326l-23.078 55.514h-15.423l6.317-14.71zm65.484-.933c-11.827 0-19.304 10.607-19.304 21.17 0 11.886 8.197 21.31 19.08 21.31 8.117 0 11.177-4.946 11.177-4.946V17.1h13.73v-40.45h-13.73v3.677s-3.414-4.611-10.953-4.611zm2.92 13c5.457 0 8.273 4.318 8.273 8.214 0 4.196-3.017 8.313-8.273 8.313-4.356 0-8.293-3.56-8.293-8.134 0-4.64 3.166-8.393 8.293-8.393zm26.491 28.386v-58.315h14.36v21.68s3.41-4.746 10.554-4.746c8.738 0 13.857 6.51 13.857 15.814V17.1h-14.254V-4.964c0-3.148-1.5-6.19-4.897-6.19-3.458 0-5.26 3.088-5.26 6.19v22.065zm63.255-41.381c-13.545 0-21.61 10.299-21.61 21.333 0 12.557 9.765 21.142 21.66 21.142 11.53 0 21.62-8.195 21.62-20.931 0-13.936-10.564-21.544-21.67-21.544zm.129 13.114c4.784 0 8.094 3.985 8.094 8.234 0 3.624-3.084 8.094-8.094 8.094-4.59 0-8.036-3.682-8.036-8.134 0-4.288 2.864-8.194 8.036-8.194zm45.463-13.114c-13.544 0-21.609 10.299-21.609 21.333 0 12.557 9.765 21.142 21.66 21.142 11.53 0 21.619-8.195 21.619-20.931 0-13.936-10.563-21.544-21.67-21.544zm.13 13.114c4.784 0 8.094 3.985 8.094 8.234 0 3.624-3.085 8.094-8.095 8.094-4.59 0-8.035-3.682-8.035-8.134 0-4.288 2.864-8.194 8.035-8.194z"></path>
- <circle cx="-24.212" cy="8.425" r="9.535"></circle>
- <path d="M-11.543-4.614H-28.71l15.236-36.6H3.628z"></path>
- </g>
- </svg>
-)