Review request

Parent-teacher conference signup, Windsurf put every screen in one component

Solved · 15 views · asked by dana_ships · edited

Repo or live app

github.com/danawhitfield/conference-slots

Unsure about: Structure

Parents pick a 10 minute slot with each teacher. Windsurf produced app/page.tsx at about 1,100 lines with a view state that switches between the slot picker, the confirmation and the teacher admin screen. It runs fine. Adding anything now means reading the whole file first, and I want to know what to pull out.

Comment

2 answers

Marked as helpful by the asker
dev_ana · edited

Your view state is doing the job the router already does for free. That is the seam.

Split along it: app/page.tsx for the picker, app/confirm/[slot]/page.tsx, app/admin/page.tsx. Three files, each one screen, and the browser back button starts working, which it currently does not.

Then move the fetching. Those three pages can stay server components that query Supabase directly and pass plain data down. Only the bits with a click handler need 'use client'. In a file like yours that is usually the form and nothing else, and the client bundle drops sharply.

Do it in that order. Routes first, then client boundaries. Trying to do both at once is where these refactors stall.

Comment
felix_codes · edited

Tactical note for doing this with Windsurf or any agent: move one screen per prompt and commit in between. Ask for the whole split at once and it will rewrite parts you did not mention, because the file no longer fits comfortably in the window and it reconstructs from memory. One screen, run it, commit, next.

Comment