@burdenoff/microfe-healthybowl 2026.605.9 → 2026.606.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.
- package/dist/healthybowl/components/ErrorBoundary.js +2 -2
- package/dist/healthybowl/components/ErrorBoundary.js.map +1 -1
- package/dist/healthybowl/components/StatCard.js +3 -3
- package/dist/healthybowl/components/StatCard.js.map +1 -1
- package/dist/healthybowl/components/StatusBadge.js +8 -8
- package/dist/healthybowl/components/StatusBadge.js.map +1 -1
- package/dist/healthybowl/components/Toast.js +4 -4
- package/dist/healthybowl/components/Toast.js.map +1 -1
- package/dist/healthybowl/pages/HomePage.js +2 -2
- package/dist/healthybowl/pages/HomePage.js.map +1 -1
- package/dist/healthybowl/pages/analytics/AnalyticsDashboardPage.js +6 -6
- package/dist/healthybowl/pages/analytics/AnalyticsDashboardPage.js.map +1 -1
- package/dist/healthybowl/pages/analytics/AnalyticsOverviewPage.js +4 -4
- package/dist/healthybowl/pages/analytics/AnalyticsOverviewPage.js.map +1 -1
- package/dist/healthybowl/pages/compliance/ComplianceAuditsPage.js +3 -3
- package/dist/healthybowl/pages/compliance/ComplianceAuditsPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/CropDetailsPage.js +13 -13
- package/dist/healthybowl/pages/crops/CropDetailsPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/CropFieldsPage.js +1 -1
- package/dist/healthybowl/pages/crops/CropFieldsPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/CropHarvestPage.js +2 -2
- package/dist/healthybowl/pages/crops/CropHarvestPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/CropsPage.js +2 -2
- package/dist/healthybowl/pages/crops/CropsPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/FieldDetailsPage.js +6 -6
- package/dist/healthybowl/pages/crops/FieldDetailsPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/HarvestDetailsPage.js +26 -26
- package/dist/healthybowl/pages/crops/HarvestDetailsPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/PlanningDetailsPage.js +24 -24
- package/dist/healthybowl/pages/crops/PlanningDetailsPage.js.map +1 -1
- package/dist/healthybowl/pages/financial/BudgetManagementPage.js +3 -3
- package/dist/healthybowl/pages/financial/BudgetManagementPage.js.map +1 -1
- package/dist/healthybowl/pages/financial/FinancialDashboardPage.js +21 -21
- package/dist/healthybowl/pages/financial/FinancialDashboardPage.js.map +1 -1
- package/dist/healthybowl/pages/financial/FinancialReportsPage.js +5 -5
- package/dist/healthybowl/pages/financial/FinancialReportsPage.js.map +1 -1
- package/dist/healthybowl/pages/financial/InvoiceManagementPage.js +3 -3
- package/dist/healthybowl/pages/financial/InvoiceManagementPage.js.map +1 -1
- package/dist/healthybowl/pages/financial/TransactionsPage.js +2 -2
- package/dist/healthybowl/pages/financial/TransactionsPage.js.map +1 -1
- package/dist/healthybowl/pages/livestock/AnimalDetailsPage.js +2 -2
- package/dist/healthybowl/pages/livestock/AnimalDetailsPage.js.map +1 -1
- package/dist/healthybowl/pages/livestock/BreedingManagementPage.js +1 -1
- package/dist/healthybowl/pages/livestock/BreedingManagementPage.js.map +1 -1
- package/dist/healthybowl/pages/marketplace/CartPage.js +8 -8
- package/dist/healthybowl/pages/marketplace/CartPage.js.map +1 -1
- package/dist/healthybowl/pages/marketplace/MarketplacePage.js +8 -8
- package/dist/healthybowl/pages/marketplace/MarketplacePage.js.map +1 -1
- package/dist/healthybowl/pages/marketplace/OrdersPage.js +1 -1
- package/dist/healthybowl/pages/marketplace/OrdersPage.js.map +1 -1
- package/dist/healthybowl/pages/marketplace/ProductDetailPage.js +5 -5
- package/dist/healthybowl/pages/marketplace/ProductDetailPage.js.map +1 -1
- package/dist/healthybowl/pages/marketplace/WishlistPage.js +5 -5
- package/dist/healthybowl/pages/marketplace/WishlistPage.js.map +1 -1
- package/dist/healthybowl/pages/network/EventsPage.js +2 -2
- package/dist/healthybowl/pages/network/EventsPage.js.map +1 -1
- package/dist/healthybowl/pages/network/ExpertsPage.js +1 -1
- package/dist/healthybowl/pages/network/ExpertsPage.js.map +1 -1
- package/dist/healthybowl/pages/network/MentorsPage.js +4 -4
- package/dist/healthybowl/pages/network/MentorsPage.js.map +1 -1
- package/dist/healthybowl/pages/network/NetworkOverviewPage.js +1 -1
- package/dist/healthybowl/pages/network/NetworkOverviewPage.js.map +1 -1
- package/dist/healthybowl/pages/pest-management/PestOverviewPage.js +1 -1
- package/dist/healthybowl/pages/pest-management/PestOverviewPage.js.map +1 -1
- package/dist/healthybowl/pages/pest-management/TreatmentLibraryPage.js +1 -1
- package/dist/healthybowl/pages/pest-management/TreatmentLibraryPage.js.map +1 -1
- package/dist/healthybowl/pages/production/ProductionPlanningPage.js +1 -1
- package/dist/healthybowl/pages/production/ProductionPlanningPage.js.map +1 -1
- package/dist/healthybowl/pages/production/ProductionSchedulePage.js +4 -4
- package/dist/healthybowl/pages/production/ProductionSchedulePage.js.map +1 -1
- package/dist/healthybowl/pages/production/RecipeManagementPage.js +1 -1
- package/dist/healthybowl/pages/production/RecipeManagementPage.js.map +1 -1
- package/dist/healthybowl/pages/products/BatchesPage.js +2 -2
- package/dist/healthybowl/pages/products/BatchesPage.js.map +1 -1
- package/dist/healthybowl/pages/products/InventoryPage.js +6 -6
- package/dist/healthybowl/pages/products/InventoryPage.js.map +1 -1
- package/dist/healthybowl/pages/products/ProductsOverviewPage.js +6 -6
- package/dist/healthybowl/pages/products/ProductsOverviewPage.js.map +1 -1
- package/dist/healthybowl/pages/products/QualityPage.js +6 -6
- package/dist/healthybowl/pages/products/QualityPage.js.map +1 -1
- package/dist/healthybowl/pages/soil/SoilDashboardPage.js +1 -1
- package/dist/healthybowl/pages/soil/SoilDashboardPage.js.map +1 -1
- package/dist/healthybowl/pages/soil/SoilMonitoringPage.js +3 -3
- package/dist/healthybowl/pages/soil/SoilMonitoringPage.js.map +1 -1
- package/dist/healthybowl/pages/soil/SoilRecommendationsPage.js +1 -1
- package/dist/healthybowl/pages/soil/SoilRecommendationsPage.js.map +1 -1
- package/dist/healthybowl/pages/traceability/SupplyChainPage.js +1 -1
- package/dist/healthybowl/pages/traceability/SupplyChainPage.js.map +1 -1
- package/dist/healthybowl/pages/weather/WeatherAlertsPage.js +1 -1
- package/dist/healthybowl/pages/weather/WeatherAlertsPage.js.map +1 -1
- package/dist/healthybowl/pages/weather/WeatherForecastPage.js +7 -7
- package/dist/healthybowl/pages/weather/WeatherForecastPage.js.map +1 -1
- package/dist/healthybowl/pages/weather/WeatherHistoryPage.js +8 -8
- package/dist/healthybowl/pages/weather/WeatherHistoryPage.js.map +1 -1
- package/dist/healthybowl/pages/weather/WeatherOverviewPage.js +16 -16
- package/dist/healthybowl/pages/weather/WeatherOverviewPage.js.map +1 -1
- package/package.json +1 -1
|
@@ -26,9 +26,9 @@ var a = class extends e {
|
|
|
26
26
|
};
|
|
27
27
|
render() {
|
|
28
28
|
return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */ i("div", {
|
|
29
|
-
className: "flex flex-col items-center justify-center rounded-lg border border-dashed border-
|
|
29
|
+
className: "flex flex-col items-center justify-center rounded-lg border border-dashed border-destructive bg-destructive/10 p-12 text-center",
|
|
30
30
|
children: [
|
|
31
|
-
/* @__PURE__ */ r(t, { className: "mb-4 h-12 w-12 text-
|
|
31
|
+
/* @__PURE__ */ r(t, { className: "mb-4 h-12 w-12 text-destructive" }),
|
|
32
32
|
/* @__PURE__ */ r("h3", {
|
|
33
33
|
className: "text-lg font-medium text-foreground",
|
|
34
34
|
children: "Something went wrong"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorBoundary.js","names":[],"sources":["../../../src/healthybowl/components/ErrorBoundary.tsx"],"sourcesContent":["import { Component, type ReactNode, type ErrorInfo } from 'react';\nimport { AlertTriangle, RefreshCw } from 'lucide-react';\n\ninterface ErrorBoundaryProps {\n children: ReactNode;\n fallback?: ReactNode;\n}\n\ninterface ErrorBoundaryState {\n hasError: boolean;\n error: Error | null;\n}\n\nexport class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {\n constructor(props: ErrorBoundaryProps) {\n super(props);\n this.state = { hasError: false, error: null };\n }\n\n static getDerivedStateFromError(error: Error): ErrorBoundaryState {\n return { hasError: true, error };\n }\n\n componentDidCatch(error: Error, errorInfo: ErrorInfo) {\n console.error('[HealthyBowl ErrorBoundary]', error, errorInfo);\n }\n\n handleReset = () => {\n this.setState({ hasError: false, error: null });\n };\n\n render() {\n if (this.state.hasError) {\n if (this.props.fallback) return this.props.fallback;\n\n return (\n <div className=\"flex flex-col items-center justify-center rounded-lg border border-dashed border-
|
|
1
|
+
{"version":3,"file":"ErrorBoundary.js","names":[],"sources":["../../../src/healthybowl/components/ErrorBoundary.tsx"],"sourcesContent":["import { Component, type ReactNode, type ErrorInfo } from 'react';\nimport { AlertTriangle, RefreshCw } from 'lucide-react';\n\ninterface ErrorBoundaryProps {\n children: ReactNode;\n fallback?: ReactNode;\n}\n\ninterface ErrorBoundaryState {\n hasError: boolean;\n error: Error | null;\n}\n\nexport class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {\n constructor(props: ErrorBoundaryProps) {\n super(props);\n this.state = { hasError: false, error: null };\n }\n\n static getDerivedStateFromError(error: Error): ErrorBoundaryState {\n return { hasError: true, error };\n }\n\n componentDidCatch(error: Error, errorInfo: ErrorInfo) {\n console.error('[HealthyBowl ErrorBoundary]', error, errorInfo);\n }\n\n handleReset = () => {\n this.setState({ hasError: false, error: null });\n };\n\n render() {\n if (this.state.hasError) {\n if (this.props.fallback) return this.props.fallback;\n\n return (\n <div className=\"flex flex-col items-center justify-center rounded-lg border border-dashed border-destructive bg-destructive/10 p-12 text-center\">\n <AlertTriangle className=\"mb-4 h-12 w-12 text-destructive\" />\n <h3 className=\"text-lg font-medium text-foreground\">Something went wrong</h3>\n <p className=\"mt-1 max-w-md text-sm text-muted-foreground\">\n {this.state.error?.message ?? 'An unexpected error occurred while rendering this section.'}\n </p>\n <button\n onClick={this.handleReset}\n className=\"mt-4 flex items-center gap-1.5 rounded-md bg-foreground px-4 py-2 text-sm font-medium text-background hover:opacity-90\"\n >\n <RefreshCw className=\"h-4 w-4\" /> Try Again\n </button>\n </div>\n );\n }\n\n return this.props.children;\n }\n}\n"],"mappings":";;;;AAaA,IAAa,IAAb,cAAmC,EAAkD;CACnF,YAAY,GAA2B;AAErC,EADA,MAAM,EAAM,EACZ,KAAK,QAAQ;GAAE,UAAU;GAAO,OAAO;GAAM;;CAG/C,OAAO,yBAAyB,GAAkC;AAChE,SAAO;GAAE,UAAU;GAAM;GAAO;;CAGlC,kBAAkB,GAAc,GAAsB;AACpD,UAAQ,MAAM,+BAA+B,GAAO,EAAU;;CAGhE,oBAAoB;AAClB,OAAK,SAAS;GAAE,UAAU;GAAO,OAAO;GAAM,CAAC;;CAGjD,SAAS;AAqBP,SApBI,KAAK,MAAM,WACT,KAAK,MAAM,WAAiB,KAAK,MAAM,WAGzC,kBAAC,OAAD;GAAK,WAAU;aAAf;IACE,kBAAC,GAAD,EAAe,WAAU,mCAAoC,CAAA;IAC7D,kBAAC,MAAD;KAAI,WAAU;eAAsC;KAAyB,CAAA;IAC7E,kBAAC,KAAD;KAAG,WAAU;eACV,KAAK,MAAM,OAAO,WAAW;KAC5B,CAAA;IACJ,kBAAC,UAAD;KACE,SAAS,KAAK;KACd,WAAU;eAFZ,CAIE,kBAAC,GAAD,EAAW,WAAU,WAAY,CAAA,EAAA,aAC1B;;IACL;OAIH,KAAK,MAAM"}
|
|
@@ -27,11 +27,11 @@ var c = ({ label: c, value: l, previousValue: u, unit: d, prefix: f, icon: p, tr
|
|
|
27
27
|
_ !== 0 && /* @__PURE__ */ s("div", {
|
|
28
28
|
className: "mt-2 flex items-center gap-1 text-xs",
|
|
29
29
|
children: [
|
|
30
|
-
v === "up" && /* @__PURE__ */ o(a, { className: "h-3 w-3 text-
|
|
31
|
-
v === "down" && /* @__PURE__ */ o(i, { className: "h-3 w-3 text-
|
|
30
|
+
v === "up" && /* @__PURE__ */ o(a, { className: "h-3 w-3 text-success" }),
|
|
31
|
+
v === "down" && /* @__PURE__ */ o(i, { className: "h-3 w-3 text-destructive" }),
|
|
32
32
|
v === "stable" && /* @__PURE__ */ o(r, { className: "h-3 w-3 text-muted-foreground" }),
|
|
33
33
|
/* @__PURE__ */ s("span", {
|
|
34
|
-
className: e("font-medium", v === "up" && "text-
|
|
34
|
+
className: e("font-medium", v === "up" && "text-success", v === "down" && "text-destructive", v === "stable" && "text-muted-foreground"),
|
|
35
35
|
children: [
|
|
36
36
|
_ > 0 ? "+" : "",
|
|
37
37
|
_,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatCard.js","names":[],"sources":["../../../src/healthybowl/components/StatCard.tsx"],"sourcesContent":["import type { FC, ReactNode } from 'react';\nimport { TrendingUp, TrendingDown, Minus } from 'lucide-react';\nimport { cn } from '../utils/helpers';\nimport { formatNumber, formatCurrency } from '../utils/helpers';\n\ninterface StatCardProps {\n label: string;\n value: number | string;\n previousValue?: number;\n unit?: string;\n prefix?: string;\n icon?: ReactNode;\n trend?: 'up' | 'down' | 'stable';\n change?: number;\n className?: string;\n}\n\nexport const StatCard: FC<StatCardProps> = ({\n label,\n value,\n previousValue,\n unit,\n prefix,\n icon,\n trend,\n change,\n className,\n}) => {\n const numericValue = typeof value === 'number' ? value : 0;\n const computedChange =\n change ?? (previousValue ? Math.round(((numericValue - previousValue) / previousValue) * 100) : 0);\n const computedTrend = trend ?? (computedChange > 0 ? 'up' : computedChange < 0 ? 'down' : 'stable');\n\n const displayValue =\n typeof value === 'string'\n ? value\n : prefix === '$'\n ? formatCurrency(value)\n : `${formatNumber(value)}${unit ? ` ${unit}` : ''}`;\n\n return (\n <div className={cn('rounded-lg border border-border bg-card p-4 shadow-sm', className)}>\n <div className=\"flex items-center justify-between\">\n <span className=\"text-sm font-medium text-muted-foreground\">{label}</span>\n {icon && <span className=\"text-muted-foreground\">{icon}</span>}\n </div>\n <div className=\"mt-2 flex items-baseline gap-2\">\n <span className=\"text-2xl font-bold text-foreground\">{displayValue}</span>\n </div>\n {computedChange !== 0 && (\n <div className=\"mt-2 flex items-center gap-1 text-xs\">\n {computedTrend === 'up' && <TrendingUp className=\"h-3 w-3 text-
|
|
1
|
+
{"version":3,"file":"StatCard.js","names":[],"sources":["../../../src/healthybowl/components/StatCard.tsx"],"sourcesContent":["import type { FC, ReactNode } from 'react';\nimport { TrendingUp, TrendingDown, Minus } from 'lucide-react';\nimport { cn } from '../utils/helpers';\nimport { formatNumber, formatCurrency } from '../utils/helpers';\n\ninterface StatCardProps {\n label: string;\n value: number | string;\n previousValue?: number;\n unit?: string;\n prefix?: string;\n icon?: ReactNode;\n trend?: 'up' | 'down' | 'stable';\n change?: number;\n className?: string;\n}\n\nexport const StatCard: FC<StatCardProps> = ({\n label,\n value,\n previousValue,\n unit,\n prefix,\n icon,\n trend,\n change,\n className,\n}) => {\n const numericValue = typeof value === 'number' ? value : 0;\n const computedChange =\n change ?? (previousValue ? Math.round(((numericValue - previousValue) / previousValue) * 100) : 0);\n const computedTrend = trend ?? (computedChange > 0 ? 'up' : computedChange < 0 ? 'down' : 'stable');\n\n const displayValue =\n typeof value === 'string'\n ? value\n : prefix === '$'\n ? formatCurrency(value)\n : `${formatNumber(value)}${unit ? ` ${unit}` : ''}`;\n\n return (\n <div className={cn('rounded-lg border border-border bg-card p-4 shadow-sm', className)}>\n <div className=\"flex items-center justify-between\">\n <span className=\"text-sm font-medium text-muted-foreground\">{label}</span>\n {icon && <span className=\"text-muted-foreground\">{icon}</span>}\n </div>\n <div className=\"mt-2 flex items-baseline gap-2\">\n <span className=\"text-2xl font-bold text-foreground\">{displayValue}</span>\n </div>\n {computedChange !== 0 && (\n <div className=\"mt-2 flex items-center gap-1 text-xs\">\n {computedTrend === 'up' && <TrendingUp className=\"h-3 w-3 text-success\" />}\n {computedTrend === 'down' && <TrendingDown className=\"h-3 w-3 text-destructive\" />}\n {computedTrend === 'stable' && <Minus className=\"h-3 w-3 text-muted-foreground\" />}\n <span\n className={cn(\n 'font-medium',\n computedTrend === 'up' && 'text-success',\n computedTrend === 'down' && 'text-destructive',\n computedTrend === 'stable' && 'text-muted-foreground'\n )}\n >\n {computedChange > 0 ? '+' : ''}\n {computedChange}%\n </span>\n <span className=\"text-muted-foreground\">vs last period</span>\n </div>\n )}\n </div>\n );\n};\n"],"mappings":";;;;AAiBA,IAAa,KAA+B,EAC1C,UACA,UACA,kBACA,SACA,WACA,SACA,UACA,WACA,mBACI;CAEJ,IAAM,IACJ,MAAW,IAAgB,KAAK,QAFb,OAAO,KAAU,WAAW,IAAQ,KAEA,KAAiB,IAAiB,IAAI,GAAG,IAC5F,IAAgB,MAAU,IAAiB,IAAI,OAAO,IAAiB,IAAI,SAAS,WAEpF,IACJ,OAAO,KAAU,WACb,IACA,MAAW,MACT,EAAe,EAAM,GACrB,GAAG,EAAa,EAAM,GAAG,IAAO,IAAI,MAAS;AAErD,QACE,kBAAC,OAAD;EAAK,WAAW,EAAG,yDAAyD,EAAU;YAAtF;GACE,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,QAAD;KAAM,WAAU;eAA6C;KAAa,CAAA,EACzE,KAAQ,kBAAC,QAAD;KAAM,WAAU;eAAyB;KAAY,CAAA,CAC1D;;GACN,kBAAC,OAAD;IAAK,WAAU;cACb,kBAAC,QAAD;KAAM,WAAU;eAAsC;KAAoB,CAAA;IACtE,CAAA;GACL,MAAmB,KAClB,kBAAC,OAAD;IAAK,WAAU;cAAf;KACG,MAAkB,QAAQ,kBAAC,GAAD,EAAY,WAAU,wBAAyB,CAAA;KACzE,MAAkB,UAAU,kBAAC,GAAD,EAAc,WAAU,4BAA6B,CAAA;KACjF,MAAkB,YAAY,kBAAC,GAAD,EAAO,WAAU,iCAAkC,CAAA;KAClF,kBAAC,QAAD;MACE,WAAW,EACT,eACA,MAAkB,QAAQ,gBAC1B,MAAkB,UAAU,oBAC5B,MAAkB,YAAY,wBAC/B;gBANH;OAQG,IAAiB,IAAI,MAAM;OAC3B;OAAe;OACX;;KACP,kBAAC,QAAD;MAAM,WAAU;gBAAwB;MAAqB,CAAA;KACzD;;GAEJ"}
|
|
@@ -2,17 +2,17 @@ import { cn as e } from "../utils/helpers.js";
|
|
|
2
2
|
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
3
|
//#region src/healthybowl/components/StatusBadge.tsx
|
|
4
4
|
var r = {
|
|
5
|
-
success: "bg-
|
|
6
|
-
warning: "bg-
|
|
7
|
-
error: "bg-
|
|
8
|
-
info: "bg-
|
|
5
|
+
success: "bg-success-subtle text-success",
|
|
6
|
+
warning: "bg-status-warning-bg-subtle text-warning",
|
|
7
|
+
error: "bg-status-error-bg-subtle text-destructive",
|
|
8
|
+
info: "bg-status-info-bg-subtle text-info",
|
|
9
9
|
default: "bg-primary/10 text-primary",
|
|
10
10
|
muted: "bg-muted text-muted-foreground"
|
|
11
11
|
}, i = {
|
|
12
|
-
success: "bg-
|
|
13
|
-
warning: "bg-
|
|
14
|
-
error: "bg-
|
|
15
|
-
info: "bg-
|
|
12
|
+
success: "bg-success",
|
|
13
|
+
warning: "bg-warning",
|
|
14
|
+
error: "bg-destructive",
|
|
15
|
+
info: "bg-info",
|
|
16
16
|
default: "bg-primary",
|
|
17
17
|
muted: "bg-muted-foreground"
|
|
18
18
|
}, a = ({ label: a, variant: o = "default", dot: s = !1, className: c }) => /* @__PURE__ */ n("span", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusBadge.js","names":[],"sources":["../../../src/healthybowl/components/StatusBadge.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { cn } from '../utils/helpers';\n\ntype BadgeVariant = 'success' | 'warning' | 'error' | 'info' | 'default' | 'muted';\n\ninterface StatusBadgeProps {\n label: string;\n variant?: BadgeVariant;\n dot?: boolean;\n className?: string;\n}\n\nconst variantStyles: Record<BadgeVariant, string> = {\n success: 'bg-
|
|
1
|
+
{"version":3,"file":"StatusBadge.js","names":[],"sources":["../../../src/healthybowl/components/StatusBadge.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { cn } from '../utils/helpers';\n\ntype BadgeVariant = 'success' | 'warning' | 'error' | 'info' | 'default' | 'muted';\n\ninterface StatusBadgeProps {\n label: string;\n variant?: BadgeVariant;\n dot?: boolean;\n className?: string;\n}\n\nconst variantStyles: Record<BadgeVariant, string> = {\n success: 'bg-success-subtle text-success',\n warning: 'bg-status-warning-bg-subtle text-warning',\n error: 'bg-status-error-bg-subtle text-destructive',\n info: 'bg-status-info-bg-subtle text-info',\n default: 'bg-primary/10 text-primary',\n muted: 'bg-muted text-muted-foreground',\n};\n\nconst dotStyles: Record<BadgeVariant, string> = {\n success: 'bg-success',\n warning: 'bg-warning',\n error: 'bg-destructive',\n info: 'bg-info',\n default: 'bg-primary',\n muted: 'bg-muted-foreground',\n};\n\nexport const StatusBadge: FC<StatusBadgeProps> = ({ label, variant = 'default', dot = false, className }) => {\n return (\n <span\n className={cn(\n 'inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium',\n variantStyles[variant],\n className\n )}\n >\n {dot && <span className={cn('h-1.5 w-1.5 rounded-full', dotStyles[variant])} />}\n {label}\n </span>\n );\n};\n"],"mappings":";;;AAYA,IAAM,IAA8C;CAClD,SAAS;CACT,SAAS;CACT,OAAO;CACP,MAAM;CACN,SAAS;CACT,OAAO;CACR,EAEK,IAA0C;CAC9C,SAAS;CACT,SAAS;CACT,OAAO;CACP,MAAM;CACN,SAAS;CACT,OAAO;CACR,EAEY,KAAqC,EAAE,UAAO,aAAU,WAAW,SAAM,IAAO,mBAEzF,kBAAC,QAAD;CACE,WAAW,EACT,mFACA,EAAc,IACd,EACD;WALH,CAOG,KAAO,kBAAC,QAAD,EAAM,WAAW,EAAG,4BAA4B,EAAU,GAAS,EAAI,CAAA,EAC9E,EACI"}
|
|
@@ -6,19 +6,19 @@ import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
|
6
6
|
var l = {
|
|
7
7
|
success: {
|
|
8
8
|
icon: r,
|
|
9
|
-
className: "border-
|
|
9
|
+
className: "border-success/30 bg-success-subtle text-success"
|
|
10
10
|
},
|
|
11
11
|
error: {
|
|
12
12
|
icon: o,
|
|
13
|
-
className: "border-
|
|
13
|
+
className: "border-destructive/30 bg-destructive/10 text-destructive"
|
|
14
14
|
},
|
|
15
15
|
warning: {
|
|
16
16
|
icon: n,
|
|
17
|
-
className: "border-
|
|
17
|
+
className: "border-warning/30 bg-warning/10 text-warning"
|
|
18
18
|
},
|
|
19
19
|
info: {
|
|
20
20
|
icon: i,
|
|
21
|
-
className: "border-
|
|
21
|
+
className: "border-info/30 bg-info/10 text-info"
|
|
22
22
|
}
|
|
23
23
|
}, u = ({ id: n, title: r, description: i, variant: o, duration: u = 4e3, onDismiss: d }) => {
|
|
24
24
|
let { icon: f, className: p } = l[o];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.js","names":[],"sources":["../../../src/healthybowl/components/Toast.tsx"],"sourcesContent":["import { useEffect, type FC } from 'react';\nimport { X, CheckCircle, AlertTriangle, Info, XCircle } from 'lucide-react';\nimport { cn } from '../utils/helpers';\n\nexport type ToastVariant = 'success' | 'error' | 'warning' | 'info';\n\nexport interface ToastData {\n id: string;\n title: string;\n description?: string;\n variant: ToastVariant;\n duration?: number;\n}\n\ninterface ToastProps extends ToastData {\n onDismiss: (id: string) => void;\n}\n\nconst variantConfig: Record<ToastVariant, { icon: typeof CheckCircle; className: string }> = {\n success: {\n icon: CheckCircle,\n className: 'border-
|
|
1
|
+
{"version":3,"file":"Toast.js","names":[],"sources":["../../../src/healthybowl/components/Toast.tsx"],"sourcesContent":["import { useEffect, type FC } from 'react';\nimport { X, CheckCircle, AlertTriangle, Info, XCircle } from 'lucide-react';\nimport { cn } from '../utils/helpers';\n\nexport type ToastVariant = 'success' | 'error' | 'warning' | 'info';\n\nexport interface ToastData {\n id: string;\n title: string;\n description?: string;\n variant: ToastVariant;\n duration?: number;\n}\n\ninterface ToastProps extends ToastData {\n onDismiss: (id: string) => void;\n}\n\nconst variantConfig: Record<ToastVariant, { icon: typeof CheckCircle; className: string }> = {\n success: {\n icon: CheckCircle,\n className: 'border-success/30 bg-success-subtle text-success',\n },\n error: { icon: XCircle, className: 'border-destructive/30 bg-destructive/10 text-destructive' },\n warning: {\n icon: AlertTriangle,\n className: 'border-warning/30 bg-warning/10 text-warning',\n },\n info: { icon: Info, className: 'border-info/30 bg-info/10 text-info' },\n};\n\nexport const Toast: FC<ToastProps> = ({ id, title, description, variant, duration = 4000, onDismiss }) => {\n const { icon: Icon, className } = variantConfig[variant];\n\n useEffect(() => {\n if (duration > 0) {\n const timer = setTimeout(() => onDismiss(id), duration);\n return () => clearTimeout(timer);\n }\n }, [id, duration, onDismiss]);\n\n return (\n <div\n className={cn(\n 'flex items-start gap-3 rounded-lg border p-4 shadow-lg animate-in slide-in-from-right-full',\n className\n )}\n >\n <Icon className=\"mt-0.5 h-5 w-5 shrink-0\" />\n <div className=\"flex-1 min-w-0\">\n <p className=\"text-sm font-medium\">{title}</p>\n {description && <p className=\"mt-0.5 text-xs opacity-80\">{description}</p>}\n </div>\n <button onClick={() => onDismiss(id)} className=\"shrink-0 opacity-60 hover:opacity-100\">\n <X className=\"h-4 w-4\" />\n </button>\n </div>\n );\n};\n\ninterface ToastContainerProps {\n toasts: ToastData[];\n onDismiss: (id: string) => void;\n}\n\nexport const ToastContainer: FC<ToastContainerProps> = ({ toasts, onDismiss }) => {\n if (toasts.length === 0) return null;\n return (\n <div className=\"fixed bottom-4 right-4 z-50 flex w-80 flex-col gap-2\">\n {toasts.map((t) => (\n <Toast key={t.id} {...t} onDismiss={onDismiss} />\n ))}\n </div>\n );\n};\n"],"mappings":";;;;;AAkBA,IAAM,IAAuF;CAC3F,SAAS;EACP,MAAM;EACN,WAAW;EACZ;CACD,OAAO;EAAE,MAAM;EAAS,WAAW;EAA4D;CAC/F,SAAS;EACP,MAAM;EACN,WAAW;EACZ;CACD,MAAM;EAAE,MAAM;EAAM,WAAW;EAAuC;CACvE,EAEY,KAAyB,EAAE,OAAI,UAAO,gBAAa,YAAS,cAAW,KAAM,mBAAgB;CACxG,IAAM,EAAE,MAAM,GAAM,iBAAc,EAAc;AAShD,QAPA,QAAgB;AACd,MAAI,IAAW,GAAG;GAChB,IAAM,IAAQ,iBAAiB,EAAU,EAAG,EAAE,EAAS;AACvD,gBAAa,aAAa,EAAM;;IAEjC;EAAC;EAAI;EAAU;EAAU,CAAC,EAG3B,kBAAC,OAAD;EACE,WAAW,EACT,8FACA,EACD;YAJH;GAME,kBAAC,GAAD,EAAM,WAAU,2BAA4B,CAAA;GAC5C,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,KAAD;KAAG,WAAU;eAAuB;KAAU,CAAA,EAC7C,KAAe,kBAAC,KAAD;KAAG,WAAU;eAA6B;KAAgB,CAAA,CACtE;;GACN,kBAAC,UAAD;IAAQ,eAAe,EAAU,EAAG;IAAE,WAAU;cAC9C,kBAAC,GAAD,EAAG,WAAU,WAAY,CAAA;IAClB,CAAA;GACL;;GASG,KAA2C,EAAE,WAAQ,mBAC5D,EAAO,WAAW,IAAU,OAE9B,kBAAC,OAAD;CAAK,WAAU;WACZ,EAAO,KAAK,MACX,kBAAC,GAAD;EAAkB,GAAI;EAAc;EAAa,EAArC,EAAE,GAAmC,CACjD;CACE,CAAA"}
|
|
@@ -387,8 +387,8 @@ var M = (e) => {
|
|
|
387
387
|
onClick: () => {
|
|
388
388
|
B(e.id, !0), e.actionUrl && U(e.actionUrl);
|
|
389
389
|
},
|
|
390
|
-
className: t("flex cursor-pointer items-start gap-3 rounded-md border p-3 transition-colors hover:bg-muted/50", e.severity === "critical" && "border-l-4 border-l-
|
|
391
|
-
children: [/* @__PURE__ */ A(f, { className: t("mt-0.5 h-4 w-4 shrink-0", e.severity === "critical" && "text-
|
|
390
|
+
className: t("flex cursor-pointer items-start gap-3 rounded-md border p-3 transition-colors hover:bg-muted/50", e.severity === "critical" && "border-l-4 border-l-destructive border-t-border border-r-border border-b-border", e.severity === "warning" && "border-l-4 border-l-warning border-t-border border-r-border border-b-border", e.severity === "info" && "border-l-4 border-l-info border-t-border border-r-border border-b-border", !e.read && "bg-muted/50"),
|
|
391
|
+
children: [/* @__PURE__ */ A(f, { className: t("mt-0.5 h-4 w-4 shrink-0", e.severity === "critical" && "text-destructive", e.severity === "warning" && "text-warning", e.severity === "info" && "text-info") }), /* @__PURE__ */ j("div", {
|
|
392
392
|
className: "min-w-0 flex-1",
|
|
393
393
|
children: [/* @__PURE__ */ j("div", {
|
|
394
394
|
className: "flex items-center gap-2",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HomePage.js","names":[],"sources":["../../../src/healthybowl/pages/HomePage.tsx"],"sourcesContent":["import { useState, useMemo, useCallback, type FC } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport {\n DollarSign,\n TrendingDown,\n TrendingUp,\n Sprout,\n PawPrint,\n ShieldCheck,\n AlertTriangle,\n Cloud,\n Droplets,\n Wind,\n Thermometer,\n Plus,\n ClipboardList,\n BarChart3,\n MapPin,\n Eye,\n Calendar,\n} from 'lucide-react';\nimport { PageLayout, StatCard, StatusBadge, ChartCard } from '../components';\nimport { useHealthyBowlData } from '../hooks/useHealthyBowlData';\nimport { useBasePath } from '../hooks/useBasePath';\nimport { cn, formatCurrency } from '../utils/helpers';\n\nconst severityVariant = (severity: string) => {\n switch (severity) {\n case 'critical':\n return 'error' as const;\n case 'warning':\n return 'warning' as const;\n default:\n return 'info' as const;\n }\n};\n\nconst healthVariant = (status: string) => {\n switch (status) {\n case 'excellent':\n return 'success' as const;\n case 'good':\n return 'info' as const;\n case 'fair':\n return 'warning' as const;\n default:\n return 'error' as const;\n }\n};\n\nconst statusVariant = (status: string) => {\n switch (status) {\n case 'harvest_ready':\n return 'success' as const;\n case 'growing':\n case 'fruiting':\n return 'info' as const;\n case 'planted':\n return 'muted' as const;\n default:\n return 'default' as const;\n }\n};\n\nexport const HomePage: FC = () => {\n const { dashboardStats, alerts, crops, weatherData, marketplaceProducts, markAlertRead, farm, loading } =\n useHealthyBowlData();\n\n const navigate = useNavigate();\n const { t: translate } = useI18n();\n const t = useCallback(\n (key: string, fallback: string): string => {\n const value = translate(key);\n return value === key ? fallback : value;\n },\n [translate]\n );\n const { buildPath } = useBasePath();\n const [alertsExpanded, setAlertsExpanded] = useState(false);\n const stats = dashboardStats;\n const visibleAlerts = alertsExpanded ? alerts : alerts.slice(0, 4);\n const defaultCurrent = {\n temperature: 0,\n condition: 'N/A',\n feelsLike: 0,\n humidity: 0,\n windSpeed: 0,\n uvIndex: 0,\n pressure: 0,\n visibility: 0,\n };\n const weather = {\n location: weatherData?.location ?? '',\n current: weatherData?.current ?? defaultCurrent,\n forecast: weatherData?.forecast ?? [],\n };\n\n // Derive market value from marketplace products (sum of price * stock)\n const marketValue = useMemo(\n () => marketplaceProducts.reduce((sum, p) => sum + p.price * p.stock, 0),\n [marketplaceProducts]\n );\n\n // Expenses as a share of revenue (honest ratio — null when there's no revenue to compare against).\n const expenseRatioPercent = useMemo(() => {\n if (stats.totalRevenue === 0) return null;\n return Math.round((stats.totalExpenses / stats.totalRevenue) * 100 * 10) / 10;\n }, [stats.totalExpenses, stats.totalRevenue]);\n\n const quickActions = [\n {\n label: t('healthybowl.home.quickActions.addCrop.label', 'Add Crop'),\n icon: Sprout,\n path: buildPath('crops'),\n description: t('healthybowl.home.quickActions.addCrop.description', 'Register a new crop'),\n },\n {\n label: t('healthybowl.home.quickActions.recordHarvest.label', 'Record Harvest'),\n icon: ClipboardList,\n path: buildPath('crops/harvest'),\n description: t('healthybowl.home.quickActions.recordHarvest.description', 'Log harvest data'),\n },\n {\n label: t('healthybowl.home.quickActions.viewFields.label', 'View Fields'),\n icon: MapPin,\n path: buildPath('crops/fields'),\n description: t('healthybowl.home.quickActions.viewFields.description', 'Manage farm fields'),\n },\n {\n label: t('healthybowl.home.quickActions.viewWeather.label', 'View Weather'),\n icon: Thermometer,\n path: buildPath('weather'),\n description: t('healthybowl.home.quickActions.viewWeather.description', 'Check forecast'),\n },\n {\n label: t('healthybowl.home.quickActions.analytics.label', 'Analytics'),\n icon: BarChart3,\n path: buildPath('analytics'),\n description: t('healthybowl.home.quickActions.analytics.description', 'View farm reports'),\n },\n ];\n\n return (\n <PageLayout\n title={t('healthybowl.home.title', 'Farm Dashboard')}\n description={t('healthybowl.home.description', 'Overview of your farm operations')}\n actions={\n <button\n onClick={() => navigate(buildPath('crops'))}\n className=\"inline-flex items-center gap-2 rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90\"\n >\n <Plus className=\"h-4 w-4\" />\n {t('healthybowl.home.primaryAction', 'Quick Action')}\n </button>\n }\n >\n {/* First-run onboarding CTA — only after data settles, so it doesn't flash for users who have a farm */}\n {!loading && !farm?.id && (\n <div className=\"mb-4 flex flex-col gap-3 rounded-lg border border-border bg-card p-5 sm:flex-row sm:items-center sm:justify-between\">\n <div>\n <p className=\"text-base font-semibold text-foreground\">\n {t('healthybowl.home.onboarding.title', 'Welcome to HealthyBowl')}\n </p>\n <p className=\"text-sm text-muted-foreground\">\n {t(\n 'healthybowl.home.onboarding.description',\n 'Set up your farm to start tracking crops, livestock, finances, and more.'\n )}\n </p>\n </div>\n <button\n onClick={() => navigate(buildPath('getting-started'))}\n className=\"inline-flex items-center gap-2 self-start rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 sm:self-auto\"\n >\n <Plus className=\"h-4 w-4\" />\n {t('healthybowl.home.onboarding.action', 'Set up your farm')}\n </button>\n </div>\n )}\n\n {/* Stat Cards - including Market Value */}\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4 xl:grid-cols-4\">\n <StatCard\n label={t('healthybowl.home.stats.revenue', 'Revenue')}\n value={stats.totalRevenue}\n prefix=\"$\"\n icon={<DollarSign className=\"h-4 w-4\" />}\n />\n <StatCard\n label={t('healthybowl.home.stats.activeCrops', 'Active Crops')}\n value={stats.activeCrops}\n icon={<Sprout className=\"h-4 w-4\" />}\n />\n <StatCard\n label={t('healthybowl.home.stats.harvestDue', 'Harvest Due')}\n value={stats.harvestDue}\n icon={<Calendar className=\"h-4 w-4\" />}\n />\n <StatCard\n label={t('healthybowl.home.stats.marketValue', 'Market Value')}\n value={marketValue}\n prefix=\"$\"\n icon={<TrendingUp className=\"h-4 w-4\" />}\n />\n </div>\n\n {/* Secondary Stats */}\n <div className=\"grid grid-cols-2 gap-4 sm:grid-cols-4\">\n <div className=\"rounded-lg border border-border bg-card p-4\">\n <div className=\"flex items-center justify-between\">\n <div>\n <p className=\"text-xs font-medium text-muted-foreground\">\n {t('healthybowl.home.metrics.totalFields', 'Total Fields')}\n </p>\n <p className=\"mt-1 text-xl font-bold text-foreground\">{stats.totalFields}</p>\n <p className=\"mt-0.5 text-xs text-muted-foreground\">\n {t('healthybowl.home.metrics.totalFieldsHint', 'All monitored')}\n </p>\n </div>\n <MapPin className=\"h-5 w-5 text-muted-foreground\" />\n </div>\n </div>\n <div className=\"rounded-lg border border-border bg-card p-4\">\n <div className=\"flex items-center justify-between\">\n <div>\n <p className=\"text-xs font-medium text-muted-foreground\">\n {t('healthybowl.home.metrics.totalAnimals', 'Total Animals')}\n </p>\n <p className=\"mt-1 text-xl font-bold text-foreground\">{stats.totalAnimals}</p>\n <p className=\"mt-0.5 text-xs text-muted-foreground\">\n {t('healthybowl.home.metrics.totalAnimalsHint', 'All healthy')}\n </p>\n </div>\n <PawPrint className=\"h-5 w-5 text-muted-foreground\" />\n </div>\n </div>\n <div className=\"rounded-lg border border-border bg-card p-4\">\n <div className=\"flex items-center justify-between\">\n <div>\n <p className=\"text-xs font-medium text-muted-foreground\">\n {t('healthybowl.home.metrics.expenses', 'Expenses')}\n </p>\n <p className=\"mt-1 text-xl font-bold text-foreground\">{formatCurrency(stats.totalExpenses)}</p>\n <p className=\"mt-0.5 text-xs text-muted-foreground\">\n {expenseRatioPercent != null\n ? `${expenseRatioPercent}% ${t('healthybowl.home.metrics.ofRevenue', 'of revenue')}`\n : t('healthybowl.home.metrics.noRevenue', 'No revenue yet')}\n </p>\n </div>\n <TrendingDown className=\"h-5 w-5 text-muted-foreground\" />\n </div>\n </div>\n <div className=\"rounded-lg border border-border bg-card p-4\">\n <div className=\"flex items-center justify-between\">\n <div>\n <p className=\"text-xs font-medium text-muted-foreground\">\n {t('healthybowl.home.metrics.organicScore', 'Organic Score')}\n </p>\n <p className=\"mt-1 text-xl font-bold text-foreground\">{stats.organicScore}%</p>\n <p className=\"mt-0.5 text-xs text-muted-foreground\">\n {t('healthybowl.home.metrics.organicHint', 'Certified organic compliance')}\n </p>\n </div>\n <ShieldCheck className=\"h-5 w-5 text-muted-foreground\" />\n </div>\n </div>\n </div>\n\n <div className=\"grid grid-cols-1 gap-6 lg:grid-cols-3\">\n {/* Weather Widget - Enhanced */}\n <ChartCard title={t('healthybowl.home.weatherCard.title', 'Current Weather')} description={weather.location}>\n <div className=\"flex flex-col gap-4\">\n <div className=\"flex items-center justify-between\">\n <div>\n <p className=\"text-4xl font-bold text-foreground\">{weather.current.temperature}°C</p>\n <p className=\"text-sm text-muted-foreground\">{weather.current.condition}</p>\n <p className=\"mt-1 text-xs text-muted-foreground\">\n {t('healthybowl.home.weatherCard.feelsLike', 'Feels like')} {weather.current.feelsLike}°C\n </p>\n </div>\n <div className=\"flex flex-col items-center\">\n <Cloud className=\"h-12 w-12 text-muted-foreground\" />\n <span className=\"mt-1 text-xs text-muted-foreground\">UV {weather.current.uvIndex}</span>\n </div>\n </div>\n\n <div className=\"grid grid-cols-2 gap-3 border-t border-border pt-3\">\n <div className=\"flex items-center gap-2 text-sm text-muted-foreground\">\n <Droplets className=\"h-4 w-4\" />\n <span>\n {weather.current.humidity}% {t('healthybowl.home.weatherCard.humidity', 'Humidity')}\n </span>\n </div>\n <div className=\"flex items-center gap-2 text-sm text-muted-foreground\">\n <Wind className=\"h-4 w-4\" />\n <span>{weather.current.windSpeed} km/h</span>\n </div>\n <div className=\"flex items-center gap-2 text-sm text-muted-foreground\">\n <Thermometer className=\"h-4 w-4\" />\n <span>{weather.current.pressure} hPa</span>\n </div>\n <div className=\"flex items-center gap-2 text-sm text-muted-foreground\">\n <Eye className=\"h-4 w-4\" />\n <span>{weather.current.visibility} km</span>\n </div>\n </div>\n\n <div className=\"grid grid-cols-4 gap-2 border-t border-border pt-3\">\n {weather.forecast.slice(0, 4).map((day) => (\n <div key={day.date} className=\"rounded-md bg-muted/50 p-2 text-center\">\n <p className=\"text-xs font-medium text-muted-foreground\">\n {new Date(day.date).toLocaleDateString('en-US', { weekday: 'short' })}\n </p>\n <p className=\"mt-1 text-sm font-semibold text-foreground\">{day.high}°</p>\n <p className=\"text-xs text-muted-foreground\">{day.low}°</p>\n <p className=\"mt-0.5 text-xs text-muted-foreground\">{day.precipitation}%</p>\n </div>\n ))}\n </div>\n\n <button\n onClick={() => navigate(buildPath('weather'))}\n className=\"w-full rounded-md border border-border py-2 text-sm text-foreground hover:bg-muted/50\"\n >\n {t('healthybowl.home.weatherCard.viewForecast', 'View Full Forecast')}\n </button>\n </div>\n </ChartCard>\n\n {/* Active Crops */}\n <ChartCard\n title={t('healthybowl.home.cropsCard.title', 'Active Crops')}\n description={`${crops.length} ${t('healthybowl.home.cropsCard.description', 'crops in progress')}`}\n >\n <div className=\"flex flex-col gap-3\">\n {crops.map((crop) => (\n <div\n key={crop.id}\n onClick={() => navigate(buildPath(`crops/${crop.id}`))}\n className=\"cursor-pointer rounded-md border border-border p-3 transition-colors hover:bg-muted/50\"\n >\n <div className=\"flex items-center justify-between\">\n <span className=\"text-sm font-medium text-foreground\">{crop.name}</span>\n <StatusBadge\n label={(crop.status ?? 'unknown').replace('_', ' ')}\n variant={statusVariant(crop.status ?? 'unknown')}\n />\n </div>\n <p className=\"mt-1 text-xs text-muted-foreground\">\n {crop.fieldName} · {crop.variety}\n </p>\n <div className=\"mt-2 flex items-center gap-2\">\n <div className=\"h-2 flex-1 rounded-full bg-muted\">\n <div className=\"h-2 rounded-full bg-primary\" style={{ width: `${crop.progress}%` }} />\n </div>\n <span className=\"text-xs font-medium text-muted-foreground\">{crop.progress}%</span>\n </div>\n <div className=\"mt-1.5 flex items-center justify-between\">\n <StatusBadge label={crop.healthStatus} variant={healthVariant(crop.healthStatus)} />\n <span className=\"text-xs text-muted-foreground\">\n {crop.daysToHarvest}d {t('healthybowl.home.cropsCard.daysToHarvest', 'to harvest')}\n </span>\n </div>\n </div>\n ))}\n <button\n onClick={() => navigate(buildPath('crops'))}\n className=\"w-full rounded-md border border-border py-2 text-sm text-foreground hover:bg-muted/50\"\n >\n {t('healthybowl.home.cropsCard.viewAll', 'View All Crops')}\n </button>\n </div>\n </ChartCard>\n\n {/* Alerts */}\n <ChartCard\n title={t('healthybowl.home.alertsCard.title', 'Alerts & Notifications')}\n description={`${alerts.filter((a) => !a.read).length} ${t('healthybowl.home.alertsCard.unread', 'unread')}`}\n actions={\n <button onClick={() => setAlertsExpanded(!alertsExpanded)} className=\"text-xs text-primary hover:underline\">\n {alertsExpanded\n ? t('healthybowl.home.alertsCard.showLess', 'Show less')\n : t('healthybowl.home.alertsCard.viewAll', 'View all')}\n </button>\n }\n >\n <div className=\"flex flex-col gap-3\">\n {visibleAlerts.map((alert) => (\n <div\n key={alert.id}\n onClick={() => {\n void markAlertRead(alert.id, true);\n if (alert.actionUrl) {\n navigate(alert.actionUrl);\n }\n }}\n className={cn(\n 'flex cursor-pointer items-start gap-3 rounded-md border p-3 transition-colors hover:bg-muted/50',\n alert.severity === 'critical' &&\n 'border-l-4 border-l-red-500 border-t-border border-r-border border-b-border',\n alert.severity === 'warning' &&\n 'border-l-4 border-l-amber-500 border-t-border border-r-border border-b-border',\n alert.severity === 'info' &&\n 'border-l-4 border-l-blue-500 border-t-border border-r-border border-b-border',\n !alert.read && 'bg-muted/50'\n )}\n >\n <AlertTriangle\n className={cn(\n 'mt-0.5 h-4 w-4 shrink-0',\n alert.severity === 'critical' && 'text-red-500',\n alert.severity === 'warning' && 'text-amber-500',\n alert.severity === 'info' && 'text-blue-500'\n )}\n />\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex items-center gap-2\">\n <span className=\"text-sm font-medium text-foreground\">{alert.title}</span>\n <StatusBadge label={alert.severity} variant={severityVariant(alert.severity)} />\n </div>\n <p className=\"mt-0.5 text-xs text-muted-foreground\">{alert.message}</p>\n </div>\n </div>\n ))}\n </div>\n </ChartCard>\n </div>\n\n {/* Quick Actions */}\n <div className=\"rounded-lg border border-border bg-card p-6\">\n <div className=\"mb-4\">\n <h3 className=\"text-sm font-semibold text-foreground\">\n {t('healthybowl.home.quickActions.title', 'Quick Actions')}\n </h3>\n <p className=\"text-xs text-muted-foreground\">\n {t('healthybowl.home.quickActions.subtitle', 'Frequently used features to manage your farm efficiently')}\n </p>\n </div>\n <div className=\"grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-6\">\n {quickActions.map(({ label, icon: Icon, path, description }) => (\n <button\n key={label}\n onClick={() => navigate(path)}\n className=\"flex flex-col items-center gap-2 rounded-lg border border-border bg-background p-4 text-center transition-colors hover:bg-muted/50\"\n >\n <div className=\"rounded-full bg-primary/10 p-3\">\n <Icon className=\"h-5 w-5 text-primary\" />\n </div>\n <span className=\"text-sm font-medium text-foreground\">{label}</span>\n <span className=\"text-xs text-muted-foreground\">{description}</span>\n </button>\n ))}\n </div>\n </div>\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;AA2BA,IAAM,KAAmB,MAAqB;AAC5C,SAAQ,GAAR;EACE,KAAK,WACH,QAAO;EACT,KAAK,UACH,QAAO;EACT,QACE,QAAO;;GAIP,KAAiB,MAAmB;AACxC,SAAQ,GAAR;EACE,KAAK,YACH,QAAO;EACT,KAAK,OACH,QAAO;EACT,KAAK,OACH,QAAO;EACT,QACE,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A;KACR;;GAGN,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,MAAD;MAAI,WAAU;gBACX,EAAE,uCAAuC,gBAAgB;MACvD,CAAA,EACL,kBAAC,KAAD;MAAG,WAAU;gBACV,EAAE,0CAA0C,2DAA2D;MACtG,CAAA,CACA;QACN,kBAAC,OAAD;KAAK,WAAU;eACZ,GAAa,KAAK,EAAE,UAAO,MAAM,GAAM,SAAM,qBAC5C,kBAAC,UAAD;MAEE,eAAe,EAAS,EAAK;MAC7B,WAAU;gBAHZ;OAKE,kBAAC,OAAD;QAAK,WAAU;kBACb,kBAAC,GAAD,EAAM,WAAU,wBAAyB,CAAA;QACrC,CAAA;OACN,kBAAC,QAAD;QAAM,WAAU;kBAAuC;QAAa,CAAA;OACpE,kBAAC,QAAD;QAAM,WAAU;kBAAiC;QAAmB,CAAA;OAC7D;QATF,EASE,CACT;KACE,CAAA,CACF;;GACK"}
|
|
1
|
+
{"version":3,"file":"HomePage.js","names":[],"sources":["../../../src/healthybowl/pages/HomePage.tsx"],"sourcesContent":["import { useState, useMemo, useCallback, type FC } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport {\n DollarSign,\n TrendingDown,\n TrendingUp,\n Sprout,\n PawPrint,\n ShieldCheck,\n AlertTriangle,\n Cloud,\n Droplets,\n Wind,\n Thermometer,\n Plus,\n ClipboardList,\n BarChart3,\n MapPin,\n Eye,\n Calendar,\n} from 'lucide-react';\nimport { PageLayout, StatCard, StatusBadge, ChartCard } from '../components';\nimport { useHealthyBowlData } from '../hooks/useHealthyBowlData';\nimport { useBasePath } from '../hooks/useBasePath';\nimport { cn, formatCurrency } from '../utils/helpers';\n\nconst severityVariant = (severity: string) => {\n switch (severity) {\n case 'critical':\n return 'error' as const;\n case 'warning':\n return 'warning' as const;\n default:\n return 'info' as const;\n }\n};\n\nconst healthVariant = (status: string) => {\n switch (status) {\n case 'excellent':\n return 'success' as const;\n case 'good':\n return 'info' as const;\n case 'fair':\n return 'warning' as const;\n default:\n return 'error' as const;\n }\n};\n\nconst statusVariant = (status: string) => {\n switch (status) {\n case 'harvest_ready':\n return 'success' as const;\n case 'growing':\n case 'fruiting':\n return 'info' as const;\n case 'planted':\n return 'muted' as const;\n default:\n return 'default' as const;\n }\n};\n\nexport const HomePage: FC = () => {\n const { dashboardStats, alerts, crops, weatherData, marketplaceProducts, markAlertRead, farm, loading } =\n useHealthyBowlData();\n\n const navigate = useNavigate();\n const { t: translate } = useI18n();\n const t = useCallback(\n (key: string, fallback: string): string => {\n const value = translate(key);\n return value === key ? fallback : value;\n },\n [translate]\n );\n const { buildPath } = useBasePath();\n const [alertsExpanded, setAlertsExpanded] = useState(false);\n const stats = dashboardStats;\n const visibleAlerts = alertsExpanded ? alerts : alerts.slice(0, 4);\n const defaultCurrent = {\n temperature: 0,\n condition: 'N/A',\n feelsLike: 0,\n humidity: 0,\n windSpeed: 0,\n uvIndex: 0,\n pressure: 0,\n visibility: 0,\n };\n const weather = {\n location: weatherData?.location ?? '',\n current: weatherData?.current ?? defaultCurrent,\n forecast: weatherData?.forecast ?? [],\n };\n\n // Derive market value from marketplace products (sum of price * stock)\n const marketValue = useMemo(\n () => marketplaceProducts.reduce((sum, p) => sum + p.price * p.stock, 0),\n [marketplaceProducts]\n );\n\n // Expenses as a share of revenue (honest ratio — null when there's no revenue to compare against).\n const expenseRatioPercent = useMemo(() => {\n if (stats.totalRevenue === 0) return null;\n return Math.round((stats.totalExpenses / stats.totalRevenue) * 100 * 10) / 10;\n }, [stats.totalExpenses, stats.totalRevenue]);\n\n const quickActions = [\n {\n label: t('healthybowl.home.quickActions.addCrop.label', 'Add Crop'),\n icon: Sprout,\n path: buildPath('crops'),\n description: t('healthybowl.home.quickActions.addCrop.description', 'Register a new crop'),\n },\n {\n label: t('healthybowl.home.quickActions.recordHarvest.label', 'Record Harvest'),\n icon: ClipboardList,\n path: buildPath('crops/harvest'),\n description: t('healthybowl.home.quickActions.recordHarvest.description', 'Log harvest data'),\n },\n {\n label: t('healthybowl.home.quickActions.viewFields.label', 'View Fields'),\n icon: MapPin,\n path: buildPath('crops/fields'),\n description: t('healthybowl.home.quickActions.viewFields.description', 'Manage farm fields'),\n },\n {\n label: t('healthybowl.home.quickActions.viewWeather.label', 'View Weather'),\n icon: Thermometer,\n path: buildPath('weather'),\n description: t('healthybowl.home.quickActions.viewWeather.description', 'Check forecast'),\n },\n {\n label: t('healthybowl.home.quickActions.analytics.label', 'Analytics'),\n icon: BarChart3,\n path: buildPath('analytics'),\n description: t('healthybowl.home.quickActions.analytics.description', 'View farm reports'),\n },\n ];\n\n return (\n <PageLayout\n title={t('healthybowl.home.title', 'Farm Dashboard')}\n description={t('healthybowl.home.description', 'Overview of your farm operations')}\n actions={\n <button\n onClick={() => navigate(buildPath('crops'))}\n className=\"inline-flex items-center gap-2 rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90\"\n >\n <Plus className=\"h-4 w-4\" />\n {t('healthybowl.home.primaryAction', 'Quick Action')}\n </button>\n }\n >\n {/* First-run onboarding CTA — only after data settles, so it doesn't flash for users who have a farm */}\n {!loading && !farm?.id && (\n <div className=\"mb-4 flex flex-col gap-3 rounded-lg border border-border bg-card p-5 sm:flex-row sm:items-center sm:justify-between\">\n <div>\n <p className=\"text-base font-semibold text-foreground\">\n {t('healthybowl.home.onboarding.title', 'Welcome to HealthyBowl')}\n </p>\n <p className=\"text-sm text-muted-foreground\">\n {t(\n 'healthybowl.home.onboarding.description',\n 'Set up your farm to start tracking crops, livestock, finances, and more.'\n )}\n </p>\n </div>\n <button\n onClick={() => navigate(buildPath('getting-started'))}\n className=\"inline-flex items-center gap-2 self-start rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 sm:self-auto\"\n >\n <Plus className=\"h-4 w-4\" />\n {t('healthybowl.home.onboarding.action', 'Set up your farm')}\n </button>\n </div>\n )}\n\n {/* Stat Cards - including Market Value */}\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4 xl:grid-cols-4\">\n <StatCard\n label={t('healthybowl.home.stats.revenue', 'Revenue')}\n value={stats.totalRevenue}\n prefix=\"$\"\n icon={<DollarSign className=\"h-4 w-4\" />}\n />\n <StatCard\n label={t('healthybowl.home.stats.activeCrops', 'Active Crops')}\n value={stats.activeCrops}\n icon={<Sprout className=\"h-4 w-4\" />}\n />\n <StatCard\n label={t('healthybowl.home.stats.harvestDue', 'Harvest Due')}\n value={stats.harvestDue}\n icon={<Calendar className=\"h-4 w-4\" />}\n />\n <StatCard\n label={t('healthybowl.home.stats.marketValue', 'Market Value')}\n value={marketValue}\n prefix=\"$\"\n icon={<TrendingUp className=\"h-4 w-4\" />}\n />\n </div>\n\n {/* Secondary Stats */}\n <div className=\"grid grid-cols-2 gap-4 sm:grid-cols-4\">\n <div className=\"rounded-lg border border-border bg-card p-4\">\n <div className=\"flex items-center justify-between\">\n <div>\n <p className=\"text-xs font-medium text-muted-foreground\">\n {t('healthybowl.home.metrics.totalFields', 'Total Fields')}\n </p>\n <p className=\"mt-1 text-xl font-bold text-foreground\">{stats.totalFields}</p>\n <p className=\"mt-0.5 text-xs text-muted-foreground\">\n {t('healthybowl.home.metrics.totalFieldsHint', 'All monitored')}\n </p>\n </div>\n <MapPin className=\"h-5 w-5 text-muted-foreground\" />\n </div>\n </div>\n <div className=\"rounded-lg border border-border bg-card p-4\">\n <div className=\"flex items-center justify-between\">\n <div>\n <p className=\"text-xs font-medium text-muted-foreground\">\n {t('healthybowl.home.metrics.totalAnimals', 'Total Animals')}\n </p>\n <p className=\"mt-1 text-xl font-bold text-foreground\">{stats.totalAnimals}</p>\n <p className=\"mt-0.5 text-xs text-muted-foreground\">\n {t('healthybowl.home.metrics.totalAnimalsHint', 'All healthy')}\n </p>\n </div>\n <PawPrint className=\"h-5 w-5 text-muted-foreground\" />\n </div>\n </div>\n <div className=\"rounded-lg border border-border bg-card p-4\">\n <div className=\"flex items-center justify-between\">\n <div>\n <p className=\"text-xs font-medium text-muted-foreground\">\n {t('healthybowl.home.metrics.expenses', 'Expenses')}\n </p>\n <p className=\"mt-1 text-xl font-bold text-foreground\">{formatCurrency(stats.totalExpenses)}</p>\n <p className=\"mt-0.5 text-xs text-muted-foreground\">\n {expenseRatioPercent != null\n ? `${expenseRatioPercent}% ${t('healthybowl.home.metrics.ofRevenue', 'of revenue')}`\n : t('healthybowl.home.metrics.noRevenue', 'No revenue yet')}\n </p>\n </div>\n <TrendingDown className=\"h-5 w-5 text-muted-foreground\" />\n </div>\n </div>\n <div className=\"rounded-lg border border-border bg-card p-4\">\n <div className=\"flex items-center justify-between\">\n <div>\n <p className=\"text-xs font-medium text-muted-foreground\">\n {t('healthybowl.home.metrics.organicScore', 'Organic Score')}\n </p>\n <p className=\"mt-1 text-xl font-bold text-foreground\">{stats.organicScore}%</p>\n <p className=\"mt-0.5 text-xs text-muted-foreground\">\n {t('healthybowl.home.metrics.organicHint', 'Certified organic compliance')}\n </p>\n </div>\n <ShieldCheck className=\"h-5 w-5 text-muted-foreground\" />\n </div>\n </div>\n </div>\n\n <div className=\"grid grid-cols-1 gap-6 lg:grid-cols-3\">\n {/* Weather Widget - Enhanced */}\n <ChartCard title={t('healthybowl.home.weatherCard.title', 'Current Weather')} description={weather.location}>\n <div className=\"flex flex-col gap-4\">\n <div className=\"flex items-center justify-between\">\n <div>\n <p className=\"text-4xl font-bold text-foreground\">{weather.current.temperature}°C</p>\n <p className=\"text-sm text-muted-foreground\">{weather.current.condition}</p>\n <p className=\"mt-1 text-xs text-muted-foreground\">\n {t('healthybowl.home.weatherCard.feelsLike', 'Feels like')} {weather.current.feelsLike}°C\n </p>\n </div>\n <div className=\"flex flex-col items-center\">\n <Cloud className=\"h-12 w-12 text-muted-foreground\" />\n <span className=\"mt-1 text-xs text-muted-foreground\">UV {weather.current.uvIndex}</span>\n </div>\n </div>\n\n <div className=\"grid grid-cols-2 gap-3 border-t border-border pt-3\">\n <div className=\"flex items-center gap-2 text-sm text-muted-foreground\">\n <Droplets className=\"h-4 w-4\" />\n <span>\n {weather.current.humidity}% {t('healthybowl.home.weatherCard.humidity', 'Humidity')}\n </span>\n </div>\n <div className=\"flex items-center gap-2 text-sm text-muted-foreground\">\n <Wind className=\"h-4 w-4\" />\n <span>{weather.current.windSpeed} km/h</span>\n </div>\n <div className=\"flex items-center gap-2 text-sm text-muted-foreground\">\n <Thermometer className=\"h-4 w-4\" />\n <span>{weather.current.pressure} hPa</span>\n </div>\n <div className=\"flex items-center gap-2 text-sm text-muted-foreground\">\n <Eye className=\"h-4 w-4\" />\n <span>{weather.current.visibility} km</span>\n </div>\n </div>\n\n <div className=\"grid grid-cols-4 gap-2 border-t border-border pt-3\">\n {weather.forecast.slice(0, 4).map((day) => (\n <div key={day.date} className=\"rounded-md bg-muted/50 p-2 text-center\">\n <p className=\"text-xs font-medium text-muted-foreground\">\n {new Date(day.date).toLocaleDateString('en-US', { weekday: 'short' })}\n </p>\n <p className=\"mt-1 text-sm font-semibold text-foreground\">{day.high}°</p>\n <p className=\"text-xs text-muted-foreground\">{day.low}°</p>\n <p className=\"mt-0.5 text-xs text-muted-foreground\">{day.precipitation}%</p>\n </div>\n ))}\n </div>\n\n <button\n onClick={() => navigate(buildPath('weather'))}\n className=\"w-full rounded-md border border-border py-2 text-sm text-foreground hover:bg-muted/50\"\n >\n {t('healthybowl.home.weatherCard.viewForecast', 'View Full Forecast')}\n </button>\n </div>\n </ChartCard>\n\n {/* Active Crops */}\n <ChartCard\n title={t('healthybowl.home.cropsCard.title', 'Active Crops')}\n description={`${crops.length} ${t('healthybowl.home.cropsCard.description', 'crops in progress')}`}\n >\n <div className=\"flex flex-col gap-3\">\n {crops.map((crop) => (\n <div\n key={crop.id}\n onClick={() => navigate(buildPath(`crops/${crop.id}`))}\n className=\"cursor-pointer rounded-md border border-border p-3 transition-colors hover:bg-muted/50\"\n >\n <div className=\"flex items-center justify-between\">\n <span className=\"text-sm font-medium text-foreground\">{crop.name}</span>\n <StatusBadge\n label={(crop.status ?? 'unknown').replace('_', ' ')}\n variant={statusVariant(crop.status ?? 'unknown')}\n />\n </div>\n <p className=\"mt-1 text-xs text-muted-foreground\">\n {crop.fieldName} · {crop.variety}\n </p>\n <div className=\"mt-2 flex items-center gap-2\">\n <div className=\"h-2 flex-1 rounded-full bg-muted\">\n <div className=\"h-2 rounded-full bg-primary\" style={{ width: `${crop.progress}%` }} />\n </div>\n <span className=\"text-xs font-medium text-muted-foreground\">{crop.progress}%</span>\n </div>\n <div className=\"mt-1.5 flex items-center justify-between\">\n <StatusBadge label={crop.healthStatus} variant={healthVariant(crop.healthStatus)} />\n <span className=\"text-xs text-muted-foreground\">\n {crop.daysToHarvest}d {t('healthybowl.home.cropsCard.daysToHarvest', 'to harvest')}\n </span>\n </div>\n </div>\n ))}\n <button\n onClick={() => navigate(buildPath('crops'))}\n className=\"w-full rounded-md border border-border py-2 text-sm text-foreground hover:bg-muted/50\"\n >\n {t('healthybowl.home.cropsCard.viewAll', 'View All Crops')}\n </button>\n </div>\n </ChartCard>\n\n {/* Alerts */}\n <ChartCard\n title={t('healthybowl.home.alertsCard.title', 'Alerts & Notifications')}\n description={`${alerts.filter((a) => !a.read).length} ${t('healthybowl.home.alertsCard.unread', 'unread')}`}\n actions={\n <button onClick={() => setAlertsExpanded(!alertsExpanded)} className=\"text-xs text-primary hover:underline\">\n {alertsExpanded\n ? t('healthybowl.home.alertsCard.showLess', 'Show less')\n : t('healthybowl.home.alertsCard.viewAll', 'View all')}\n </button>\n }\n >\n <div className=\"flex flex-col gap-3\">\n {visibleAlerts.map((alert) => (\n <div\n key={alert.id}\n onClick={() => {\n void markAlertRead(alert.id, true);\n if (alert.actionUrl) {\n navigate(alert.actionUrl);\n }\n }}\n className={cn(\n 'flex cursor-pointer items-start gap-3 rounded-md border p-3 transition-colors hover:bg-muted/50',\n alert.severity === 'critical' &&\n 'border-l-4 border-l-destructive border-t-border border-r-border border-b-border',\n alert.severity === 'warning' &&\n 'border-l-4 border-l-warning border-t-border border-r-border border-b-border',\n alert.severity === 'info' &&\n 'border-l-4 border-l-info border-t-border border-r-border border-b-border',\n !alert.read && 'bg-muted/50'\n )}\n >\n <AlertTriangle\n className={cn(\n 'mt-0.5 h-4 w-4 shrink-0',\n alert.severity === 'critical' && 'text-destructive',\n alert.severity === 'warning' && 'text-warning',\n alert.severity === 'info' && 'text-info'\n )}\n />\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex items-center gap-2\">\n <span className=\"text-sm font-medium text-foreground\">{alert.title}</span>\n <StatusBadge label={alert.severity} variant={severityVariant(alert.severity)} />\n </div>\n <p className=\"mt-0.5 text-xs text-muted-foreground\">{alert.message}</p>\n </div>\n </div>\n ))}\n </div>\n </ChartCard>\n </div>\n\n {/* Quick Actions */}\n <div className=\"rounded-lg border border-border bg-card p-6\">\n <div className=\"mb-4\">\n <h3 className=\"text-sm font-semibold text-foreground\">\n {t('healthybowl.home.quickActions.title', 'Quick Actions')}\n </h3>\n <p className=\"text-xs text-muted-foreground\">\n {t('healthybowl.home.quickActions.subtitle', 'Frequently used features to manage your farm efficiently')}\n </p>\n </div>\n <div className=\"grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-6\">\n {quickActions.map(({ label, icon: Icon, path, description }) => (\n <button\n key={label}\n onClick={() => navigate(path)}\n className=\"flex flex-col items-center gap-2 rounded-lg border border-border bg-background p-4 text-center transition-colors hover:bg-muted/50\"\n >\n <div className=\"rounded-full bg-primary/10 p-3\">\n <Icon className=\"h-5 w-5 text-primary\" />\n </div>\n <span className=\"text-sm font-medium text-foreground\">{label}</span>\n <span className=\"text-xs text-muted-foreground\">{description}</span>\n </button>\n ))}\n </div>\n </div>\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;AA2BA,IAAM,KAAmB,MAAqB;AAC5C,SAAQ,GAAR;EACE,KAAK,WACH,QAAO;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,EAAgB,EAAM,SAAS;WAAI,CAAA,CAC5E;aACN,kBAAC,KAAD;UAAG,WAAU;oBAAwC,EAAM;UAAY,CAAA,CACnE;WACF;UAjCC,EAAM,GAiCP,CACN;OACE,CAAA;MACI,CAAA;KACR;;GAGN,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,MAAD;MAAI,WAAU;gBACX,EAAE,uCAAuC,gBAAgB;MACvD,CAAA,EACL,kBAAC,KAAD;MAAG,WAAU;gBACV,EAAE,0CAA0C,2DAA2D;MACtG,CAAA,CACA;QACN,kBAAC,OAAD;KAAK,WAAU;eACZ,GAAa,KAAK,EAAE,UAAO,MAAM,GAAM,SAAM,qBAC5C,kBAAC,UAAD;MAEE,eAAe,EAAS,EAAK;MAC7B,WAAU;gBAHZ;OAKE,kBAAC,OAAD;QAAK,WAAU;kBACb,kBAAC,GAAD,EAAM,WAAU,wBAAyB,CAAA;QACrC,CAAA;OACN,kBAAC,QAAD;QAAM,WAAU;kBAAuC;QAAa,CAAA;OACpE,kBAAC,QAAD;QAAM,WAAU;kBAAiC;QAAmB,CAAA;OAC7D;QATF,EASE,CACT;KACE,CAAA,CACF;;GACK"}
|
|
@@ -130,7 +130,7 @@ function E() {
|
|
|
130
130
|
/* @__PURE__ */ C(u, {
|
|
131
131
|
dataKey: "revenue",
|
|
132
132
|
name: "Revenue",
|
|
133
|
-
fill: "
|
|
133
|
+
fill: "var(--color-success)",
|
|
134
134
|
radius: [
|
|
135
135
|
4,
|
|
136
136
|
4,
|
|
@@ -141,7 +141,7 @@ function E() {
|
|
|
141
141
|
/* @__PURE__ */ C(u, {
|
|
142
142
|
dataKey: "expenses",
|
|
143
143
|
name: "Expenses",
|
|
144
|
-
fill: "
|
|
144
|
+
fill: "var(--color-destructive)",
|
|
145
145
|
radius: [
|
|
146
146
|
4,
|
|
147
147
|
4,
|
|
@@ -196,7 +196,7 @@ function E() {
|
|
|
196
196
|
type: "monotone",
|
|
197
197
|
dataKey: "tomatoes",
|
|
198
198
|
name: "Tomatoes",
|
|
199
|
-
stroke: "
|
|
199
|
+
stroke: "var(--color-destructive)",
|
|
200
200
|
strokeWidth: 2,
|
|
201
201
|
dot: { r: 3 }
|
|
202
202
|
}),
|
|
@@ -204,7 +204,7 @@ function E() {
|
|
|
204
204
|
type: "monotone",
|
|
205
205
|
dataKey: "peppers",
|
|
206
206
|
name: "Peppers",
|
|
207
|
-
stroke: "
|
|
207
|
+
stroke: "var(--color-success)",
|
|
208
208
|
strokeWidth: 2,
|
|
209
209
|
dot: { r: 3 }
|
|
210
210
|
}),
|
|
@@ -212,7 +212,7 @@ function E() {
|
|
|
212
212
|
type: "monotone",
|
|
213
213
|
dataKey: "lettuce",
|
|
214
214
|
name: "Lettuce",
|
|
215
|
-
stroke: "
|
|
215
|
+
stroke: "var(--color-info)",
|
|
216
216
|
strokeWidth: 2,
|
|
217
217
|
dot: { r: 3 }
|
|
218
218
|
}),
|
|
@@ -220,7 +220,7 @@ function E() {
|
|
|
220
220
|
type: "monotone",
|
|
221
221
|
dataKey: "basil",
|
|
222
222
|
name: "Basil",
|
|
223
|
-
stroke: "
|
|
223
|
+
stroke: "var(--color-primary)",
|
|
224
224
|
strokeWidth: 2,
|
|
225
225
|
dot: { r: 3 }
|
|
226
226
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnalyticsDashboardPage.js","names":[],"sources":["../../../../src/healthybowl/pages/analytics/AnalyticsDashboardPage.tsx"],"sourcesContent":["import { useMemo, useState } from 'react';\nimport { BarChart3, Activity, TrendingUp, Layers } from 'lucide-react';\nimport {\n BarChart,\n Bar,\n XAxis,\n YAxis,\n CartesianGrid,\n Tooltip,\n Legend,\n ResponsiveContainer,\n LineChart,\n Line,\n} from 'recharts';\nimport { PageLayout, StatCard, ChartCard } from '../../components';\nimport { useHealthyBowlData } from '../../hooks/useHealthyBowlData';\nimport { cn, formatCurrency, formatNumber } from '../../utils/helpers';\n\nconst periods = ['Q1', 'Q2', 'Monthly'] as const;\n\nexport function AnalyticsDashboardPage() {\n const { analyticsKPIs, revenueChartData, yieldTrendData } = useHealthyBowlData();\n\n const [selectedPeriod, setSelectedPeriod] = useState<string>('Q1');\n\n // Derive performance metrics from actual KPI data\n const performanceMetrics = useMemo(() => {\n const revenueKpi = analyticsKPIs.find((k) => (k.label ?? '').toLowerCase().includes('revenue'));\n const expenseKpi = analyticsKPIs.find(\n (k) => (k.label ?? '').toLowerCase().includes('expense') || (k.label ?? '').toLowerCase().includes('cost')\n );\n const yieldKpi = analyticsKPIs.find((k) => (k.label ?? '').toLowerCase().includes('yield'));\n\n const totalRevenue = revenueKpi\n ? typeof revenueKpi.value === 'number'\n ? revenueKpi.value\n : parseFloat(String(revenueKpi.value)) || 0\n : 0;\n const totalExpenses = expenseKpi\n ? typeof expenseKpi.value === 'number'\n ? expenseKpi.value\n : parseFloat(String(expenseKpi.value)) || 0\n : 0;\n const efficiency = totalRevenue > 0 ? Math.round((1 - totalExpenses / totalRevenue) * 100) : 87;\n const yieldGrowth = yieldKpi?.change ?? 15;\n const costPerAcre = totalExpenses > 0 ? Math.round(totalExpenses / Math.max(analyticsKPIs.length, 1)) : 300;\n\n return [\n {\n label: 'Crop Efficiency',\n value: Math.max(0, Math.min(100, efficiency)),\n unit: '%',\n icon: <Activity className=\"h-4 w-4\" />,\n },\n {\n label: 'Resource Utilization',\n value: Math.max(0, Math.min(100, efficiency + 5)),\n unit: '%',\n icon: <Layers className=\"h-4 w-4\" />,\n },\n { label: 'Yield Growth', value: Math.round(yieldGrowth), unit: '%', icon: <TrendingUp className=\"h-4 w-4\" /> },\n {\n label: 'Cost per Acre',\n value: costPerAcre,\n unit: '',\n icon: <BarChart3 className=\"h-4 w-4\" />,\n prefix: '$' as const,\n },\n ];\n }, [analyticsKPIs]);\n\n // Filter chart data by period\n const filteredRevenueData = useMemo(() => {\n if (selectedPeriod === 'Q1') return revenueChartData.slice(0, 3);\n if (selectedPeriod === 'Q2') return revenueChartData.slice(3, 6);\n return revenueChartData; // Monthly = all\n }, [revenueChartData, selectedPeriod]);\n\n return (\n <PageLayout\n title=\"Analytics Dashboard\"\n description=\"Detailed farm performance analytics\"\n actions={\n <div className=\"flex items-center gap-1 rounded-lg border border-border bg-muted p-0.5\">\n {periods.map((p) => (\n <button\n key={p}\n onClick={() => setSelectedPeriod(p)}\n className={cn(\n 'rounded-md px-3 py-1 text-sm font-medium transition-colors',\n selectedPeriod === p\n ? 'bg-card text-foreground shadow-sm'\n : 'text-muted-foreground hover:text-foreground'\n )}\n >\n {p}\n </button>\n ))}\n </div>\n }\n >\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4\">\n {performanceMetrics.map((m) => (\n <StatCard key={m.label} label={m.label} value={m.value} unit={m.unit} prefix={m.prefix} icon={m.icon} />\n ))}\n </div>\n\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3\">\n {analyticsKPIs.slice(0, 3).map((kpi) => (\n <StatCard\n key={kpi.id}\n label={kpi.label}\n value={kpi.value}\n previousValue={kpi.previousValue}\n prefix={kpi.unit === '$' ? '$' : undefined}\n unit={kpi.unit !== '$' ? kpi.unit : undefined}\n trend={kpi.trend}\n change={kpi.change}\n />\n ))}\n </div>\n\n <ChartCard title=\"Revenue vs Expenses\" description={`Period: ${selectedPeriod}`}>\n <ResponsiveContainer width=\"100%\" height={280}>\n <BarChart data={filteredRevenueData} margin={{ top: 5, right: 20, left: 0, bottom: 5 }}>\n <CartesianGrid strokeDasharray=\"3 3\" className=\"stroke-border\" />\n <XAxis dataKey=\"month\" className=\"text-xs\" tick={{ fill: 'currentColor' }} />\n <YAxis\n className=\"text-xs\"\n tick={{ fill: 'currentColor' }}\n tickFormatter={(v) => `$${(v / 1000).toFixed(0)}k`}\n />\n <Tooltip\n formatter={(value: number) => formatCurrency(value)}\n contentStyle={{\n backgroundColor: 'var(--color-card)',\n border: '1px solid var(--color-border)',\n borderRadius: '8px',\n }}\n labelStyle={{ color: 'var(--color-foreground)' }}\n />\n <Legend />\n <Bar dataKey=\"revenue\" name=\"Revenue\" fill=\"#22c55e\" radius={[4, 4, 0, 0]} />\n <Bar dataKey=\"expenses\" name=\"Expenses\" fill=\"#f87171\" radius={[4, 4, 0, 0]} />\n </BarChart>\n </ResponsiveContainer>\n </ChartCard>\n\n <ChartCard title=\"Yield Trend by Crop\" description=\"Monthly yield in kg\">\n <ResponsiveContainer width=\"100%\" height={280}>\n <LineChart data={yieldTrendData} margin={{ top: 5, right: 20, left: 0, bottom: 5 }}>\n <CartesianGrid strokeDasharray=\"3 3\" className=\"stroke-border\" />\n <XAxis dataKey=\"month\" className=\"text-xs\" tick={{ fill: 'currentColor' }} />\n <YAxis className=\"text-xs\" tick={{ fill: 'currentColor' }} tickFormatter={(v) => `${v} kg`} />\n <Tooltip\n formatter={(value: number) => `${formatNumber(value)} kg`}\n contentStyle={{\n backgroundColor: 'var(--color-card)',\n border: '1px solid var(--color-border)',\n borderRadius: '8px',\n }}\n labelStyle={{ color: 'var(--color-foreground)' }}\n />\n <Legend />\n <Line type=\"monotone\" dataKey=\"tomatoes\" name=\"Tomatoes\" stroke=\"#ef4444\" strokeWidth={2} dot={{ r: 3 }} />\n <Line type=\"monotone\" dataKey=\"peppers\" name=\"Peppers\" stroke=\"#22c55e\" strokeWidth={2} dot={{ r: 3 }} />\n <Line type=\"monotone\" dataKey=\"lettuce\" name=\"Lettuce\" stroke=\"#3b82f6\" strokeWidth={2} dot={{ r: 3 }} />\n <Line type=\"monotone\" dataKey=\"basil\" name=\"Basil\" stroke=\"#8b5cf6\" strokeWidth={2} dot={{ r: 3 }} />\n </LineChart>\n </ResponsiveContainer>\n </ChartCard>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAkBA,IAAM,IAAU;CAAC;CAAM;CAAM;CAAU;AAEvC,SAAgB,IAAyB;CACvC,IAAM,EAAE,kBAAe,qBAAkB,sBA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AY,EAAE,OAAO,2BAA2B;QAChD,CAAA;OACF,kBAAC,GAAD,EAAU,CAAA;OACV,kBAAC,GAAD;QAAM,MAAK;QAAW,SAAQ;QAAW,MAAK;QAAW,QAAO;QAAU,aAAa;QAAG,KAAK,EAAE,GAAG,GAAG;QAAI,CAAA;OAC3G,kBAAC,GAAD;QAAM,MAAK;QAAW,SAAQ;QAAU,MAAK;QAAU,QAAO;QAAU,aAAa;QAAG,KAAK,EAAE,GAAG,GAAG;QAAI,CAAA;OACzG,kBAAC,GAAD;QAAM,MAAK;QAAW,SAAQ;QAAU,MAAK;QAAU,QAAO;QAAU,aAAa;QAAG,KAAK,EAAE,GAAG,GAAG;QAAI,CAAA;OACzG,kBAAC,GAAD;QAAM,MAAK;QAAW,SAAQ;QAAQ,MAAK;QAAQ,QAAO;QAAU,aAAa;QAAG,KAAK,EAAE,GAAG,GAAG;QAAI,CAAA;OAC3F;;KACQ,CAAA;IACZ,CAAA;GACD"}
|
|
1
|
+
{"version":3,"file":"AnalyticsDashboardPage.js","names":[],"sources":["../../../../src/healthybowl/pages/analytics/AnalyticsDashboardPage.tsx"],"sourcesContent":["import { useMemo, useState } from 'react';\nimport { BarChart3, Activity, TrendingUp, Layers } from 'lucide-react';\nimport {\n BarChart,\n Bar,\n XAxis,\n YAxis,\n CartesianGrid,\n Tooltip,\n Legend,\n ResponsiveContainer,\n LineChart,\n Line,\n} from 'recharts';\nimport { PageLayout, StatCard, ChartCard } from '../../components';\nimport { useHealthyBowlData } from '../../hooks/useHealthyBowlData';\nimport { cn, formatCurrency, formatNumber } from '../../utils/helpers';\n\nconst periods = ['Q1', 'Q2', 'Monthly'] as const;\n\nexport function AnalyticsDashboardPage() {\n const { analyticsKPIs, revenueChartData, yieldTrendData } = useHealthyBowlData();\n\n const [selectedPeriod, setSelectedPeriod] = useState<string>('Q1');\n\n // Derive performance metrics from actual KPI data\n const performanceMetrics = useMemo(() => {\n const revenueKpi = analyticsKPIs.find((k) => (k.label ?? '').toLowerCase().includes('revenue'));\n const expenseKpi = analyticsKPIs.find(\n (k) => (k.label ?? '').toLowerCase().includes('expense') || (k.label ?? '').toLowerCase().includes('cost')\n );\n const yieldKpi = analyticsKPIs.find((k) => (k.label ?? '').toLowerCase().includes('yield'));\n\n const totalRevenue = revenueKpi\n ? typeof revenueKpi.value === 'number'\n ? revenueKpi.value\n : parseFloat(String(revenueKpi.value)) || 0\n : 0;\n const totalExpenses = expenseKpi\n ? typeof expenseKpi.value === 'number'\n ? expenseKpi.value\n : parseFloat(String(expenseKpi.value)) || 0\n : 0;\n const efficiency = totalRevenue > 0 ? Math.round((1 - totalExpenses / totalRevenue) * 100) : 87;\n const yieldGrowth = yieldKpi?.change ?? 15;\n const costPerAcre = totalExpenses > 0 ? Math.round(totalExpenses / Math.max(analyticsKPIs.length, 1)) : 300;\n\n return [\n {\n label: 'Crop Efficiency',\n value: Math.max(0, Math.min(100, efficiency)),\n unit: '%',\n icon: <Activity className=\"h-4 w-4\" />,\n },\n {\n label: 'Resource Utilization',\n value: Math.max(0, Math.min(100, efficiency + 5)),\n unit: '%',\n icon: <Layers className=\"h-4 w-4\" />,\n },\n { label: 'Yield Growth', value: Math.round(yieldGrowth), unit: '%', icon: <TrendingUp className=\"h-4 w-4\" /> },\n {\n label: 'Cost per Acre',\n value: costPerAcre,\n unit: '',\n icon: <BarChart3 className=\"h-4 w-4\" />,\n prefix: '$' as const,\n },\n ];\n }, [analyticsKPIs]);\n\n // Filter chart data by period\n const filteredRevenueData = useMemo(() => {\n if (selectedPeriod === 'Q1') return revenueChartData.slice(0, 3);\n if (selectedPeriod === 'Q2') return revenueChartData.slice(3, 6);\n return revenueChartData; // Monthly = all\n }, [revenueChartData, selectedPeriod]);\n\n return (\n <PageLayout\n title=\"Analytics Dashboard\"\n description=\"Detailed farm performance analytics\"\n actions={\n <div className=\"flex items-center gap-1 rounded-lg border border-border bg-muted p-0.5\">\n {periods.map((p) => (\n <button\n key={p}\n onClick={() => setSelectedPeriod(p)}\n className={cn(\n 'rounded-md px-3 py-1 text-sm font-medium transition-colors',\n selectedPeriod === p\n ? 'bg-card text-foreground shadow-sm'\n : 'text-muted-foreground hover:text-foreground'\n )}\n >\n {p}\n </button>\n ))}\n </div>\n }\n >\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4\">\n {performanceMetrics.map((m) => (\n <StatCard key={m.label} label={m.label} value={m.value} unit={m.unit} prefix={m.prefix} icon={m.icon} />\n ))}\n </div>\n\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3\">\n {analyticsKPIs.slice(0, 3).map((kpi) => (\n <StatCard\n key={kpi.id}\n label={kpi.label}\n value={kpi.value}\n previousValue={kpi.previousValue}\n prefix={kpi.unit === '$' ? '$' : undefined}\n unit={kpi.unit !== '$' ? kpi.unit : undefined}\n trend={kpi.trend}\n change={kpi.change}\n />\n ))}\n </div>\n\n <ChartCard title=\"Revenue vs Expenses\" description={`Period: ${selectedPeriod}`}>\n <ResponsiveContainer width=\"100%\" height={280}>\n <BarChart data={filteredRevenueData} margin={{ top: 5, right: 20, left: 0, bottom: 5 }}>\n <CartesianGrid strokeDasharray=\"3 3\" className=\"stroke-border\" />\n <XAxis dataKey=\"month\" className=\"text-xs\" tick={{ fill: 'currentColor' }} />\n <YAxis\n className=\"text-xs\"\n tick={{ fill: 'currentColor' }}\n tickFormatter={(v) => `$${(v / 1000).toFixed(0)}k`}\n />\n <Tooltip\n formatter={(value: number) => formatCurrency(value)}\n contentStyle={{\n backgroundColor: 'var(--color-card)',\n border: '1px solid var(--color-border)',\n borderRadius: '8px',\n }}\n labelStyle={{ color: 'var(--color-foreground)' }}\n />\n <Legend />\n <Bar dataKey=\"revenue\" name=\"Revenue\" fill=\"var(--color-success)\" radius={[4, 4, 0, 0]} />\n <Bar dataKey=\"expenses\" name=\"Expenses\" fill=\"var(--color-destructive)\" radius={[4, 4, 0, 0]} />\n </BarChart>\n </ResponsiveContainer>\n </ChartCard>\n\n <ChartCard title=\"Yield Trend by Crop\" description=\"Monthly yield in kg\">\n <ResponsiveContainer width=\"100%\" height={280}>\n <LineChart data={yieldTrendData} margin={{ top: 5, right: 20, left: 0, bottom: 5 }}>\n <CartesianGrid strokeDasharray=\"3 3\" className=\"stroke-border\" />\n <XAxis dataKey=\"month\" className=\"text-xs\" tick={{ fill: 'currentColor' }} />\n <YAxis className=\"text-xs\" tick={{ fill: 'currentColor' }} tickFormatter={(v) => `${v} kg`} />\n <Tooltip\n formatter={(value: number) => `${formatNumber(value)} kg`}\n contentStyle={{\n backgroundColor: 'var(--color-card)',\n border: '1px solid var(--color-border)',\n borderRadius: '8px',\n }}\n labelStyle={{ color: 'var(--color-foreground)' }}\n />\n <Legend />\n <Line\n type=\"monotone\"\n dataKey=\"tomatoes\"\n name=\"Tomatoes\"\n stroke=\"var(--color-destructive)\"\n strokeWidth={2}\n dot={{ r: 3 }}\n />\n <Line\n type=\"monotone\"\n dataKey=\"peppers\"\n name=\"Peppers\"\n stroke=\"var(--color-success)\"\n strokeWidth={2}\n dot={{ r: 3 }}\n />\n <Line\n type=\"monotone\"\n dataKey=\"lettuce\"\n name=\"Lettuce\"\n stroke=\"var(--color-info)\"\n strokeWidth={2}\n dot={{ r: 3 }}\n />\n <Line\n type=\"monotone\"\n dataKey=\"basil\"\n name=\"Basil\"\n stroke=\"var(--color-primary)\"\n strokeWidth={2}\n dot={{ r: 3 }}\n />\n </LineChart>\n </ResponsiveContainer>\n </ChartCard>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAkBA,IAAM,IAAU;CAAC;CAAM;CAAM;CAAU;AAEvC,SAAgB,IAAyB;CACvC,IAAM,EAAE,kBAAe,qBAAkB,sBAAmB,GAAoB,EAE1E,CAAC,GAAgB,KAAqB,EAAiB,KAAK,EAG5D,IAAqB,QAAc;EACvC,IAAM,IAAa,EAAc,MAAM,OAAO,EAAE,SAAS,IAAI,aAAa,CAAC,SAAS,UAAU,CAAC,EACz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AG,GAAG;QACb,CAAA;OACF,kBAAC,GAAD;QACE,MAAK;QACL,SAAQ;QACR,MAAK;QACL,QAAO;QACP,aAAa;QACb,KAAK,EAAE,GAAG,GAAG;QACb,CAAA;OACF,kBAAC,GAAD;QACE,MAAK;QACL,SAAQ;QACR,MAAK;QACL,QAAO;QACP,aAAa;QACb,KAAK,EAAE,GAAG,GAAG;QACb,CAAA;OACF,kBAAC,GAAD;QACE,MAAK;QACL,SAAQ;QACR,MAAK;QACL,QAAO;QACP,aAAa;QACb,KAAK,EAAE,GAAG,GAAG;QACb,CAAA;OACQ;;KACQ,CAAA;IACZ,CAAA;GACD"}
|
|
@@ -86,11 +86,11 @@ function y() {
|
|
|
86
86
|
className: "flex w-full gap-0.5 items-end",
|
|
87
87
|
style: { height: "160px" },
|
|
88
88
|
children: [/* @__PURE__ */ g("div", {
|
|
89
|
-
className: "flex-1 rounded-t bg-
|
|
89
|
+
className: "flex-1 rounded-t bg-success/80",
|
|
90
90
|
style: { height: `${e.revenue / b * 100}%` },
|
|
91
91
|
title: `Revenue: ${t(e.revenue)}`
|
|
92
92
|
}), /* @__PURE__ */ g("div", {
|
|
93
|
-
className: "flex-1 rounded-t bg-
|
|
93
|
+
className: "flex-1 rounded-t bg-destructive/60",
|
|
94
94
|
style: { height: `${e.expenses / b * 100}%` },
|
|
95
95
|
title: `Expenses: ${t(e.expenses)}`
|
|
96
96
|
})]
|
|
@@ -103,10 +103,10 @@ function y() {
|
|
|
103
103
|
className: "mt-3 flex items-center gap-4 text-xs text-muted-foreground",
|
|
104
104
|
children: [/* @__PURE__ */ _("span", {
|
|
105
105
|
className: "flex items-center gap-1.5",
|
|
106
|
-
children: [/* @__PURE__ */ g("span", { className: "h-2.5 w-2.5 rounded-sm bg-
|
|
106
|
+
children: [/* @__PURE__ */ g("span", { className: "h-2.5 w-2.5 rounded-sm bg-success/80" }), " Revenue"]
|
|
107
107
|
}), /* @__PURE__ */ _("span", {
|
|
108
108
|
className: "flex items-center gap-1.5",
|
|
109
|
-
children: [/* @__PURE__ */ g("span", { className: "h-2.5 w-2.5 rounded-sm bg-
|
|
109
|
+
children: [/* @__PURE__ */ g("span", { className: "h-2.5 w-2.5 rounded-sm bg-destructive/60" }), " Expenses"]
|
|
110
110
|
})]
|
|
111
111
|
})]
|
|
112
112
|
}), /* @__PURE__ */ g(i, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnalyticsOverviewPage.js","names":[],"sources":["../../../../src/healthybowl/pages/analytics/AnalyticsOverviewPage.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { useBasePath } from '../../hooks/useBasePath';\nimport {\n DollarSign,\n TrendingDown,\n TrendingUp,\n Wheat,\n ShieldCheck,\n ShoppingCart,\n FileText,\n ArrowRight,\n} from 'lucide-react';\nimport { PageLayout, StatCard, ChartCard } from '../../components';\nimport { useHealthyBowlData } from '../../hooks/useHealthyBowlData';\nimport { formatCurrency } from '../../utils/helpers';\n\nconst kpiIcons = [\n <DollarSign className=\"h-4 w-4\" />,\n <TrendingDown className=\"h-4 w-4\" />,\n <TrendingUp className=\"h-4 w-4\" />,\n <Wheat className=\"h-4 w-4\" />,\n <ShieldCheck className=\"h-4 w-4\" />,\n <ShoppingCart className=\"h-4 w-4\" />,\n];\n\nexport function AnalyticsOverviewPage() {\n const { analyticsKPIs, revenueChartData, cropDistributionData } = useHealthyBowlData();\n const navigate = useNavigate();\n const { buildPath } = useBasePath();\n\n const [period, setPeriod] = useState('6m');\n\n const maxRevenue = Math.max(...revenueChartData.map((d) => d.revenue));\n\n return (\n <PageLayout title=\"Analytics Overview\" description=\"Key performance metrics for your farm\">\n {/* Quick Navigation */}\n <div className=\"flex flex-wrap gap-3\">\n {[\n {\n label: 'Reports',\n icon: FileText,\n path: buildPath('analytics/reports'),\n desc: 'Generate and export reports',\n },\n ].map((item) => (\n <button\n key={item.label}\n type=\"button\"\n onClick={() => navigate(item.path)}\n className=\"flex items-center gap-3 rounded-lg border border-border bg-card px-4 py-3 text-left shadow-sm transition-colors hover:border-primary/30 hover:bg-accent\"\n >\n <item.icon className=\"h-5 w-5 text-muted-foreground\" />\n <div>\n <p className=\"text-sm font-medium text-foreground\">{item.label}</p>\n <p className=\"text-xs text-muted-foreground\">{item.desc}</p>\n </div>\n <ArrowRight className=\"ml-2 h-4 w-4 text-muted-foreground\" />\n </button>\n ))}\n </div>\n\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3\">\n {analyticsKPIs.map((kpi, i) => (\n <StatCard\n key={kpi.id}\n label={kpi.label}\n value={kpi.value}\n previousValue={kpi.previousValue}\n prefix={kpi.unit === '$' ? '$' : undefined}\n unit={kpi.unit !== '$' ? kpi.unit : undefined}\n trend={kpi.trend}\n change={kpi.change}\n icon={kpiIcons[i]}\n />\n ))}\n </div>\n\n <div className=\"flex gap-2\">\n {(['3m', '6m', '1y'] as const).map((p) => (\n <button\n key={p}\n onClick={() => setPeriod(p)}\n className={`rounded-md px-3 py-1.5 text-sm font-medium ${\n period === p\n ? 'bg-primary text-primary-foreground'\n : 'border border-border text-foreground hover:bg-muted/50'\n }`}\n >\n {p === '3m' ? '3 Months' : p === '6m' ? '6 Months' : '1 Year'}\n </button>\n ))}\n </div>\n\n <div className=\"grid grid-cols-1 gap-4 lg:grid-cols-2\">\n <ChartCard title=\"Revenue Trend\" description={`Last ${period}`}>\n <div className=\"flex items-end gap-2 h-48\">\n {revenueChartData.map((d) => (\n <div key={d.month} className=\"flex flex-1 flex-col items-center gap-1\">\n <div className=\"flex w-full gap-0.5 items-end\" style={{ height: '160px' }}>\n <div\n className=\"flex-1 rounded-t bg-
|
|
1
|
+
{"version":3,"file":"AnalyticsOverviewPage.js","names":[],"sources":["../../../../src/healthybowl/pages/analytics/AnalyticsOverviewPage.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { useBasePath } from '../../hooks/useBasePath';\nimport {\n DollarSign,\n TrendingDown,\n TrendingUp,\n Wheat,\n ShieldCheck,\n ShoppingCart,\n FileText,\n ArrowRight,\n} from 'lucide-react';\nimport { PageLayout, StatCard, ChartCard } from '../../components';\nimport { useHealthyBowlData } from '../../hooks/useHealthyBowlData';\nimport { formatCurrency } from '../../utils/helpers';\n\nconst kpiIcons = [\n <DollarSign className=\"h-4 w-4\" />,\n <TrendingDown className=\"h-4 w-4\" />,\n <TrendingUp className=\"h-4 w-4\" />,\n <Wheat className=\"h-4 w-4\" />,\n <ShieldCheck className=\"h-4 w-4\" />,\n <ShoppingCart className=\"h-4 w-4\" />,\n];\n\nexport function AnalyticsOverviewPage() {\n const { analyticsKPIs, revenueChartData, cropDistributionData } = useHealthyBowlData();\n const navigate = useNavigate();\n const { buildPath } = useBasePath();\n\n const [period, setPeriod] = useState('6m');\n\n const maxRevenue = Math.max(...revenueChartData.map((d) => d.revenue));\n\n return (\n <PageLayout title=\"Analytics Overview\" description=\"Key performance metrics for your farm\">\n {/* Quick Navigation */}\n <div className=\"flex flex-wrap gap-3\">\n {[\n {\n label: 'Reports',\n icon: FileText,\n path: buildPath('analytics/reports'),\n desc: 'Generate and export reports',\n },\n ].map((item) => (\n <button\n key={item.label}\n type=\"button\"\n onClick={() => navigate(item.path)}\n className=\"flex items-center gap-3 rounded-lg border border-border bg-card px-4 py-3 text-left shadow-sm transition-colors hover:border-primary/30 hover:bg-accent\"\n >\n <item.icon className=\"h-5 w-5 text-muted-foreground\" />\n <div>\n <p className=\"text-sm font-medium text-foreground\">{item.label}</p>\n <p className=\"text-xs text-muted-foreground\">{item.desc}</p>\n </div>\n <ArrowRight className=\"ml-2 h-4 w-4 text-muted-foreground\" />\n </button>\n ))}\n </div>\n\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3\">\n {analyticsKPIs.map((kpi, i) => (\n <StatCard\n key={kpi.id}\n label={kpi.label}\n value={kpi.value}\n previousValue={kpi.previousValue}\n prefix={kpi.unit === '$' ? '$' : undefined}\n unit={kpi.unit !== '$' ? kpi.unit : undefined}\n trend={kpi.trend}\n change={kpi.change}\n icon={kpiIcons[i]}\n />\n ))}\n </div>\n\n <div className=\"flex gap-2\">\n {(['3m', '6m', '1y'] as const).map((p) => (\n <button\n key={p}\n onClick={() => setPeriod(p)}\n className={`rounded-md px-3 py-1.5 text-sm font-medium ${\n period === p\n ? 'bg-primary text-primary-foreground'\n : 'border border-border text-foreground hover:bg-muted/50'\n }`}\n >\n {p === '3m' ? '3 Months' : p === '6m' ? '6 Months' : '1 Year'}\n </button>\n ))}\n </div>\n\n <div className=\"grid grid-cols-1 gap-4 lg:grid-cols-2\">\n <ChartCard title=\"Revenue Trend\" description={`Last ${period}`}>\n <div className=\"flex items-end gap-2 h-48\">\n {revenueChartData.map((d) => (\n <div key={d.month} className=\"flex flex-1 flex-col items-center gap-1\">\n <div className=\"flex w-full gap-0.5 items-end\" style={{ height: '160px' }}>\n <div\n className=\"flex-1 rounded-t bg-success/80\"\n style={{ height: `${(d.revenue / maxRevenue) * 100}%` }}\n title={`Revenue: ${formatCurrency(d.revenue)}`}\n />\n <div\n className=\"flex-1 rounded-t bg-destructive/60\"\n style={{ height: `${(d.expenses / maxRevenue) * 100}%` }}\n title={`Expenses: ${formatCurrency(d.expenses)}`}\n />\n </div>\n <span className=\"text-xs text-muted-foreground\">{d.month}</span>\n </div>\n ))}\n </div>\n <div className=\"mt-3 flex items-center gap-4 text-xs text-muted-foreground\">\n <span className=\"flex items-center gap-1.5\">\n <span className=\"h-2.5 w-2.5 rounded-sm bg-success/80\" /> Revenue\n </span>\n <span className=\"flex items-center gap-1.5\">\n <span className=\"h-2.5 w-2.5 rounded-sm bg-destructive/60\" /> Expenses\n </span>\n </div>\n </ChartCard>\n\n <ChartCard title=\"Crop Distribution\" description=\"By category\">\n <div className=\"space-y-3 py-2\">\n {cropDistributionData.map((d) => (\n <div key={d.name} className=\"space-y-1\">\n <div className=\"flex items-center justify-between text-sm\">\n <span className=\"text-foreground\">{d.name}</span>\n <span className=\"text-muted-foreground\">{d.value}%</span>\n </div>\n <div className=\"h-2 w-full rounded-full bg-muted\">\n <div className=\"h-2 rounded-full\" style={{ width: `${d.value}%`, backgroundColor: d.color }} />\n </div>\n </div>\n ))}\n </div>\n </ChartCard>\n </div>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAiBA,IAAM,IAAW;CACf,kBAAC,GAAD,EAAY,WAAU,WAAY,CAAA;CAClC,kBAAC,GAAD,EAAc,WAAU,WAAY,CAAA;CACpC,kBAAC,GAAD,EAAY,WAAU,WAAY,CAAA;CAClC,kBAAC,GAAD,EAAO,WAAU,WAAY,CAAA;CAC7B,kBAAC,GAAD,EAAa,WAAU,WAAY,CAAA;CACnC,kBAAC,GAAD,EAAc,WAAU,WAAY,CAAA;CACrC;AAED,SAAgB,IAAwB;CACtC,IAAM,EAAE,kBAAe,qBAAkB,4BAAyB,GAAoB,EAChF,IAAW,GAAa,EACxB,EAAE,iBAAc,GAAa,EAE7B,CAAC,GAAQ,KAAa,EAAS,KAAK,EAEpC,IAAa,KAAK,IAAI,GAAG,EAAiB,KAAK,MAAM,EAAE,QAAQ,CAAC;AAEtE,QACE,kBAAC,GAAD;EAAY,OAAM;EAAqB,aAAY;YAAnD;GAEE,kBAAC,OAAD;IAAK,WAAU;cACZ,CACC;KACE,OAAO;KACP,MAAM;KACN,MAAM,EAAU,oBAAoB;KACpC,MAAM;KACP,CACF,CAAC,KAAK,MACL,kBAAC,UAAD;KAEE,MAAK;KACL,eAAe,EAAS,EAAK,KAAK;KAClC,WAAU;eAJZ;MAME,kBAAC,EAAK,MAAN,EAAW,WAAU,iCAAkC,CAAA;MACvD,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,KAAD;OAAG,WAAU;iBAAuC,EAAK;OAAU,CAAA,EACnE,kBAAC,KAAD;OAAG,WAAU;iBAAiC,EAAK;OAAS,CAAA,CACxD,EAAA,CAAA;MACN,kBAAC,GAAD,EAAY,WAAU,sCAAuC,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OAAD;MAAK,WAAU;gBAAf,CACE,kBAAC,QAAD;OAAM,WAAU;iBAAhB,CACE,kBAAC,QAAD,EAAM,WAAU,wCAAyC,CAAA,EAAA,WACpD;UACP,kBAAC,QAAD;OAAM,WAAU;iBAAhB,CACE,kBAAC,QAAD,EAAM,WAAU,4CAA6C,CAAA,EAAA,YACxD;SACH;QACI;QAEZ,kBAAC,GAAD;KAAW,OAAM;KAAoB,aAAY;eAC/C,kBAAC,OAAD;MAAK,WAAU;gBACZ,EAAqB,KAAK,MACzB,kBAAC,OAAD;OAAkB,WAAU;iBAA5B,CACE,kBAAC,OAAD;QAAK,WAAU;kBAAf,CACE,kBAAC,QAAD;SAAM,WAAU;mBAAmB,EAAE;SAAY,CAAA,EACjD,kBAAC,QAAD;SAAM,WAAU;mBAAhB,CAAyC,EAAE,OAAM,IAAQ;WACrD;WACN,kBAAC,OAAD;QAAK,WAAU;kBACb,kBAAC,OAAD;SAAK,WAAU;SAAmB,OAAO;UAAE,OAAO,GAAG,EAAE,MAAM;UAAI,iBAAiB,EAAE;UAAO;SAAI,CAAA;QAC3F,CAAA,CACF;SARI,EAAE,KAQN,CACN;MACE,CAAA;KACI,CAAA,CACR;;GACK"}
|
|
@@ -115,7 +115,7 @@ var m = (e) => {
|
|
|
115
115
|
key: "criticalFindings",
|
|
116
116
|
header: "Critical",
|
|
117
117
|
render: (e) => /* @__PURE__ */ f("span", {
|
|
118
|
-
className: e.criticalFindings > 0 ? "font-medium text-
|
|
118
|
+
className: e.criticalFindings > 0 ? "font-medium text-destructive" : "text-foreground",
|
|
119
119
|
children: e.criticalFindings
|
|
120
120
|
})
|
|
121
121
|
},
|
|
@@ -126,7 +126,7 @@ var m = (e) => {
|
|
|
126
126
|
className: "text-muted-foreground",
|
|
127
127
|
children: "-"
|
|
128
128
|
}) : /* @__PURE__ */ p("span", {
|
|
129
|
-
className: e.score >= 90 ? "font-medium text-
|
|
129
|
+
className: e.score >= 90 ? "font-medium text-success" : "text-foreground",
|
|
130
130
|
children: [e.score, "%"]
|
|
131
131
|
})
|
|
132
132
|
}
|
|
@@ -190,7 +190,7 @@ var m = (e) => {
|
|
|
190
190
|
className: "text-muted-foreground",
|
|
191
191
|
children: "Critical: "
|
|
192
192
|
}), /* @__PURE__ */ f("span", {
|
|
193
|
-
className: O.criticalFindings > 0 ? "font-medium text-
|
|
193
|
+
className: O.criticalFindings > 0 ? "font-medium text-destructive" : "text-foreground",
|
|
194
194
|
children: O.criticalFindings
|
|
195
195
|
})] })
|
|
196
196
|
]
|