diff --git a/apps/portal/src/pages/resumes/submit.tsx b/apps/portal/src/pages/resumes/submit.tsx index 6286f173..f664836c 100644 --- a/apps/portal/src/pages/resumes/submit.tsx +++ b/apps/portal/src/pages/resumes/submit.tsx @@ -14,6 +14,7 @@ import { CheckboxInput, Dialog, Select, + Spinner, TextArea, TextInput, } from '@tih/ui'; @@ -74,6 +75,7 @@ export default function SubmitResumeForm({ const [isDialogShown, setIsDialogShown] = useState(false); const { data: session, status } = useSession(); + const isSessionLoading = status === 'loading'; const router = useRouter(); const trpcContext = trpc.useContext(); const resumeUpsertMutation = trpc.useMutation('resumes.resume.user.upsert'); @@ -122,12 +124,12 @@ export default function SubmitResumeForm({ // Route user to sign in if not logged in useEffect(() => { - if (status !== 'loading') { + if (isSessionLoading) { if (session?.user?.id == null) { router.push('/api/auth/signin'); } } - }, [router, session, status]); + }, [isSessionLoading, router, session]); const onSubmit: SubmitHandler = async (data) => { setIsLoading(true); @@ -221,11 +223,17 @@ export default function SubmitResumeForm({ }, [errors?.file, invalidFileUploadError]); const onValueChange = (section: InputKeys, value: string) => { - setValue(section, value.trim(), { shouldTouch: false }); + setValue(section, value.trim(), { shouldDirty: true }); }; return ( <> + {isSessionLoading && ( +
+ {' '} + {' '} +
+ )} Upload a Resume @@ -268,12 +276,18 @@ export default function SubmitResumeForm({ {/* Title Section */} setValue('title', val)} + onChange={(val) => onValueChange('title', val)} />