Skip to main content

AddWorkerButton

packages/core/components/organisms/AddWorkerButton.js · Tier: organism · Module: core · Rendering: Client Component ('use client')

Purpose​

The "add municipal operator" action for the Administration → Workers subsection. It opens the shared CreateAgentModal and refreshes the worker list (router.refresh()) after a successful invitation so the new agent appears.

Props​

PropTypeRequiredDefaultDescription
onCreateAgent(payload) => Promise<{ ok: true } | { error, status? }>yes—The invitation server action.
buttonLabelstringyes—Trigger button text.
modalLabelsobjectyes—Localized labels for CreateAgentModal (admin.createAgent).

Composition​

  • Uses: atoms/core/Button, atoms/core/Icon, molecules/core/CreateAgentModal, useRouter, useState.
  • Used by: the Administration → Workers page.

Internationalisation​

buttonLabel + modalLabels supplied by the caller (the page resolves them from the admin dictionary).

Accessibility​

A standard button that opens the accessible CreateAgentModal; the list refresh is deferred until the modal closes.

Usage​

<AddWorkerButton onCreateAgent={inviteAgent} buttonLabel={t.admin.addWorker} modalLabels={t.admin.createAgent} />

molecules/core/CreateAgentModal, organisms/core/UserCardGrid.