From 55bcaef339acc07c34d356ffee3065fc129da2d0 Mon Sep 17 00:00:00 2001 From: hbrooks Date: Wed, 24 Jan 2024 13:05:11 -0800 Subject: [PATCH 1/3] . --- src/components/auth/ErrorAlert.tsx | 9 --------- src/components/auth/SignInForm.tsx | 4 ++-- src/components/auth/SignUpForm.tsx | 4 ++-- src/components/home/{DashboardMode.tsx => Home.tsx} | 2 +- src/components/home/{modes => }/ResponsesTable.tsx | 0 src/components/{home/ErrorMode.tsx => shared/Error.tsx} | 0 src/pages/forms/[id].tsx | 2 +- src/pages/home.tsx | 4 ++-- 8 files changed, 8 insertions(+), 17 deletions(-) delete mode 100644 src/components/auth/ErrorAlert.tsx rename src/components/home/{DashboardMode.tsx => Home.tsx} (99%) rename src/components/home/{modes => }/ResponsesTable.tsx (100%) rename src/components/{home/ErrorMode.tsx => shared/Error.tsx} (100%) diff --git a/src/components/auth/ErrorAlert.tsx b/src/components/auth/ErrorAlert.tsx deleted file mode 100644 index 47f49bc..0000000 --- a/src/components/auth/ErrorAlert.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { AuthError } from '@supabase/supabase-js'; - -interface ErrorAlertProps { - error: AuthError; -} - -export default function ErrorAlert(props: ErrorAlertProps) { - return

{props.error.message}

; -} diff --git a/src/components/auth/SignInForm.tsx b/src/components/auth/SignInForm.tsx index 8b0c3f5..cbac57f 100644 --- a/src/components/auth/SignInForm.tsx +++ b/src/components/auth/SignInForm.tsx @@ -3,7 +3,7 @@ import { Database } from '../../../types/supabase'; import React, { useState } from 'react'; import { AuthError } from '@supabase/supabase-js'; import { createClientComponentClient } from '@supabase/auth-helpers-nextjs'; -import ErrorAlert from './ErrorAlert'; +import Error from '../shared/Error'; import { useRouter } from 'next/router'; export default function SignInForm() { @@ -40,7 +40,7 @@ export default function SignInForm() { return ( <> - {error && } + {error && }
- {error && } + {error && } (); diff --git a/src/components/home/modes/ResponsesTable.tsx b/src/components/home/ResponsesTable.tsx similarity index 100% rename from src/components/home/modes/ResponsesTable.tsx rename to src/components/home/ResponsesTable.tsx diff --git a/src/components/home/ErrorMode.tsx b/src/components/shared/Error.tsx similarity index 100% rename from src/components/home/ErrorMode.tsx rename to src/components/shared/Error.tsx diff --git a/src/pages/forms/[id].tsx b/src/pages/forms/[id].tsx index 283abdb..dde373c 100644 --- a/src/pages/forms/[id].tsx +++ b/src/pages/forms/[id].tsx @@ -12,7 +12,7 @@ import Link from 'next/link'; import { useRouter } from 'next/router'; import { useEffect, useState } from 'react'; import { Database } from '../../../types/supabase'; -import ResponsesTable from '../../components/home/modes/ResponsesTable'; +import ResponsesTable from '../../components/home/ResponsesTable'; export default function FormDetailPage() { const { isLoading: isSessionLoading, session, error } = useSessionContext(); diff --git a/src/pages/home.tsx b/src/pages/home.tsx index b3574cd..02d1277 100644 --- a/src/pages/home.tsx +++ b/src/pages/home.tsx @@ -1,5 +1,5 @@ import Page from '@/components/layout/Page'; -import DashboardMode from '@/components/home/DashboardMode'; +import Home from '@/components/home/Home'; import { getUserFromSupabase } from '@/utils'; import { createClientComponentClient } from '@supabase/auth-helpers-nextjs'; import { useSessionContext } from '@supabase/auth-helpers-react'; @@ -25,7 +25,7 @@ export default function HomePage() { return ( - + ); } From 358118d5043170b815f3135882fe0e0bb54d1ebe Mon Sep 17 00:00:00 2001 From: hbrooks Date: Wed, 24 Jan 2024 13:09:55 -0800 Subject: [PATCH 2/3] . --- src/components/auth/SignUpForm.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/auth/SignUpForm.tsx b/src/components/auth/SignUpForm.tsx index 7e83c26..f834852 100644 --- a/src/components/auth/SignUpForm.tsx +++ b/src/components/auth/SignUpForm.tsx @@ -13,7 +13,7 @@ export default function SignUpForm() { useState(false); const { push } = useRouter(); - async function signUp(email: string, password: string) { + const signUp = async (email: string, password: string) => { setIsMainButtonDisabled(true); const { data, error } = await supabase.auth.signUp({ email, @@ -26,7 +26,7 @@ export default function SignUpForm() { supabase.auth.signInWithPassword({ email, password }); push('/home'); } - } + }; async function onFormSubmit(event: React.FormEvent) { event.preventDefault(); @@ -46,7 +46,7 @@ export default function SignUpForm() { className="space-y-6" action="#" method="POST" - onSubmit={onFormSubmit} + onSubmit={() => onFormSubmit} >