Skip to content

Split CreateGrant into a schedule module and one file per wizard step #139

Description

@gabitoesmiapodo

User story / Problem statement

Currently components/CreateGrant/index.tsx is 535 lines with eleven useState calls. It mixes four jobs: the schedule model and its demo presets, field validation, a balance fetch, and three steps of markup. It is the hardest file to read in an app whose purpose is being read.

Expected outcome

The schedule maths is a pure module with tests. Each wizard step is its own file. The entry composes them and holds little else. The form behaves exactly as it does today.

Acceptance criteria

  • CreateGrant/schedule.ts holds addMonths, defaultSchedule, buildDemoSchedule and the preset transform as pure functions
  • A unit test covers re-anchoring a demo preset to submit time
  • Each of the three steps renders from its own PascalCase file beside the entry
  • balance and balanceState become one value, so a fetch error cannot sit beside a loaded balance
  • The dialog wraps a <form> and Enter submits from the last step
  • CreateGrant/index.tsx is under 200 lines
  • No visual or interaction change

Technical notes

Follow the layout rules in dapp/frontend/CLAUDE.md. The folder already holds fields.ts, DateField.tsx and LiveScheduleCurve.tsx, so step files are PascalCase beside the entry and shared helpers are camelCase leaf modules. Name each step for what it shows, never Step1. Issue #138 replaces the step counter with Ark Steps and touches the same file, so land this one first.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions