@stamprally/admin-ui
v0.25.10
Published
Accessible authoring components for stamp rally administrators.
Readme
@stamprally/admin-ui
Use RallyAvailabilityForm and CompletionConditionForm to embed the rally period and completion settings independently of AdminRallyEditor. Both are controlled components that accept the current configuration and an onChange callback.
Accessible authoring forms and headless editing hooks for React 18 / 19.
Setup
pnpm add @stamprally/core @stamprally/admin-uiimport { AdminRallyEditor } from "@stamprally/admin-ui";
import "@stamprally/admin-ui/styles.css";
<AdminRallyEditor config={adminConfig} locale="en" onChange={setAdminConfig} />;Edit rally content, spots, conditions, availability, rewards, localization, metadata, and theme fields. The editor includes publish-readiness analysis; JsonConfigIO handles validated JSON import/export.
Headless editing
Use useAdminRallyEditor to build a custom editor:
import { useAdminRallyEditor } from "@stamprally/admin-ui";
const editor = useAdminRallyEditor(adminConfig, { onChange: saveDraft });
editor.addSpot({ name: { en: "Museum" }, conditions: [{ type: "qr", secretToken: "" }] });
editor.reorderSpots(2, 0);
editor.undo();Actions update configuration immutably. Use canUndo / canRedo for history controls and resetConfig to replace the draft. Localized field updates preserve other languages.
Keep the resulting AdminRallyConfig private and publish only toPublicConfig(adminConfig). Reward inventory enforcement belongs to the server persistence adapter.
See the feature guide for editing and preflight details.
License
MIT
