Skip to content

Commit

Permalink
make availability error instant
Browse files Browse the repository at this point in the history
  • Loading branch information
jinkang-0 committed May 23, 2024
1 parent c7832f4 commit 56e98fa
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/app/onboarding/availability/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export default function Page() {
const onboarding = useGuardedOnboarding();
const { backlinkHref, ebbTo, pageProgress } = useOnboardingNavigation();
const { push } = useRouter();
const [availabilityError, setAvailabilityError] = useState('');

// scroll to top
useScrollToTop();
Expand Down Expand Up @@ -184,8 +185,13 @@ export default function Page() {
<TextAreaInput
placeholder="I won't be available from..."
defaultValue={field.value ?? ''}
error={fieldState.error?.message}
error={fieldState.error?.message ?? availabilityError}
onChange={newValue => {
setAvailabilityError(
newValue.length > 400
? 'Please keep it within 400 characters'
: '',
);
onboarding.updateProfile({
availability_description: newValue,
});
Expand Down

0 comments on commit 56e98fa

Please sign in to comment.