@burdenoff/microfe-healthybowl 2026.804.1 → 2026.805.1

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.
@@ -0,0 +1,64 @@
1
+ import { useHealthyBowl as e } from "../context/HealthyBowlContext.js";
2
+ import { useMemo as t } from "react";
3
+ import { gql as n } from "@apollo/client";
4
+ import { useQuery as r } from "@apollo/client/react";
5
+ //#region src/healthybowl/hooks/useHealthyBowlLivestockFeed.ts
6
+ var i = "00000000-0000-0000-0000-000000000001", a = n`
7
+ query HealthyBowlLivestockFeed(
8
+ $context: ContextInput!
9
+ $groupId: ID
10
+ $from: String
11
+ $to: String
12
+ $granularity: HealthyBowlGrowthGranularity
13
+ ) {
14
+ healthyBowlLivestockFeed(context: $context, groupId: $groupId, from: $from, to: $to, granularity: $granularity) {
15
+ buckets {
16
+ at
17
+ totalCost
18
+ totalKg
19
+ byUnit {
20
+ unit
21
+ quantity
22
+ }
23
+ records
24
+ }
25
+ summary {
26
+ totalCost
27
+ totalKg
28
+ totalGainKg
29
+ animalsCounted
30
+ feedConversionRatio
31
+ costPerKgGain
32
+ unitsSeen
33
+ windowFrom
34
+ windowTo
35
+ granularity
36
+ }
37
+ }
38
+ }
39
+ `;
40
+ function o(n = {}) {
41
+ let { workspaceId: o } = e(), s = o || i, { data: c, loading: l, error: u, refetch: d } = r(a, {
42
+ variables: {
43
+ context: t(() => ({ workspaceId: s }), [s]),
44
+ groupId: n.groupId ?? null,
45
+ from: n.from ?? null,
46
+ to: n.to ?? null,
47
+ granularity: n.granularity ?? "WEEK"
48
+ },
49
+ fetchPolicy: "cache-and-network",
50
+ skip: n.enabled === !1
51
+ }), f = c?.healthyBowlLivestockFeed ?? null;
52
+ return {
53
+ feed: f,
54
+ buckets: f?.buckets ?? [],
55
+ summary: f?.summary ?? null,
56
+ loading: l,
57
+ error: u,
58
+ refetch: d
59
+ };
60
+ }
61
+ //#endregion
62
+ export { o as useHealthyBowlLivestockFeed };
63
+
64
+ //# sourceMappingURL=useHealthyBowlLivestockFeed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useHealthyBowlLivestockFeed.js","names":[],"sources":["../../../src/healthybowl/hooks/useHealthyBowlLivestockFeed.ts"],"sourcesContent":["/**\n * Livestock feed analytics — data hook (BOFF-5971, slice 2).\n *\n * Companion to `useHealthyBowlLivestockGrowth`: feed says what went in, growth says what came out.\n * The document is declared inline with `gql` for the same reason as its sibling — codegen validates\n * against the committed `graphql/wspace.graphql` snapshot, which does not yet carry this query.\n *\n * ⚠️ `totalKg` is null whenever the period mixes a non-mass unit (bags, litres). That is the\n * backend refusing to invent a total, not a loading state — render it as \"mixed units\", never as\n * zero.\n */\n\nimport { useMemo } from 'react';\nimport { gql } from '@apollo/client';\nimport { useQuery } from '@apollo/client/react';\nimport { useHealthyBowl } from '../context/HealthyBowlContext';\nimport type { GrowthGranularity } from './useHealthyBowlLivestockGrowth';\n\nconst FALLBACK_WORKSPACE_ID = '00000000-0000-0000-0000-000000000001';\n\nexport interface FeedUnitTotal {\n unit: string;\n quantity: number;\n}\n\nexport interface FeedBucket {\n at: string;\n totalCost: number;\n totalKg: number | null;\n byUnit: FeedUnitTotal[];\n records: number;\n}\n\nexport interface FeedSummary {\n totalCost: number;\n totalKg: number | null;\n totalGainKg: number | null;\n animalsCounted: number;\n feedConversionRatio: number | null;\n costPerKgGain: number | null;\n unitsSeen: string[];\n windowFrom: string | null;\n windowTo: string | null;\n granularity: GrowthGranularity;\n}\n\nexport interface LivestockFeed {\n buckets: FeedBucket[];\n summary: FeedSummary;\n}\n\ninterface HbContext {\n workspaceId: string;\n}\n\nconst GET_LIVESTOCK_FEED = gql`\n query HealthyBowlLivestockFeed(\n $context: ContextInput!\n $groupId: ID\n $from: String\n $to: String\n $granularity: HealthyBowlGrowthGranularity\n ) {\n healthyBowlLivestockFeed(context: $context, groupId: $groupId, from: $from, to: $to, granularity: $granularity) {\n buckets {\n at\n totalCost\n totalKg\n byUnit {\n unit\n quantity\n }\n records\n }\n summary {\n totalCost\n totalKg\n totalGainKg\n animalsCounted\n feedConversionRatio\n costPerKgGain\n unitsSeen\n windowFrom\n windowTo\n granularity\n }\n }\n }\n`;\n\nexport interface UseLivestockFeedOptions {\n enabled?: boolean;\n groupId?: string | null;\n from?: string | null;\n to?: string | null;\n granularity?: GrowthGranularity;\n}\n\nexport function useHealthyBowlLivestockFeed(options: UseLivestockFeedOptions = {}) {\n const { workspaceId } = useHealthyBowl();\n const effectiveWorkspaceId = workspaceId || FALLBACK_WORKSPACE_ID;\n const ctx = useMemo<HbContext>(() => ({ workspaceId: effectiveWorkspaceId }), [effectiveWorkspaceId]);\n\n const { data, loading, error, refetch } = useQuery<\n { healthyBowlLivestockFeed: LivestockFeed },\n {\n context: HbContext;\n groupId: string | null;\n from: string | null;\n to: string | null;\n granularity: GrowthGranularity;\n }\n >(GET_LIVESTOCK_FEED, {\n variables: {\n context: ctx,\n groupId: options.groupId ?? null,\n from: options.from ?? null,\n to: options.to ?? null,\n granularity: options.granularity ?? 'WEEK',\n },\n fetchPolicy: 'cache-and-network',\n skip: options.enabled === false,\n });\n\n const feed = data?.healthyBowlLivestockFeed ?? null;\n\n return {\n feed,\n buckets: feed?.buckets ?? [],\n summary: feed?.summary ?? null,\n loading,\n error,\n refetch,\n };\n}\n"],"mappings":";;;;;AAkBA,IAAM,IAAwB,wCAqCxB,IAAqB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2C9B,SAAgB,EAA4B,IAAmC,EAAE,EAAE;CACjF,IAAM,EAAE,mBAAgB,GAAgB,EAClC,IAAuB,KAAe,GAGtC,EAAE,SAAM,YAAS,UAAO,eAAY,EASxC,GAAoB;EACpB,WAAW;GACT,SAbQ,SAA0B,EAAE,aAAa,GAAsB,GAAG,CAAC,EAAqB,CAAC;GAcjG,SAAS,EAAQ,WAAW;GAC5B,MAAM,EAAQ,QAAQ;GACtB,IAAI,EAAQ,MAAM;GAClB,aAAa,EAAQ,eAAe;GACrC;EACD,aAAa;EACb,MAAM,EAAQ,YAAY;EAC3B,CAAC,EAEI,IAAO,GAAM,4BAA4B;AAE/C,QAAO;EACL;EACA,SAAS,GAAM,WAAW,EAAE;EAC5B,SAAS,GAAM,WAAW;EAC1B;EACA;EACA;EACD"}
@@ -0,0 +1,93 @@
1
+ import { useHealthyBowl as e } from "../context/HealthyBowlContext.js";
2
+ import { useMemo as t } from "react";
3
+ import { gql as n } from "@apollo/client";
4
+ import { useQuery as r } from "@apollo/client/react";
5
+ //#region src/healthybowl/hooks/useHealthyBowlLivestockGrowth.ts
6
+ var i = "00000000-0000-0000-0000-000000000001", a = n`
7
+ query HealthyBowlLivestockGrowth(
8
+ $context: ContextInput!
9
+ $groupId: ID
10
+ $animalIds: [ID!]
11
+ $from: String
12
+ $to: String
13
+ $granularity: HealthyBowlGrowthGranularity
14
+ ) {
15
+ healthyBowlLivestockGrowth(
16
+ context: $context
17
+ groupId: $groupId
18
+ animalIds: $animalIds
19
+ from: $from
20
+ to: $to
21
+ granularity: $granularity
22
+ ) {
23
+ series {
24
+ animalId
25
+ tagNumber
26
+ name
27
+ type
28
+ groupId
29
+ groupName
30
+ points {
31
+ at
32
+ weightKg
33
+ }
34
+ adgKgPerDay
35
+ latestWeightKg
36
+ latestWeightAt
37
+ }
38
+ herdAverage {
39
+ at
40
+ avgWeightKg
41
+ animalCount
42
+ sampleSize
43
+ }
44
+ summary {
45
+ animalsWithWeights
46
+ animalsWithoutWeights
47
+ medianAdgKgPerDay
48
+ fastestGrowing {
49
+ animalId
50
+ name
51
+ tagNumber
52
+ adgKgPerDay
53
+ }
54
+ slowestGrowing {
55
+ animalId
56
+ name
57
+ tagNumber
58
+ adgKgPerDay
59
+ }
60
+ windowFrom
61
+ windowTo
62
+ granularity
63
+ }
64
+ }
65
+ }
66
+ `;
67
+ function o(n = {}) {
68
+ let { workspaceId: o } = e(), s = o || i, { data: c, loading: l, error: u, refetch: d } = r(a, {
69
+ variables: {
70
+ context: t(() => ({ workspaceId: s }), [s]),
71
+ groupId: n.groupId ?? null,
72
+ animalIds: n.animalIds ?? null,
73
+ from: n.from ?? null,
74
+ to: n.to ?? null,
75
+ granularity: n.granularity ?? "WEEK"
76
+ },
77
+ fetchPolicy: "cache-and-network",
78
+ skip: n.enabled === !1
79
+ }), f = c?.healthyBowlLivestockGrowth ?? null;
80
+ return {
81
+ growth: f,
82
+ series: f?.series ?? [],
83
+ herdAverage: f?.herdAverage ?? [],
84
+ summary: f?.summary ?? null,
85
+ loading: l,
86
+ error: u,
87
+ refetch: d
88
+ };
89
+ }
90
+ //#endregion
91
+ export { o as useHealthyBowlLivestockGrowth };
92
+
93
+ //# sourceMappingURL=useHealthyBowlLivestockGrowth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useHealthyBowlLivestockGrowth.js","names":[],"sources":["../../../src/healthybowl/hooks/useHealthyBowlLivestockGrowth.ts"],"sourcesContent":["/**\n * Livestock growth analytics — data hook (BOFF-5971).\n *\n * Feeds the growth chart: one weight curve per animal, a herd-average line, and the ADG leaders.\n * The document is declared inline with `gql` — the same escape hatch `useHealthyBowlLivestockDepth`\n * and `useHealthyBowlWithdrawal` use — because codegen validates against the committed\n * `graphql/wspace.graphql` snapshot, which does not yet carry this query.\n *\n * Types mirror `wspace-healthybowl-svc/src/modules/healthybowl/schema/livestock-depth.gql`.\n *\n * ⚠️ ADG here is computed over the requested window, so it can legitimately differ from the\n * lifetime ADG shown on the deep herd view — same formula, different span. Label it as such\n * wherever both appear on one screen.\n */\n\nimport { useMemo } from 'react';\nimport { gql } from '@apollo/client';\nimport { useQuery } from '@apollo/client/react';\nimport { useHealthyBowl } from '../context/HealthyBowlContext';\n\nconst FALLBACK_WORKSPACE_ID = '00000000-0000-0000-0000-000000000001';\n\n// ── types (mirror livestock-depth.gql) ────────────────────────────────────────\n\nexport type GrowthGranularity = 'DAY' | 'WEEK' | 'MONTH';\n\nexport interface GrowthPoint {\n at: string;\n weightKg: number;\n}\n\nexport interface GrowthSeries {\n animalId: string;\n tagNumber: string;\n name: string;\n type: string;\n groupId: string | null;\n groupName: string | null;\n points: GrowthPoint[];\n adgKgPerDay: number | null;\n latestWeightKg: number | null;\n latestWeightAt: string | null;\n}\n\nexport interface GrowthAveragePoint {\n at: string;\n avgWeightKg: number;\n animalCount: number;\n sampleSize: number;\n}\n\nexport interface GrowthLeader {\n animalId: string;\n name: string;\n tagNumber: string;\n adgKgPerDay: number;\n}\n\nexport interface GrowthSummary {\n animalsWithWeights: number;\n animalsWithoutWeights: number;\n medianAdgKgPerDay: number | null;\n fastestGrowing: GrowthLeader | null;\n slowestGrowing: GrowthLeader | null;\n windowFrom: string | null;\n windowTo: string | null;\n granularity: GrowthGranularity;\n}\n\nexport interface LivestockGrowth {\n series: GrowthSeries[];\n herdAverage: GrowthAveragePoint[];\n summary: GrowthSummary;\n}\n\ninterface HbContext {\n workspaceId: string;\n}\n\nconst GET_LIVESTOCK_GROWTH = gql`\n query HealthyBowlLivestockGrowth(\n $context: ContextInput!\n $groupId: ID\n $animalIds: [ID!]\n $from: String\n $to: String\n $granularity: HealthyBowlGrowthGranularity\n ) {\n healthyBowlLivestockGrowth(\n context: $context\n groupId: $groupId\n animalIds: $animalIds\n from: $from\n to: $to\n granularity: $granularity\n ) {\n series {\n animalId\n tagNumber\n name\n type\n groupId\n groupName\n points {\n at\n weightKg\n }\n adgKgPerDay\n latestWeightKg\n latestWeightAt\n }\n herdAverage {\n at\n avgWeightKg\n animalCount\n sampleSize\n }\n summary {\n animalsWithWeights\n animalsWithoutWeights\n medianAdgKgPerDay\n fastestGrowing {\n animalId\n name\n tagNumber\n adgKgPerDay\n }\n slowestGrowing {\n animalId\n name\n tagNumber\n adgKgPerDay\n }\n windowFrom\n windowTo\n granularity\n }\n }\n }\n`;\n\nexport interface UseLivestockGrowthOptions {\n enabled?: boolean;\n groupId?: string | null;\n animalIds?: string[] | null;\n from?: string | null;\n to?: string | null;\n granularity?: GrowthGranularity;\n}\n\nexport function useHealthyBowlLivestockGrowth(options: UseLivestockGrowthOptions = {}) {\n const { workspaceId } = useHealthyBowl();\n const effectiveWorkspaceId = workspaceId || FALLBACK_WORKSPACE_ID;\n const ctx = useMemo<HbContext>(() => ({ workspaceId: effectiveWorkspaceId }), [effectiveWorkspaceId]);\n\n const { data, loading, error, refetch } = useQuery<\n { healthyBowlLivestockGrowth: LivestockGrowth },\n {\n context: HbContext;\n groupId: string | null;\n animalIds: string[] | null;\n from: string | null;\n to: string | null;\n granularity: GrowthGranularity;\n }\n >(GET_LIVESTOCK_GROWTH, {\n variables: {\n context: ctx,\n groupId: options.groupId ?? null,\n animalIds: options.animalIds ?? null,\n from: options.from ?? null,\n to: options.to ?? null,\n granularity: options.granularity ?? 'WEEK',\n },\n fetchPolicy: 'cache-and-network',\n skip: options.enabled === false,\n });\n\n const growth = data?.healthyBowlLivestockGrowth ?? null;\n\n return {\n growth,\n series: growth?.series ?? [],\n herdAverage: growth?.herdAverage ?? [],\n summary: growth?.summary ?? null,\n loading,\n error,\n refetch,\n };\n}\n"],"mappings":";;;;;AAoBA,IAAM,IAAwB,wCA2DxB,IAAuB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuEhC,SAAgB,EAA8B,IAAqC,EAAE,EAAE;CACrF,IAAM,EAAE,mBAAgB,GAAgB,EAClC,IAAuB,KAAe,GAGtC,EAAE,SAAM,YAAS,UAAO,eAAY,EAUxC,GAAsB;EACtB,WAAW;GACT,SAdQ,SAA0B,EAAE,aAAa,GAAsB,GAAG,CAAC,EAAqB,CAAC;GAejG,SAAS,EAAQ,WAAW;GAC5B,WAAW,EAAQ,aAAa;GAChC,MAAM,EAAQ,QAAQ;GACtB,IAAI,EAAQ,MAAM;GAClB,aAAa,EAAQ,eAAe;GACrC;EACD,aAAa;EACb,MAAM,EAAQ,YAAY;EAC3B,CAAC,EAEI,IAAS,GAAM,8BAA8B;AAEnD,QAAO;EACL;EACA,QAAQ,GAAQ,UAAU,EAAE;EAC5B,aAAa,GAAQ,eAAe,EAAE;EACtC,SAAS,GAAQ,WAAW;EAC5B;EACA;EACA;EACD"}
@@ -6,11 +6,13 @@ import { StatusBadge as a } from "../../components/StatusBadge.js";
6
6
  import { EmptyState as o } from "../../components/EmptyState.js";
7
7
  import { ErrorState as s } from "../../components/ErrorState.js";
8
8
  import { ChartCard as c } from "../../components/ChartCard.js";
9
- import { LoadingSkeleton as ee } from "../../components/LoadingSkeleton.js";
9
+ import { LoadingSkeleton as l } from "../../components/LoadingSkeleton.js";
10
10
  import "../../components/index.js";
11
- import { useHealthyBowlData as te } from "../../hooks/useHealthyBowlData.js";
12
- import { useI18n as l } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
13
- import { AlertCircle as u, ArrowRight as d, Baby as f, Calendar as p, ChevronRight as m, Clock as h, DollarSign as g, Egg as _, Heart as v, Milk as y, Package as b, PawPrint as x, Plus as S, TrendingUp as C, Users as ne } from "lucide-react";
11
+ import { useHealthyBowlData as ee } from "../../hooks/useHealthyBowlData.js";
12
+ import { LivestockGrowthCard as u } from "./LivestockGrowthCard.js";
13
+ import { LivestockFeedCard as d } from "./LivestockFeedCard.js";
14
+ import { useI18n as f } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
15
+ import { AlertCircle as p, ArrowRight as te, Baby as ne, Calendar as m, ChevronRight as h, Clock as g, DollarSign as re, Egg as ie, Heart as _, Milk as v, Package as y, PawPrint as b, Plus as x, TrendingUp as S, Users as C } from "lucide-react";
14
16
  import { useNavigate as w } from "react-router";
15
17
  import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
16
18
  import { Button as O } from "@burdenoff/fe-libs/ui";
@@ -32,7 +34,7 @@ var k = (e) => {
32
34
  meat: 350,
33
35
  manure: 5
34
36
  }, j = () => {
35
- let { animals: j, healthRecords: M, vaccinations: N, productionRecords: P, feedRecords: F, loading: I, errors: L } = te(), R = w(), { buildPath: z } = n(), { t: B } = l(), V = j.length, H = j.filter((e) => e.healthStatus === "healthy").length, U = j.filter((e) => e.healthStatus === "sick").length, W = j.filter((e) => e.healthStatus === "under_treatment").length, G = j.filter((e) => e.healthStatus === "quarantine").length, K = j.filter((e) => e.healthStatus === "pregnant").length, q = j.reduce((e, t) => (e[t.type] = (e[t.type] || 0) + 1, e), {}), J = P.filter((e) => e.type === "milk").reduce((e, t) => e + t.quantity, 0), Y = P.filter((e) => e.type === "eggs").reduce((e, t) => e + t.quantity, 0), X = P.reduce((e, t) => e + t.quantity * (A[t.type] ?? 0), 0), Z = F.reduce((e, t) => e + t.cost, 0), re = X > 0 ? ((X - Z) / X * 100).toFixed(1) : "0.0", Q = M.filter((e) => e.status === "active" || e.status === "monitoring").slice(0, 3), $ = N.filter((e) => e.status === "scheduled").slice(0, 3);
37
+ let { animals: j, healthRecords: M, vaccinations: N, productionRecords: P, feedRecords: F, loading: I, errors: L } = ee(), R = w(), { buildPath: z } = n(), { t: B } = f(), V = j.length, H = j.filter((e) => e.healthStatus === "healthy").length, U = j.filter((e) => e.healthStatus === "sick").length, W = j.filter((e) => e.healthStatus === "under_treatment").length, G = j.filter((e) => e.healthStatus === "quarantine").length, K = j.filter((e) => e.healthStatus === "pregnant").length, q = j.reduce((e, t) => (e[t.type] = (e[t.type] || 0) + 1, e), {}), J = P.filter((e) => e.type === "milk").reduce((e, t) => e + t.quantity, 0), Y = P.filter((e) => e.type === "eggs").reduce((e, t) => e + t.quantity, 0), X = P.reduce((e, t) => e + t.quantity * (A[t.type] ?? 0), 0), Z = F.reduce((e, t) => e + t.cost, 0), ae = X > 0 ? ((X - Z) / X * 100).toFixed(1) : "0.0", Q = M.filter((e) => e.status === "active" || e.status === "monitoring").slice(0, 3), $ = N.filter((e) => e.status === "scheduled").slice(0, 3);
36
38
  return /* @__PURE__ */ E(r, {
37
39
  title: B("healthybowl.livestock.dashboard.title", "Livestock Management"),
38
40
  description: B("healthybowl.livestock.dashboard.description", "Monitor and manage your livestock operations"),
@@ -62,9 +64,9 @@ var k = (e) => {
62
64
  actions: /* @__PURE__ */ D(O, {
63
65
  variant: "default",
64
66
  onClick: () => R(z("livestock/animals")),
65
- children: [/* @__PURE__ */ E(S, { className: "h-4 w-4" }), B("healthybowl.livestock.dashboard.actions.addAnimal", "Add Animal")]
67
+ children: [/* @__PURE__ */ E(x, { className: "h-4 w-4" }), B("healthybowl.livestock.dashboard.actions.addAnimal", "Add Animal")]
66
68
  }),
67
- children: I && j.length === 0 ? /* @__PURE__ */ E(ee, {
69
+ children: I && j.length === 0 ? /* @__PURE__ */ E(l, {
68
70
  variant: "card",
69
71
  count: 4
70
72
  }) : /* @__PURE__ */ D(T, { children: [
@@ -75,23 +77,23 @@ var k = (e) => {
75
77
  hero: !0,
76
78
  label: B("healthybowl.livestock.dashboard.stats.totalAnimals.label", "Total Animals"),
77
79
  value: V,
78
- icon: /* @__PURE__ */ E(x, { className: "h-4 w-4" })
80
+ icon: /* @__PURE__ */ E(b, { className: "h-4 w-4" })
79
81
  }),
80
82
  /* @__PURE__ */ E(i, {
81
83
  label: B("healthybowl.livestock.dashboard.stats.healthIssues.label", "Health Issues"),
82
84
  value: U + W,
83
- icon: /* @__PURE__ */ E(v, { className: "h-4 w-4" })
85
+ icon: /* @__PURE__ */ E(_, { className: "h-4 w-4" })
84
86
  }),
85
87
  /* @__PURE__ */ E(i, {
86
88
  label: B("healthybowl.livestock.dashboard.stats.productionValue.label", "Est. Production Value"),
87
89
  value: e(X),
88
- icon: /* @__PURE__ */ E(g, { className: "h-4 w-4" })
90
+ icon: /* @__PURE__ */ E(re, { className: "h-4 w-4" })
89
91
  }),
90
92
  /* @__PURE__ */ E(i, {
91
93
  label: B("healthybowl.livestock.dashboard.stats.margin.label", "Est. Margin"),
92
- value: parseFloat(re),
94
+ value: parseFloat(ae),
93
95
  unit: "%",
94
- icon: /* @__PURE__ */ E(C, { className: "h-4 w-4" })
96
+ icon: /* @__PURE__ */ E(S, { className: "h-4 w-4" })
95
97
  })
96
98
  ]
97
99
  }),
@@ -148,7 +150,7 @@ var k = (e) => {
148
150
  children: [
149
151
  B("healthybowl.livestock.dashboard.distribution.viewAll", "View All Animals"),
150
152
  " ",
151
- /* @__PURE__ */ E(d, { className: "h-4 w-4" })
153
+ /* @__PURE__ */ E(te, { className: "h-4 w-4" })
152
154
  ]
153
155
  })
154
156
  })]
@@ -164,7 +166,7 @@ var k = (e) => {
164
166
  className: "flex items-center gap-3",
165
167
  children: [/* @__PURE__ */ E("div", {
166
168
  className: "rounded-full bg-bg-surface p-3",
167
- children: /* @__PURE__ */ E(y, { className: "h-5 w-5 text-primary" })
169
+ children: /* @__PURE__ */ E(v, { className: "h-5 w-5 text-primary" })
168
170
  }), /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("p", {
169
171
  className: "text-sm font-medium text-text-primary",
170
172
  children: B("healthybowl.livestock.dashboard.production.milk.label", "Milk Production")
@@ -189,7 +191,7 @@ var k = (e) => {
189
191
  className: "flex items-center gap-3",
190
192
  children: [/* @__PURE__ */ E("div", {
191
193
  className: "rounded-full bg-bg-surface p-3",
192
- children: /* @__PURE__ */ E(_, { className: "h-5 w-5 text-primary" })
194
+ children: /* @__PURE__ */ E(ie, { className: "h-5 w-5 text-primary" })
193
195
  }), /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("p", {
194
196
  className: "text-sm font-medium text-text-primary",
195
197
  children: B("healthybowl.livestock.dashboard.production.eggs.label", "Egg Collection")
@@ -215,13 +217,15 @@ var k = (e) => {
215
217
  children: [
216
218
  B("healthybowl.livestock.dashboard.production.record", "Record Production"),
217
219
  " ",
218
- /* @__PURE__ */ E(S, { className: "h-4 w-4" })
220
+ /* @__PURE__ */ E(x, { className: "h-4 w-4" })
219
221
  ]
220
222
  })
221
223
  ]
222
224
  })
223
225
  })]
224
226
  }),
227
+ /* @__PURE__ */ E(u, {}),
228
+ /* @__PURE__ */ E(d, {}),
225
229
  /* @__PURE__ */ D("div", {
226
230
  className: "grid grid-cols-1 gap-6 lg:grid-cols-3",
227
231
  children: [/* @__PURE__ */ D("div", {
@@ -251,35 +255,35 @@ var k = (e) => {
251
255
  label: B("healthybowl.livestock.dashboard.healthStatus.healthy", "Healthy"),
252
256
  value: H,
253
257
  variant: "success",
254
- icon: v
258
+ icon: _
255
259
  },
256
260
  {
257
261
  id: "sick",
258
262
  label: B("healthybowl.livestock.dashboard.healthStatus.sick", "Sick"),
259
263
  value: U,
260
264
  variant: "error",
261
- icon: u
265
+ icon: p
262
266
  },
263
267
  {
264
268
  id: "treatment",
265
269
  label: B("healthybowl.livestock.dashboard.healthStatus.treatment", "Treatment"),
266
270
  value: W,
267
271
  variant: "warning",
268
- icon: h
272
+ icon: g
269
273
  },
270
274
  {
271
275
  id: "quarantine",
272
276
  label: B("healthybowl.livestock.dashboard.healthStatus.quarantine", "Quarantine"),
273
277
  value: G,
274
278
  variant: "error",
275
- icon: u
279
+ icon: p
276
280
  },
277
281
  {
278
282
  id: "pregnant",
279
283
  label: B("healthybowl.livestock.dashboard.healthStatus.pregnant", "Pregnant"),
280
284
  value: K,
281
285
  variant: "info",
282
- icon: f
286
+ icon: ne
283
287
  }
284
288
  ].map((e) => /* @__PURE__ */ D("div", {
285
289
  className: "rounded-lg bg-bg-sunken/50 p-3 text-center",
@@ -318,7 +322,7 @@ var k = (e) => {
318
322
  className: "text-xs text-text-secondary",
319
323
  children: e.diagnosis
320
324
  })] })]
321
- }), /* @__PURE__ */ E(m, { className: "h-4 w-4 text-text-secondary" })]
325
+ }), /* @__PURE__ */ E(h, { className: "h-4 w-4 text-text-secondary" })]
322
326
  }, e.id))
323
327
  })]
324
328
  })
@@ -340,31 +344,31 @@ var k = (e) => {
340
344
  {
341
345
  id: "healthCheck",
342
346
  label: B("healthybowl.livestock.dashboard.quickActions.recordHealthCheck", "Record Health Check"),
343
- icon: v,
347
+ icon: _,
344
348
  path: z("livestock/health")
345
349
  },
346
350
  {
347
351
  id: "vaccination",
348
352
  label: B("healthybowl.livestock.dashboard.quickActions.scheduleVaccination", "Schedule Vaccination"),
349
- icon: p,
353
+ icon: m,
350
354
  path: z("livestock/vaccinations")
351
355
  },
352
356
  {
353
357
  id: "feed",
354
358
  label: B("healthybowl.livestock.dashboard.quickActions.updateFeedRecords", "Update Feed Records"),
355
- icon: b,
359
+ icon: y,
356
360
  path: z("livestock/feed")
357
361
  },
358
362
  {
359
363
  id: "breeding",
360
364
  label: B("healthybowl.livestock.dashboard.quickActions.breedingManagement", "Breeding Management"),
361
- icon: ne,
365
+ icon: C,
362
366
  path: z("livestock/breeding")
363
367
  },
364
368
  {
365
369
  id: "production",
366
370
  label: B("healthybowl.livestock.dashboard.quickActions.viewProduction", "View Production"),
367
- icon: C,
371
+ icon: S,
368
372
  path: z("livestock/production")
369
373
  }
370
374
  ].map((e) => /* @__PURE__ */ D(O, {
@@ -400,7 +404,7 @@ var k = (e) => {
400
404
  className: "flex items-center justify-between rounded-md border border-border-subtle p-3 hover:bg-bg-sunken/30",
401
405
  children: [/* @__PURE__ */ D("div", {
402
406
  className: "flex items-center gap-3",
403
- children: [/* @__PURE__ */ E(p, { className: "h-4 w-4 text-text-secondary" }), /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("p", {
407
+ children: [/* @__PURE__ */ E(m, { className: "h-4 w-4 text-text-secondary" }), /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("p", {
404
408
  className: "text-sm font-medium text-text-primary",
405
409
  children: e.animalName
406
410
  }), /* @__PURE__ */ E("p", {
@@ -1 +1 @@
1
- {"version":3,"file":"LivestockDashboardPage.js","names":[],"sources":["../../../../src/healthybowl/pages/livestock/LivestockDashboardPage.tsx"],"sourcesContent":["import { type FC } from 'react';\nimport { useNavigate } from 'react-router';\nimport { useBasePath } from '../../hooks/useBasePath';\nimport {\n PawPrint,\n Heart,\n Baby,\n DollarSign,\n TrendingUp,\n Milk,\n Egg,\n Calendar,\n ArrowRight,\n AlertCircle,\n Clock,\n ChevronRight,\n Plus,\n Package,\n Users,\n} from 'lucide-react';\nimport {\n PageLayout,\n StatCard,\n StatusBadge,\n ChartCard,\n LoadingSkeleton,\n EmptyState,\n ErrorState,\n} from '../../components';\nimport { useHealthyBowlData } from '../../hooks/useHealthyBowlData';\nimport { formatDate, formatCurrency } from '../../utils/helpers';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { Button } from '@burdenoff/fe-libs/ui';\n\nconst getAnimalIcon = (type: string) => {\n switch (type) {\n case 'cattle':\n case 'buffalo':\n return '🐄';\n case 'goat':\n return '🐐';\n case 'sheep':\n return '🐑';\n case 'pig':\n return '🐷';\n case 'poultry':\n return '🐔';\n default:\n return '🐾';\n }\n};\n\n// Per-unit price estimates for production types (used to derive revenue)\nconst UNIT_PRICES: Record<string, number> = {\n milk: 55,\n eggs: 8,\n wool: 400,\n meat: 350,\n manure: 5,\n};\n\nexport const LivestockDashboardPage: FC = () => {\n const { animals, healthRecords, vaccinations, productionRecords, feedRecords, loading, errors } =\n useHealthyBowlData();\n\n const navigate = useNavigate();\n const { buildPath } = useBasePath();\n const { t } = useI18n();\n\n const totalAnimals = animals.length;\n const healthy = animals.filter((a) => a.healthStatus === 'healthy').length;\n const sick = animals.filter((a) => a.healthStatus === 'sick').length;\n const underTreatment = animals.filter((a) => a.healthStatus === 'under_treatment').length;\n const quarantine = animals.filter((a) => a.healthStatus === 'quarantine').length;\n const pregnant = animals.filter((a) => a.healthStatus === 'pregnant').length;\n\n const typeCounts = animals.reduce<Record<string, number>>((acc, a) => {\n acc[a.type] = (acc[a.type] || 0) + 1;\n return acc;\n }, {});\n\n // Total production from all records\n const milkProduction = productionRecords.filter((p) => p.type === 'milk').reduce((sum, p) => sum + p.quantity, 0);\n const eggProduction = productionRecords.filter((p) => p.type === 'eggs').reduce((sum, p) => sum + p.quantity, 0);\n\n // Derive financial figures from actual data\n const monthlyRevenue = productionRecords.reduce((sum, p) => sum + p.quantity * (UNIT_PRICES[p.type] ?? 0), 0);\n const monthlyExpenses = feedRecords.reduce((sum, r) => sum + r.cost, 0);\n const profitMargin =\n monthlyRevenue > 0 ? (((monthlyRevenue - monthlyExpenses) / monthlyRevenue) * 100).toFixed(1) : '0.0';\n\n const recentHealthIssues = healthRecords\n .filter((r) => r.status === 'active' || r.status === 'monitoring')\n .slice(0, 3);\n const upcomingVaccinations = vaccinations.filter((v) => v.status === 'scheduled').slice(0, 3);\n\n return (\n <PageLayout\n title={t('healthybowl.livestock.dashboard.title', 'Livestock Management')}\n description={t('healthybowl.livestock.dashboard.description', 'Monitor and manage your livestock operations')}\n purpose=\"The health of your animal operation at a glance — herd size, health flags and production. Start here each day, then dive into the registry, health, breeding or feed sections as needed.\"\n nextStepsKey=\"healthybowl-livestock-dashboard\"\n nextStepsTitle=\"Run your herd day to day\"\n nextSteps={[\n {\n id: 'registry',\n label: 'Register your animals',\n description: 'Build the herd registry so every record links to an animal.',\n onClick: () => navigate(buildPath('livestock/animals')),\n },\n {\n id: 'health',\n label: 'Log health & vaccinations',\n description: 'Keep treatment and vaccination history in one place.',\n onClick: () => navigate(buildPath('livestock/health')),\n },\n {\n id: 'production',\n label: 'Track production',\n description: 'Record milk, eggs or other yields to watch trends.',\n onClick: () => navigate(buildPath('livestock/production')),\n },\n ]}\n actions={\n <Button variant=\"default\" onClick={() => navigate(buildPath('livestock/animals'))}>\n <Plus className=\"h-4 w-4\" />\n {t('healthybowl.livestock.dashboard.actions.addAnimal', 'Add Animal')}\n </Button>\n }\n >\n {loading && animals.length === 0 ? (\n <LoadingSkeleton variant=\"card\" count={4} />\n ) : (\n <>\n {/* Key Metrics */}\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4\">\n <StatCard\n hero\n label={t('healthybowl.livestock.dashboard.stats.totalAnimals.label', 'Total Animals')}\n value={totalAnimals}\n icon={<PawPrint className=\"h-4 w-4\" />}\n />\n <StatCard\n label={t('healthybowl.livestock.dashboard.stats.healthIssues.label', 'Health Issues')}\n value={sick + underTreatment}\n icon={<Heart className=\"h-4 w-4\" />}\n />\n <StatCard\n label={t('healthybowl.livestock.dashboard.stats.productionValue.label', 'Est. Production Value')}\n value={formatCurrency(monthlyRevenue)}\n icon={<DollarSign className=\"h-4 w-4\" />}\n />\n <StatCard\n label={t('healthybowl.livestock.dashboard.stats.margin.label', 'Est. Margin')}\n value={parseFloat(profitMargin)}\n unit=\"%\"\n icon={<TrendingUp className=\"h-4 w-4\" />}\n />\n </div>\n\n {/* Animal Distribution & Total Production */}\n <div className=\"grid grid-cols-1 gap-6 lg:grid-cols-2\">\n {/* Animal Distribution */}\n <ChartCard\n title={t('healthybowl.livestock.dashboard.distribution.title', 'Animal Distribution')}\n description={t('healthybowl.livestock.dashboard.distribution.description', 'Breakdown by animal type')}\n >\n {totalAnimals === 0 ? (\n errors.livestock ? (\n <ErrorState />\n ) : (\n <EmptyState\n illustration=\"empty-generic\"\n title={t('healthybowl.livestock.dashboard.distribution.empty.title', 'No animals yet')}\n description={t(\n 'healthybowl.livestock.dashboard.distribution.empty.description',\n 'Add an animal to see your livestock distribution by type.'\n )}\n />\n )\n ) : (\n <div className=\"flex flex-col gap-3\">\n {Object.entries(typeCounts).map(([type, count]) => {\n const percentage = totalAnimals > 0 ? Math.round((count / totalAnimals) * 100) : 0;\n return (\n <div key={type} className=\"space-y-1.5\">\n <div className=\"flex items-center justify-between\">\n <div className=\"flex items-center gap-2\">\n <span className=\"text-lg\">{getAnimalIcon(type)}</span>\n <span className=\"text-sm font-medium capitalize text-text-primary\">{type}</span>\n </div>\n <span className=\"text-xs text-text-secondary\">\n {count} ({percentage}%)\n </span>\n </div>\n <div className=\"h-2 w-full rounded-full bg-bg-sunken\">\n <div\n className=\"h-2 rounded-full bg-action-primary-bg transition-all\"\n style={{ width: `${percentage}%` }}\n />\n </div>\n </div>\n );\n })}\n </div>\n )}\n <div className=\"mt-4 border-t border-border-subtle pt-4\">\n <Button\n variant=\"outline\"\n onClick={() => navigate(buildPath('livestock/animals'))}\n className=\"w-full justify-center\"\n >\n {t('healthybowl.livestock.dashboard.distribution.viewAll', 'View All Animals')}{' '}\n <ArrowRight className=\"h-4 w-4\" />\n </Button>\n </div>\n </ChartCard>\n\n {/* Total Production */}\n <ChartCard\n title={t('healthybowl.livestock.dashboard.production.title', 'Total Production')}\n description={t(\n 'healthybowl.livestock.dashboard.production.description',\n 'Cumulative production tracking'\n )}\n >\n <div className=\"flex flex-col gap-4\">\n <div className=\"flex items-center justify-between rounded-lg bg-bg-sunken/50 p-4\">\n <div className=\"flex items-center gap-3\">\n <div className=\"rounded-full bg-bg-surface p-3\">\n <Milk className=\"h-5 w-5 text-primary\" />\n </div>\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n {t('healthybowl.livestock.dashboard.production.milk.label', 'Milk Production')}\n </p>\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.production.milk.source', 'From dairy animals')}\n </p>\n </div>\n </div>\n <div className=\"text-right\">\n <p className=\"text-xl font-bold text-text-primary\">{milkProduction}</p>\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.production.milk.unit', 'liters')}\n </p>\n </div>\n </div>\n\n <div className=\"flex items-center justify-between rounded-lg bg-bg-sunken/50 p-4\">\n <div className=\"flex items-center gap-3\">\n <div className=\"rounded-full bg-bg-surface p-3\">\n <Egg className=\"h-5 w-5 text-primary\" />\n </div>\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n {t('healthybowl.livestock.dashboard.production.eggs.label', 'Egg Collection')}\n </p>\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.production.eggs.source', 'From poultry')}\n </p>\n </div>\n </div>\n <div className=\"text-right\">\n <p className=\"text-xl font-bold text-text-primary\">{eggProduction}</p>\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.production.eggs.unit', 'eggs')}\n </p>\n </div>\n </div>\n\n <Button\n variant=\"default\"\n onClick={() => navigate(buildPath('livestock/production'))}\n className=\"w-full justify-center\"\n >\n {t('healthybowl.livestock.dashboard.production.record', 'Record Production')}{' '}\n <Plus className=\"h-4 w-4\" />\n </Button>\n </div>\n </ChartCard>\n </div>\n\n {/* Health Status & Quick Actions */}\n <div className=\"grid grid-cols-1 gap-6 lg:grid-cols-3\">\n {/* Health Status Overview */}\n <div className=\"lg:col-span-2 rounded-lg border border-border-subtle bg-bg-surface p-4 shadow-sm\">\n <div className=\"mb-4 flex items-center justify-between\">\n <div>\n <h3 className=\"text-sm font-medium text-text-primary\">\n {t('healthybowl.livestock.dashboard.healthStatus.title', 'Health Status Overview')}\n </h3>\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.healthStatus.subtitle', 'Current health distribution')}\n </p>\n </div>\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => navigate(buildPath('livestock/health'))}\n className=\"text-xs\"\n >\n {t('healthybowl.common.viewAll', 'View All')}\n </Button>\n </div>\n\n <div className=\"grid grid-cols-2 gap-3 sm:grid-cols-3 md:grid-cols-5\">\n {[\n {\n id: 'healthy',\n label: t('healthybowl.livestock.dashboard.healthStatus.healthy', 'Healthy'),\n value: healthy,\n variant: 'success' as const,\n icon: Heart,\n },\n {\n id: 'sick',\n label: t('healthybowl.livestock.dashboard.healthStatus.sick', 'Sick'),\n value: sick,\n variant: 'error' as const,\n icon: AlertCircle,\n },\n {\n id: 'treatment',\n label: t('healthybowl.livestock.dashboard.healthStatus.treatment', 'Treatment'),\n value: underTreatment,\n variant: 'warning' as const,\n icon: Clock,\n },\n {\n id: 'quarantine',\n label: t('healthybowl.livestock.dashboard.healthStatus.quarantine', 'Quarantine'),\n value: quarantine,\n variant: 'error' as const,\n icon: AlertCircle,\n },\n {\n id: 'pregnant',\n label: t('healthybowl.livestock.dashboard.healthStatus.pregnant', 'Pregnant'),\n value: pregnant,\n variant: 'info' as const,\n icon: Baby,\n },\n ].map((item) => (\n <div key={item.id} className=\"rounded-lg bg-bg-sunken/50 p-3 text-center\">\n <item.icon className=\"mx-auto mb-1 h-4 w-4 text-text-secondary\" />\n <p className=\"text-xl font-bold text-text-primary\">{item.value}</p>\n <p className=\"text-xs text-text-secondary\">{item.label}</p>\n </div>\n ))}\n </div>\n\n {/* Recent Health Issues */}\n {recentHealthIssues.length > 0 && (\n <div className=\"mt-4\">\n <h4 className=\"mb-2 text-sm font-medium text-text-primary\">\n {t('healthybowl.livestock.dashboard.healthStatus.recentIssues', 'Recent Health Issues')}\n </h4>\n <div className=\"flex flex-col gap-2\">\n {recentHealthIssues.map((issue) => (\n <div\n key={issue.id}\n className=\"flex cursor-pointer items-center justify-between rounded-md border border-border-subtle p-3 hover:bg-bg-sunken/30\"\n onClick={() => navigate(buildPath('livestock/health'))}\n >\n <div className=\"flex items-center gap-3\">\n <StatusBadge label={issue.status} variant={issue.status === 'active' ? 'warning' : 'info'} />\n <div>\n <p className=\"text-sm font-medium text-text-primary\">{issue.animalName}</p>\n <p className=\"text-xs text-text-secondary\">{issue.diagnosis}</p>\n </div>\n </div>\n <ChevronRight className=\"h-4 w-4 text-text-secondary\" />\n </div>\n ))}\n </div>\n </div>\n )}\n </div>\n\n {/* Quick Actions */}\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-4 shadow-sm\">\n <h3 className=\"mb-1 text-sm font-medium text-text-primary\">\n {t('healthybowl.livestock.dashboard.quickActions.title', 'Quick Actions')}\n </h3>\n <p className=\"mb-4 text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.quickActions.subtitle', 'Common livestock tasks')}\n </p>\n <div className=\"flex flex-col gap-2\">\n {[\n {\n id: 'healthCheck',\n label: t('healthybowl.livestock.dashboard.quickActions.recordHealthCheck', 'Record Health Check'),\n icon: Heart,\n path: buildPath('livestock/health'),\n },\n {\n id: 'vaccination',\n label: t(\n 'healthybowl.livestock.dashboard.quickActions.scheduleVaccination',\n 'Schedule Vaccination'\n ),\n icon: Calendar,\n path: buildPath('livestock/vaccinations'),\n },\n {\n id: 'feed',\n label: t('healthybowl.livestock.dashboard.quickActions.updateFeedRecords', 'Update Feed Records'),\n icon: Package,\n path: buildPath('livestock/feed'),\n },\n {\n id: 'breeding',\n label: t('healthybowl.livestock.dashboard.quickActions.breedingManagement', 'Breeding Management'),\n icon: Users,\n path: buildPath('livestock/breeding'),\n },\n {\n id: 'production',\n label: t('healthybowl.livestock.dashboard.quickActions.viewProduction', 'View Production'),\n icon: TrendingUp,\n path: buildPath('livestock/production'),\n },\n ].map((action) => (\n <Button\n key={action.id}\n variant=\"outline\"\n onClick={() => navigate(action.path)}\n className=\"justify-start\"\n >\n <action.icon className=\"h-4 w-4 text-text-secondary\" />\n {action.label}\n </Button>\n ))}\n </div>\n </div>\n </div>\n\n {/* Upcoming Vaccinations */}\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-4 shadow-sm\">\n <div className=\"mb-4 flex items-center justify-between\">\n <div>\n <h3 className=\"text-sm font-medium text-text-primary\">\n {t('healthybowl.livestock.dashboard.vaccinations.title', 'Upcoming Vaccinations')}\n </h3>\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.vaccinations.subtitle', 'Next 7 days · {{count}} scheduled', {\n count: upcomingVaccinations.length,\n })}\n </p>\n </div>\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => navigate(buildPath('livestock/vaccinations'))}\n className=\"text-xs\"\n >\n {t('healthybowl.common.viewAll', 'View All')}\n </Button>\n </div>\n <div className=\"flex flex-col gap-2\">\n {upcomingVaccinations.map((vac) => (\n <div\n key={vac.id}\n className=\"flex items-center justify-between rounded-md border border-border-subtle p-3 hover:bg-bg-sunken/30\"\n >\n <div className=\"flex items-center gap-3\">\n <Calendar className=\"h-4 w-4 text-text-secondary\" />\n <div>\n <p className=\"text-sm font-medium text-text-primary\">{vac.animalName}</p>\n <p className=\"text-xs text-text-secondary\">{vac.vaccineName}</p>\n </div>\n </div>\n <div className=\"text-right\">\n <p className=\"text-xs font-medium text-text-primary\">{formatDate(vac.nextDueDate)}</p>\n <StatusBadge label={vac.status} variant=\"info\" />\n </div>\n </div>\n ))}\n {upcomingVaccinations.length === 0 && (\n <p className=\"py-4 text-center text-sm text-text-secondary\">\n {t('healthybowl.livestock.dashboard.vaccinations.empty', 'No upcoming vaccinations')}\n </p>\n )}\n </div>\n </div>\n\n {/* Financial Summary — production value is ESTIMATED (recorded quantities × standard unit\n prices, not booked sales); feed cost is real. Labelled as estimates to avoid implying\n real revenue. */}\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-4 shadow-sm\">\n <h3 className=\"mb-1 text-sm font-medium text-text-primary\">\n {t('healthybowl.livestock.dashboard.financials.title', 'Estimated Financials')}\n </h3>\n <p className=\"mb-3 text-xs text-text-secondary\">\n {t(\n 'healthybowl.livestock.dashboard.financials.description',\n 'Production value is estimated from recorded output at standard unit prices; feed cost is actual.'\n )}\n </p>\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-3\">\n <div className=\"rounded-lg bg-bg-sunken/50 p-3 text-center\">\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.financials.productionValue', 'Est. Production Value')}\n </p>\n <p className=\"text-lg font-bold text-text-primary\">{formatCurrency(monthlyRevenue)}</p>\n </div>\n <div className=\"rounded-lg bg-bg-sunken/50 p-3 text-center\">\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.financials.feedCost', 'Feed Cost')}\n </p>\n <p className=\"text-lg font-bold text-text-primary\">{formatCurrency(monthlyExpenses)}</p>\n </div>\n <div className=\"rounded-lg bg-bg-sunken/50 p-3 text-center\">\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.financials.net', 'Est. Net')}\n </p>\n <p className=\"text-lg font-bold text-text-primary\">\n {formatCurrency(monthlyRevenue - monthlyExpenses)}\n </p>\n </div>\n </div>\n </div>\n </>\n )}\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAkCA,IAAM,KAAiB,MAAiB;AACtC,SAAQ,GAAR;EACE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,EAAI;QAAgB,CAAA,CAC5D,EAAA,CAAA,CACF;UACN,kBAAC,OAAD;OAAK,WAAU;iBAAf,CACE,kBAAC,KAAD;QAAG,WAAU;kBAAyC,EAAW,EAAI,YAAY;QAAK,CAAA,EACtF,kBAAC,GAAD;QAAa,OAAO,EAAI;QAAQ,SAAQ;QAAS,CAAA,CAC7C;SACF;QAdC,EAAI,GAcL,CACN,EACD,EAAqB,WAAW,KAC/B,kBAAC,KAAD;MAAG,WAAU;gBACV,EAAE,sDAAsD,2BAA2B;MAClF,CAAA,CAEF;OACF;;GAKN,kBAAC,OAAD;IAAK,WAAU;cAAf;KACE,kBAAC,MAAD;MAAI,WAAU;gBACX,EAAE,oDAAoD,uBAAuB;MAC3E,CAAA;KACL,kBAAC,KAAD;MAAG,WAAU;gBACV,EACC,0DACA,mGACD;MACC,CAAA;KACJ,kBAAC,OAAD;MAAK,WAAU;gBAAf;OACE,kBAAC,OAAD;QAAK,WAAU;kBAAf,CACE,kBAAC,KAAD;SAAG,WAAU;mBACV,EAAE,8DAA8D,wBAAwB;SACvF,CAAA,EACJ,kBAAC,KAAD;SAAG,WAAU;mBAAuC,EAAe,EAAe;SAAK,CAAA,CACnF;;OACN,kBAAC,OAAD;QAAK,WAAU;kBAAf,CACE,kBAAC,KAAD;SAAG,WAAU;mBACV,EAAE,uDAAuD,YAAY;SACpE,CAAA,EACJ,kBAAC,KAAD;SAAG,WAAU;mBAAuC,EAAe,EAAgB;SAAK,CAAA,CACpF;;OACN,kBAAC,OAAD;QAAK,WAAU;kBAAf,CACE,kBAAC,KAAD;SAAG,WAAU;mBACV,EAAE,kDAAkD,WAAW;SAC9D,CAAA,EACJ,kBAAC,KAAD;SAAG,WAAU;mBACV,EAAe,IAAiB,EAAgB;SAC/C,CAAA,CACA;;OACF;;KACF;;GACL,EAAA,CAAA;EAEM,CAAA"}
1
+ {"version":3,"file":"LivestockDashboardPage.js","names":[],"sources":["../../../../src/healthybowl/pages/livestock/LivestockDashboardPage.tsx"],"sourcesContent":["import { type FC } from 'react';\nimport { useNavigate } from 'react-router';\nimport { useBasePath } from '../../hooks/useBasePath';\nimport {\n PawPrint,\n Heart,\n Baby,\n DollarSign,\n TrendingUp,\n Milk,\n Egg,\n Calendar,\n ArrowRight,\n AlertCircle,\n Clock,\n ChevronRight,\n Plus,\n Package,\n Users,\n} from 'lucide-react';\nimport {\n PageLayout,\n StatCard,\n StatusBadge,\n ChartCard,\n LoadingSkeleton,\n EmptyState,\n ErrorState,\n} from '../../components';\nimport { LivestockGrowthCard } from './LivestockGrowthCard';\nimport { LivestockFeedCard } from './LivestockFeedCard';\nimport { useHealthyBowlData } from '../../hooks/useHealthyBowlData';\nimport { formatDate, formatCurrency } from '../../utils/helpers';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { Button } from '@burdenoff/fe-libs/ui';\n\nconst getAnimalIcon = (type: string) => {\n switch (type) {\n case 'cattle':\n case 'buffalo':\n return '🐄';\n case 'goat':\n return '🐐';\n case 'sheep':\n return '🐑';\n case 'pig':\n return '🐷';\n case 'poultry':\n return '🐔';\n default:\n return '🐾';\n }\n};\n\n// Per-unit price estimates for production types (used to derive revenue)\nconst UNIT_PRICES: Record<string, number> = {\n milk: 55,\n eggs: 8,\n wool: 400,\n meat: 350,\n manure: 5,\n};\n\nexport const LivestockDashboardPage: FC = () => {\n const { animals, healthRecords, vaccinations, productionRecords, feedRecords, loading, errors } =\n useHealthyBowlData();\n\n const navigate = useNavigate();\n const { buildPath } = useBasePath();\n const { t } = useI18n();\n\n const totalAnimals = animals.length;\n const healthy = animals.filter((a) => a.healthStatus === 'healthy').length;\n const sick = animals.filter((a) => a.healthStatus === 'sick').length;\n const underTreatment = animals.filter((a) => a.healthStatus === 'under_treatment').length;\n const quarantine = animals.filter((a) => a.healthStatus === 'quarantine').length;\n const pregnant = animals.filter((a) => a.healthStatus === 'pregnant').length;\n\n const typeCounts = animals.reduce<Record<string, number>>((acc, a) => {\n acc[a.type] = (acc[a.type] || 0) + 1;\n return acc;\n }, {});\n\n // Total production from all records\n const milkProduction = productionRecords.filter((p) => p.type === 'milk').reduce((sum, p) => sum + p.quantity, 0);\n const eggProduction = productionRecords.filter((p) => p.type === 'eggs').reduce((sum, p) => sum + p.quantity, 0);\n\n // Derive financial figures from actual data\n const monthlyRevenue = productionRecords.reduce((sum, p) => sum + p.quantity * (UNIT_PRICES[p.type] ?? 0), 0);\n const monthlyExpenses = feedRecords.reduce((sum, r) => sum + r.cost, 0);\n const profitMargin =\n monthlyRevenue > 0 ? (((monthlyRevenue - monthlyExpenses) / monthlyRevenue) * 100).toFixed(1) : '0.0';\n\n const recentHealthIssues = healthRecords\n .filter((r) => r.status === 'active' || r.status === 'monitoring')\n .slice(0, 3);\n const upcomingVaccinations = vaccinations.filter((v) => v.status === 'scheduled').slice(0, 3);\n\n return (\n <PageLayout\n title={t('healthybowl.livestock.dashboard.title', 'Livestock Management')}\n description={t('healthybowl.livestock.dashboard.description', 'Monitor and manage your livestock operations')}\n purpose=\"The health of your animal operation at a glance — herd size, health flags and production. Start here each day, then dive into the registry, health, breeding or feed sections as needed.\"\n nextStepsKey=\"healthybowl-livestock-dashboard\"\n nextStepsTitle=\"Run your herd day to day\"\n nextSteps={[\n {\n id: 'registry',\n label: 'Register your animals',\n description: 'Build the herd registry so every record links to an animal.',\n onClick: () => navigate(buildPath('livestock/animals')),\n },\n {\n id: 'health',\n label: 'Log health & vaccinations',\n description: 'Keep treatment and vaccination history in one place.',\n onClick: () => navigate(buildPath('livestock/health')),\n },\n {\n id: 'production',\n label: 'Track production',\n description: 'Record milk, eggs or other yields to watch trends.',\n onClick: () => navigate(buildPath('livestock/production')),\n },\n ]}\n actions={\n <Button variant=\"default\" onClick={() => navigate(buildPath('livestock/animals'))}>\n <Plus className=\"h-4 w-4\" />\n {t('healthybowl.livestock.dashboard.actions.addAnimal', 'Add Animal')}\n </Button>\n }\n >\n {loading && animals.length === 0 ? (\n <LoadingSkeleton variant=\"card\" count={4} />\n ) : (\n <>\n {/* Key Metrics */}\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4\">\n <StatCard\n hero\n label={t('healthybowl.livestock.dashboard.stats.totalAnimals.label', 'Total Animals')}\n value={totalAnimals}\n icon={<PawPrint className=\"h-4 w-4\" />}\n />\n <StatCard\n label={t('healthybowl.livestock.dashboard.stats.healthIssues.label', 'Health Issues')}\n value={sick + underTreatment}\n icon={<Heart className=\"h-4 w-4\" />}\n />\n <StatCard\n label={t('healthybowl.livestock.dashboard.stats.productionValue.label', 'Est. Production Value')}\n value={formatCurrency(monthlyRevenue)}\n icon={<DollarSign className=\"h-4 w-4\" />}\n />\n <StatCard\n label={t('healthybowl.livestock.dashboard.stats.margin.label', 'Est. Margin')}\n value={parseFloat(profitMargin)}\n unit=\"%\"\n icon={<TrendingUp className=\"h-4 w-4\" />}\n />\n </div>\n\n {/* Animal Distribution & Total Production */}\n <div className=\"grid grid-cols-1 gap-6 lg:grid-cols-2\">\n {/* Animal Distribution */}\n <ChartCard\n title={t('healthybowl.livestock.dashboard.distribution.title', 'Animal Distribution')}\n description={t('healthybowl.livestock.dashboard.distribution.description', 'Breakdown by animal type')}\n >\n {totalAnimals === 0 ? (\n errors.livestock ? (\n <ErrorState />\n ) : (\n <EmptyState\n illustration=\"empty-generic\"\n title={t('healthybowl.livestock.dashboard.distribution.empty.title', 'No animals yet')}\n description={t(\n 'healthybowl.livestock.dashboard.distribution.empty.description',\n 'Add an animal to see your livestock distribution by type.'\n )}\n />\n )\n ) : (\n <div className=\"flex flex-col gap-3\">\n {Object.entries(typeCounts).map(([type, count]) => {\n const percentage = totalAnimals > 0 ? Math.round((count / totalAnimals) * 100) : 0;\n return (\n <div key={type} className=\"space-y-1.5\">\n <div className=\"flex items-center justify-between\">\n <div className=\"flex items-center gap-2\">\n <span className=\"text-lg\">{getAnimalIcon(type)}</span>\n <span className=\"text-sm font-medium capitalize text-text-primary\">{type}</span>\n </div>\n <span className=\"text-xs text-text-secondary\">\n {count} ({percentage}%)\n </span>\n </div>\n <div className=\"h-2 w-full rounded-full bg-bg-sunken\">\n <div\n className=\"h-2 rounded-full bg-action-primary-bg transition-all\"\n style={{ width: `${percentage}%` }}\n />\n </div>\n </div>\n );\n })}\n </div>\n )}\n <div className=\"mt-4 border-t border-border-subtle pt-4\">\n <Button\n variant=\"outline\"\n onClick={() => navigate(buildPath('livestock/animals'))}\n className=\"w-full justify-center\"\n >\n {t('healthybowl.livestock.dashboard.distribution.viewAll', 'View All Animals')}{' '}\n <ArrowRight className=\"h-4 w-4\" />\n </Button>\n </div>\n </ChartCard>\n\n {/* Total Production */}\n <ChartCard\n title={t('healthybowl.livestock.dashboard.production.title', 'Total Production')}\n description={t(\n 'healthybowl.livestock.dashboard.production.description',\n 'Cumulative production tracking'\n )}\n >\n <div className=\"flex flex-col gap-4\">\n <div className=\"flex items-center justify-between rounded-lg bg-bg-sunken/50 p-4\">\n <div className=\"flex items-center gap-3\">\n <div className=\"rounded-full bg-bg-surface p-3\">\n <Milk className=\"h-5 w-5 text-primary\" />\n </div>\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n {t('healthybowl.livestock.dashboard.production.milk.label', 'Milk Production')}\n </p>\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.production.milk.source', 'From dairy animals')}\n </p>\n </div>\n </div>\n <div className=\"text-right\">\n <p className=\"text-xl font-bold text-text-primary\">{milkProduction}</p>\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.production.milk.unit', 'liters')}\n </p>\n </div>\n </div>\n\n <div className=\"flex items-center justify-between rounded-lg bg-bg-sunken/50 p-4\">\n <div className=\"flex items-center gap-3\">\n <div className=\"rounded-full bg-bg-surface p-3\">\n <Egg className=\"h-5 w-5 text-primary\" />\n </div>\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n {t('healthybowl.livestock.dashboard.production.eggs.label', 'Egg Collection')}\n </p>\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.production.eggs.source', 'From poultry')}\n </p>\n </div>\n </div>\n <div className=\"text-right\">\n <p className=\"text-xl font-bold text-text-primary\">{eggProduction}</p>\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.production.eggs.unit', 'eggs')}\n </p>\n </div>\n </div>\n\n <Button\n variant=\"default\"\n onClick={() => navigate(buildPath('livestock/production'))}\n className=\"w-full justify-center\"\n >\n {t('healthybowl.livestock.dashboard.production.record', 'Record Production')}{' '}\n <Plus className=\"h-4 w-4\" />\n </Button>\n </div>\n </ChartCard>\n </div>\n\n {/* Growth (BOFF-5971) — herd-average weight curve + ADG leaders */}\n <LivestockGrowthCard />\n\n {/* Feed (BOFF-5971) — spend over time + what a kilo of gain costs */}\n <LivestockFeedCard />\n\n {/* Health Status & Quick Actions */}\n <div className=\"grid grid-cols-1 gap-6 lg:grid-cols-3\">\n {/* Health Status Overview */}\n <div className=\"lg:col-span-2 rounded-lg border border-border-subtle bg-bg-surface p-4 shadow-sm\">\n <div className=\"mb-4 flex items-center justify-between\">\n <div>\n <h3 className=\"text-sm font-medium text-text-primary\">\n {t('healthybowl.livestock.dashboard.healthStatus.title', 'Health Status Overview')}\n </h3>\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.healthStatus.subtitle', 'Current health distribution')}\n </p>\n </div>\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => navigate(buildPath('livestock/health'))}\n className=\"text-xs\"\n >\n {t('healthybowl.common.viewAll', 'View All')}\n </Button>\n </div>\n\n <div className=\"grid grid-cols-2 gap-3 sm:grid-cols-3 md:grid-cols-5\">\n {[\n {\n id: 'healthy',\n label: t('healthybowl.livestock.dashboard.healthStatus.healthy', 'Healthy'),\n value: healthy,\n variant: 'success' as const,\n icon: Heart,\n },\n {\n id: 'sick',\n label: t('healthybowl.livestock.dashboard.healthStatus.sick', 'Sick'),\n value: sick,\n variant: 'error' as const,\n icon: AlertCircle,\n },\n {\n id: 'treatment',\n label: t('healthybowl.livestock.dashboard.healthStatus.treatment', 'Treatment'),\n value: underTreatment,\n variant: 'warning' as const,\n icon: Clock,\n },\n {\n id: 'quarantine',\n label: t('healthybowl.livestock.dashboard.healthStatus.quarantine', 'Quarantine'),\n value: quarantine,\n variant: 'error' as const,\n icon: AlertCircle,\n },\n {\n id: 'pregnant',\n label: t('healthybowl.livestock.dashboard.healthStatus.pregnant', 'Pregnant'),\n value: pregnant,\n variant: 'info' as const,\n icon: Baby,\n },\n ].map((item) => (\n <div key={item.id} className=\"rounded-lg bg-bg-sunken/50 p-3 text-center\">\n <item.icon className=\"mx-auto mb-1 h-4 w-4 text-text-secondary\" />\n <p className=\"text-xl font-bold text-text-primary\">{item.value}</p>\n <p className=\"text-xs text-text-secondary\">{item.label}</p>\n </div>\n ))}\n </div>\n\n {/* Recent Health Issues */}\n {recentHealthIssues.length > 0 && (\n <div className=\"mt-4\">\n <h4 className=\"mb-2 text-sm font-medium text-text-primary\">\n {t('healthybowl.livestock.dashboard.healthStatus.recentIssues', 'Recent Health Issues')}\n </h4>\n <div className=\"flex flex-col gap-2\">\n {recentHealthIssues.map((issue) => (\n <div\n key={issue.id}\n className=\"flex cursor-pointer items-center justify-between rounded-md border border-border-subtle p-3 hover:bg-bg-sunken/30\"\n onClick={() => navigate(buildPath('livestock/health'))}\n >\n <div className=\"flex items-center gap-3\">\n <StatusBadge label={issue.status} variant={issue.status === 'active' ? 'warning' : 'info'} />\n <div>\n <p className=\"text-sm font-medium text-text-primary\">{issue.animalName}</p>\n <p className=\"text-xs text-text-secondary\">{issue.diagnosis}</p>\n </div>\n </div>\n <ChevronRight className=\"h-4 w-4 text-text-secondary\" />\n </div>\n ))}\n </div>\n </div>\n )}\n </div>\n\n {/* Quick Actions */}\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-4 shadow-sm\">\n <h3 className=\"mb-1 text-sm font-medium text-text-primary\">\n {t('healthybowl.livestock.dashboard.quickActions.title', 'Quick Actions')}\n </h3>\n <p className=\"mb-4 text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.quickActions.subtitle', 'Common livestock tasks')}\n </p>\n <div className=\"flex flex-col gap-2\">\n {[\n {\n id: 'healthCheck',\n label: t('healthybowl.livestock.dashboard.quickActions.recordHealthCheck', 'Record Health Check'),\n icon: Heart,\n path: buildPath('livestock/health'),\n },\n {\n id: 'vaccination',\n label: t(\n 'healthybowl.livestock.dashboard.quickActions.scheduleVaccination',\n 'Schedule Vaccination'\n ),\n icon: Calendar,\n path: buildPath('livestock/vaccinations'),\n },\n {\n id: 'feed',\n label: t('healthybowl.livestock.dashboard.quickActions.updateFeedRecords', 'Update Feed Records'),\n icon: Package,\n path: buildPath('livestock/feed'),\n },\n {\n id: 'breeding',\n label: t('healthybowl.livestock.dashboard.quickActions.breedingManagement', 'Breeding Management'),\n icon: Users,\n path: buildPath('livestock/breeding'),\n },\n {\n id: 'production',\n label: t('healthybowl.livestock.dashboard.quickActions.viewProduction', 'View Production'),\n icon: TrendingUp,\n path: buildPath('livestock/production'),\n },\n ].map((action) => (\n <Button\n key={action.id}\n variant=\"outline\"\n onClick={() => navigate(action.path)}\n className=\"justify-start\"\n >\n <action.icon className=\"h-4 w-4 text-text-secondary\" />\n {action.label}\n </Button>\n ))}\n </div>\n </div>\n </div>\n\n {/* Upcoming Vaccinations */}\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-4 shadow-sm\">\n <div className=\"mb-4 flex items-center justify-between\">\n <div>\n <h3 className=\"text-sm font-medium text-text-primary\">\n {t('healthybowl.livestock.dashboard.vaccinations.title', 'Upcoming Vaccinations')}\n </h3>\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.vaccinations.subtitle', 'Next 7 days · {{count}} scheduled', {\n count: upcomingVaccinations.length,\n })}\n </p>\n </div>\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => navigate(buildPath('livestock/vaccinations'))}\n className=\"text-xs\"\n >\n {t('healthybowl.common.viewAll', 'View All')}\n </Button>\n </div>\n <div className=\"flex flex-col gap-2\">\n {upcomingVaccinations.map((vac) => (\n <div\n key={vac.id}\n className=\"flex items-center justify-between rounded-md border border-border-subtle p-3 hover:bg-bg-sunken/30\"\n >\n <div className=\"flex items-center gap-3\">\n <Calendar className=\"h-4 w-4 text-text-secondary\" />\n <div>\n <p className=\"text-sm font-medium text-text-primary\">{vac.animalName}</p>\n <p className=\"text-xs text-text-secondary\">{vac.vaccineName}</p>\n </div>\n </div>\n <div className=\"text-right\">\n <p className=\"text-xs font-medium text-text-primary\">{formatDate(vac.nextDueDate)}</p>\n <StatusBadge label={vac.status} variant=\"info\" />\n </div>\n </div>\n ))}\n {upcomingVaccinations.length === 0 && (\n <p className=\"py-4 text-center text-sm text-text-secondary\">\n {t('healthybowl.livestock.dashboard.vaccinations.empty', 'No upcoming vaccinations')}\n </p>\n )}\n </div>\n </div>\n\n {/* Financial Summary — production value is ESTIMATED (recorded quantities × standard unit\n prices, not booked sales); feed cost is real. Labelled as estimates to avoid implying\n real revenue. */}\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-4 shadow-sm\">\n <h3 className=\"mb-1 text-sm font-medium text-text-primary\">\n {t('healthybowl.livestock.dashboard.financials.title', 'Estimated Financials')}\n </h3>\n <p className=\"mb-3 text-xs text-text-secondary\">\n {t(\n 'healthybowl.livestock.dashboard.financials.description',\n 'Production value is estimated from recorded output at standard unit prices; feed cost is actual.'\n )}\n </p>\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-3\">\n <div className=\"rounded-lg bg-bg-sunken/50 p-3 text-center\">\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.financials.productionValue', 'Est. Production Value')}\n </p>\n <p className=\"text-lg font-bold text-text-primary\">{formatCurrency(monthlyRevenue)}</p>\n </div>\n <div className=\"rounded-lg bg-bg-sunken/50 p-3 text-center\">\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.financials.feedCost', 'Feed Cost')}\n </p>\n <p className=\"text-lg font-bold text-text-primary\">{formatCurrency(monthlyExpenses)}</p>\n </div>\n <div className=\"rounded-lg bg-bg-sunken/50 p-3 text-center\">\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.financials.net', 'Est. Net')}\n </p>\n <p className=\"text-lg font-bold text-text-primary\">\n {formatCurrency(monthlyRevenue - monthlyExpenses)}\n </p>\n </div>\n </div>\n </div>\n </>\n )}\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAoCA,IAAM,KAAiB,MAAiB;AACtC,SAAQ,GAAR;EACE,KAAK;EACL,KAAK,UACH,QAAO;EACT,KAAK,OACH,QAAO;EACT,KAAK,QACH,QAAO;EACT,KAAK,MACH,QAAO;EACT,KAAK,UACH,QAAO;EACT,QACE,QAAO;;GAKP,IAAsC;CAC1C,MAAM;CACN,MAAM;CACN,MAAM;CACN,MAAM;CACN,QAAQ;CACT,EAEY,UAAmC;CAC9C,IAAM,EAAE,YAAS,kBAAe,iBAAc,sBAAmB,gBAAa,YAAS,cACrF,IAAoB,EAEhB,IAAW,GAAa,EACxB,EAAE,iBAAc,GAAa,EAC7B,EAAE,SAAM,GAAS,EAEjB,IAAe,EAAQ,QACvB,IAAU,EAAQ,QAAQ,MAAM,EAAE,iBAAiB,UAAU,CAAC,QAC9D,IAAO,EAAQ,QAAQ,MAAM,EAAE,iBAAiB,OAAO,CAAC,QACxD,IAAiB,EAAQ,QAAQ,MAAM,EAAE,iBAAiB,kBAAkB,CAAC,QAC7E,IAAa,EAAQ,QAAQ,MAAM,EAAE,iBAAiB,aAAa,CAAC,QACpE,IAAW,EAAQ,QAAQ,MAAM,EAAE,iBAAiB,WAAW,CAAC,QAEhE,IAAa,EAAQ,QAAgC,GAAK,OAC9D,EAAI,EAAE,SAAS,EAAI,EAAE,SAAS,KAAK,GAC5B,IACN,EAAE,CAAC,EAGA,IAAiB,EAAkB,QAAQ,MAAM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D;QAAK,WAAU;kBAAf,CACE,kBAAC,KAAD;SAAG,WAAU;mBACV,EAAE,uDAAuD,YAAY;SACpE,CAAA,EACJ,kBAAC,KAAD;SAAG,WAAU;mBAAuC,EAAe,EAAgB;SAAK,CAAA,CACpF;;OACN,kBAAC,OAAD;QAAK,WAAU;kBAAf,CACE,kBAAC,KAAD;SAAG,WAAU;mBACV,EAAE,kDAAkD,WAAW;SAC9D,CAAA,EACJ,kBAAC,KAAD;SAAG,WAAU;mBACV,EAAe,IAAiB,EAAgB;SAC/C,CAAA,CACA;;OACF;;KACF;;GACL,EAAA,CAAA;EAEM,CAAA"}
@@ -0,0 +1,161 @@
1
+ import { formatNumber as e } from "../../utils/helpers.js";
2
+ import { ChartCard as t } from "../../components/ChartCard.js";
3
+ import { Tooltip as n } from "../../../node_modules/recharts/es6/component/Tooltip.js";
4
+ import { ResponsiveContainer as r } from "../../../node_modules/recharts/es6/component/ResponsiveContainer.js";
5
+ import { Bar as i } from "../../../node_modules/recharts/es6/cartesian/Bar.js";
6
+ import { CartesianGrid as a } from "../../../node_modules/recharts/es6/cartesian/CartesianGrid.js";
7
+ import { XAxis as o } from "../../../node_modules/recharts/es6/cartesian/XAxis.js";
8
+ import { YAxis as s } from "../../../node_modules/recharts/es6/cartesian/YAxis.js";
9
+ import { BarChart as c } from "../../../node_modules/recharts/es6/chart/BarChart.js";
10
+ import { useHealthyBowlLivestockFeed as l } from "../../hooks/useHealthyBowlLivestockFeed.js";
11
+ import { useState as u } from "react";
12
+ import { useI18n as d } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
13
+ import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
14
+ //#region src/healthybowl/pages/livestock/LivestockFeedCard.tsx
15
+ var h = [
16
+ "DAY",
17
+ "WEEK",
18
+ "MONTH"
19
+ ], g = ({ groupId: g = null, className: _ }) => {
20
+ let { t: v } = d(), [y, b] = u("WEEK"), { buckets: x, summary: S, loading: C, error: w } = l({
21
+ groupId: g,
22
+ granularity: y
23
+ }), T = x.length > 0, E = /* @__PURE__ */ p("div", {
24
+ className: "flex items-center gap-1",
25
+ children: h.map((e) => /* @__PURE__ */ p("button", {
26
+ type: "button",
27
+ onClick: () => b(e),
28
+ "aria-pressed": y === e,
29
+ className: `min-h-[32px] rounded-md px-2 py-1 text-xs transition-colors ${y === e ? "bg-action-primary-bg text-action-primary-text" : "text-text-secondary hover:bg-bg-sunken/50"}`,
30
+ children: v(`healthybowl.livestock.feed.granularity.${e.toLowerCase()}`, e.charAt(0) + e.slice(1).toLowerCase())
31
+ }, e))
32
+ });
33
+ return /* @__PURE__ */ p(t, {
34
+ title: v("healthybowl.livestock.feed.title", "Feed"),
35
+ description: v("healthybowl.livestock.feed.description", "What the herd ate, what it cost, and how much weight it bought."),
36
+ actions: E,
37
+ className: _,
38
+ children: w ? /* @__PURE__ */ m("div", {
39
+ className: "py-8 text-center",
40
+ children: [/* @__PURE__ */ p("p", {
41
+ className: "text-sm text-text-primary",
42
+ children: v("healthybowl.livestock.feed.error.title", "Could not load feed data")
43
+ }), /* @__PURE__ */ p("p", {
44
+ className: "mt-1 text-xs text-text-secondary",
45
+ children: w.message
46
+ })]
47
+ }) : C && !T ? /* @__PURE__ */ p("p", {
48
+ className: "py-8 text-center text-xs text-text-secondary",
49
+ children: v("healthybowl.livestock.feed.loading", "Loading feed data…")
50
+ }) : T ? /* @__PURE__ */ m(f, { children: [
51
+ /* @__PURE__ */ p(r, {
52
+ width: "100%",
53
+ height: 240,
54
+ children: /* @__PURE__ */ m(c, {
55
+ data: x,
56
+ margin: {
57
+ top: 5,
58
+ right: 20,
59
+ left: 0,
60
+ bottom: 5
61
+ },
62
+ children: [
63
+ /* @__PURE__ */ p(a, {
64
+ strokeDasharray: "3 3",
65
+ stroke: "var(--color-border)"
66
+ }),
67
+ /* @__PURE__ */ p(o, {
68
+ dataKey: "at",
69
+ tick: { fontSize: 11 },
70
+ stroke: "var(--color-muted-foreground)"
71
+ }),
72
+ /* @__PURE__ */ p(s, {
73
+ tick: { fontSize: 11 },
74
+ stroke: "var(--color-muted-foreground)"
75
+ }),
76
+ /* @__PURE__ */ p(n, {
77
+ cursor: {
78
+ fill: "var(--color-muted)",
79
+ opacity: .2
80
+ },
81
+ contentStyle: {
82
+ backgroundColor: "var(--color-card)",
83
+ border: "1px solid var(--color-border)",
84
+ borderRadius: 8,
85
+ fontSize: 12
86
+ },
87
+ labelStyle: { color: "var(--color-foreground)" },
88
+ formatter: (t, n, r) => {
89
+ let i = r?.payload, a = (i?.byUnit ?? []).map((t) => `${e(t.quantity)} ${t.unit}`).join(", ");
90
+ return [e(typeof t == "number" ? t : Number(t)), v("healthybowl.livestock.feed.tooltip.cost", "Spend — {{qty}} across {{n}} records", {
91
+ qty: a || "—",
92
+ n: String(i?.records ?? 0)
93
+ })];
94
+ }
95
+ }),
96
+ /* @__PURE__ */ p(i, {
97
+ dataKey: "totalCost",
98
+ fill: "var(--color-success)",
99
+ radius: [
100
+ 3,
101
+ 3,
102
+ 0,
103
+ 0
104
+ ]
105
+ })
106
+ ]
107
+ })
108
+ }),
109
+ S && /* @__PURE__ */ m("dl", {
110
+ className: "mt-3 grid grid-cols-2 gap-3 border-t border-border-subtle pt-3 sm:grid-cols-4",
111
+ children: [
112
+ /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("dt", {
113
+ className: "text-xs text-text-secondary",
114
+ children: v("healthybowl.livestock.feed.summary.spend", "Total spend")
115
+ }), /* @__PURE__ */ p("dd", {
116
+ className: "text-sm font-medium text-text-primary",
117
+ children: e(S.totalCost)
118
+ })] }),
119
+ /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("dt", {
120
+ className: "text-xs text-text-secondary",
121
+ children: v("healthybowl.livestock.feed.summary.intake", "Feed used")
122
+ }), /* @__PURE__ */ p("dd", {
123
+ className: "text-sm font-medium text-text-primary",
124
+ children: ((t) => t === null ? v("healthybowl.livestock.feed.mixedUnits", "mixed units") : `${e(t)} kg`)(S.totalKg)
125
+ })] }),
126
+ /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("dt", {
127
+ className: "text-xs text-text-secondary",
128
+ children: v("healthybowl.livestock.feed.summary.fcr", "Feed per kg gained")
129
+ }), /* @__PURE__ */ p("dd", {
130
+ className: "text-sm font-medium text-text-primary",
131
+ children: S.feedConversionRatio === null ? "—" : `${S.feedConversionRatio} kg`
132
+ })] }),
133
+ /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("dt", {
134
+ className: "text-xs text-text-secondary",
135
+ children: v("healthybowl.livestock.feed.summary.costPerKg", "Cost per kg gained")
136
+ }), /* @__PURE__ */ p("dd", {
137
+ className: "text-sm font-medium text-text-primary",
138
+ children: S.costPerKgGain === null ? "—" : e(S.costPerKgGain)
139
+ })] })
140
+ ]
141
+ }),
142
+ S && S.totalKg === null && S.unitsSeen.length > 1 && /* @__PURE__ */ p("p", {
143
+ className: "mt-2 text-xs text-text-secondary",
144
+ children: v("healthybowl.livestock.feed.mixedUnitsHint", "Feed was recorded in {{units}}, so it cannot be totalled by weight — spend per kilo gained still is.", { units: S.unitsSeen.join(", ") })
145
+ })
146
+ ] }) : /* @__PURE__ */ m("div", {
147
+ className: "py-8 text-center",
148
+ children: [/* @__PURE__ */ p("p", {
149
+ className: "text-sm text-text-primary",
150
+ children: v("healthybowl.livestock.feed.empty.title", "No feed recorded yet")
151
+ }), /* @__PURE__ */ p("p", {
152
+ className: "mt-1 text-xs text-text-secondary",
153
+ children: v("healthybowl.livestock.feed.empty.hint", "Log what you feed the herd to see spend over time — and, with weights, what it costs to add a kilo.")
154
+ })]
155
+ })
156
+ });
157
+ };
158
+ //#endregion
159
+ export { g as LivestockFeedCard };
160
+
161
+ //# sourceMappingURL=LivestockFeedCard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LivestockFeedCard.js","names":[],"sources":["../../../../src/healthybowl/pages/livestock/LivestockFeedCard.tsx"],"sourcesContent":["/**\n * Livestock feed chart (BOFF-5971, slice 2).\n *\n * Sits under the growth card: growth shows what came out, this shows what went in and what it cost.\n *\n * Deliberate choices:\n * - **Cost is the plotted series, not quantity.** `FeedRecord.unit` is free text, so a period can\n * mix kg with bags and litres; the backend refuses to total those into kilograms and returns\n * null. Currency always sums, so spend is the one series that is honest in every workspace.\n * Quantity appears in the tooltip, per unit.\n * - **\"Mixed units\" is rendered as a statement, never as 0 kg.** A null total means the backend\n * declined to invent a number, and showing zero would misreport intake as nothing.\n * - Feed conversion is shown beside cost-per-kg-gained, because a farm buying feed in bags can\n * still act on the second even when the first is uncomputable.\n */\n\nimport { useState, type FC } from 'react';\nimport { Bar, BarChart, CartesianGrid, ResponsiveContainer, Tooltip, XAxis, YAxis } from 'recharts';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { ChartCard } from '../../components/ChartCard';\nimport { formatNumber } from '../../utils/helpers';\nimport { useHealthyBowlLivestockFeed } from '../../hooks/useHealthyBowlLivestockFeed';\nimport type { GrowthGranularity } from '../../hooks/useHealthyBowlLivestockGrowth';\n\nconst GRANULARITIES: GrowthGranularity[] = ['DAY', 'WEEK', 'MONTH'];\n\ninterface LivestockFeedCardProps {\n groupId?: string | null;\n className?: string;\n}\n\nexport const LivestockFeedCard: FC<LivestockFeedCardProps> = ({ groupId = null, className }) => {\n const { t } = useI18n();\n const [granularity, setGranularity] = useState<GrowthGranularity>('WEEK');\n const { buckets, summary, loading, error } = useHealthyBowlLivestockFeed({ groupId, granularity });\n\n const hasData = buckets.length > 0;\n\n const granularityToggle = (\n <div className=\"flex items-center gap-1\">\n {GRANULARITIES.map((g) => (\n <button\n key={g}\n type=\"button\"\n onClick={() => setGranularity(g)}\n aria-pressed={granularity === g}\n className={`min-h-[32px] rounded-md px-2 py-1 text-xs transition-colors ${\n granularity === g\n ? 'bg-action-primary-bg text-action-primary-text'\n : 'text-text-secondary hover:bg-bg-sunken/50'\n }`}\n >\n {t(`healthybowl.livestock.feed.granularity.${g.toLowerCase()}`, g.charAt(0) + g.slice(1).toLowerCase())}\n </button>\n ))}\n </div>\n );\n\n /** Null kg means \"units cannot be totalled\", which must never render as 0. */\n const kgLabel = (kg: number | null): string =>\n kg === null ? t('healthybowl.livestock.feed.mixedUnits', 'mixed units') : `${formatNumber(kg)} kg`;\n\n return (\n <ChartCard\n title={t('healthybowl.livestock.feed.title', 'Feed')}\n description={t(\n 'healthybowl.livestock.feed.description',\n 'What the herd ate, what it cost, and how much weight it bought.'\n )}\n actions={granularityToggle}\n className={className}\n >\n {error ? (\n <div className=\"py-8 text-center\">\n <p className=\"text-sm text-text-primary\">\n {t('healthybowl.livestock.feed.error.title', 'Could not load feed data')}\n </p>\n <p className=\"mt-1 text-xs text-text-secondary\">{error.message}</p>\n </div>\n ) : loading && !hasData ? (\n <p className=\"py-8 text-center text-xs text-text-secondary\">\n {t('healthybowl.livestock.feed.loading', 'Loading feed data…')}\n </p>\n ) : !hasData ? (\n <div className=\"py-8 text-center\">\n <p className=\"text-sm text-text-primary\">\n {t('healthybowl.livestock.feed.empty.title', 'No feed recorded yet')}\n </p>\n <p className=\"mt-1 text-xs text-text-secondary\">\n {t(\n 'healthybowl.livestock.feed.empty.hint',\n 'Log what you feed the herd to see spend over time — and, with weights, what it costs to add a kilo.'\n )}\n </p>\n </div>\n ) : (\n <>\n <ResponsiveContainer width=\"100%\" height={240}>\n <BarChart data={buckets} margin={{ top: 5, right: 20, left: 0, bottom: 5 }}>\n <CartesianGrid strokeDasharray=\"3 3\" stroke=\"var(--color-border)\" />\n <XAxis dataKey=\"at\" tick={{ fontSize: 11 }} stroke=\"var(--color-muted-foreground)\" />\n <YAxis tick={{ fontSize: 11 }} stroke=\"var(--color-muted-foreground)\" />\n <Tooltip\n cursor={{ fill: 'var(--color-muted)', opacity: 0.2 }}\n contentStyle={{\n backgroundColor: 'var(--color-card)',\n border: '1px solid var(--color-border)',\n borderRadius: 8,\n fontSize: 12,\n }}\n labelStyle={{ color: 'var(--color-foreground)' }}\n formatter={(value: number | string, _name: string, item: { payload?: FeedTooltipPayload }) => {\n const p = item?.payload;\n const qty = (p?.byUnit ?? []).map((u) => `${formatNumber(u.quantity)} ${u.unit}`).join(', ');\n return [\n formatNumber(typeof value === 'number' ? value : Number(value)),\n t('healthybowl.livestock.feed.tooltip.cost', 'Spend — {{qty}} across {{n}} records', {\n qty: qty || '—',\n n: String(p?.records ?? 0),\n }),\n ];\n }}\n />\n <Bar dataKey=\"totalCost\" fill=\"var(--color-success)\" radius={[3, 3, 0, 0]} />\n </BarChart>\n </ResponsiveContainer>\n\n {summary && (\n <dl className=\"mt-3 grid grid-cols-2 gap-3 border-t border-border-subtle pt-3 sm:grid-cols-4\">\n <div>\n <dt className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.feed.summary.spend', 'Total spend')}\n </dt>\n <dd className=\"text-sm font-medium text-text-primary\">{formatNumber(summary.totalCost)}</dd>\n </div>\n <div>\n <dt className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.feed.summary.intake', 'Feed used')}\n </dt>\n <dd className=\"text-sm font-medium text-text-primary\">{kgLabel(summary.totalKg)}</dd>\n </div>\n <div>\n <dt className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.feed.summary.fcr', 'Feed per kg gained')}\n </dt>\n <dd className=\"text-sm font-medium text-text-primary\">\n {summary.feedConversionRatio === null ? '—' : `${summary.feedConversionRatio} kg`}\n </dd>\n </div>\n <div>\n <dt className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.feed.summary.costPerKg', 'Cost per kg gained')}\n </dt>\n <dd className=\"text-sm font-medium text-text-primary\">\n {summary.costPerKgGain === null ? '—' : formatNumber(summary.costPerKgGain)}\n </dd>\n </div>\n </dl>\n )}\n\n {summary && summary.totalKg === null && summary.unitsSeen.length > 1 && (\n <p className=\"mt-2 text-xs text-text-secondary\">\n {t(\n 'healthybowl.livestock.feed.mixedUnitsHint',\n 'Feed was recorded in {{units}}, so it cannot be totalled by weight — spend per kilo gained still is.',\n { units: summary.unitsSeen.join(', ') }\n )}\n </p>\n )}\n </>\n )}\n </ChartCard>\n );\n};\n\ninterface FeedTooltipPayload {\n byUnit?: { unit: string; quantity: number }[];\n records?: number;\n}\n"],"mappings":";;;;;;;;;;;;;;AAwBA,IAAM,IAAqC;CAAC;CAAO;CAAQ;CAAQ,EAOtD,KAAiD,EAAE,aAAU,MAAM,mBAAgB;CAC9F,IAAM,EAAE,SAAM,GAAS,EACjB,CAAC,GAAa,KAAkB,EAA4B,OAAO,EACnE,EAAE,YAAS,YAAS,YAAS,aAAU,EAA4B;EAAE;EAAS;EAAa,CAAC,EAE5F,IAAU,EAAQ,SAAS,GAE3B,IACJ,kBAAC,OAAD;EAAK,WAAU;YACZ,EAAc,KAAK,MAClB,kBAAC,UAAD;GAEE,MAAK;GACL,eAAe,EAAe,EAAE;GAChC,gBAAc,MAAgB;GAC9B,WAAW,+DACT,MAAgB,IACZ,kDACA;aAGL,EAAE,0CAA0C,EAAE,aAAa,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,aAAa,CAAC;GAChG,EAXF,EAWE,CACT;EACE,CAAA;AAOR,QACE,kBAAC,GAAD;EACE,OAAO,EAAE,oCAAoC,OAAO;EACpD,aAAa,EACX,0CACA,kEACD;EACD,SAAS;EACE;YAEV,IACC,kBAAC,OAAD;GAAK,WAAU;aAAf,CACE,kBAAC,KAAD;IAAG,WAAU;cACV,EAAE,0CAA0C,2BAA2B;IACtE,CAAA,EACJ,kBAAC,KAAD;IAAG,WAAU;cAAoC,EAAM;IAAY,CAAA,CAC/D;OACJ,KAAW,CAAC,IACd,kBAAC,KAAD;GAAG,WAAU;aACV,EAAE,sCAAsC,qBAAqB;GAC5D,CAAA,GACD,IAaH,kBAAA,GAAA,EAAA,UAAA;GACE,kBAAC,GAAD;IAAqB,OAAM;IAAO,QAAQ;cACxC,kBAAC,GAAD;KAAU,MAAM;KAAS,QAAQ;MAAE,KAAK;MAAG,OAAO;MAAI,MAAM;MAAG,QAAQ;MAA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,MAAO,OAAO,EAAE,yCAAyC,cAAc,GAAG,GAAG,EAAa,EAAG,CAAC,MA+EnB,EAAQ,QAAQ;MAAM,CAAA,CACjF,EAAA,CAAA;KACN,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,MAAD;MAAI,WAAU;gBACX,EAAE,0CAA0C,qBAAqB;MAC/D,CAAA,EACL,kBAAC,MAAD;MAAI,WAAU;gBACX,EAAQ,wBAAwB,OAAO,MAAM,GAAG,EAAQ,oBAAoB;MAC1E,CAAA,CACD,EAAA,CAAA;KACN,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,MAAD;MAAI,WAAU;gBACX,EAAE,gDAAgD,qBAAqB;MACrE,CAAA,EACL,kBAAC,MAAD;MAAI,WAAU;gBACX,EAAQ,kBAAkB,OAAO,MAAM,EAAa,EAAQ,cAAc;MACxE,CAAA,CACD,EAAA,CAAA;KACH;;GAGN,KAAW,EAAQ,YAAY,QAAQ,EAAQ,UAAU,SAAS,KACjE,kBAAC,KAAD;IAAG,WAAU;cACV,EACC,6CACA,wGACA,EAAE,OAAO,EAAQ,UAAU,KAAK,KAAK,EAAE,CACxC;IACC,CAAA;GAEL,EAAA,CAAA,GArFH,kBAAC,OAAD;GAAK,WAAU;aAAf,CACE,kBAAC,KAAD;IAAG,WAAU;cACV,EAAE,0CAA0C,uBAAuB;IAClE,CAAA,EACJ,kBAAC,KAAD;IAAG,WAAU;cACV,EACC,yCACA,sGACD;IACC,CAAA,CACA;;EA6EE,CAAA"}
@@ -0,0 +1,169 @@
1
+ import { formatNumber as e } from "../../utils/helpers.js";
2
+ import { ChartCard as t } from "../../components/ChartCard.js";
3
+ import { Tooltip as n } from "../../../node_modules/recharts/es6/component/Tooltip.js";
4
+ import { ResponsiveContainer as r } from "../../../node_modules/recharts/es6/component/ResponsiveContainer.js";
5
+ import { CartesianGrid as i } from "../../../node_modules/recharts/es6/cartesian/CartesianGrid.js";
6
+ import { Line as a } from "../../../node_modules/recharts/es6/cartesian/Line.js";
7
+ import { XAxis as o } from "../../../node_modules/recharts/es6/cartesian/XAxis.js";
8
+ import { YAxis as s } from "../../../node_modules/recharts/es6/cartesian/YAxis.js";
9
+ import { LineChart as c } from "../../../node_modules/recharts/es6/chart/LineChart.js";
10
+ import { useHealthyBowlLivestockGrowth as l } from "../../hooks/useHealthyBowlLivestockGrowth.js";
11
+ import { useMemo as u, useState as d } from "react";
12
+ import { useI18n as f } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
13
+ import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
14
+ //#region src/healthybowl/pages/livestock/LivestockGrowthCard.tsx
15
+ var g = [
16
+ "DAY",
17
+ "WEEK",
18
+ "MONTH"
19
+ ], _ = ({ groupId: _ = null, className: v }) => {
20
+ let { t: y } = f(), [b, x] = d("WEEK"), { herdAverage: S, summary: C, loading: w, error: T } = l({
21
+ groupId: _,
22
+ granularity: b
23
+ }), E = u(() => [...S].sort((e, t) => e.at.localeCompare(t.at)).map((e) => ({
24
+ at: e.at,
25
+ herd: e.avgWeightKg,
26
+ animalCount: e.animalCount,
27
+ sampleSize: e.sampleSize
28
+ })), [S]), D = E.length > 0, O = /* @__PURE__ */ m("div", {
29
+ className: "flex items-center gap-1",
30
+ children: g.map((e) => /* @__PURE__ */ m("button", {
31
+ type: "button",
32
+ onClick: () => x(e),
33
+ "aria-pressed": b === e,
34
+ className: `min-h-[32px] rounded-md px-2 py-1 text-xs transition-colors ${b === e ? "bg-action-primary-bg text-action-primary-text" : "text-text-secondary hover:bg-bg-sunken/50"}`,
35
+ children: y(`healthybowl.livestock.growth.granularity.${e.toLowerCase()}`, e.charAt(0) + e.slice(1).toLowerCase())
36
+ }, e))
37
+ });
38
+ return /* @__PURE__ */ m(t, {
39
+ title: y("healthybowl.livestock.growth.title", "Growth"),
40
+ description: y("healthybowl.livestock.growth.description", "Average herd weight over time, and how fast each animal is gaining."),
41
+ actions: O,
42
+ className: v,
43
+ children: T ? /* @__PURE__ */ h("div", {
44
+ className: "py-8 text-center",
45
+ children: [/* @__PURE__ */ m("p", {
46
+ className: "text-sm text-text-primary",
47
+ children: y("healthybowl.livestock.growth.error.title", "Could not load growth data")
48
+ }), /* @__PURE__ */ m("p", {
49
+ className: "mt-1 text-xs text-text-secondary",
50
+ children: T.message
51
+ })]
52
+ }) : w && !D ? /* @__PURE__ */ m("p", {
53
+ className: "py-8 text-center text-xs text-text-secondary",
54
+ children: y("healthybowl.livestock.growth.loading", "Loading growth data…")
55
+ }) : D ? /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(r, {
56
+ width: "100%",
57
+ height: 280,
58
+ children: /* @__PURE__ */ h(c, {
59
+ data: E,
60
+ margin: {
61
+ top: 5,
62
+ right: 20,
63
+ left: 0,
64
+ bottom: 5
65
+ },
66
+ children: [
67
+ /* @__PURE__ */ m(i, {
68
+ strokeDasharray: "3 3",
69
+ stroke: "var(--color-border)"
70
+ }),
71
+ /* @__PURE__ */ m(o, {
72
+ dataKey: "at",
73
+ tick: { fontSize: 11 },
74
+ stroke: "var(--color-muted-foreground)"
75
+ }),
76
+ /* @__PURE__ */ m(s, {
77
+ tick: { fontSize: 11 },
78
+ stroke: "var(--color-muted-foreground)",
79
+ label: {
80
+ value: "kg",
81
+ angle: -90,
82
+ position: "insideLeft",
83
+ fontSize: 11
84
+ }
85
+ }),
86
+ /* @__PURE__ */ m(n, {
87
+ contentStyle: {
88
+ backgroundColor: "var(--color-card)",
89
+ border: "1px solid var(--color-border)",
90
+ borderRadius: 8,
91
+ fontSize: 12
92
+ },
93
+ labelStyle: { color: "var(--color-foreground)" },
94
+ formatter: (t, n, r) => {
95
+ let i = typeof t == "number" ? e(t) : t;
96
+ if (n !== "herd") return [`${i} kg`, n];
97
+ let a = r?.payload?.animalCount, o = r?.payload?.sampleSize;
98
+ return [`${i} kg`, y("healthybowl.livestock.growth.tooltip.herd", "Herd average ({{count}} animals, {{samples}} readings)", {
99
+ count: String(a ?? "—"),
100
+ samples: String(o ?? "—")
101
+ })];
102
+ }
103
+ }),
104
+ /* @__PURE__ */ m(a, {
105
+ type: "monotone",
106
+ dataKey: "herd",
107
+ name: "herd",
108
+ stroke: "var(--color-success)",
109
+ strokeWidth: 2.5,
110
+ dot: { r: 2 },
111
+ connectNulls: !0
112
+ })
113
+ ]
114
+ })
115
+ }), C && /* @__PURE__ */ h("dl", {
116
+ className: "mt-3 grid grid-cols-2 gap-3 border-t border-border-subtle pt-3 sm:grid-cols-4",
117
+ children: [
118
+ /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("dt", {
119
+ className: "text-xs text-text-secondary",
120
+ children: y("healthybowl.livestock.growth.summary.medianAdg", "Median gain")
121
+ }), /* @__PURE__ */ m("dd", {
122
+ className: "text-sm font-medium text-text-primary",
123
+ children: C.medianAdgKgPerDay === null ? "—" : `${C.medianAdgKgPerDay} kg/day`
124
+ })] }),
125
+ /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("dt", {
126
+ className: "text-xs text-text-secondary",
127
+ children: y("healthybowl.livestock.growth.summary.fastest", "Fastest")
128
+ }), /* @__PURE__ */ m("dd", {
129
+ className: "text-sm font-medium text-text-primary",
130
+ children: C.fastestGrowing ? `${C.fastestGrowing.name} · ${C.fastestGrowing.adgKgPerDay} kg/day` : "—"
131
+ })] }),
132
+ /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("dt", {
133
+ className: "text-xs text-text-secondary",
134
+ children: y("healthybowl.livestock.growth.summary.slowest", "Slowest")
135
+ }), /* @__PURE__ */ m("dd", {
136
+ className: "text-sm font-medium text-text-primary",
137
+ children: C.slowestGrowing ? `${C.slowestGrowing.name} · ${C.slowestGrowing.adgKgPerDay} kg/day` : "—"
138
+ })] }),
139
+ /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("dt", {
140
+ className: "text-xs text-text-secondary",
141
+ children: y("healthybowl.livestock.growth.summary.unweighed", "Not weighed")
142
+ }), /* @__PURE__ */ h("dd", {
143
+ className: "text-sm font-medium text-text-primary",
144
+ children: [C.animalsWithoutWeights, /* @__PURE__ */ h("span", {
145
+ className: "text-xs text-text-secondary",
146
+ children: [
147
+ " ",
148
+ "/ ",
149
+ C.animalsWithWeights + C.animalsWithoutWeights
150
+ ]
151
+ })]
152
+ })] })
153
+ ]
154
+ })] }) : /* @__PURE__ */ h("div", {
155
+ className: "py-8 text-center",
156
+ children: [/* @__PURE__ */ m("p", {
157
+ className: "text-sm text-text-primary",
158
+ children: y("healthybowl.livestock.growth.empty.title", "No weights recorded yet")
159
+ }), /* @__PURE__ */ m("p", {
160
+ className: "mt-1 text-xs text-text-secondary",
161
+ children: y("healthybowl.livestock.growth.empty.hint", "Record a weight against an animal — two measurements are enough to show a growth rate.")
162
+ })]
163
+ })
164
+ });
165
+ };
166
+ //#endregion
167
+ export { _ as LivestockGrowthCard };
168
+
169
+ //# sourceMappingURL=LivestockGrowthCard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LivestockGrowthCard.js","names":[],"sources":["../../../../src/healthybowl/pages/livestock/LivestockGrowthCard.tsx"],"sourcesContent":["/**\n * Livestock growth chart (BOFF-5971).\n *\n * Plots the herd-average weight line from `healthyBowlLivestockGrowth`, with the ADG leaders and\n * the coverage gap beside it.\n *\n * Deliberate choices:\n * - Only the herd-average line is plotted. Per-animal curves were tried and pulled: herd points\n * are keyed by BUCKET START (Monday, for WEEK) while a weight is keyed by its measurement date,\n * so the two only align at DAY granularity — everywhere else the curves land on separate rows.\n * Bucketing the animal points here would duplicate the Monday-start rule that deliberately\n * lives in exactly one place (`livestock-depth/growth.ts`). The overlay returns when the chart\n * moves to a numeric time axis, or when the API carries a bucket key per point.\n * - `animalCount` / `sampleSize` ride in the tooltip. The backend averages each animal to itself\n * before averaging the herd, so a bucket built from one animal is honest but thin — the user\n * should be able to see that rather than read it as a solid trend.\n * - A query error is surfaced as an error, never as the empty state: \"no weights recorded\" is a\n * statement about the farm, and it must not be shown when the truth is \"we could not load\".\n */\n\nimport { useMemo, useState, type FC } from 'react';\nimport { CartesianGrid, Line, LineChart, ResponsiveContainer, Tooltip, XAxis, YAxis } from 'recharts';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { ChartCard } from '../../components/ChartCard';\nimport { formatNumber } from '../../utils/helpers';\nimport { useHealthyBowlLivestockGrowth, type GrowthGranularity } from '../../hooks/useHealthyBowlLivestockGrowth';\n\nconst GRANULARITIES: GrowthGranularity[] = ['DAY', 'WEEK', 'MONTH'];\n\ninterface LivestockGrowthCardProps {\n groupId?: string | null;\n className?: string;\n}\n\nexport const LivestockGrowthCard: FC<LivestockGrowthCardProps> = ({ groupId = null, className }) => {\n const { t } = useI18n();\n const [granularity, setGranularity] = useState<GrowthGranularity>('WEEK');\n const { herdAverage, summary, loading, error } = useHealthyBowlLivestockGrowth({ groupId, granularity });\n\n const chartData = useMemo(\n () =>\n [...herdAverage]\n .sort((a, b) => a.at.localeCompare(b.at))\n .map((p) => ({\n at: p.at,\n herd: p.avgWeightKg,\n animalCount: p.animalCount,\n sampleSize: p.sampleSize,\n })),\n [herdAverage]\n );\n\n const hasData = chartData.length > 0;\n\n const granularityToggle = (\n <div className=\"flex items-center gap-1\">\n {GRANULARITIES.map((g) => (\n <button\n key={g}\n type=\"button\"\n onClick={() => setGranularity(g)}\n aria-pressed={granularity === g}\n className={`min-h-[32px] rounded-md px-2 py-1 text-xs transition-colors ${\n granularity === g\n ? 'bg-action-primary-bg text-action-primary-text'\n : 'text-text-secondary hover:bg-bg-sunken/50'\n }`}\n >\n {t(`healthybowl.livestock.growth.granularity.${g.toLowerCase()}`, g.charAt(0) + g.slice(1).toLowerCase())}\n </button>\n ))}\n </div>\n );\n\n return (\n <ChartCard\n title={t('healthybowl.livestock.growth.title', 'Growth')}\n description={t(\n 'healthybowl.livestock.growth.description',\n 'Average herd weight over time, and how fast each animal is gaining.'\n )}\n actions={granularityToggle}\n className={className}\n >\n {error ? (\n <div className=\"py-8 text-center\">\n <p className=\"text-sm text-text-primary\">\n {t('healthybowl.livestock.growth.error.title', 'Could not load growth data')}\n </p>\n <p className=\"mt-1 text-xs text-text-secondary\">{error.message}</p>\n </div>\n ) : loading && !hasData ? (\n <p className=\"py-8 text-center text-xs text-text-secondary\">\n {t('healthybowl.livestock.growth.loading', 'Loading growth data…')}\n </p>\n ) : !hasData ? (\n <div className=\"py-8 text-center\">\n <p className=\"text-sm text-text-primary\">\n {t('healthybowl.livestock.growth.empty.title', 'No weights recorded yet')}\n </p>\n <p className=\"mt-1 text-xs text-text-secondary\">\n {t(\n 'healthybowl.livestock.growth.empty.hint',\n 'Record a weight against an animal — two measurements are enough to show a growth rate.'\n )}\n </p>\n </div>\n ) : (\n <>\n <ResponsiveContainer width=\"100%\" height={280}>\n <LineChart data={chartData} margin={{ top: 5, right: 20, left: 0, bottom: 5 }}>\n <CartesianGrid strokeDasharray=\"3 3\" stroke=\"var(--color-border)\" />\n <XAxis dataKey=\"at\" tick={{ fontSize: 11 }} stroke=\"var(--color-muted-foreground)\" />\n <YAxis\n tick={{ fontSize: 11 }}\n stroke=\"var(--color-muted-foreground)\"\n label={{ value: 'kg', angle: -90, position: 'insideLeft', fontSize: 11 }}\n />\n <Tooltip\n contentStyle={{\n backgroundColor: 'var(--color-card)',\n border: '1px solid var(--color-border)',\n borderRadius: 8,\n fontSize: 12,\n }}\n labelStyle={{ color: 'var(--color-foreground)' }}\n formatter={(value: number | string, name: string, item: { payload?: Record<string, unknown> }) => {\n const kg = typeof value === 'number' ? formatNumber(value) : value;\n if (name !== 'herd') return [`${kg} kg`, name];\n const count = item?.payload?.['animalCount'];\n const samples = item?.payload?.['sampleSize'];\n return [\n `${kg} kg`,\n t(\n 'healthybowl.livestock.growth.tooltip.herd',\n 'Herd average ({{count}} animals, {{samples}} readings)',\n {\n count: String(count ?? '—'),\n samples: String(samples ?? '—'),\n }\n ),\n ];\n }}\n />\n <Line\n type=\"monotone\"\n dataKey=\"herd\"\n name=\"herd\"\n stroke=\"var(--color-success)\"\n strokeWidth={2.5}\n dot={{ r: 2 }}\n connectNulls\n />\n </LineChart>\n </ResponsiveContainer>\n\n {summary && (\n <dl className=\"mt-3 grid grid-cols-2 gap-3 border-t border-border-subtle pt-3 sm:grid-cols-4\">\n <div>\n <dt className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.growth.summary.medianAdg', 'Median gain')}\n </dt>\n <dd className=\"text-sm font-medium text-text-primary\">\n {summary.medianAdgKgPerDay === null ? '—' : `${summary.medianAdgKgPerDay} kg/day`}\n </dd>\n </div>\n <div>\n <dt className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.growth.summary.fastest', 'Fastest')}\n </dt>\n <dd className=\"text-sm font-medium text-text-primary\">\n {summary.fastestGrowing\n ? `${summary.fastestGrowing.name} · ${summary.fastestGrowing.adgKgPerDay} kg/day`\n : '—'}\n </dd>\n </div>\n <div>\n <dt className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.growth.summary.slowest', 'Slowest')}\n </dt>\n <dd className=\"text-sm font-medium text-text-primary\">\n {summary.slowestGrowing\n ? `${summary.slowestGrowing.name} · ${summary.slowestGrowing.adgKgPerDay} kg/day`\n : '—'}\n </dd>\n </div>\n <div>\n <dt className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.growth.summary.unweighed', 'Not weighed')}\n </dt>\n <dd className=\"text-sm font-medium text-text-primary\">\n {summary.animalsWithoutWeights}\n <span className=\"text-xs text-text-secondary\">\n {' '}\n / {summary.animalsWithWeights + summary.animalsWithoutWeights}\n </span>\n </dd>\n </div>\n </dl>\n )}\n </>\n )}\n </ChartCard>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;AA2BA,IAAM,IAAqC;CAAC;CAAO;CAAQ;CAAQ,EAOtD,KAAqD,EAAE,aAAU,MAAM,mBAAgB;CAClG,IAAM,EAAE,SAAM,GAAS,EACjB,CAAC,GAAa,KAAkB,EAA4B,OAAO,EACnE,EAAE,gBAAa,YAAS,YAAS,aAAU,EAA8B;EAAE;EAAS;EAAa,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A;IACN,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,MAAD;KAAI,WAAU;eACX,EAAE,gDAAgD,UAAU;KAC1D,CAAA,EACL,kBAAC,MAAD;KAAI,WAAU;eACX,EAAQ,iBACL,GAAG,EAAQ,eAAe,KAAK,KAAK,EAAQ,eAAe,YAAY,WACvE;KACD,CAAA,CACD,EAAA,CAAA;IACN,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,MAAD;KAAI,WAAU;eACX,EAAE,kDAAkD,cAAc;KAChE,CAAA,EACL,kBAAC,MAAD;KAAI,WAAU;eAAd,CACG,EAAQ,uBACT,kBAAC,QAAD;MAAM,WAAU;gBAAhB;OACG;OAAI;OACF,EAAQ,qBAAqB,EAAQ;OACnC;QACJ;OACD,EAAA,CAAA;IACH;KAEN,EAAA,CAAA,GAxGH,kBAAC,OAAD;GAAK,WAAU;aAAf,CACE,kBAAC,KAAD;IAAG,WAAU;cACV,EAAE,4CAA4C,0BAA0B;IACvE,CAAA,EACJ,kBAAC,KAAD;IAAG,WAAU;cACV,EACC,2CACA,yFACD;IACC,CAAA,CACA;;EAgGE,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-healthybowl",
3
- "version": "2026.804.1",
3
+ "version": "2026.805.1",
4
4
  "description": "Burdenoff HealthyBowl Microfrontend - Comprehensive organic farming and agro-foods management platform",
5
5
  "type": "module",
6
6
  "files": [
@@ -110,7 +110,7 @@
110
110
  "zustand": "^5.0.0"
111
111
  },
112
112
  "publishConfig": {
113
- "access": "restricted"
113
+ "access": "public"
114
114
  },
115
115
  "overrides": {
116
116
  "lodash": ">=4.17.21",