@burdenoff/microfe-healthybowl 2026.1115.1 → 2026.1115.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,28 +11,28 @@ import { formatCurrency as c } from "../../utils/helpers.js";
11
11
  import { CHART_PERIODS as l, sliceTrailingMonths as u } from "./chartPeriod.js";
12
12
  import { useMemo as d, useState as f } from "react";
13
13
  import { useI18n as p } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
14
- import { ArrowRight as m, DollarSign as h, FileText as g, ShieldCheck as _, ShoppingCart as v, TrendingDown as y, TrendingUp as b, Wheat as x } from "lucide-react";
15
- import { useNavigate as S } from "react-router";
16
- import { jsx as C, jsxs as w } from "react/jsx-runtime";
14
+ import { ArrowRight as m, DollarSign as h, Download as g, FileText as _, ShieldCheck as v, ShoppingCart as y, TrendingDown as b, TrendingUp as x, Wheat as S } from "lucide-react";
15
+ import { useNavigate as C } from "react-router";
16
+ import { jsx as w, jsxs as T } from "react/jsx-runtime";
17
17
  // src/healthybowl/pages/analytics/AnalyticsOverviewPage.tsx
18
- var T = [
19
- /* @__PURE__ */ C(h, { className: "h-4 w-4" }),
20
- /* @__PURE__ */ C(y, { className: "h-4 w-4" }),
21
- /* @__PURE__ */ C(b, { className: "h-4 w-4" }),
22
- /* @__PURE__ */ C(x, { className: "h-4 w-4" }),
23
- /* @__PURE__ */ C(_, { className: "h-4 w-4" }),
24
- /* @__PURE__ */ C(v, { className: "h-4 w-4" })
18
+ var E = [
19
+ /* @__PURE__ */ w(h, { className: "h-4 w-4" }),
20
+ /* @__PURE__ */ w(b, { className: "h-4 w-4" }),
21
+ /* @__PURE__ */ w(x, { className: "h-4 w-4" }),
22
+ /* @__PURE__ */ w(S, { className: "h-4 w-4" }),
23
+ /* @__PURE__ */ w(v, { className: "h-4 w-4" }),
24
+ /* @__PURE__ */ w(y, { className: "h-4 w-4" })
25
25
  ];
26
- function E() {
27
- let { t: h } = p(), { analyticsKPIs: _, revenueChartData: v, cropDistributionData: y, loading: b, errors: x } = s(), E = S(), { buildPath: D } = e(), [O, k] = f("6m"), A = d(() => u(v, O), [v, O]), j = A.length ? Math.max(...A.flatMap((e) => [e.revenue, e.expenses])) : 0;
28
- return b && _.length === 0 && v.length === 0 && y.length === 0 ? /* @__PURE__ */ C(t, {
26
+ function D() {
27
+ let { t: h } = p(), { analyticsKPIs: v, revenueChartData: y, cropDistributionData: b, loading: x, errors: S } = s(), D = C(), { buildPath: O } = e(), [k, A] = f("6m"), j = d(() => u(y, k), [y, k]), M = j.length ? Math.max(...j.flatMap((e) => [e.revenue, e.expenses])) : 0;
28
+ return x && v.length === 0 && y.length === 0 && b.length === 0 ? /* @__PURE__ */ w(t, {
29
29
  title: h("healthybowl.analytics.overview.title", "Analytics Overview"),
30
30
  description: h("healthybowl.analytics.overview.description", "Key performance metrics for your farm"),
31
- children: /* @__PURE__ */ C(o, {
31
+ children: /* @__PURE__ */ w(o, {
32
32
  variant: "card",
33
33
  count: 4
34
34
  })
35
- }) : /* @__PURE__ */ w(t, {
35
+ }) : /* @__PURE__ */ T(t, {
36
36
  title: h("healthybowl.analytics.overview.title", "Analytics Overview"),
37
37
  description: h("healthybowl.analytics.overview.description", "Key performance metrics for your farm"),
38
38
  purpose: "Your farm's headline numbers and a jumping-off point into the detailed reports — use this to get a quick health check, then drill into dashboards, reports, or insights for the full story.",
@@ -43,54 +43,60 @@ function E() {
43
43
  id: "dashboard",
44
44
  label: "Open the analytics dashboard",
45
45
  description: "See revenue, expenses and yields trended over time.",
46
- onClick: () => E(D("analytics/dashboard"))
46
+ onClick: () => D(O("analytics/dashboard"))
47
47
  },
48
48
  {
49
49
  id: "reports",
50
50
  label: "Generate a report",
51
51
  description: "Produce a shareable summary for an advisor or financier.",
52
- onClick: () => E(D("analytics/reports"))
52
+ onClick: () => D(O("analytics/reports"))
53
53
  },
54
54
  {
55
55
  id: "insights",
56
56
  label: "Review insights",
57
57
  description: "Act on recommendations drawn from your farm data.",
58
- onClick: () => E(D("analytics/insights"))
58
+ onClick: () => D(O("analytics/insights"))
59
59
  }
60
60
  ],
61
61
  children: [
62
- /* @__PURE__ */ C("div", {
62
+ /* @__PURE__ */ w("div", {
63
63
  className: "flex flex-wrap gap-3",
64
64
  children: [{
65
65
  id: "reports",
66
66
  label: h("healthybowl.analytics.overview.quickNav.reports.label", "Reports"),
67
- icon: g,
68
- path: D("analytics/reports"),
67
+ icon: _,
68
+ path: O("analytics/reports"),
69
69
  desc: h("healthybowl.analytics.overview.quickNav.reports.desc", "Generate and export reports")
70
- }].map((e) => /* @__PURE__ */ w("button", {
70
+ }, {
71
+ id: "export",
72
+ label: h("healthybowl.analytics.overview.quickNav.export.label", "Export data"),
73
+ icon: g,
74
+ path: O("analytics/export"),
75
+ desc: h("healthybowl.analytics.overview.quickNav.export.desc", "Download crops, livestock or transactions")
76
+ }].map((e) => /* @__PURE__ */ T("button", {
71
77
  type: "button",
72
- onClick: () => E(e.path),
78
+ onClick: () => D(e.path),
73
79
  className: "flex items-center gap-3 rounded-lg border border-border-subtle bg-bg-surface px-4 py-3 text-start shadow-sm transition-colors hover:border-primary/30 hover:bg-accent",
74
80
  children: [
75
- /* @__PURE__ */ C(e.icon, { className: "h-5 w-5 text-text-secondary" }),
76
- /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ C("p", {
81
+ /* @__PURE__ */ w(e.icon, { className: "h-5 w-5 text-text-secondary" }),
82
+ /* @__PURE__ */ T("div", { children: [/* @__PURE__ */ w("p", {
77
83
  className: "text-sm font-medium text-text-primary",
78
84
  children: e.label
79
- }), /* @__PURE__ */ C("p", {
85
+ }), /* @__PURE__ */ w("p", {
80
86
  className: "text-xs text-text-secondary",
81
87
  children: e.desc
82
88
  })] }),
83
- /* @__PURE__ */ C(m, { className: "ms-2 h-4 w-4 text-text-secondary" })
89
+ /* @__PURE__ */ w(m, { className: "ms-2 h-4 w-4 text-text-secondary" })
84
90
  ]
85
91
  }, e.id))
86
92
  }),
87
- _.length === 0 ? x.analytics ? /* @__PURE__ */ C(i, {}) : /* @__PURE__ */ C(r, {
93
+ v.length === 0 ? S.analytics ? /* @__PURE__ */ w(i, {}) : /* @__PURE__ */ w(r, {
88
94
  illustration: "empty-data",
89
95
  title: h("healthybowl.analytics.overview.kpis.empty.title", "No metrics yet"),
90
96
  description: h("healthybowl.analytics.overview.kpis.empty.description", "Key performance metrics will appear here once your farm has activity to report.")
91
- }) : /* @__PURE__ */ C("div", {
97
+ }) : /* @__PURE__ */ w("div", {
92
98
  className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",
93
- children: _.map((e, t) => /* @__PURE__ */ C(n, {
99
+ children: v.map((e, t) => /* @__PURE__ */ w(n, {
94
100
  hero: t === 0,
95
101
  label: e.label,
96
102
  value: e.value,
@@ -99,88 +105,88 @@ function E() {
99
105
  unit: e.unit === "$" ? void 0 : e.unit,
100
106
  trend: e.trend,
101
107
  change: e.change,
102
- icon: T[t]
108
+ icon: E[t]
103
109
  }, e.id))
104
110
  }),
105
- /* @__PURE__ */ C("div", {
111
+ /* @__PURE__ */ w("div", {
106
112
  className: "flex gap-2",
107
- children: l.map((e) => /* @__PURE__ */ C("button", {
113
+ children: l.map((e) => /* @__PURE__ */ w("button", {
108
114
  type: "button",
109
- onClick: () => k(e),
110
- className: `rounded-md px-3 py-1.5 text-sm font-medium ${O === e ? "bg-action-primary-bg text-action-primary-text" : "border border-border-subtle text-text-primary hover:bg-bg-sunken/50"}`,
115
+ onClick: () => A(e),
116
+ className: `rounded-md px-3 py-1.5 text-sm font-medium ${k === e ? "bg-action-primary-bg text-action-primary-text" : "border border-border-subtle text-text-primary hover:bg-bg-sunken/50"}`,
111
117
  children: e === "3m" ? h("healthybowl.analytics.overview.period.3m", "3 Months") : h("healthybowl.analytics.overview.period.6m", "6 Months")
112
118
  }, e))
113
119
  }),
114
- /* @__PURE__ */ w("div", {
120
+ /* @__PURE__ */ T("div", {
115
121
  className: "grid grid-cols-1 gap-4 lg:grid-cols-2",
116
- children: [/* @__PURE__ */ w(a, {
122
+ children: [/* @__PURE__ */ T(a, {
117
123
  title: h("healthybowl.analytics.overview.revenueChart.title", "Revenue Trend"),
118
- description: O === "3m" ? h("healthybowl.analytics.overview.revenueChart.description.3m", "Last 3 months") : h("healthybowl.analytics.overview.revenueChart.description.6m", "Last 6 months"),
119
- children: [A.length === 0 ? /* @__PURE__ */ C("div", {
124
+ description: k === "3m" ? h("healthybowl.analytics.overview.revenueChart.description.3m", "Last 3 months") : h("healthybowl.analytics.overview.revenueChart.description.6m", "Last 6 months"),
125
+ children: [j.length === 0 ? /* @__PURE__ */ w("div", {
120
126
  className: "flex h-48 items-center justify-center text-sm text-text-secondary",
121
127
  children: h("healthybowl.analytics.overview.revenueChart.empty", "No revenue data yet.")
122
- }) : /* @__PURE__ */ C("div", {
128
+ }) : /* @__PURE__ */ w("div", {
123
129
  className: "flex items-end gap-2 h-48",
124
- children: A.map((e) => /* @__PURE__ */ w("div", {
130
+ children: j.map((e) => /* @__PURE__ */ T("div", {
125
131
  className: "flex flex-1 flex-col items-center gap-1",
126
- children: [/* @__PURE__ */ w("div", {
132
+ children: [/* @__PURE__ */ T("div", {
127
133
  className: "flex w-full gap-0.5 items-end",
128
134
  style: { height: "160px" },
129
- children: [/* @__PURE__ */ C("div", {
135
+ children: [/* @__PURE__ */ w("div", {
130
136
  className: "flex-1 rounded-t bg-success/80",
131
- style: { height: `${j > 0 ? e.revenue / j * 100 : 0}%` },
137
+ style: { height: `${M > 0 ? e.revenue / M * 100 : 0}%` },
132
138
  title: h("healthybowl.analytics.overview.revenueChart.tooltip.revenue", "Revenue: {{amount}}", { amount: c(e.revenue, "INR") })
133
- }), /* @__PURE__ */ C("div", {
139
+ }), /* @__PURE__ */ w("div", {
134
140
  className: "flex-1 rounded-t bg-status-error-bg/60",
135
- style: { height: `${j > 0 ? e.expenses / j * 100 : 0}%` },
141
+ style: { height: `${M > 0 ? e.expenses / M * 100 : 0}%` },
136
142
  title: h("healthybowl.analytics.overview.revenueChart.tooltip.expenses", "Expenses: {{amount}}", { amount: c(e.expenses, "INR") })
137
143
  })]
138
- }), /* @__PURE__ */ C("span", {
144
+ }), /* @__PURE__ */ w("span", {
139
145
  className: "text-xs text-text-secondary",
140
146
  children: e.month
141
147
  })]
142
148
  }, e.month))
143
- }), /* @__PURE__ */ w("div", {
149
+ }), /* @__PURE__ */ T("div", {
144
150
  className: "mt-3 flex items-center gap-4 text-xs text-text-secondary",
145
- children: [/* @__PURE__ */ w("span", {
151
+ children: [/* @__PURE__ */ T("span", {
146
152
  className: "flex items-center gap-1.5",
147
153
  children: [
148
- /* @__PURE__ */ C("span", { className: "h-2.5 w-2.5 rounded-sm bg-success/80" }),
154
+ /* @__PURE__ */ w("span", { className: "h-2.5 w-2.5 rounded-sm bg-success/80" }),
149
155
  " ",
150
156
  h("healthybowl.analytics.overview.revenueChart.legend.revenue", "Revenue")
151
157
  ]
152
- }), /* @__PURE__ */ w("span", {
158
+ }), /* @__PURE__ */ T("span", {
153
159
  className: "flex items-center gap-1.5",
154
160
  children: [
155
- /* @__PURE__ */ C("span", { className: "h-2.5 w-2.5 rounded-sm bg-status-error-bg/60" }),
161
+ /* @__PURE__ */ w("span", { className: "h-2.5 w-2.5 rounded-sm bg-status-error-bg/60" }),
156
162
  " ",
157
163
  h("healthybowl.analytics.overview.revenueChart.legend.expenses", "Expenses")
158
164
  ]
159
165
  })]
160
166
  })]
161
- }), /* @__PURE__ */ C(a, {
167
+ }), /* @__PURE__ */ w(a, {
162
168
  title: h("healthybowl.analytics.overview.cropChart.title", "Crop Distribution"),
163
169
  description: h("healthybowl.analytics.overview.cropChart.description", "By category"),
164
- children: y.length === 0 ? /* @__PURE__ */ C(r, {
170
+ children: b.length === 0 ? /* @__PURE__ */ w(r, {
165
171
  illustration: "empty-data",
166
172
  title: h("healthybowl.analytics.overview.cropChart.empty.title", "No crop data yet"),
167
173
  description: h("healthybowl.analytics.overview.cropChart.empty.description", "Crop distribution will appear here once crops are added.")
168
- }) : /* @__PURE__ */ C("div", {
174
+ }) : /* @__PURE__ */ w("div", {
169
175
  className: "space-y-3 py-2",
170
- children: y.map((e) => /* @__PURE__ */ w("div", {
176
+ children: b.map((e) => /* @__PURE__ */ T("div", {
171
177
  className: "space-y-1",
172
- children: [/* @__PURE__ */ w("div", {
178
+ children: [/* @__PURE__ */ T("div", {
173
179
  className: "flex items-center justify-between text-sm",
174
- children: [/* @__PURE__ */ C("span", {
180
+ children: [/* @__PURE__ */ w("span", {
175
181
  className: "text-text-primary",
176
182
  children: e.name
177
- }), /* @__PURE__ */ w("span", {
183
+ }), /* @__PURE__ */ T("span", {
178
184
  className: "text-text-secondary",
179
185
  children: [e.value, "%"]
180
186
  })]
181
- }), /* @__PURE__ */ C("div", {
187
+ }), /* @__PURE__ */ w("div", {
182
188
  className: "h-2 w-full rounded-full bg-bg-sunken",
183
- children: /* @__PURE__ */ C("div", {
189
+ children: /* @__PURE__ */ w("div", {
184
190
  className: "h-2 rounded-full",
185
191
  style: {
186
192
  width: `${e.value}%`,
@@ -195,4 +201,4 @@ function E() {
195
201
  ]
196
202
  });
197
203
  }
198
- export { E as AnalyticsOverviewPage };
204
+ export { D as AnalyticsOverviewPage };