Skip to content

Split bounty-detail-sidebar-cta.tsx into SidebarCTA and MobileCTA files #209

Description

@Benjtalkshow

components/bounty-detail/bounty-detail-sidebar-cta.tsx is around 680 lines and exports both SidebarCTA and MobileCTA from the same file. The two components duplicate state and event handlers (cancel dialog, dispute dialog, application dialog, copy logic) and any change to the apply or dispute flow has to be made in both places. The file is hard to read and a constant merge-conflict surface. We've already had merges drop handleApply from SidebarCTA and break the build.

What to do

Split into three files:

  • components/bounty-detail/bounty-detail-sidebar-cta.tsx exports SidebarCTA
  • components/bounty-detail/bounty-detail-mobile-cta.tsx exports MobileCTA
  • components/bounty-detail/use-bounty-cta-state.ts exports a shared hook returning everything both components need: walletAddress, hasJoined, isPastDeadline, handleJoin, handleApply, cancel dialog state, copy state, canRaiseDispute, etc.

Update bounty-detail-client.tsx to import MobileCTA from the new file. No behavioral change.

Acceptance criteria

  • Both components render exactly as before
  • No duplicated state or event handlers between the two files
  • Each file is under 300 lines
  • The shared hook owns all the data both components consume

Files

  • components/bounty-detail/bounty-detail-sidebar-cta.tsx
  • components/bounty-detail/bounty-detail-mobile-cta.tsx (new)
  • components/bounty-detail/use-bounty-cta-state.ts (new)
  • components/bounty-detail/bounty-detail-client.tsx

Activity

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions