Skip to content

[Refactor] Break down workflow-progress-button.tsx into smaller components #9

@itigges22

Description

@itigges22

Description

Current State

components/workflow-progress-button.tsx is 1885 lines long — the largest component in the codebase. It handles:

  • Multiple dialog states (progress, form, approval, rejection)
  • Form rendering with conditional fields
  • User assignment selection
  • Workflow state management
  • Approval/rejection logic
  • Form submission

This creates:

  • Difficult testing (can't test dialogs independently)
  • Hard to understand flow
  • Risk of bugs in deeply nested logic

Desired Outcome

Break into composable components:

components/
  workflow/
    workflow-progress-button.tsx  (orchestrator, ~200 lines)
    workflow-progress-dialog.tsx
    workflow-form-dialog.tsx
    workflow-approval-dialog.tsx
    workflow-user-select.tsx
    hooks/
      use-workflow-progress.ts
      use-workflow-form.ts

How to approach

  1. Identify the distinct UI states (dialogs)
  2. Extract each dialog to its own component
  3. Create a custom hook for shared state logic
  4. Keep the main component as a thin orchestrator

Related large components to tackle after

  • components/account-overview.tsx (1424 lines)
  • components/unified-projects-section.tsx (965 lines)
  • components/department-overview.tsx (708 lines)

Acceptance Criteria

  • Main component under 300 lines
  • Each dialog in separate file
  • Custom hooks for complex state
  • All existing functionality preserved
  • No visual regressions

Metadata

Metadata

Assignees

No one assigned

    Labels

    RefactorNeed to optimize the codebaseenhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions