Skip to content

refactor(projects): use shadcn Input/Textarea/Label in project-form - #11

Merged
MeepCastana merged 3 commits into
developfrom
fix/project-form-shadcn
Aug 6, 2026
Merged

MeepCastana merged 3 commits into
developfrom
fix/project-form-shadcn

Conversation

@OGtwelve

@OGtwelve OGtwelve commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Fixes #4

Stacked on #10 (base fix/projects-new-default-name) — merge order: #9#10 → this; GitHub retargets automatically.

What

project-form.tsx hand-rolled its text controls with a duplicated inline Tailwind string while the FPS Select in the same form used shadcn — two styling systems in one form.

How

Mechanical swap to the existing Input, Textarea, Label primitives (they forward refs and spread props, so register(), type="number", min, valueAsNumber, placeholder pass through unchanged). Also swapped the raw Frame Rate <label> — not in the issue's table, but the acceptance criterion is zero raw <label>s in the file.

Net visual change: fields go from bg-secondary/40px/2px-ring to the primitives' bg-transparent/36px/1px-ring — i.e. they now match the Select exactly, which is the point of the issue.

Verification

  • grep '<input\|<textarea\|<label' in the file → 0 matches
  • Headless Chromium: name Input vs FPS SelectTrigger computed styles — height 36px == 36px, border oklch(0.24 0 0) == same, background transparent == same
  • Clearing the name still renders "Project name is required"
  • Custom size flow end-to-end: pick Custom Size → width 1000 / height 500 → submit → editor opens with canvas W=1000, H=500 in the properties panel
  • lint ✅, projects tests ✅

The route passed hideHeader to ProjectForm (suppressing its h1) and
rendered only the logo in its own header bar, leaving the page with no
heading at all — nothing visible saying what the screen is, and no
document heading for screen-reader navigation.

Render the h1 in the route header next to the logo, separated by a
divider, per the issue's preferred option: the heading shares the
existing bar instead of stacking a second one.
The Create Project button was disabled the moment /projects/new loaded:
name is required, the form validates onChange, and the untouched field
showed no validation message — a dead primary button with no explanation.

Prefill the name as 'Project N' (N from the loaded project count, store
is preloaded in beforeLoad) and focus the field with the text selected,
so a first-time visitor can submit immediately or just type over the
default. The defaultValues object is memoized once on mount — a stable
identity, since ProjectForm resets whenever it changes.

Focus + select runs in an effect declared after the reset effect
(reset() rewrites the input value, which collapses any earlier
selection) and is limited to the create flow (!isEditing) to stay out of
the edit dialog's focus management.
Four raw inputs/textareas and five raw labels carried a duplicated
inline Tailwind class string while the FPS Select in the same form used
the shadcn component — two styling systems side by side, with different
heights, backgrounds, and focus rings.

Swap them for the existing Input, Textarea, and Label primitives. They
forward refs and spread props, so react-hook-form's register() spread,
type=number, min, and placeholder all pass through unchanged.
@MeepCastana
MeepCastana changed the base branch from fix/projects-new-default-name to develop August 6, 2026 14:54

@MeepCastana MeepCastana left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed locally on a combined review branch (all six merged clean, no conflicts). CI green. Approved.

@MeepCastana
MeepCastana merged commit 0e5bda5 into develop Aug 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.

project-form uses raw inputs instead of shadcn Input/Textarea/Label

2 participants