Skip to content

Add form validation, providers, and onboarding hooks - #48

Merged
Chaithra0206 merged 3 commits into
Developer-Kommunity-24:mainfrom
Chaithra0206:main
Sep 6, 2026
Merged

Chaithra0206 merged 3 commits into
Developer-Kommunity-24:mainfrom
Chaithra0206:main

Conversation

@Chaithra0206

Copy link
Copy Markdown
Collaborator

Standardized state management, form handling, and validation across apps/web.

Changes

  • Added TanStack Query, React Hook Form, Zod, and Sonner.
  • Added a global Providers component for React Query and toast notifications.
  • Updated login and onboarding forms to use React Hook Form with Zod validation.
  • Added mutation hooks for social sign-in, profile saving, and user role updates.
  • Added lib/env.ts for validating required environment variables.
  • Improved form input performance and removed the typing lag in the existing forms.

Comment thread apps/web/app/(auth)/login/page.tsx Outdated
Comment on lines +61 to +64
defaultValues: {
name: '',
email: '',
},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default values can be a seperate object outside, to keep the code lean

Comment thread apps/web/app/(auth)/login/page.tsx Outdated
Comment on lines 151 to 162
<input
id="name-input"
type="text"
value={name}
onChange={(e) => setName(e.target.value)}
{...register('name')}
onFocus={() => {
setState((s) => ({ ...s, focusedField: 'email' }))
sound.playPop(380)
}}
onBlur={() => setState((s) => ({ ...s, focusedField: 'none' }))}
placeholder="Your full name"
className="w-full px-3.5 py-2.5 rounded-xl border border-zinc-200 text-sm focus:outline-none focus:ring-2 focus:ring-zinc-900/10 focus:border-zinc-900 transition bg-zinc-50/50 hover:bg-zinc-50"
className="w-full px-3.5 py-2.5 rounded-xl border border-zinc-200 text-sm focus:outline-none focus:ring-2 focus:ring-zinc-900/10 focus:border-zinc-900 transition bg-zinc-50/50 hover:bg-zinc-50 text-zinc-900"
/>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets use the shadcn input, also ig it has inbuilt support for react-hook-form iirc

Comment on lines +36 to +41
defaultValues: {
companyName: '',
companyMail: '',
companyUrl: '',
headquartersLocation: '',
},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move outside


setTimeout(() => {
router.push('/landing')
}, 1400)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, what is the obsession with 1400? and can we have it as a constant var

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not strictly necessary for functionality it was just added to let the confetti play before redirecting.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah but the 1400 ms timer is weird, either it can be 1s or 2s, not sure how we came with 1400. wanted to know that

I saw 1400 in 4-5 places, if its a calculated number then it shld be written in constants, so it can be easier to share with others, if not we shld follow whole seconds to keep things simple

Comment thread apps/web/app/(onboarding)/recruiter/page.tsx
spread: 80,
origin: { y: 0.6 },
colors: ['#00C26D', '#34D399', '#6366F1', '#3B82F6'],
})

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw the same thing above, we can make this a reusable util function, so we just call showConfetti() and we dont have to define the colors and all again.

Even the particleCount and spread are different from the above one, is it intended?

if yes we can just make the CONFETTI_COLORS a shared constant, and keep others same

Comment thread apps/web/app/(onboarding)/student/page.tsx Outdated
graduationYear: '2026',
gpa: '',
specialization: '',
skills: ['React', 'TypeScript', 'Next.js', 'Tailwind CSS'],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this hardcoded as default skills? we shld not, not everyone will be web dev, will create bad UX. and will overpopulate these skills for no reason

Comment on lines 212 to 226
@@ -216,7 +220,7 @@ export default function RecruiterOnboardingPage() {
<g transform="translate(102, 172)">
<circle cx="9" cy="9" r="8" fill="var(--brand-green)" />
<circle cx="9" cy="7" r="3.2" fill="#FFFFFF" />
<path d="M 4,14 C 4,11 6.5,10 9,10 C 11.5,10 14,14 14,14 Z" fill="#FFFFFF" />
<path d="M 4,14 C 4,11 6.5,10 9,10 C 11.5,10 14,11 14,14 Z" fill="#FFFFFF" />
<rect x="24" y="4" width="65" height="4" rx="2" fill="#94A3B8" />
<rect x="24" y="11" width="40" height="3" rx="1.5" fill="var(--border-muted)" />
</g>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets avoid hardcoded svgs, please use icon libraries, iirc lucide-icons comes with shadcn

Comment thread apps/web/app/(auth)/login/page.tsx Outdated
})}
onFocus={() => {
setState((s) => ({ ...s, focusedField: 'email' }))
sound.playPop(420)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whats 420 here? magic number, please put it in a constant, and why are we playing sounds?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

420 Hz is the pitch for the playful sound effect. I can pull it into a named constant or disable the sounds if you’d rather keep it silent!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah lets keep it silent

@Chaithra0206

Copy link
Copy Markdown
Collaborator Author
  • Move defaultValues out of the page components and define them as constants in login/page.tsx, recruiter/page.tsx, and student/page.tsx.
  • Replace the raw <input> elements in login/page.tsx with the shared shadcn Input component.
  • Define and share the SelfAssignableRole type across auth.schema.ts, use-auth.ts, use-onboarding.ts, and role-select/page.tsx.
  • Remove the localStorage logic from use-onboarding.ts
  • Created a reusable generic useSaveProfile<TData>(role) hook to handle both student and recruiter profile save mutations.
  • Added a shared showConfetti() helper and ONBOARDING_REDIRECT_DELAY_MS constant in lib/utils/confetti.ts.
  • Reset the default student onboarding skills value to an empty array
  • Replace the error banner in student onboarding with inline, per-field error messages below the relevant inputs.
  • Replaced the hardcoded SVG illustration in recruiter/page.tsx with Lucide icons.

Comment thread apps/web/app/(auth)/login/page.tsx Outdated
Comment on lines +188 to +191
className={`w-full px-3.5 py-2.5 rounded-xl border text-sm text-zinc-900 placeholder:text-zinc-400 focus:outline-none transition bg-zinc-50/40 hover:bg-zinc-50 ${
state.focusedField === 'email'
? 'border-zinc-900 ring-2 ring-zinc-900/10 bg-white'
: 'border-zinc-200'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets avoid ternaries, can u use classNames here from shadcn package?

@Chaithra0206
Chaithra0206 merged commit d65e6de into Developer-Kommunity-24:main Sep 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants