@burdenoff/microfe-movethewheels 2026.805.1 → 2026.827.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.
Files changed (67) hide show
  1. package/dist/components/CarbonFootprintPanel.js +108 -0
  2. package/dist/components/index.js +1 -0
  3. package/dist/generated/wspace-operations.d.ts +168 -912
  4. package/dist/generated/wspace-types.d.ts +78432 -35831
  5. package/dist/hooks/useAnalytics.js +45 -4
  6. package/dist/hooks/useFleet.js +142 -74
  7. package/dist/hooks/useInventory.js +163 -70
  8. package/dist/hooks/useOrders.js +2 -2
  9. package/dist/hooks/useTracking.js +5 -5
  10. package/dist/index.js +33 -32
  11. package/dist/movethewheels/components/CarbonFootprintPanel.d.ts +7 -0
  12. package/dist/movethewheels/components/index.d.ts +1 -0
  13. package/dist/movethewheels/hooks/index.d.ts +3 -3
  14. package/dist/movethewheels/hooks/useAnalytics.d.ts +22 -0
  15. package/dist/movethewheels/hooks/useFleet.d.ts +32 -1
  16. package/dist/movethewheels/hooks/useInventory.d.ts +67 -12
  17. package/dist/movethewheels/hooks/useOrders.d.ts +25 -2
  18. package/dist/movethewheels/types/index.d.ts +2 -0
  19. package/dist/node_modules/lucide-react/dist/esm/icons/arrow-down-right.js +11 -0
  20. package/dist/node_modules/lucide-react/dist/esm/icons/arrow-left-right.js +22 -0
  21. package/dist/node_modules/lucide-react/dist/esm/icons/arrow-up-right.js +11 -0
  22. package/dist/node_modules/lucide-react/dist/esm/icons/calendar-clock.js +32 -0
  23. package/dist/node_modules/lucide-react/dist/esm/icons/history.js +18 -0
  24. package/dist/node_modules/lucide-react/dist/esm/icons/leaf.js +11 -0
  25. package/dist/node_modules/lucide-react/dist/esm/icons/lock.js +16 -0
  26. package/dist/node_modules/lucide-react/dist/esm/icons/user-round.js +13 -0
  27. package/dist/pages/AnalyticsPage.js +81 -79
  28. package/dist/pages/CreateOrderPage.js +246 -195
  29. package/dist/pages/DeliveryCapturePage.js +91 -78
  30. package/dist/pages/DriversPage.js +202 -108
  31. package/dist/pages/InventoryPage.js +356 -131
  32. package/dist/pages/ProductDetailsPage.js +212 -156
  33. package/dist/pages/VehicleDetailsPage.js +257 -193
  34. package/dist/utils/formatters.js +4 -1
  35. package/package.json +1 -1
  36. package/src/generated/wspace-operations.ts +134 -929
  37. package/src/generated/wspace-types.ts +91730 -40059
  38. package/src/movethewheels/components/CarbonFootprintPanel.tsx +133 -0
  39. package/src/movethewheels/components/UpcomingDemandPanel.tsx +20 -11
  40. package/src/movethewheels/components/index.ts +3 -0
  41. package/src/movethewheels/hooks/index.ts +11 -0
  42. package/src/movethewheels/hooks/useAnalytics.ts +86 -0
  43. package/src/movethewheels/hooks/useDemandForecast.ts +10 -4
  44. package/src/movethewheels/hooks/useFleet.ts +133 -3
  45. package/src/movethewheels/hooks/useInventory.ts +311 -53
  46. package/src/movethewheels/hooks/useOrders.ts +31 -7
  47. package/src/movethewheels/hooks/useTracking.ts +14 -14
  48. package/src/movethewheels/pages/AnalyticsPage.tsx +5 -5
  49. package/src/movethewheels/pages/CreateOrderPage.tsx +67 -10
  50. package/src/movethewheels/pages/DeliveryCapturePage.tsx +8 -0
  51. package/src/movethewheels/pages/DriversPage.tsx +181 -31
  52. package/src/movethewheels/pages/InventoryPage.tsx +299 -19
  53. package/src/movethewheels/pages/ProductDetailsPage.tsx +68 -3
  54. package/src/movethewheels/pages/VehicleDetailsPage.tsx +86 -27
  55. package/src/movethewheels/types/index.ts +2 -0
  56. package/src/operations/wspace/movethewheels/fragments/core.graphql +23 -53
  57. package/src/operations/wspace/movethewheels/fragments/core.withdrawn.graphql +59 -0
  58. package/src/operations/wspace/movethewheels/mutations/entities.graphql +5 -5
  59. package/src/operations/wspace/movethewheels/mutations/marketplace-reports.graphql +18 -78
  60. package/src/operations/wspace/movethewheels/mutations/marketplace-reports.withdrawn.graphql +93 -0
  61. package/src/operations/wspace/movethewheels/mutations/orders.graphql +7 -7
  62. package/src/operations/wspace/movethewheels/queries/dashboard.graphql +3 -3
  63. package/src/operations/wspace/movethewheels/queries/entities.graphql +3 -3
  64. package/src/operations/wspace/movethewheels/queries/logistics.graphql +3 -3
  65. package/src/operations/wspace/movethewheels/queries/marketplace-reports.withdrawn.graphql +58 -0
  66. package/src/operations/wspace/movethewheels/queries/orders.graphql +3 -3
  67. package/src/operations/wspace/movethewheels/queries/marketplace-reports.graphql +0 -40
@@ -0,0 +1,108 @@
1
+ import { Leaf as e } from "../node_modules/lucide-react/dist/esm/icons/leaf.js";
2
+ import { Truck as t } from "../node_modules/lucide-react/dist/esm/icons/truck.js";
3
+ import { useEmissionsSummary as n } from "../hooks/useAnalytics.js";
4
+ import { Card as r, CardContent as i, CardHeader as a, CardTitle as o } from "./ui.js";
5
+ import { MetricCard as s, MetricGrid as c } from "./MetricCard.js";
6
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
7
+ //#region src/movethewheels/components/CarbonFootprintPanel.tsx
8
+ function d(e) {
9
+ return e >= 1e3 ? `${(e / 1e3).toFixed(2)} t` : `${e.toFixed(1)} kg`;
10
+ }
11
+ function f(e) {
12
+ return e >= 1e3 ? `${(e / 1e3).toFixed(1)}k km` : `${e.toFixed(1)} km`;
13
+ }
14
+ function p() {
15
+ let { summary: p, isLoading: m, error: h } = n();
16
+ if (h) return /* @__PURE__ */ l(r, {
17
+ className: "border-status-error-border",
18
+ children: /* @__PURE__ */ l(i, {
19
+ className: "p-6 text-center",
20
+ children: /* @__PURE__ */ l("p", {
21
+ className: "text-sm text-status-error-text",
22
+ children: "Couldn't load emissions data"
23
+ })
24
+ })
25
+ });
26
+ if (m) return /* @__PURE__ */ u(r, { children: [/* @__PURE__ */ l(a, { children: /* @__PURE__ */ u(o, {
27
+ className: "flex items-center gap-2",
28
+ children: [/* @__PURE__ */ l(e, {
29
+ size: 18,
30
+ className: "text-status-success-text"
31
+ }), "Carbon footprint"]
32
+ }) }), /* @__PURE__ */ l(i, { children: /* @__PURE__ */ l(c, {
33
+ columns: 3,
34
+ children: Array.from({ length: 3 }).map((e, t) => /* @__PURE__ */ l("div", { className: "h-24 rounded-xl bg-bg-sunken motion-safe:animate-pulse" }, t))
35
+ }) })] });
36
+ let g = p.totalDistanceKm > 0;
37
+ return /* @__PURE__ */ u(r, { children: [/* @__PURE__ */ l(a, { children: /* @__PURE__ */ u(o, {
38
+ className: "flex items-center gap-2",
39
+ children: [/* @__PURE__ */ l(e, {
40
+ size: 18,
41
+ className: "text-status-success-text"
42
+ }), "Carbon footprint"]
43
+ }) }), /* @__PURE__ */ u(i, {
44
+ className: "space-y-6",
45
+ children: [
46
+ /* @__PURE__ */ u(c, {
47
+ columns: 3,
48
+ children: [
49
+ /* @__PURE__ */ l(s, {
50
+ label: "Total CO2e",
51
+ value: d(p.totalCo2eKg),
52
+ icon: /* @__PURE__ */ l(e, { size: 20 }),
53
+ accent: "success"
54
+ }),
55
+ /* @__PURE__ */ l(s, {
56
+ label: "Total distance",
57
+ value: f(p.totalDistanceKm),
58
+ icon: /* @__PURE__ */ l(t, { size: 20 }),
59
+ accent: "blue"
60
+ }),
61
+ /* @__PURE__ */ l(s, {
62
+ label: "Avg intensity",
63
+ value: `${(p.averageCo2eKgPerKm * 1e3).toFixed(1)} g/km`,
64
+ icon: /* @__PURE__ */ l(e, { size: 20 }),
65
+ accent: "warning"
66
+ })
67
+ ]
68
+ }),
69
+ g && p.byVehicle.length > 0 && /* @__PURE__ */ u("div", {
70
+ className: "space-y-3",
71
+ children: [/* @__PURE__ */ l("h4", {
72
+ className: "text-sm font-medium text-text-secondary",
73
+ children: "By vehicle"
74
+ }), /* @__PURE__ */ l("div", {
75
+ className: "space-y-2",
76
+ children: p.byVehicle.filter((e) => e.totalDistanceKm > 0 || e.co2eKg > 0).slice(0, 5).map((e) => /* @__PURE__ */ u("div", {
77
+ className: "flex items-center justify-between rounded-lg bg-bg-sunken px-3 py-2",
78
+ children: [/* @__PURE__ */ u("div", {
79
+ className: "flex items-center gap-2",
80
+ children: [/* @__PURE__ */ l(t, {
81
+ size: 16,
82
+ className: "text-text-secondary"
83
+ }), /* @__PURE__ */ l("span", {
84
+ className: "text-sm font-medium text-text-primary",
85
+ children: e.vehicleNumber ?? "Unassigned"
86
+ })]
87
+ }), /* @__PURE__ */ u("div", {
88
+ className: "text-right",
89
+ children: [/* @__PURE__ */ l("p", {
90
+ className: "text-sm font-medium text-text-primary",
91
+ children: d(e.co2eKg)
92
+ }), /* @__PURE__ */ l("p", {
93
+ className: "text-xs text-text-secondary",
94
+ children: f(e.totalDistanceKm)
95
+ })]
96
+ })]
97
+ }, e.vehicleId ?? "unassigned"))
98
+ })]
99
+ }),
100
+ !g && /* @__PURE__ */ l("p", {
101
+ className: "text-sm text-text-secondary",
102
+ children: "No route distance recorded yet. Assign vehicles and distances to routes to see emissions estimates."
103
+ })
104
+ ]
105
+ })] });
106
+ }
107
+ //#endregion
108
+ export { p as CarbonFootprintPanel };
@@ -20,3 +20,4 @@ import "./DataTable.js";
20
20
  import "./FormError.js";
21
21
  import "./Notice.js";
22
22
  import "./DocumentsCard.js";
23
+ import "./CarbonFootprintPanel.js";