fix: prevent new backend guards from ever surfacing as raw errors

The colony-apiary and queen-availability validation just added
backend-side had no matching frontend guard, so a user could still
pick an inactive apiary or open the assign-colony dialog on an
unavailable queen and only find out it fails after submitting:

- Colony create/move apiary pickers now fetch only ACTIVE apiaries.
- The queen "Volk zuweisen" button is disabled once her status is
  LOST/REPLACED/SOLD/DECEASED (QUEEN_UNAVAILABLE_STATUSES, mirroring
  the backend's QUEEN_NO_LONGER_AVAILABLE_STATUSES), instead of only
  failing after the form is filled out and submitted.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
Nick SzaunigandClaude Sonnet 5 committed 2026-09-08 22:39:47 +02:00
1 parent 3e179391b0
commit 3678a01319
5 files changed
+37 -5

No files matched your search

+11
View File
@@ -12,6 +12,17 @@ export const QUEEN_STATUSES: QueenStatus[] = [
"DECEASED",
];
// Mirrors the backend's QUEEN_NO_LONGER_AVAILABLE_STATUSES - a queen in one
// of these statuses can no longer be assigned to a colony (the backend
// rejects it), so the assign-colony UI disables itself instead of letting
// the user hit that error after filling out the form.
export const QUEEN_UNAVAILABLE_STATUSES: QueenStatus[] = [
"LOST",
"REPLACED",
"SOLD",
"DECEASED",
];
export const QUEEN_STATUS_LABELS: Record<QueenStatus, string> = {
ACTIVE: "Aktiv",
RESERVE: "Reserve",