Skip to content

Configurable workflow state colors #128

@mliebischer

Description

@mliebischer

Problem

Two places currently hardcode the same workflow-state → color mapping independently:

  • packages/contents/components/ReviewState.tsx (the state dot in the @@contents listing)
  • packages/cmsui/components/History/HistoryView.tsx (statusDotClass, the "Action done" dot in the @@history view, added in [CMSUI] - History route #30 — deliberately mirroring the Contents mapping for visual consistency; marked with a TODO)
Image

Both map published--color-quanta-cobalt, private--color-quanta-rose, versioning/green → --color-quanta-neon, and fall back to the neutral --color-quanta-pigeon for everything else.

This has two limitations:

  1. Custom workflows: sites with their own workflows (other review states) only ever get the neutral fallback color. There is no way to register colors for additional states.
  2. Theming: themes can re-color the dots only by overriding the Quanta token values globally. The mapping itself (which state gets which token) is not configurable.

Prior art

Volto solves this with a central, configurable mapping: config/Workflows.jsconfig.settings.workflowMapping, consumed by all components that render workflow states.

Proposal (to be discussed)

  • A single source of truth for the mapping, registered through @plone/registry (e.g. config.settings), with the current four entries as the default.
  • Values are design tokens (CSS custom properties), not hex values, so themes keep working.
  • A small shared component/helper consumed by both @plone/contents and @plone/cmsui. Open question: which package may host it so that both can depend on it (@plone/layout? @plone/components would need to stay free of Plone-specific logic per the conventions).

Acceptance criteria

  • Given a custom workflow state and a registered color for it, when the Contents listing or the History view renders that state, then the registered color is shown.
  • Given no registered color for a state, then the neutral fallback is shown (current behavior).
  • Contents and History render identical colors for identical states from the same source (no duplicated mapping).

References

  • [CMSUI] - History route #30 (History route — where the duplication was flagged)
  • packages/contents/components/ReviewState.tsx
  • packages/cmsui/components/History/HistoryView.tsx (statusDotClass)
  • Volto: src/config/Workflows.js, settings.workflowMapping

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions