Skip to main content

QuestionStatusActions

packages/engagement/components/molecules/QuestionStatusActions.js · Tier: molecule · Module: engagement · Rendering: Client Component ('use client')

Purpose​

Admin/backoffice action buttons that change a consultation's status: Start survey (future consultations only → PATCH openDate=today) and Close survey (active consultations only → PATCH closeDate=today). Returns null when neither action applies.

Props​

PropTypeRequiredDefaultDescription
questionIdstring | numberyes—The consultation.
status'active' | 'future' | 'past'yes—Determines which action (if any) is shown.
tobjectyes—participation.questionDetail.adminActions dictionary.

Behaviour​

Calls openQuestion / closeQuestion (server actions), showing a spinner while pending and refreshing on success; errors are surfaced inline and announced.

Composition​

  • Uses: atoms/core/Icon, openQuestion/closeQuestion (engagement/lib/actions/questions), useAnnounce, useRouter, useState.
  • Used by: organisms/engagement/QuestionDetailView.

Internationalisation​

Copy via t (startSurvey, closeSurvey, actionError).

Accessibility​

Buttons carry a disabled/loading state; errors announced (assertive).

organisms/engagement/QuestionDetailView, molecules/engagement/EditQuestionButton.