Skip to content

feat: complete step-by-step invoice creation wizard (#891) - #943

Open
adenueltech wants to merge 1 commit into
Stellar-split:mainfrom
adenueltech:feat/issue-891-invoice-wizard
Open

adenueltech wants to merge 1 commit into
Stellar-split:mainfrom
adenueltech:feat/issue-891-invoice-wizard

Conversation

@adenueltech

Copy link
Copy Markdown

Closes #891

What changed

/invoice/new already had a 4-step stepper. This PR fills in what the issue asks for and fixes several bugs in the existing flow.

Validation at each step

  • Moved step definitions, help text and validation into src/lib/invoiceWizard.ts (pure, unit tested).
  • Fixed: equal-split mode always failed recipient validation, because per-row amounts are empty in that mode. It now validates the total amount instead.
  • Fixed: the deadline field is on step 1, but its range was checked on step 3. It is now validated on step 1 (whole number, 1–365).
  • Token and recipient addresses use real StrKey checks instead of startsWith/length. Duplicate recipients are rejected, and errors name the row ("Recipient 2 needs…").
  • The co-signer threshold must be between 1 and the number of co-signers.
  • Errors appear both in the step summary and inline on the field, with aria-describedby pointing at the message (also fixed in FormField).

Navigation

  • Submit re-validates every step and jumps to the first invalid one, so a deep link to ?step=4 or a restored draft can't skip checks.
  • Pressing Enter on an earlier step advances the wizard instead of submitting.
  • The review step has an "Edit" link for each section.

Progress indicator

  • Progress bar (role="progressbar") with "Step X of 4" under the existing stepper.

Drafts saved automatically

  • The draft snapshot now includes the current step, equal-split total, tags, co-signers, threshold and installments. Restoring brings all of them back and resumes on the saved step. New DraftFormData fields are optional, so existing drafts still load.
  • Autosave only starts after the user interacts, so an untouched form no longer shows a "restore draft?" banner on the next visit.
  • A "Draft saved HH:MM" status shows when autosave runs.

Help text

  • Each step has a one-line description, and every field has helper text (token, deadline, clone deadline, recurring, interval, equal split, total, recipients, tags, co-signers).
  • Removed a duplicate DeadlineSuggester that rendered twice on step 1.

How I tested

  • npx vitest run src/__tests__/invoiceWizardSteps.test.ts src/lib/offlineDraftDB.test.ts src/hooks/useOfflineDraftAutosave.test.ts: 39 passed
  • npx tsc --noEmit: 0 errors
  • next lint on the changed files: no warnings or errors

🤖 Generated with Claude Code

- Move wizard step definitions, help text and validation into
  src/lib/invoiceWizard.ts so the rules are shared and unit tested
- Fix equal-split mode always failing recipient validation
- Validate the deadline on the step it lives on (1-365 days)
- Use real StrKey checks for token and recipient addresses, reject duplicates
- Re-validate every step on submit so ?step=4 deep links cannot skip checks
- Enter on an earlier step advances the wizard instead of submitting
- Save the full wizard state (step, equal split, tags, co-signers,
  installments) in drafts and restore all of it
- Only autosave once the user has interacted; show "Draft saved" time
- Add a progress bar, per-step descriptions, help text for each field and
  Edit shortcuts on the review step
- Remove duplicated DeadlineSuggester on step 1
- FormField: point aria-describedby at the error message when shown

Closes Stellar-split#891

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 17, 2026

Copy link
Copy Markdown

@adenueltech is attempting to deploy a commit to the kingsman-99's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Oct 17, 2026

Copy link
Copy Markdown

@adenueltech Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

This branch has not been deployed

No deployments
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.

Redesign invoice creation form with step-by-step wizard

1 participant