@burdenoff/microfe-healthybowl 2026.1005.2 → 2026.1007.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/dist/healthybowl/components/BedLayoutGrid.js +128 -115
  2. package/dist/healthybowl/components/BedLayoutGrid.js.map +1 -1
  3. package/dist/healthybowl/components/CropPicker.js +37 -0
  4. package/dist/healthybowl/components/CropPicker.js.map +1 -0
  5. package/dist/healthybowl/components/DataTable.js +125 -108
  6. package/dist/healthybowl/components/DataTable.js.map +1 -1
  7. package/dist/healthybowl/components/FilterBar.js +9 -6
  8. package/dist/healthybowl/components/FilterBar.js.map +1 -1
  9. package/dist/healthybowl/components/PlantCatalogPicker.js +32 -0
  10. package/dist/healthybowl/components/PlantCatalogPicker.js.map +1 -0
  11. package/dist/healthybowl/components/WorkspaceRecordPicker.js +164 -0
  12. package/dist/healthybowl/components/WorkspaceRecordPicker.js.map +1 -0
  13. package/dist/healthybowl/components/index.js +3 -1
  14. package/dist/healthybowl/hooks/useCropPage.js +71 -0
  15. package/dist/healthybowl/hooks/useCropPage.js.map +1 -0
  16. package/dist/healthybowl/hooks/usePlantCatalog.js +133 -44
  17. package/dist/healthybowl/hooks/usePlantCatalog.js.map +1 -1
  18. package/dist/healthybowl/hooks/usePlantingEstimate.js +6 -6
  19. package/dist/healthybowl/hooks/usePlantingEstimate.js.map +1 -1
  20. package/dist/healthybowl/hooks/useWorkspaceRead.js +46 -0
  21. package/dist/healthybowl/hooks/useWorkspaceRead.js.map +1 -0
  22. package/dist/healthybowl/pages/HomePage.js +143 -142
  23. package/dist/healthybowl/pages/HomePage.js.map +1 -1
  24. package/dist/healthybowl/pages/analytics/ReportsPage.js +8 -8
  25. package/dist/healthybowl/pages/catalog/PlantCatalogPage.js +266 -192
  26. package/dist/healthybowl/pages/catalog/PlantCatalogPage.js.map +1 -1
  27. package/dist/healthybowl/pages/catalog/WorkspaceBrowseFilters.js +58 -0
  28. package/dist/healthybowl/pages/catalog/WorkspaceBrowseFilters.js.map +1 -0
  29. package/dist/healthybowl/pages/catalog/browsePagination.js +24 -0
  30. package/dist/healthybowl/pages/catalog/browsePagination.js.map +1 -0
  31. package/dist/healthybowl/pages/compliance/ComplianceDocumentsPage.js +6 -6
  32. package/dist/healthybowl/pages/crops/CropDetailsPage.js +340 -348
  33. package/dist/healthybowl/pages/crops/CropDetailsPage.js.map +1 -1
  34. package/dist/healthybowl/pages/crops/CropPlanningPage.js +468 -434
  35. package/dist/healthybowl/pages/crops/CropPlanningPage.js.map +1 -1
  36. package/dist/healthybowl/pages/crops/CropsPage.js +633 -542
  37. package/dist/healthybowl/pages/crops/CropsPage.js.map +1 -1
  38. package/dist/healthybowl/pages/crops/FieldDetailsPage.js +875 -800
  39. package/dist/healthybowl/pages/crops/FieldDetailsPage.js.map +1 -1
  40. package/dist/healthybowl/pages/crops/PlanningDetailsPage.js +459 -448
  41. package/dist/healthybowl/pages/crops/PlanningDetailsPage.js.map +1 -1
  42. package/dist/healthybowl/pages/crops/SuccessionCropLabel.js +21 -0
  43. package/dist/healthybowl/pages/crops/SuccessionCropLabel.js.map +1 -0
  44. package/dist/healthybowl/pages/crops/planningEdit.js +30 -0
  45. package/dist/healthybowl/pages/crops/planningEdit.js.map +1 -0
  46. package/dist/healthybowl/pages/fields/FieldMapPage.js +989 -941
  47. package/dist/healthybowl/pages/fields/FieldMapPage.js.map +1 -1
  48. package/dist/healthybowl/pages/financial/GeneralLedgerPage.js +6 -6
  49. package/dist/healthybowl/pages/financial/InvoiceManagementPage.js +7 -7
  50. package/dist/healthybowl/pages/financial/InvoiceManagementPage.js.map +1 -1
  51. package/dist/healthybowl/pages/financial/TransactionsPage.js +541 -541
  52. package/dist/healthybowl/pages/financial/TransactionsPage.js.map +1 -1
  53. package/dist/healthybowl/pages/government-schemes/ApplicationTrackingPage.js +10 -10
  54. package/dist/healthybowl/pages/government-schemes/CommunicationPage.js +207 -207
  55. package/dist/healthybowl/pages/government-schemes/CommunicationPage.js.map +1 -1
  56. package/dist/healthybowl/pages/government-schemes/SchemeAdminPage.js +38 -38
  57. package/dist/healthybowl/pages/government-schemes/SchemeAdminPage.js.map +1 -1
  58. package/dist/healthybowl/pages/government-schemes/TrainingProgramsPage.js +15 -15
  59. package/dist/healthybowl/pages/government-schemes/TrainingProgramsPage.js.map +1 -1
  60. package/dist/healthybowl/pages/livestock/AnimalRegistryPage.js +4 -4
  61. package/dist/healthybowl/pages/livestock/BreedingManagementPage.js +4 -4
  62. package/dist/healthybowl/pages/livestock/FeedManagementPage.js +4 -4
  63. package/dist/healthybowl/pages/livestock/HealthRecordsPage.js +16 -16
  64. package/dist/healthybowl/pages/livestock/HealthRecordsPage.js.map +1 -1
  65. package/dist/healthybowl/pages/livestock/ProductionTrackingPage.js +4 -4
  66. package/dist/healthybowl/pages/livestock/VaccinationSchedulePage.js +4 -4
  67. package/dist/healthybowl/pages/market/MarketPricesPage.js +305 -305
  68. package/dist/healthybowl/pages/market/MarketPricesPage.js.map +1 -1
  69. package/dist/healthybowl/pages/network/CohortsPage.js +107 -107
  70. package/dist/healthybowl/pages/network/CohortsPage.js.map +1 -1
  71. package/dist/healthybowl/pages/network/CommunityPage.js +247 -247
  72. package/dist/healthybowl/pages/network/CommunityPage.js.map +1 -1
  73. package/dist/healthybowl/pages/network/EventsPage.js +16 -16
  74. package/dist/healthybowl/pages/network/EventsPage.js.map +1 -1
  75. package/dist/healthybowl/pages/network/ExpertsPage.js +470 -470
  76. package/dist/healthybowl/pages/network/ExpertsPage.js.map +1 -1
  77. package/dist/healthybowl/pages/network/MentorsPage.js +6 -6
  78. package/dist/healthybowl/pages/pest-management/PestIssuesPage.js +8 -8
  79. package/dist/healthybowl/pages/pest-management/TreatmentLibraryPage.js +7 -7
  80. package/dist/healthybowl/pages/pest-management/TreatmentLibraryPage.js.map +1 -1
  81. package/dist/healthybowl/pages/production/ProductionBatchesPage.js +7 -7
  82. package/dist/healthybowl/pages/production/RecipeManagementPage.js +5 -5
  83. package/dist/healthybowl/pages/production/ValueAddedProductsPage.js +7 -7
  84. package/dist/healthybowl/pages/soil/SoilTestsPage.js +6 -6
  85. package/dist/healthybowl/pages/soil/SoilTestsPage.js.map +1 -1
  86. package/dist/healthybowl/pages/suppliers/SuppliersPage.js +10 -10
  87. package/dist/healthybowl/pages/sustainability/CarbonCreditLedgerPage.js +6 -6
  88. package/dist/healthybowl/pages/terrace/PlantingFormModal.js +151 -131
  89. package/dist/healthybowl/pages/terrace/PlantingFormModal.js.map +1 -1
  90. package/dist/healthybowl/pages/traceability/BatchTrackingPage.js +6 -6
  91. package/dist/healthybowl/utils/cropComparison.js +1 -1
  92. package/dist/healthybowl/utils/cropComparison.js.map +1 -1
  93. package/dist/healthybowl/utils/cropPicker.js +35 -0
  94. package/dist/healthybowl/utils/cropPicker.js.map +1 -0
  95. package/dist/healthybowl/utils/plantingCapacity.js +2 -2
  96. package/dist/healthybowl/utils/plantingCapacity.js.map +1 -1
  97. package/dist/healthybowl/utils/quotaLabels.js +8 -0
  98. package/dist/healthybowl/utils/quotaLabels.js.map +1 -0
  99. package/dist/healthybowl/utils/seedRate.js +1 -8
  100. package/dist/healthybowl/utils/seedRate.js.map +1 -1
  101. package/package.json +1 -1
@@ -1,23 +1,23 @@
1
1
  import { PageLayout as e } from "../../components/PageLayout.js";
2
2
  import { StatCard as t } from "../../components/StatCard.js";
3
- import { StatusBadge as ee } from "../../components/StatusBadge.js";
3
+ import { FilterBar as ee } from "../../components/FilterBar.js";
4
+ import { StatusBadge as te } from "../../components/StatusBadge.js";
4
5
  import { EmptyState as n } from "../../components/EmptyState.js";
5
- import { FilterBar as r } from "../../components/FilterBar.js";
6
- import { ToastContainer as i } from "../../components/Toast.js";
7
- import { useConfirm as a } from "../../components/ConfirmDialog.js";
8
- import { PageLoader as o } from "../../components/PageLoader.js";
9
- import { Modal as s } from "../../components/Modal.js";
10
- import { useAddHealthyBowlCohortMembersMutation as te, useCreateHealthyBowlCohortMutation as ne, useDeleteHealthyBowlCohortMutation as re, useGetHealthyBowlCohortsQuery as ie } from "../../../generated/wspace-operations.js";
11
- import { useToast as ae } from "../../hooks/useToast.js";
6
+ import { ToastContainer as r } from "../../components/Toast.js";
7
+ import { useConfirm as i } from "../../components/ConfirmDialog.js";
8
+ import { PageLoader as a } from "../../components/PageLoader.js";
9
+ import { Modal as o } from "../../components/Modal.js";
10
+ import { useAddHealthyBowlCohortMembersMutation as ne, useCreateHealthyBowlCohortMutation as s, useDeleteHealthyBowlCohortMutation as c, useGetHealthyBowlCohortsQuery as l } from "../../../generated/wspace-operations.js";
11
+ import { useToast as u } from "../../hooks/useToast.js";
12
12
  import "../../components/index.js";
13
- import { GroupType as oe, MembershipType as se } from "../../../generated/wspace-types.js";
14
- import { useMemo as c, useState as l } from "react";
15
- import { useI18n as u } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
16
- import { AlertCircle as d, Layers as f, Plus as p, Trash2 as m, UserPlus as h, Users as g } from "lucide-react";
13
+ import { GroupType as re, MembershipType as ie } from "../../../generated/wspace-types.js";
14
+ import { useMemo as d, useState as f } from "react";
15
+ import { useI18n as ae } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
16
+ import { AlertCircle as p, Layers as m, Plus as h, Trash2 as oe, UserPlus as g, Users as se } from "lucide-react";
17
17
  import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
18
- import { Button as b, ResponsiveTable as ce } from "@burdenoff/fe-libs/ui";
18
+ import { Button as b, ResponsiveTable as x } from "@burdenoff/fe-libs/ui";
19
19
  //#region src/healthybowl/pages/network/CohortsPage.tsx
20
- var x = "healthybowl", le = (e) => {
20
+ var S = "healthybowl", ce = (e) => {
21
21
  switch (e.toUpperCase()) {
22
22
  case "ACTIVE": return "success";
23
23
  case "ARCHIVED":
@@ -26,20 +26,20 @@ var x = "healthybowl", le = (e) => {
26
26
  case "DELETED": return "muted";
27
27
  default: return "default";
28
28
  }
29
- }, S = () => {
30
- let { t: S } = u(), { toasts: ue, toast: C, dismiss: de } = ae(), fe = a(), { data: w, loading: T, error: E, refetch: D } = ie({
29
+ }, C = () => {
30
+ let { t: C } = ae(), { toasts: le, toast: w, dismiss: ue } = u(), de = i(), { data: T, loading: fe, error: E, refetch: D } = l({
31
31
  variables: { first: 100 },
32
32
  fetchPolicy: "cache-and-network"
33
- }), [O] = ne(), [k] = re(), [A] = te(), j = c(() => (w?.myGroups.edges ?? []).map((e) => e.node).filter((e) => e.productKey === x), [w]), [M, N] = l(""), P = c(() => {
33
+ }), [O] = s(), [k] = c(), [A] = ne(), j = d(() => (T?.myGroups.edges ?? []).map((e) => e.node).filter((e) => e.productKey === S), [T]), [M, N] = f(""), P = d(() => {
34
34
  let e = M.trim().toLowerCase();
35
35
  return e ? j.filter((t) => t.name.toLowerCase().includes(e) || (t.description ?? "").toLowerCase().includes(e)) : j;
36
- }, [j, M]), F = j.reduce((e, t) => e + t.memberCount, 0), I = j.filter((e) => e.status.toUpperCase() === "ACTIVE").length, [L, R] = l(!1), [z, B] = l(!1), [V, H] = l(""), [U, W] = l(""), G = () => {
36
+ }, [j, M]), F = j.reduce((e, t) => e + t.memberCount, 0), I = j.filter((e) => e.status.toUpperCase() === "ACTIVE").length, [L, R] = f(!1), [z, B] = f(!1), [V, H] = f(""), [U, W] = f(""), G = () => {
37
37
  H(""), W("");
38
38
  }, pe = async () => {
39
39
  if (!V.trim()) {
40
- C({
41
- title: S("healthybowl.network.cohorts.toast.nameRequired.title", "Cohort name required"),
42
- description: S("healthybowl.network.cohorts.toast.nameRequired.description", "Give the cohort a name."),
40
+ w({
41
+ title: C("healthybowl.network.cohorts.toast.nameRequired.title", "Cohort name required"),
42
+ description: C("healthybowl.network.cohorts.toast.nameRequired.description", "Give the cohort a name."),
43
43
  variant: "warning"
44
44
  });
45
45
  return;
@@ -49,51 +49,51 @@ var x = "healthybowl", le = (e) => {
49
49
  await O({ variables: { input: {
50
50
  name: V.trim(),
51
51
  description: U.trim() || null,
52
- groupType: oe.Team,
53
- membershipType: se.Static,
54
- productKey: x
55
- } } }), C({
56
- title: S("healthybowl.network.cohorts.toast.created.title", "Cohort created"),
57
- description: S("healthybowl.network.cohorts.toast.created.description", "“{{name}}” has been created.", { name: V.trim() }),
52
+ groupType: re.Team,
53
+ membershipType: ie.Static,
54
+ productKey: S
55
+ } } }), w({
56
+ title: C("healthybowl.network.cohorts.toast.created.title", "Cohort created"),
57
+ description: C("healthybowl.network.cohorts.toast.created.description", "“{{name}}” has been created.", { name: V.trim() }),
58
58
  variant: "success"
59
59
  }), R(!1), G(), await D();
60
60
  } catch (e) {
61
- C({
62
- title: S("healthybowl.network.cohorts.toast.createFailed.title", "Could not create cohort"),
63
- description: e instanceof Error ? e.message : S("healthybowl.network.cohorts.toast.createFailed.description", "Failed to create cohort."),
61
+ w({
62
+ title: C("healthybowl.network.cohorts.toast.createFailed.title", "Could not create cohort"),
63
+ description: e instanceof Error ? e.message : C("healthybowl.network.cohorts.toast.createFailed.description", "Failed to create cohort."),
64
64
  variant: "error"
65
65
  });
66
66
  } finally {
67
67
  B(!1);
68
68
  }
69
- }, [K, q] = l(null), me = async (e) => {
70
- if (await fe({ message: S("healthybowl.network.cohorts.deleteConfirm", "Delete the cohort “{{name}}”? This cannot be undone.", { name: e.name }) })) {
69
+ }, [K, q] = f(null), me = async (e) => {
70
+ if (await de({ message: C("healthybowl.network.cohorts.deleteConfirm", "Delete the cohort “{{name}}”? This cannot be undone.", { name: e.name }) })) {
71
71
  q(e.id);
72
72
  try {
73
- await k({ variables: { id: e.id } }), C({
74
- title: S("healthybowl.network.cohorts.toast.deleted.title", "Cohort deleted"),
75
- description: S("healthybowl.network.cohorts.toast.deleted.description", "“{{name}}” has been removed.", { name: e.name }),
73
+ await k({ variables: { id: e.id } }), w({
74
+ title: C("healthybowl.network.cohorts.toast.deleted.title", "Cohort deleted"),
75
+ description: C("healthybowl.network.cohorts.toast.deleted.description", "“{{name}}” has been removed.", { name: e.name }),
76
76
  variant: "success"
77
77
  }), await D();
78
78
  } catch (e) {
79
- C({
80
- title: S("healthybowl.network.cohorts.toast.deleteFailed.title", "Could not delete cohort"),
81
- description: e instanceof Error ? e.message : S("healthybowl.network.cohorts.toast.deleteFailed.description", "Failed to delete cohort."),
79
+ w({
80
+ title: C("healthybowl.network.cohorts.toast.deleteFailed.title", "Could not delete cohort"),
81
+ description: e instanceof Error ? e.message : C("healthybowl.network.cohorts.toast.deleteFailed.description", "Failed to delete cohort."),
82
82
  variant: "error"
83
83
  });
84
84
  } finally {
85
85
  q(null);
86
86
  }
87
87
  }
88
- }, [J, Y] = l(null), [X, Z] = l(""), [Q, $] = l(!1), he = (e) => {
88
+ }, [J, Y] = f(null), [X, Z] = f(""), [Q, $] = f(!1), he = (e) => {
89
89
  Z(""), Y(e);
90
90
  }, ge = async () => {
91
91
  if (!J) return;
92
92
  let e = X.trim();
93
93
  if (!e) {
94
- C({
95
- title: S("healthybowl.network.cohorts.toast.emailRequired.title", "Email required"),
96
- description: S("healthybowl.network.cohorts.toast.emailRequired.description", "Enter the email of the farmer to add."),
94
+ w({
95
+ title: C("healthybowl.network.cohorts.toast.emailRequired.title", "Email required"),
96
+ description: C("healthybowl.network.cohorts.toast.emailRequired.description", "Enter the email of the farmer to add."),
97
97
  variant: "warning"
98
98
  });
99
99
  return;
@@ -106,25 +106,25 @@ var x = "healthybowl", le = (e) => {
106
106
  } })).data?.addGroupMembers;
107
107
  if (t && t.failedCount > 0) {
108
108
  let e = t.failed[0]?.error;
109
- C({
110
- title: S("healthybowl.network.cohorts.toast.addMemberFailed.title", "Could not add member"),
111
- description: e ?? S("healthybowl.network.cohorts.toast.addMemberFailed.description", "Failed to add the farmer."),
109
+ w({
110
+ title: C("healthybowl.network.cohorts.toast.addMemberFailed.title", "Could not add member"),
111
+ description: e ?? C("healthybowl.network.cohorts.toast.addMemberFailed.description", "Failed to add the farmer."),
112
112
  variant: "error"
113
113
  });
114
114
  return;
115
115
  }
116
- C({
117
- title: S("healthybowl.network.cohorts.toast.memberAdded.title", "Member added"),
118
- description: S("healthybowl.network.cohorts.toast.memberAdded.description", "{{email}} was added to “{{name}}”.", {
116
+ w({
117
+ title: C("healthybowl.network.cohorts.toast.memberAdded.title", "Member added"),
118
+ description: C("healthybowl.network.cohorts.toast.memberAdded.description", "{{email}} was added to “{{name}}”.", {
119
119
  email: e,
120
120
  name: J.name
121
121
  }),
122
122
  variant: "success"
123
123
  }), Y(null), Z(""), await D();
124
124
  } catch (e) {
125
- C({
126
- title: S("healthybowl.network.cohorts.toast.addMemberFailed.title", "Could not add member"),
127
- description: e instanceof Error ? e.message : S("healthybowl.network.cohorts.toast.addMemberFailed.description", "Failed to add the farmer."),
125
+ w({
126
+ title: C("healthybowl.network.cohorts.toast.addMemberFailed.title", "Could not add member"),
127
+ description: e instanceof Error ? e.message : C("healthybowl.network.cohorts.toast.addMemberFailed.description", "Failed to add the farmer."),
128
128
  variant: "error"
129
129
  });
130
130
  } finally {
@@ -133,7 +133,7 @@ var x = "healthybowl", le = (e) => {
133
133
  }, _e = [
134
134
  {
135
135
  key: "name",
136
- header: S("healthybowl.network.cohorts.table.headers.name", "Cohort"),
136
+ header: C("healthybowl.network.cohorts.table.headers.name", "Cohort"),
137
137
  priority: "primary",
138
138
  cell: (e) => /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v("p", {
139
139
  className: "font-medium text-text-primary",
@@ -145,24 +145,24 @@ var x = "healthybowl", le = (e) => {
145
145
  },
146
146
  {
147
147
  key: "members",
148
- header: S("healthybowl.network.cohorts.table.headers.members", "Members"),
148
+ header: C("healthybowl.network.cohorts.table.headers.members", "Members"),
149
149
  priority: "secondary",
150
150
  cellClassName: "text-text-secondary",
151
- cell: (e) => S("healthybowl.network.cohorts.table.memberCount", "{{count}} members", { count: e.memberCount })
151
+ cell: (e) => C("healthybowl.network.cohorts.table.memberCount", "{{count}} members", { count: e.memberCount })
152
152
  },
153
153
  {
154
154
  key: "status",
155
- header: S("healthybowl.network.cohorts.table.headers.status", "Status"),
155
+ header: C("healthybowl.network.cohorts.table.headers.status", "Status"),
156
156
  priority: "secondary",
157
- cell: (e) => /* @__PURE__ */ v(ee, {
157
+ cell: (e) => /* @__PURE__ */ v(te, {
158
158
  label: e.status,
159
- variant: le(e.status),
159
+ variant: ce(e.status),
160
160
  dot: !0
161
161
  })
162
162
  },
163
163
  {
164
164
  key: "actions",
165
- header: S("healthybowl.network.cohorts.table.headers.actions", "Actions"),
165
+ header: C("healthybowl.network.cohorts.table.headers.actions", "Actions"),
166
166
  priority: "secondary",
167
167
  headerClassName: "text-end",
168
168
  cell: (e) => /* @__PURE__ */ y("div", {
@@ -171,35 +171,35 @@ var x = "healthybowl", le = (e) => {
171
171
  variant: "outline",
172
172
  size: "sm",
173
173
  onClick: () => he(e),
174
- "aria-label": S("healthybowl.network.cohorts.actions.addMember", "Add member"),
174
+ "aria-label": C("healthybowl.network.cohorts.actions.addMember", "Add member"),
175
175
  children: [
176
- /* @__PURE__ */ v(h, { className: "h-3.5 w-3.5" }),
176
+ /* @__PURE__ */ v(g, { className: "h-3.5 w-3.5" }),
177
177
  " ",
178
- S("healthybowl.network.cohorts.actions.addMember", "Add member")
178
+ C("healthybowl.network.cohorts.actions.addMember", "Add member")
179
179
  ]
180
180
  }), /* @__PURE__ */ y(b, {
181
181
  variant: "destructive",
182
182
  size: "sm",
183
183
  onClick: () => me(e),
184
184
  disabled: K === e.id,
185
- "aria-label": S("healthybowl.network.cohorts.actions.deleteCohort", "Delete cohort"),
186
- children: [/* @__PURE__ */ v(m, { className: "h-3.5 w-3.5" }), K === e.id ? S("healthybowl.network.cohorts.actions.deleting", "Deleting…") : S("healthybowl.network.cohorts.actions.delete", "Delete")]
185
+ "aria-label": C("healthybowl.network.cohorts.actions.deleteCohort", "Delete cohort"),
186
+ children: [/* @__PURE__ */ v(oe, { className: "h-3.5 w-3.5" }), K === e.id ? C("healthybowl.network.cohorts.actions.deleting", "Deleting…") : C("healthybowl.network.cohorts.actions.delete", "Delete")]
187
187
  })]
188
188
  })
189
189
  }
190
190
  ];
191
191
  return /* @__PURE__ */ y(e, {
192
- title: S("healthybowl.network.cohorts.title", "Farmer Cohorts"),
193
- description: S("healthybowl.network.cohorts.description", "Group farmers into cohorts for programs, training and outreach — powered by the shared workspace Groups service"),
192
+ title: C("healthybowl.network.cohorts.title", "Farmer Cohorts"),
193
+ description: C("healthybowl.network.cohorts.description", "Group farmers into cohorts for programs, training and outreach — powered by the shared workspace Groups service"),
194
194
  purpose: "Organise farmers into groups for training, programs or outreach. Cohorts make it easy to run something for many farmers at once — share resources, track participation, and reach everyone in a group together.",
195
195
  actions: /* @__PURE__ */ y(b, {
196
196
  onClick: () => {
197
197
  G(), R(!0);
198
198
  },
199
199
  children: [
200
- /* @__PURE__ */ v(p, { className: "h-3.5 w-3.5" }),
200
+ /* @__PURE__ */ v(h, { className: "h-3.5 w-3.5" }),
201
201
  " ",
202
- S("healthybowl.network.cohorts.actions.createCohort", "Create Cohort")
202
+ C("healthybowl.network.cohorts.actions.createCohort", "Create Cohort")
203
203
  ]
204
204
  }),
205
205
  children: [
@@ -208,149 +208,149 @@ var x = "healthybowl", le = (e) => {
208
208
  children: [
209
209
  /* @__PURE__ */ v(t, {
210
210
  hero: !0,
211
- label: S("healthybowl.network.cohorts.stats.total", "Total Cohorts"),
211
+ label: C("healthybowl.network.cohorts.stats.total", "Total Cohorts"),
212
212
  value: j.length,
213
- icon: /* @__PURE__ */ v(f, { className: "h-4 w-4" })
213
+ icon: /* @__PURE__ */ v(m, { className: "h-4 w-4" })
214
214
  }),
215
215
  /* @__PURE__ */ v(t, {
216
- label: S("healthybowl.network.cohorts.stats.active", "Active"),
216
+ label: C("healthybowl.network.cohorts.stats.active", "Active"),
217
217
  value: I,
218
- icon: /* @__PURE__ */ v(g, { className: "h-4 w-4" })
218
+ icon: /* @__PURE__ */ v(se, { className: "h-4 w-4" })
219
219
  }),
220
220
  /* @__PURE__ */ v(t, {
221
- label: S("healthybowl.network.cohorts.stats.members", "Total Members"),
221
+ label: C("healthybowl.network.cohorts.stats.members", "Total Members"),
222
222
  value: F,
223
- icon: /* @__PURE__ */ v(h, { className: "h-4 w-4" })
223
+ icon: /* @__PURE__ */ v(g, { className: "h-4 w-4" })
224
224
  })
225
225
  ]
226
226
  }),
227
- /* @__PURE__ */ v(r, {
227
+ /* @__PURE__ */ v(ee, {
228
228
  searchValue: M,
229
229
  onSearchChange: N,
230
- searchPlaceholder: S("healthybowl.network.cohorts.searchPlaceholder", "Search cohorts by name…")
230
+ searchPlaceholder: C("healthybowl.network.cohorts.searchPlaceholder", "Search cohorts by name…")
231
231
  }),
232
232
  P.length > 0 ? /* @__PURE__ */ v("div", {
233
233
  className: "overflow-hidden rounded-lg border border-border-subtle bg-bg-surface",
234
- children: /* @__PURE__ */ v(ce, {
234
+ children: /* @__PURE__ */ v(x, {
235
235
  columns: _e,
236
236
  data: P,
237
237
  rowKey: (e) => String(e.id)
238
238
  })
239
- }) : j.length === 0 ? T ? /* @__PURE__ */ v(o, {}) : E ? /* @__PURE__ */ y("div", {
239
+ }) : j.length === 0 ? fe ? /* @__PURE__ */ v(a, {}) : E ? /* @__PURE__ */ y("div", {
240
240
  className: "flex items-center gap-2 rounded-lg border border-border-subtle bg-bg-surface p-5 text-sm text-text-secondary",
241
241
  children: [
242
- /* @__PURE__ */ v(d, { className: "h-4 w-4" }),
242
+ /* @__PURE__ */ v(p, { className: "h-4 w-4" }),
243
243
  " ",
244
- S("healthybowl.network.cohorts.loadError", "Cohorts aren’t available right now."),
244
+ C("healthybowl.network.cohorts.loadError", "Cohorts aren’t available right now."),
245
245
  /* @__PURE__ */ v(b, {
246
246
  variant: "ghost",
247
247
  size: "sm",
248
248
  onClick: () => void D(),
249
249
  className: "ms-2 text-primary",
250
- children: S("healthybowl.common.retry", "Retry")
250
+ children: C("healthybowl.common.retry", "Retry")
251
251
  })
252
252
  ]
253
253
  }) : /* @__PURE__ */ v(n, {
254
254
  illustration: "empty-people",
255
- title: S("healthybowl.network.cohorts.emptyState.none.title", "No cohorts yet"),
256
- description: S("healthybowl.network.cohorts.emptyState.none.description", "Create your first farmer cohort to organize training programs and outreach."),
255
+ title: C("healthybowl.network.cohorts.emptyState.none.title", "No cohorts yet"),
256
+ description: C("healthybowl.network.cohorts.emptyState.none.description", "Create your first farmer cohort to organize training programs and outreach."),
257
257
  action: /* @__PURE__ */ y(b, {
258
258
  onClick: () => {
259
259
  G(), R(!0);
260
260
  },
261
261
  children: [
262
- /* @__PURE__ */ v(p, { className: "h-3.5 w-3.5" }),
262
+ /* @__PURE__ */ v(h, { className: "h-3.5 w-3.5" }),
263
263
  " ",
264
- S("healthybowl.network.cohorts.actions.createCohort", "Create Cohort")
264
+ C("healthybowl.network.cohorts.actions.createCohort", "Create Cohort")
265
265
  ]
266
266
  })
267
267
  }) : /* @__PURE__ */ v(n, {
268
268
  illustration: "empty-search",
269
- title: S("healthybowl.network.cohorts.emptyState.noMatch.title", "No cohorts found"),
270
- description: S("healthybowl.network.cohorts.emptyState.noMatch.description", "No cohorts match your search. Try a different name."),
269
+ title: C("healthybowl.network.cohorts.emptyState.noMatch.title", "No cohorts found"),
270
+ description: C("healthybowl.network.cohorts.emptyState.noMatch.description", "No cohorts match your search. Try a different name."),
271
271
  action: /* @__PURE__ */ v(b, {
272
272
  onClick: () => N(""),
273
- children: S("healthybowl.network.cohorts.actions.clearSearch", "Clear search")
273
+ children: C("healthybowl.network.cohorts.actions.clearSearch", "Clear search")
274
274
  })
275
275
  }),
276
- /* @__PURE__ */ v(s, {
276
+ /* @__PURE__ */ v(o, {
277
277
  open: L,
278
278
  onClose: () => R(!1),
279
- title: S("healthybowl.network.cohorts.createModal.title", "Create Cohort"),
280
- description: S("healthybowl.network.cohorts.createModal.description", "Cohorts are static groups of farmers stored in the shared workspace Groups service."),
279
+ title: C("healthybowl.network.cohorts.createModal.title", "Create Cohort"),
280
+ description: C("healthybowl.network.cohorts.createModal.description", "Cohorts are static groups of farmers stored in the shared workspace Groups service."),
281
281
  footer: /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v(b, {
282
282
  variant: "outline",
283
283
  onClick: () => R(!1),
284
- children: S("healthybowl.common.cancel", "Cancel")
284
+ children: C("healthybowl.common.cancel", "Cancel")
285
285
  }), /* @__PURE__ */ v(b, {
286
286
  onClick: pe,
287
287
  disabled: z,
288
- children: z ? S("healthybowl.network.cohorts.createModal.creating", "Creating…") : S("healthybowl.network.cohorts.createModal.create", "Create Cohort")
288
+ children: z ? C("healthybowl.network.cohorts.createModal.creating", "Creating…") : C("healthybowl.network.cohorts.createModal.create", "Create Cohort")
289
289
  })] }),
290
290
  children: /* @__PURE__ */ y("div", {
291
291
  className: "space-y-4",
292
292
  children: [/* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
293
293
  htmlFor: "cohort-name",
294
294
  className: "mb-1 block text-xs font-medium text-text-primary",
295
- children: S("healthybowl.network.cohorts.form.fields.name.label", "Name")
295
+ children: C("healthybowl.network.cohorts.form.fields.name.label", "Name")
296
296
  }), /* @__PURE__ */ v("input", {
297
297
  id: "cohort-name",
298
298
  type: "text",
299
299
  value: V,
300
300
  onChange: (e) => H(e.target.value),
301
301
  maxLength: 120,
302
- placeholder: S("healthybowl.network.cohorts.form.fields.name.placeholder", "e.g. Kharif 2026 Organic Cluster"),
302
+ placeholder: C("healthybowl.network.cohorts.form.fields.name.placeholder", "e.g. Kharif 2026 Organic Cluster"),
303
303
  className: "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
304
304
  })] }), /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
305
305
  htmlFor: "cohort-description",
306
306
  className: "mb-1 block text-xs font-medium text-text-primary",
307
- children: S("healthybowl.network.cohorts.form.fields.description.label", "Description (optional)")
307
+ children: C("healthybowl.network.cohorts.form.fields.description.label", "Description (optional)")
308
308
  }), /* @__PURE__ */ v("textarea", {
309
309
  id: "cohort-description",
310
310
  value: U,
311
311
  onChange: (e) => W(e.target.value),
312
312
  rows: 3,
313
313
  maxLength: 500,
314
- placeholder: S("healthybowl.network.cohorts.form.fields.description.placeholder", "What is this cohort for?"),
314
+ placeholder: C("healthybowl.network.cohorts.form.fields.description.placeholder", "What is this cohort for?"),
315
315
  className: "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
316
316
  })] })]
317
317
  })
318
318
  }),
319
- /* @__PURE__ */ v(s, {
319
+ /* @__PURE__ */ v(o, {
320
320
  open: J !== null,
321
321
  onClose: () => Y(null),
322
- title: S("healthybowl.network.cohorts.memberModal.title", "Add Member"),
323
- description: J ? S("healthybowl.network.cohorts.memberModal.description", "Add a farmer to “{{name}}”.", { name: J.name }) : void 0,
322
+ title: C("healthybowl.network.cohorts.memberModal.title", "Add Member"),
323
+ description: J ? C("healthybowl.network.cohorts.memberModal.description", "Add a farmer to “{{name}}”.", { name: J.name }) : void 0,
324
324
  footer: /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v(b, {
325
325
  variant: "outline",
326
326
  onClick: () => Y(null),
327
- children: S("healthybowl.common.cancel", "Cancel")
327
+ children: C("healthybowl.common.cancel", "Cancel")
328
328
  }), /* @__PURE__ */ v(b, {
329
329
  onClick: ge,
330
330
  disabled: Q,
331
- children: Q ? S("healthybowl.network.cohorts.memberModal.adding", "Adding…") : S("healthybowl.network.cohorts.memberModal.add", "Add Member")
331
+ children: Q ? C("healthybowl.network.cohorts.memberModal.adding", "Adding…") : C("healthybowl.network.cohorts.memberModal.add", "Add Member")
332
332
  })] }),
333
333
  children: /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
334
334
  htmlFor: "cohort-member-email",
335
335
  className: "mb-1 block text-xs font-medium text-text-primary",
336
- children: S("healthybowl.network.cohorts.form.fields.email.label", "Farmer email")
336
+ children: C("healthybowl.network.cohorts.form.fields.email.label", "Farmer email")
337
337
  }), /* @__PURE__ */ v("input", {
338
338
  id: "cohort-member-email",
339
339
  type: "email",
340
340
  value: X,
341
341
  onChange: (e) => Z(e.target.value),
342
- placeholder: S("healthybowl.network.cohorts.form.fields.email.placeholder", "farmer@example.com"),
342
+ placeholder: C("healthybowl.network.cohorts.form.fields.email.placeholder", "farmer@example.com"),
343
343
  className: "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
344
344
  })] })
345
345
  }),
346
- /* @__PURE__ */ v(i, {
347
- toasts: ue,
348
- onDismiss: de
346
+ /* @__PURE__ */ v(r, {
347
+ toasts: le,
348
+ onDismiss: ue
349
349
  })
350
350
  ]
351
351
  });
352
352
  };
353
353
  //#endregion
354
- export { S as CohortsPage };
354
+ export { C as CohortsPage };
355
355
 
356
356
  //# sourceMappingURL=CohortsPage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CohortsPage.js","names":[],"sources":["../../../../src/healthybowl/pages/network/CohortsPage.tsx"],"sourcesContent":["import { useMemo, useState, type FC } from 'react';\nimport { Users, Plus, Trash2, UserPlus, AlertCircle, Layers } from 'lucide-react';\nimport {\n PageLayout,\n StatCard,\n FilterBar,\n StatusBadge,\n EmptyState,\n PageLoader,\n Modal,\n useConfirm,\n} from '../../components';\nimport { ToastContainer } from '../../components/Toast';\nimport { Button, ResponsiveTable, type ResponsiveTableColumn } from '@burdenoff/fe-libs/ui';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { useToast } from '../../hooks/useToast';\nimport { GroupType, MembershipType } from '../../../generated/wspace-types';\nimport {\n useGetHealthyBowlCohortsQuery,\n useCreateHealthyBowlCohortMutation,\n useDeleteHealthyBowlCohortMutation,\n useAddHealthyBowlCohortMembersMutation,\n type HealthyBowlCohortFieldsFragment,\n} from '../../../generated/wspace-operations';\n\n/**\n * Farmer Cohorts — genuine same-layer reuse of `wspace-groups-svc`.\n *\n * The page talks to the workspace gateway directly (the tags-reuse pattern):\n * no HealthyBowl-svc M2M and no parallel group store. `wspace-groups-svc` owns\n * the group lifecycle and enforces its own `@rbac` at the gateway edge, so\n * there is no HB-side RBAC seed to maintain. HB-owned cohorts are marked with\n * `productKey: \"healthybowl\"` and a STATIC membership type; everything else is\n * the platform groups service's responsibility.\n */\n\nconst HB_PRODUCT_KEY = 'healthybowl';\n\ntype Cohort = HealthyBowlCohortFieldsFragment;\n\nconst statusVariant = (status: string): 'success' | 'warning' | 'muted' | 'default' => {\n switch (status.toUpperCase()) {\n case 'ACTIVE':\n return 'success';\n case 'ARCHIVED':\n case 'FROZEN':\n case 'SUSPENDED':\n return 'warning';\n case 'DELETED':\n return 'muted';\n default:\n return 'default';\n }\n};\n\nexport const CohortsPage: FC = () => {\n const { t } = useI18n();\n const { toasts, toast, dismiss } = useToast();\n const confirm = useConfirm();\n\n const { data, loading, error, refetch } = useGetHealthyBowlCohortsQuery({\n variables: { first: 100 },\n fetchPolicy: 'cache-and-network',\n });\n const [createCohort] = useCreateHealthyBowlCohortMutation();\n const [deleteCohort] = useDeleteHealthyBowlCohortMutation();\n const [addMembers] = useAddHealthyBowlCohortMembersMutation();\n\n // The groups service returns every group the caller can see; a Farmer Cohort\n // is the HB-owned subset (productKey === \"healthybowl\"). Filtering here keeps\n // the page honest without inventing a separate store.\n const cohorts: Cohort[] = useMemo(() => {\n const edges = data?.myGroups.edges ?? [];\n const nodes: Cohort[] = edges.map((edge: { node: Cohort }) => edge.node);\n return nodes.filter((g) => g.productKey === HB_PRODUCT_KEY);\n }, [data]);\n\n const [search, setSearch] = useState('');\n\n const filtered = useMemo(() => {\n const q = search.trim().toLowerCase();\n if (!q) return cohorts;\n return cohorts.filter((c) => c.name.toLowerCase().includes(q) || (c.description ?? '').toLowerCase().includes(q));\n }, [cohorts, search]);\n\n const totalMembers = cohorts.reduce((sum, c) => sum + c.memberCount, 0);\n const activeCount = cohorts.filter((c) => c.status.toUpperCase() === 'ACTIVE').length;\n\n // ── Create cohort ──────────────────────────────────────────────────────────\n const [showCreate, setShowCreate] = useState(false);\n const [creating, setCreating] = useState(false);\n const [name, setName] = useState('');\n const [description, setDescription] = useState('');\n\n const resetCreateForm = () => {\n setName('');\n setDescription('');\n };\n\n const handleCreate = async () => {\n if (!name.trim()) {\n toast({\n title: t('healthybowl.network.cohorts.toast.nameRequired.title', 'Cohort name required'),\n description: t('healthybowl.network.cohorts.toast.nameRequired.description', 'Give the cohort a name.'),\n variant: 'warning',\n });\n return;\n }\n setCreating(true);\n try {\n await createCohort({\n variables: {\n input: {\n name: name.trim(),\n description: description.trim() || null,\n groupType: GroupType.Team,\n membershipType: MembershipType.Static,\n productKey: HB_PRODUCT_KEY,\n },\n },\n });\n toast({\n title: t('healthybowl.network.cohorts.toast.created.title', 'Cohort created'),\n description: t('healthybowl.network.cohorts.toast.created.description', '“{{name}}” has been created.', {\n name: name.trim(),\n }),\n variant: 'success',\n });\n setShowCreate(false);\n resetCreateForm();\n await refetch();\n } catch (err) {\n toast({\n title: t('healthybowl.network.cohorts.toast.createFailed.title', 'Could not create cohort'),\n description:\n err instanceof Error\n ? err.message\n : t('healthybowl.network.cohorts.toast.createFailed.description', 'Failed to create cohort.'),\n variant: 'error',\n });\n } finally {\n setCreating(false);\n }\n };\n\n // ── Delete cohort ──────────────────────────────────────────────────────────\n const [deletingId, setDeletingId] = useState<string | null>(null);\n\n const handleDelete = async (cohort: Cohort) => {\n if (\n !(await confirm({\n message: t(\n 'healthybowl.network.cohorts.deleteConfirm',\n 'Delete the cohort “{{name}}”? This cannot be undone.',\n {\n name: cohort.name,\n }\n ),\n }))\n ) {\n return;\n }\n setDeletingId(cohort.id);\n try {\n await deleteCohort({ variables: { id: cohort.id } });\n toast({\n title: t('healthybowl.network.cohorts.toast.deleted.title', 'Cohort deleted'),\n description: t('healthybowl.network.cohorts.toast.deleted.description', '“{{name}}” has been removed.', {\n name: cohort.name,\n }),\n variant: 'success',\n });\n await refetch();\n } catch (err) {\n toast({\n title: t('healthybowl.network.cohorts.toast.deleteFailed.title', 'Could not delete cohort'),\n description:\n err instanceof Error\n ? err.message\n : t('healthybowl.network.cohorts.toast.deleteFailed.description', 'Failed to delete cohort.'),\n variant: 'error',\n });\n } finally {\n setDeletingId(null);\n }\n };\n\n // ── Add member (stretch) ─────────────────────────────────────────────────────\n const [memberCohort, setMemberCohort] = useState<Cohort | null>(null);\n const [memberEmail, setMemberEmail] = useState('');\n const [addingMember, setAddingMember] = useState(false);\n\n const openAddMember = (cohort: Cohort) => {\n setMemberEmail('');\n setMemberCohort(cohort);\n };\n\n const handleAddMember = async () => {\n if (!memberCohort) return;\n const email = memberEmail.trim();\n if (!email) {\n toast({\n title: t('healthybowl.network.cohorts.toast.emailRequired.title', 'Email required'),\n description: t(\n 'healthybowl.network.cohorts.toast.emailRequired.description',\n 'Enter the email of the farmer to add.'\n ),\n variant: 'warning',\n });\n return;\n }\n setAddingMember(true);\n try {\n const res = await addMembers({\n variables: { groupId: memberCohort.id, members: [{ email }] },\n });\n const result = res.data?.addGroupMembers;\n if (result && result.failedCount > 0) {\n const reason = result.failed[0]?.error;\n toast({\n title: t('healthybowl.network.cohorts.toast.addMemberFailed.title', 'Could not add member'),\n description:\n reason ?? t('healthybowl.network.cohorts.toast.addMemberFailed.description', 'Failed to add the farmer.'),\n variant: 'error',\n });\n return;\n }\n toast({\n title: t('healthybowl.network.cohorts.toast.memberAdded.title', 'Member added'),\n description: t(\n 'healthybowl.network.cohorts.toast.memberAdded.description',\n '{{email}} was added to “{{name}}”.',\n { email, name: memberCohort.name }\n ),\n variant: 'success',\n });\n setMemberCohort(null);\n setMemberEmail('');\n await refetch();\n } catch (err) {\n toast({\n title: t('healthybowl.network.cohorts.toast.addMemberFailed.title', 'Could not add member'),\n description:\n err instanceof Error\n ? err.message\n : t('healthybowl.network.cohorts.toast.addMemberFailed.description', 'Failed to add the farmer.'),\n variant: 'error',\n });\n } finally {\n setAddingMember(false);\n }\n };\n\n const columns: ResponsiveTableColumn<Cohort>[] = [\n {\n key: 'name',\n header: t('healthybowl.network.cohorts.table.headers.name', 'Cohort'),\n priority: 'primary',\n cell: (cohort) => (\n <>\n <p className=\"font-medium text-text-primary\">{cohort.name}</p>\n {cohort.description && (\n <p className=\"mt-0.5 line-clamp-1 text-xs text-text-secondary\">{cohort.description}</p>\n )}\n </>\n ),\n },\n {\n key: 'members',\n header: t('healthybowl.network.cohorts.table.headers.members', 'Members'),\n priority: 'secondary',\n cellClassName: 'text-text-secondary',\n cell: (cohort) =>\n t('healthybowl.network.cohorts.table.memberCount', '{{count}} members', {\n count: cohort.memberCount,\n }),\n },\n {\n key: 'status',\n header: t('healthybowl.network.cohorts.table.headers.status', 'Status'),\n priority: 'secondary',\n cell: (cohort) => <StatusBadge label={cohort.status} variant={statusVariant(cohort.status)} dot />,\n },\n {\n key: 'actions',\n header: t('healthybowl.network.cohorts.table.headers.actions', 'Actions'),\n priority: 'secondary',\n headerClassName: 'text-end',\n cell: (cohort) => (\n <div className=\"flex items-center justify-end gap-2\">\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={() => openAddMember(cohort)}\n aria-label={t('healthybowl.network.cohorts.actions.addMember', 'Add member')}\n >\n <UserPlus className=\"h-3.5 w-3.5\" /> {t('healthybowl.network.cohorts.actions.addMember', 'Add member')}\n </Button>\n <Button\n variant=\"destructive\"\n size=\"sm\"\n onClick={() => handleDelete(cohort)}\n disabled={deletingId === cohort.id}\n aria-label={t('healthybowl.network.cohorts.actions.deleteCohort', 'Delete cohort')}\n >\n <Trash2 className=\"h-3.5 w-3.5\" />\n {deletingId === cohort.id\n ? t('healthybowl.network.cohorts.actions.deleting', 'Deleting…')\n : t('healthybowl.network.cohorts.actions.delete', 'Delete')}\n </Button>\n </div>\n ),\n },\n ];\n\n return (\n <PageLayout\n title={t('healthybowl.network.cohorts.title', 'Farmer Cohorts')}\n description={t(\n 'healthybowl.network.cohorts.description',\n 'Group farmers into cohorts for programs, training and outreach — powered by the shared workspace Groups service'\n )}\n purpose=\"Organise farmers into groups for training, programs or outreach. Cohorts make it easy to run something for many farmers at once — share resources, track participation, and reach everyone in a group together.\"\n actions={\n <Button\n onClick={() => {\n resetCreateForm();\n setShowCreate(true);\n }}\n >\n <Plus className=\"h-3.5 w-3.5\" /> {t('healthybowl.network.cohorts.actions.createCohort', 'Create Cohort')}\n </Button>\n }\n >\n {/* Stats */}\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-3\">\n <StatCard\n hero\n label={t('healthybowl.network.cohorts.stats.total', 'Total Cohorts')}\n value={cohorts.length}\n icon={<Layers className=\"h-4 w-4\" />}\n />\n <StatCard\n label={t('healthybowl.network.cohorts.stats.active', 'Active')}\n value={activeCount}\n icon={<Users className=\"h-4 w-4\" />}\n />\n <StatCard\n label={t('healthybowl.network.cohorts.stats.members', 'Total Members')}\n value={totalMembers}\n icon={<UserPlus className=\"h-4 w-4\" />}\n />\n </div>\n\n {/* Filter */}\n <FilterBar\n searchValue={search}\n onSearchChange={setSearch}\n searchPlaceholder={t('healthybowl.network.cohorts.searchPlaceholder', 'Search cohorts by name…')}\n />\n\n {/* List */}\n {filtered.length > 0 ? (\n <div className=\"overflow-hidden rounded-lg border border-border-subtle bg-bg-surface\">\n <ResponsiveTable<Cohort> columns={columns} data={filtered} rowKey={(cohort) => String(cohort.id)} />\n </div>\n ) : cohorts.length === 0 ? (\n loading ? (\n <PageLoader />\n ) : error ? (\n <div className=\"flex items-center gap-2 rounded-lg border border-border-subtle bg-bg-surface p-5 text-sm text-text-secondary\">\n <AlertCircle className=\"h-4 w-4\" />{' '}\n {t('healthybowl.network.cohorts.loadError', 'Cohorts aren’t available right now.')}\n <Button variant=\"ghost\" size=\"sm\" onClick={() => void refetch()} className=\"ms-2 text-primary\">\n {t('healthybowl.common.retry', 'Retry')}\n </Button>\n </div>\n ) : (\n <EmptyState\n illustration=\"empty-people\"\n title={t('healthybowl.network.cohorts.emptyState.none.title', 'No cohorts yet')}\n description={t(\n 'healthybowl.network.cohorts.emptyState.none.description',\n 'Create your first farmer cohort to organize training programs and outreach.'\n )}\n action={\n <Button\n onClick={() => {\n resetCreateForm();\n setShowCreate(true);\n }}\n >\n <Plus className=\"h-3.5 w-3.5\" />{' '}\n {t('healthybowl.network.cohorts.actions.createCohort', 'Create Cohort')}\n </Button>\n }\n />\n )\n ) : (\n <EmptyState\n illustration=\"empty-search\"\n title={t('healthybowl.network.cohorts.emptyState.noMatch.title', 'No cohorts found')}\n description={t(\n 'healthybowl.network.cohorts.emptyState.noMatch.description',\n 'No cohorts match your search. Try a different name.'\n )}\n action={\n <Button onClick={() => setSearch('')}>\n {t('healthybowl.network.cohorts.actions.clearSearch', 'Clear search')}\n </Button>\n }\n />\n )}\n\n {/* Create modal */}\n <Modal\n open={showCreate}\n onClose={() => setShowCreate(false)}\n title={t('healthybowl.network.cohorts.createModal.title', 'Create Cohort')}\n description={t(\n 'healthybowl.network.cohorts.createModal.description',\n 'Cohorts are static groups of farmers stored in the shared workspace Groups service.'\n )}\n footer={\n <>\n <Button variant=\"outline\" onClick={() => setShowCreate(false)}>\n {t('healthybowl.common.cancel', 'Cancel')}\n </Button>\n <Button onClick={handleCreate} disabled={creating}>\n {creating\n ? t('healthybowl.network.cohorts.createModal.creating', 'Creating…')\n : t('healthybowl.network.cohorts.createModal.create', 'Create Cohort')}\n </Button>\n </>\n }\n >\n <div className=\"space-y-4\">\n <div>\n <label htmlFor=\"cohort-name\" className=\"mb-1 block text-xs font-medium text-text-primary\">\n {t('healthybowl.network.cohorts.form.fields.name.label', 'Name')}\n </label>\n <input\n id=\"cohort-name\"\n type=\"text\"\n value={name}\n onChange={(e) => setName(e.target.value)}\n maxLength={120}\n placeholder={t(\n 'healthybowl.network.cohorts.form.fields.name.placeholder',\n 'e.g. Kharif 2026 Organic Cluster'\n )}\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n </div>\n <div>\n <label htmlFor=\"cohort-description\" className=\"mb-1 block text-xs font-medium text-text-primary\">\n {t('healthybowl.network.cohorts.form.fields.description.label', 'Description (optional)')}\n </label>\n <textarea\n id=\"cohort-description\"\n value={description}\n onChange={(e) => setDescription(e.target.value)}\n rows={3}\n maxLength={500}\n placeholder={t(\n 'healthybowl.network.cohorts.form.fields.description.placeholder',\n 'What is this cohort for?'\n )}\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n </div>\n </div>\n </Modal>\n\n {/* Add member modal */}\n <Modal\n open={memberCohort !== null}\n onClose={() => setMemberCohort(null)}\n title={t('healthybowl.network.cohorts.memberModal.title', 'Add Member')}\n description={\n memberCohort\n ? t('healthybowl.network.cohorts.memberModal.description', 'Add a farmer to “{{name}}”.', {\n name: memberCohort.name,\n })\n : undefined\n }\n footer={\n <>\n <Button variant=\"outline\" onClick={() => setMemberCohort(null)}>\n {t('healthybowl.common.cancel', 'Cancel')}\n </Button>\n <Button onClick={handleAddMember} disabled={addingMember}>\n {addingMember\n ? t('healthybowl.network.cohorts.memberModal.adding', 'Adding…')\n : t('healthybowl.network.cohorts.memberModal.add', 'Add Member')}\n </Button>\n </>\n }\n >\n <div>\n <label htmlFor=\"cohort-member-email\" className=\"mb-1 block text-xs font-medium text-text-primary\">\n {t('healthybowl.network.cohorts.form.fields.email.label', 'Farmer email')}\n </label>\n <input\n id=\"cohort-member-email\"\n type=\"email\"\n value={memberEmail}\n onChange={(e) => setMemberEmail(e.target.value)}\n placeholder={t('healthybowl.network.cohorts.form.fields.email.placeholder', 'farmer@example.com')}\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n </div>\n </Modal>\n\n <ToastContainer toasts={toasts} onDismiss={dismiss} />\n </PageLayout>\n );\n};\n"],"mappings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AAC,YAAD;MACE,IAAG;MACH,OAAO;MACP,WAAW,MAAM,EAAe,EAAE,OAAO,KAAK;MAC9C,MAAM;MACN,WAAW;MACX,aAAa,EACX,mEACA,0BACF;MACA,WAAU;KACX,CAAA,CACE,EAAA,CAAA,CACF;;GACA,CAAA;GAGP,kBAAC,GAAD;IACE,MAAM,MAAiB;IACvB,eAAe,EAAgB,IAAI;IACnC,OAAO,EAAE,iDAAiD,YAAY;IACtE,aACE,IACI,EAAE,uDAAuD,+BAA+B,EACtF,MAAM,EAAa,KACrB,CAAC,IACD,KAAA;IAEN,QACE,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,GAAD;KAAQ,SAAQ;KAAU,eAAe,EAAgB,IAAI;eAC1D,EAAE,6BAA6B,QAAQ;IAClC,CAAA,GACR,kBAAC,GAAD;KAAQ,SAAS;KAAiB,UAAU;eACzC,IACG,EAAE,kDAAkD,SAAS,IAC7D,EAAE,+CAA+C,YAAY;IAC3D,CAAA,CACR,EAAA,CAAA;cAGJ,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,SAAD;KAAO,SAAQ;KAAsB,WAAU;eAC5C,EAAE,uDAAuD,cAAc;IACnE,CAAA,GACP,kBAAC,SAAD;KACE,IAAG;KACH,MAAK;KACL,OAAO;KACP,WAAW,MAAM,EAAe,EAAE,OAAO,KAAK;KAC9C,aAAa,EAAE,6DAA6D,oBAAoB;KAChG,WAAU;IACX,CAAA,CACE,EAAA,CAAA;GACA,CAAA;GAEP,kBAAC,GAAD;IAAwB;IAAQ,WAAW;GAAU,CAAA;EAC3C;;AAEhB"}
1
+ {"version":3,"file":"CohortsPage.js","names":[],"sources":["../../../../src/healthybowl/pages/network/CohortsPage.tsx"],"sourcesContent":["import { useMemo, useState, type FC } from 'react';\nimport { Users, Plus, Trash2, UserPlus, AlertCircle, Layers } from 'lucide-react';\nimport {\n PageLayout,\n StatCard,\n FilterBar,\n StatusBadge,\n EmptyState,\n PageLoader,\n Modal,\n useConfirm,\n} from '../../components';\nimport { ToastContainer } from '../../components/Toast';\nimport { Button, ResponsiveTable, type ResponsiveTableColumn } from '@burdenoff/fe-libs/ui';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { useToast } from '../../hooks/useToast';\nimport { GroupType, MembershipType } from '../../../generated/wspace-types';\nimport {\n useGetHealthyBowlCohortsQuery,\n useCreateHealthyBowlCohortMutation,\n useDeleteHealthyBowlCohortMutation,\n useAddHealthyBowlCohortMembersMutation,\n type HealthyBowlCohortFieldsFragment,\n} from '../../../generated/wspace-operations';\n\n/**\n * Farmer Cohorts — genuine same-layer reuse of `wspace-groups-svc`.\n *\n * The page talks to the workspace gateway directly (the tags-reuse pattern):\n * no HealthyBowl-svc M2M and no parallel group store. `wspace-groups-svc` owns\n * the group lifecycle and enforces its own `@rbac` at the gateway edge, so\n * there is no HB-side RBAC seed to maintain. HB-owned cohorts are marked with\n * `productKey: \"healthybowl\"` and a STATIC membership type; everything else is\n * the platform groups service's responsibility.\n */\n\nconst HB_PRODUCT_KEY = 'healthybowl';\n\ntype Cohort = HealthyBowlCohortFieldsFragment;\n\nconst statusVariant = (status: string): 'success' | 'warning' | 'muted' | 'default' => {\n switch (status.toUpperCase()) {\n case 'ACTIVE':\n return 'success';\n case 'ARCHIVED':\n case 'FROZEN':\n case 'SUSPENDED':\n return 'warning';\n case 'DELETED':\n return 'muted';\n default:\n return 'default';\n }\n};\n\nexport const CohortsPage: FC = () => {\n const { t } = useI18n();\n const { toasts, toast, dismiss } = useToast();\n const confirm = useConfirm();\n\n const { data, loading, error, refetch } = useGetHealthyBowlCohortsQuery({\n variables: { first: 100 },\n fetchPolicy: 'cache-and-network',\n });\n const [createCohort] = useCreateHealthyBowlCohortMutation();\n const [deleteCohort] = useDeleteHealthyBowlCohortMutation();\n const [addMembers] = useAddHealthyBowlCohortMembersMutation();\n\n // The groups service returns every group the caller can see; a Farmer Cohort\n // is the HB-owned subset (productKey === \"healthybowl\"). Filtering here keeps\n // the page honest without inventing a separate store.\n const cohorts: Cohort[] = useMemo(() => {\n const edges = data?.myGroups.edges ?? [];\n const nodes: Cohort[] = edges.map((edge: { node: Cohort }) => edge.node);\n return nodes.filter((g) => g.productKey === HB_PRODUCT_KEY);\n }, [data]);\n\n const [search, setSearch] = useState('');\n\n const filtered = useMemo(() => {\n const q = search.trim().toLowerCase();\n if (!q) return cohorts;\n return cohorts.filter((c) => c.name.toLowerCase().includes(q) || (c.description ?? '').toLowerCase().includes(q));\n }, [cohorts, search]);\n\n const totalMembers = cohorts.reduce((sum, c) => sum + c.memberCount, 0);\n const activeCount = cohorts.filter((c) => c.status.toUpperCase() === 'ACTIVE').length;\n\n // ── Create cohort ──────────────────────────────────────────────────────────\n const [showCreate, setShowCreate] = useState(false);\n const [creating, setCreating] = useState(false);\n const [name, setName] = useState('');\n const [description, setDescription] = useState('');\n\n const resetCreateForm = () => {\n setName('');\n setDescription('');\n };\n\n const handleCreate = async () => {\n if (!name.trim()) {\n toast({\n title: t('healthybowl.network.cohorts.toast.nameRequired.title', 'Cohort name required'),\n description: t('healthybowl.network.cohorts.toast.nameRequired.description', 'Give the cohort a name.'),\n variant: 'warning',\n });\n return;\n }\n setCreating(true);\n try {\n await createCohort({\n variables: {\n input: {\n name: name.trim(),\n description: description.trim() || null,\n groupType: GroupType.Team,\n membershipType: MembershipType.Static,\n productKey: HB_PRODUCT_KEY,\n },\n },\n });\n toast({\n title: t('healthybowl.network.cohorts.toast.created.title', 'Cohort created'),\n description: t('healthybowl.network.cohorts.toast.created.description', '“{{name}}” has been created.', {\n name: name.trim(),\n }),\n variant: 'success',\n });\n setShowCreate(false);\n resetCreateForm();\n await refetch();\n } catch (err) {\n toast({\n title: t('healthybowl.network.cohorts.toast.createFailed.title', 'Could not create cohort'),\n description:\n err instanceof Error\n ? err.message\n : t('healthybowl.network.cohorts.toast.createFailed.description', 'Failed to create cohort.'),\n variant: 'error',\n });\n } finally {\n setCreating(false);\n }\n };\n\n // ── Delete cohort ──────────────────────────────────────────────────────────\n const [deletingId, setDeletingId] = useState<string | null>(null);\n\n const handleDelete = async (cohort: Cohort) => {\n if (\n !(await confirm({\n message: t(\n 'healthybowl.network.cohorts.deleteConfirm',\n 'Delete the cohort “{{name}}”? This cannot be undone.',\n {\n name: cohort.name,\n }\n ),\n }))\n ) {\n return;\n }\n setDeletingId(cohort.id);\n try {\n await deleteCohort({ variables: { id: cohort.id } });\n toast({\n title: t('healthybowl.network.cohorts.toast.deleted.title', 'Cohort deleted'),\n description: t('healthybowl.network.cohorts.toast.deleted.description', '“{{name}}” has been removed.', {\n name: cohort.name,\n }),\n variant: 'success',\n });\n await refetch();\n } catch (err) {\n toast({\n title: t('healthybowl.network.cohorts.toast.deleteFailed.title', 'Could not delete cohort'),\n description:\n err instanceof Error\n ? err.message\n : t('healthybowl.network.cohorts.toast.deleteFailed.description', 'Failed to delete cohort.'),\n variant: 'error',\n });\n } finally {\n setDeletingId(null);\n }\n };\n\n // ── Add member (stretch) ─────────────────────────────────────────────────────\n const [memberCohort, setMemberCohort] = useState<Cohort | null>(null);\n const [memberEmail, setMemberEmail] = useState('');\n const [addingMember, setAddingMember] = useState(false);\n\n const openAddMember = (cohort: Cohort) => {\n setMemberEmail('');\n setMemberCohort(cohort);\n };\n\n const handleAddMember = async () => {\n if (!memberCohort) return;\n const email = memberEmail.trim();\n if (!email) {\n toast({\n title: t('healthybowl.network.cohorts.toast.emailRequired.title', 'Email required'),\n description: t(\n 'healthybowl.network.cohorts.toast.emailRequired.description',\n 'Enter the email of the farmer to add.'\n ),\n variant: 'warning',\n });\n return;\n }\n setAddingMember(true);\n try {\n const res = await addMembers({\n variables: { groupId: memberCohort.id, members: [{ email }] },\n });\n const result = res.data?.addGroupMembers;\n if (result && result.failedCount > 0) {\n const reason = result.failed[0]?.error;\n toast({\n title: t('healthybowl.network.cohorts.toast.addMemberFailed.title', 'Could not add member'),\n description:\n reason ?? t('healthybowl.network.cohorts.toast.addMemberFailed.description', 'Failed to add the farmer.'),\n variant: 'error',\n });\n return;\n }\n toast({\n title: t('healthybowl.network.cohorts.toast.memberAdded.title', 'Member added'),\n description: t(\n 'healthybowl.network.cohorts.toast.memberAdded.description',\n '{{email}} was added to “{{name}}”.',\n { email, name: memberCohort.name }\n ),\n variant: 'success',\n });\n setMemberCohort(null);\n setMemberEmail('');\n await refetch();\n } catch (err) {\n toast({\n title: t('healthybowl.network.cohorts.toast.addMemberFailed.title', 'Could not add member'),\n description:\n err instanceof Error\n ? err.message\n : t('healthybowl.network.cohorts.toast.addMemberFailed.description', 'Failed to add the farmer.'),\n variant: 'error',\n });\n } finally {\n setAddingMember(false);\n }\n };\n\n const columns: ResponsiveTableColumn<Cohort>[] = [\n {\n key: 'name',\n header: t('healthybowl.network.cohorts.table.headers.name', 'Cohort'),\n priority: 'primary',\n cell: (cohort) => (\n <>\n <p className=\"font-medium text-text-primary\">{cohort.name}</p>\n {cohort.description && (\n <p className=\"mt-0.5 line-clamp-1 text-xs text-text-secondary\">{cohort.description}</p>\n )}\n </>\n ),\n },\n {\n key: 'members',\n header: t('healthybowl.network.cohorts.table.headers.members', 'Members'),\n priority: 'secondary',\n cellClassName: 'text-text-secondary',\n cell: (cohort) =>\n t('healthybowl.network.cohorts.table.memberCount', '{{count}} members', {\n count: cohort.memberCount,\n }),\n },\n {\n key: 'status',\n header: t('healthybowl.network.cohorts.table.headers.status', 'Status'),\n priority: 'secondary',\n cell: (cohort) => <StatusBadge label={cohort.status} variant={statusVariant(cohort.status)} dot />,\n },\n {\n key: 'actions',\n header: t('healthybowl.network.cohorts.table.headers.actions', 'Actions'),\n priority: 'secondary',\n headerClassName: 'text-end',\n cell: (cohort) => (\n <div className=\"flex items-center justify-end gap-2\">\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={() => openAddMember(cohort)}\n aria-label={t('healthybowl.network.cohorts.actions.addMember', 'Add member')}\n >\n <UserPlus className=\"h-3.5 w-3.5\" /> {t('healthybowl.network.cohorts.actions.addMember', 'Add member')}\n </Button>\n <Button\n variant=\"destructive\"\n size=\"sm\"\n onClick={() => handleDelete(cohort)}\n disabled={deletingId === cohort.id}\n aria-label={t('healthybowl.network.cohorts.actions.deleteCohort', 'Delete cohort')}\n >\n <Trash2 className=\"h-3.5 w-3.5\" />\n {deletingId === cohort.id\n ? t('healthybowl.network.cohorts.actions.deleting', 'Deleting…')\n : t('healthybowl.network.cohorts.actions.delete', 'Delete')}\n </Button>\n </div>\n ),\n },\n ];\n\n return (\n <PageLayout\n title={t('healthybowl.network.cohorts.title', 'Farmer Cohorts')}\n description={t(\n 'healthybowl.network.cohorts.description',\n 'Group farmers into cohorts for programs, training and outreach — powered by the shared workspace Groups service'\n )}\n purpose=\"Organise farmers into groups for training, programs or outreach. Cohorts make it easy to run something for many farmers at once — share resources, track participation, and reach everyone in a group together.\"\n actions={\n <Button\n onClick={() => {\n resetCreateForm();\n setShowCreate(true);\n }}\n >\n <Plus className=\"h-3.5 w-3.5\" /> {t('healthybowl.network.cohorts.actions.createCohort', 'Create Cohort')}\n </Button>\n }\n >\n {/* Stats */}\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-3\">\n <StatCard\n hero\n label={t('healthybowl.network.cohorts.stats.total', 'Total Cohorts')}\n value={cohorts.length}\n icon={<Layers className=\"h-4 w-4\" />}\n />\n <StatCard\n label={t('healthybowl.network.cohorts.stats.active', 'Active')}\n value={activeCount}\n icon={<Users className=\"h-4 w-4\" />}\n />\n <StatCard\n label={t('healthybowl.network.cohorts.stats.members', 'Total Members')}\n value={totalMembers}\n icon={<UserPlus className=\"h-4 w-4\" />}\n />\n </div>\n\n {/* Filter */}\n <FilterBar\n searchValue={search}\n onSearchChange={setSearch}\n searchPlaceholder={t('healthybowl.network.cohorts.searchPlaceholder', 'Search cohorts by name…')}\n />\n\n {/* List */}\n {filtered.length > 0 ? (\n <div className=\"overflow-hidden rounded-lg border border-border-subtle bg-bg-surface\">\n <ResponsiveTable<Cohort> columns={columns} data={filtered} rowKey={(cohort) => String(cohort.id)} />\n </div>\n ) : cohorts.length === 0 ? (\n loading ? (\n <PageLoader />\n ) : error ? (\n <div className=\"flex items-center gap-2 rounded-lg border border-border-subtle bg-bg-surface p-5 text-sm text-text-secondary\">\n <AlertCircle className=\"h-4 w-4\" />{' '}\n {t('healthybowl.network.cohorts.loadError', 'Cohorts aren’t available right now.')}\n <Button variant=\"ghost\" size=\"sm\" onClick={() => void refetch()} className=\"ms-2 text-primary\">\n {t('healthybowl.common.retry', 'Retry')}\n </Button>\n </div>\n ) : (\n <EmptyState\n illustration=\"empty-people\"\n title={t('healthybowl.network.cohorts.emptyState.none.title', 'No cohorts yet')}\n description={t(\n 'healthybowl.network.cohorts.emptyState.none.description',\n 'Create your first farmer cohort to organize training programs and outreach.'\n )}\n action={\n <Button\n onClick={() => {\n resetCreateForm();\n setShowCreate(true);\n }}\n >\n <Plus className=\"h-3.5 w-3.5\" />{' '}\n {t('healthybowl.network.cohorts.actions.createCohort', 'Create Cohort')}\n </Button>\n }\n />\n )\n ) : (\n <EmptyState\n illustration=\"empty-search\"\n title={t('healthybowl.network.cohorts.emptyState.noMatch.title', 'No cohorts found')}\n description={t(\n 'healthybowl.network.cohorts.emptyState.noMatch.description',\n 'No cohorts match your search. Try a different name.'\n )}\n action={\n <Button onClick={() => setSearch('')}>\n {t('healthybowl.network.cohorts.actions.clearSearch', 'Clear search')}\n </Button>\n }\n />\n )}\n\n {/* Create modal */}\n <Modal\n open={showCreate}\n onClose={() => setShowCreate(false)}\n title={t('healthybowl.network.cohorts.createModal.title', 'Create Cohort')}\n description={t(\n 'healthybowl.network.cohorts.createModal.description',\n 'Cohorts are static groups of farmers stored in the shared workspace Groups service.'\n )}\n footer={\n <>\n <Button variant=\"outline\" onClick={() => setShowCreate(false)}>\n {t('healthybowl.common.cancel', 'Cancel')}\n </Button>\n <Button onClick={handleCreate} disabled={creating}>\n {creating\n ? t('healthybowl.network.cohorts.createModal.creating', 'Creating…')\n : t('healthybowl.network.cohorts.createModal.create', 'Create Cohort')}\n </Button>\n </>\n }\n >\n <div className=\"space-y-4\">\n <div>\n <label htmlFor=\"cohort-name\" className=\"mb-1 block text-xs font-medium text-text-primary\">\n {t('healthybowl.network.cohorts.form.fields.name.label', 'Name')}\n </label>\n <input\n id=\"cohort-name\"\n type=\"text\"\n value={name}\n onChange={(e) => setName(e.target.value)}\n maxLength={120}\n placeholder={t(\n 'healthybowl.network.cohorts.form.fields.name.placeholder',\n 'e.g. Kharif 2026 Organic Cluster'\n )}\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n </div>\n <div>\n <label htmlFor=\"cohort-description\" className=\"mb-1 block text-xs font-medium text-text-primary\">\n {t('healthybowl.network.cohorts.form.fields.description.label', 'Description (optional)')}\n </label>\n <textarea\n id=\"cohort-description\"\n value={description}\n onChange={(e) => setDescription(e.target.value)}\n rows={3}\n maxLength={500}\n placeholder={t(\n 'healthybowl.network.cohorts.form.fields.description.placeholder',\n 'What is this cohort for?'\n )}\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n </div>\n </div>\n </Modal>\n\n {/* Add member modal */}\n <Modal\n open={memberCohort !== null}\n onClose={() => setMemberCohort(null)}\n title={t('healthybowl.network.cohorts.memberModal.title', 'Add Member')}\n description={\n memberCohort\n ? t('healthybowl.network.cohorts.memberModal.description', 'Add a farmer to “{{name}}”.', {\n name: memberCohort.name,\n })\n : undefined\n }\n footer={\n <>\n <Button variant=\"outline\" onClick={() => setMemberCohort(null)}>\n {t('healthybowl.common.cancel', 'Cancel')}\n </Button>\n <Button onClick={handleAddMember} disabled={addingMember}>\n {addingMember\n ? t('healthybowl.network.cohorts.memberModal.adding', 'Adding…')\n : t('healthybowl.network.cohorts.memberModal.add', 'Add Member')}\n </Button>\n </>\n }\n >\n <div>\n <label htmlFor=\"cohort-member-email\" className=\"mb-1 block text-xs font-medium text-text-primary\">\n {t('healthybowl.network.cohorts.form.fields.email.label', 'Farmer email')}\n </label>\n <input\n id=\"cohort-member-email\"\n type=\"email\"\n value={memberEmail}\n onChange={(e) => setMemberEmail(e.target.value)}\n placeholder={t('healthybowl.network.cohorts.form.fields.email.placeholder', 'farmer@example.com')}\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n </div>\n </Modal>\n\n <ToastContainer toasts={toasts} onDismiss={dismiss} />\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAoCA,IAAM,IAAiB,eAIjB,MAAiB,MAAgE;CACrF,QAAQ,EAAO,YAAY,GAA3B;EACE,KAAK,UACH,OAAO;EACT,KAAK;EACL,KAAK;EACL,KAAK,aACH,OAAO;EACT,KAAK,WACH,OAAO;EACT,SACE,OAAO;CACX;AACF,GAEa,UAAwB;CACnC,IAAM,EAAE,SAAM,GAAQ,GAChB,EAAE,YAAQ,UAAO,gBAAY,EAAS,GACtC,KAAU,EAAW,GAErB,EAAE,SAAM,aAAS,UAAO,eAAY,EAA8B;EACtE,WAAW,EAAE,OAAO,IAAI;EACxB,aAAa;CACf,CAAC,GACK,CAAC,KAAgB,EAAmC,GACpD,CAAC,KAAgB,EAAmC,GACpD,CAAC,KAAc,GAAuC,GAKtD,IAAoB,SACV,GAAM,SAAS,SAAS,CAAC,GACT,KAAK,MAA2B,EAAK,IAC5D,EAAM,QAAQ,MAAM,EAAE,eAAe,CAAc,GACzD,CAAC,CAAI,CAAC,GAEH,CAAC,GAAQ,KAAa,EAAS,EAAE,GAEjC,IAAW,QAAc;EAC7B,IAAM,IAAI,EAAO,KAAK,EAAE,YAAY;EAEpC,OADK,IACE,EAAQ,QAAQ,MAAM,EAAE,KAAK,YAAY,EAAE,SAAS,CAAC,MAAM,EAAE,eAAe,IAAI,YAAY,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