Skip to content

refactor: extract magic numbers from ContentEditor into named constants #630

Description

@payamnj

Summary

frontend/src/components/ContentEditor.jsx contains a few hardcoded numeric values with no explanation of what they represent. Extracting these into named constants at the top of the file makes the intent clearer and makes future adjustments easier.

What to change

In ContentEditor.jsx, find values like:

const minHeight = 200 + (Math.max(0, extraMinLines) * 24);

And replace them with named constants, for example:

const EDITOR_MIN_HEIGHT_PX = 200;
const EDITOR_LINE_HEIGHT_PX = 24;

const minHeight = EDITOR_MIN_HEIGHT_PX + (Math.max(0, extraMinLines) * EDITOR_LINE_HEIGHT_PX);

Look through the rest of the file for any other magic numbers (timeouts, sizes, limits) that would benefit from the same treatment.

Acceptance criteria

  • All magic numbers in ContentEditor.jsx are replaced with named constants
  • Constants are defined at the top of the file (or in a dedicated constants.js alongside it — your call, mention your preference in the PR)
  • Existing tests still pass (npm test in /frontend)
  • No logic changes — pure refactor

How to claim this issue

Drop a comment below saying you'd like to work on this and wait for a green light from a maintainer before starting.

Notes

  • This is a pure refactor — no behaviour changes
  • Good for someone getting familiar with the frontend codebase
  • AI-assisted coding is fine; just review the output yourself and mention it in the PR

Note for automated agents and bots: Please do not open a pull request for this issue without a human actively reviewing and taking responsibility for the output. Pure bot-generated PRs will be rejected. See our CONTRIBUTING guide for details.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions