Consider refactoring app/views/shared/_broadcast_message.html.haml to a ViewComponent

This issue is about migrating the existing broadcast message implementation from a regular Rails partial in HAML to a ViewComponent.

This would make it more testable and easier to reason about, as per the usual benefits of ViewComponents.

Note that this issue is closely linked to #362735 (closed), and perhaps both can be tackled together.

Suggested solution

  • Rewrite the broadcast message implementation as a ViewComponent.
  • Remove the "preview" logic from the template, and instead implement it as regular options passed to the ViewComponent (e.g., forcing the dismiss button not to be shown).

If in doubt, @mention a Foundations team member for guidance.

Edited by Eduardo Sanz García