Skip to content

Add a duplicate-from-existing-commitment prefill action to the create flow #952

Description

@1nonlypiece

📌 Description

Users who want a new commitment similar to one they already have must re-enter everything; there's no 'duplicate' path into src/app/create/page.tsx.

This issue adds a Duplicate action (from the detail page / My Commitments) that opens the create flow prefilled from an existing commitment.

🎯 Requirements and Context

This is a feature / enhancement task for the CommitLabs frontend (Next.js + TypeScript). It must be implemented cleanly, fully typed, accessible, and well tested — and must not regress existing behavior.

  • Add a 'Duplicate' action on the commitment detail / card that routes to create with a source id.
  • Prefill the wizard from the source commitment's parameters while keeping all fields editable.
  • Do not copy identity-bound fields (id, ownership, on-chain state) — only configurable parameters.
  • Integrate with draft persistence and validation; safe when source is missing.

🛠️ Suggested Execution

1. Fork the repo and create a branch

git checkout -b feature/create-duplicate-commitment

2. Implement the change

  • Primary files to add or modify:
    • src/components/CommitmentDetailActions.tsx — Duplicate action.
    • src/app/create/page.tsx — read source + prefill.
    • src/components/CreateCommitmentStepConfigure.tsx — receive prefill.
  • Add focused tests in src/app/create/DuplicateCommitment.test.tsx using Jest / Vitest + React Testing Library (happy-dom), covering rendering, interaction, and the edge cases below.
  • Add documentation in docs/DUPLICATE_COMMITMENT.md describing the feature, props/API, accessibility behavior, and a usage example; cross-link it from the relevant README/docs.
  • Keep the diff small and reviewer-friendly; reuse existing primitives, hooks, and the typed API client instead of duplicating logic.

3. Cover edge cases

  • prefill from source
  • identity fields not copied
  • missing source handled
  • fields editable + validated

4. Test and commit

  • Run the suite (e.g. pnpm test / pnpm vitest run) and ensure new lines are covered.
  • Verify keyboard navigation, focus handling, and prefers-reduced-motion where relevant.

Example commit message

feat: duplicate-from-existing prefill in create flow

✅ Guidelines

  • Minimum 95% test coverage on the new/changed lines.
  • Clear, reviewer-friendly documentation (props/API + usage example + accessibility notes).
  • No regressions to existing components, routes, or tests.
  • Fully typed (no any), accessible (labels, roles, live regions where relevant).
  • Timeframe: 96 hours.

🏷️ Labels

type-feature · type-enhancement · area-frontend · MAYBE REWARDED · GRANTFOX OSS · OFFICIAL CAMPAIGN

💬 Community & Support

  • Join the CommitLabs contributor Discord to coordinate, ask questions, and get unblocked fast: https://discord.gg/WV7tdYkJk
  • Please introduce yourself in the channel before you start so we can avoid duplicate work, pair you with a reviewer, and get your PR merged quickly.
  • Maintainers actively triage this channel and aim for fast, clear, respectful reviews — reach out any time you're blocked.

Metadata

Metadata

Labels

Fields

No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions