Skip to content

Unify campaign status values across frontend #520

Description

@0xdevcollins

Problem

Campaign status values are inconsistent throughout the codebase — mixed case, different naming conventions, and redundant checks. This causes rendering bugs where some status-dependent UI doesn't show correctly.

Examples of Inconsistency

  • ProjectSidebarActions: checks `'CAMPAIGNING'`, `'campaigning'`, `'LIVE'`, `'live'`, `'VOTING'`, `'Funding'`, `'Validation'`
  • ProjectSidebarProgress: uses `'CAMPAIGNING'` and `'campaigning'`
  • project-milestone/index.tsx: checks `'LIVE'`, `'FUNDED'`, `'EXECUTING'`, plus `trustlessWorkStatus === 'funded'`
  • utils.ts: maps `'IDEA'` → Validation, `'LIVE'` → Live, lowercase variants too
  • canCancel logic checks 6 different status strings

Expected Behavior

  1. Create a single `CampaignStatus` enum in `features/projects/types/`:
    enum CampaignStatus {
      IDEA = 'IDEA',
      REVIEWING = 'REVIEWING',
      VOTING = 'VOTING',
      CAMPAIGNING = 'CAMPAIGNING',
      FUNDED = 'FUNDED',
      EXECUTING = 'EXECUTING',
      LIVE = 'LIVE',
      COMPLETED = 'COMPLETED',
      FAILED = 'FAILED',
      CANCELLED = 'CANCELLED',
    }
  2. Add a normalizer function that maps API response values to the enum
  3. Replace all hardcoded string comparisons with enum references
  4. Update status mapping utils to use the enum

Acceptance Criteria

  • Single source of truth for all status values
  • All components use the enum, no hardcoded strings
  • Status-dependent UI renders correctly for all states
  • No case-sensitivity bugs

Priority

High — This is causing subtle rendering bugs today.

Labels

crowdfunding, tech-debt, bug

Activity

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions