@burdenoff/microfe-healthybowl 2026.1010.2 → 2026.1013.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/CreateFarmTaskButton.js +48 -44
- package/dist/healthybowl/pages/tasks/JobCardPage.js +106 -106
- package/dist/healthybowl/pages/tasks/TasksPage.js +131 -82
- package/dist/healthybowl/pages/tasks/defaultTaskProjectResolver.js +37 -0
- package/dist/healthybowl/pages/tasks/useDefaultTaskProject.js +49 -55
- package/package.json +2 -2
|
@@ -4,41 +4,41 @@ import { useToast as n } from "../hooks/useToast.js";
|
|
|
4
4
|
import { CreateTaskCore as r } from "../../node_modules/@burdenoff/planmagnet-fe-sdk/dist/index.js";
|
|
5
5
|
import { useDefaultTaskProject as i } from "../pages/tasks/useDefaultTaskProject.js";
|
|
6
6
|
import { useCanManageTasks as a } from "../pages/tasks/useCanManageTasks.js";
|
|
7
|
-
import { useCallback as o,
|
|
8
|
-
import { ClipboardList as
|
|
9
|
-
import { Fragment as
|
|
10
|
-
import { Button as
|
|
11
|
-
import { gql as
|
|
12
|
-
import { ApolloProvider as
|
|
13
|
-
import { useSafeGatewayClient as
|
|
7
|
+
import { useCallback as o, useEffect as s, useState as c } from "react";
|
|
8
|
+
import { ClipboardList as l } from "lucide-react";
|
|
9
|
+
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
10
|
+
import { Button as p } from "@burdenoff/fe-libs/ui";
|
|
11
|
+
import { gql as m } from "@apollo/client";
|
|
12
|
+
import { ApolloProvider as h, useMutation as g } from "@apollo/client/react";
|
|
13
|
+
import { useSafeGatewayClient as _ } from "@burdenoff/fe-libs/shared/graphql";
|
|
14
14
|
//#region src/healthybowl/components/CreateFarmTaskButton.tsx
|
|
15
|
-
var
|
|
15
|
+
var v = m`
|
|
16
16
|
mutation HealthyBowlLinkWorkItem($input: PlanmagnetCreateWorkItemLinkInput!) {
|
|
17
17
|
planmagnetLinkWorkItem(input: $input) {
|
|
18
18
|
id
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
`,
|
|
22
|
-
let S =
|
|
23
|
-
return !S || !w ? null : /* @__PURE__ */
|
|
24
|
-
variant:
|
|
25
|
-
size:
|
|
21
|
+
`, y = ({ entityType: n, entityId: r, entityLabel: i, label: o = "Create Task", variant: s = "outline", size: m, iconOnly: g, title: v, className: y, icon: x }) => {
|
|
22
|
+
let S = _("workspace"), { workspaceId: C } = e(), { canManage: w } = a(C), [T, E] = c(!1);
|
|
23
|
+
return !S || !w ? null : /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ f(p, {
|
|
24
|
+
variant: s,
|
|
25
|
+
size: m,
|
|
26
26
|
onClick: () => E(!0),
|
|
27
|
-
className:
|
|
28
|
-
title: v ?? (
|
|
29
|
-
"aria-label":
|
|
30
|
-
children: [x ?? /* @__PURE__ */
|
|
27
|
+
className: y,
|
|
28
|
+
title: v ?? (g ? o : void 0),
|
|
29
|
+
"aria-label": g ? v ?? o : void 0,
|
|
30
|
+
children: [x ?? /* @__PURE__ */ d(l, {
|
|
31
31
|
className: "size-4",
|
|
32
32
|
"aria-hidden": "true"
|
|
33
|
-
}), !
|
|
34
|
-
}), /* @__PURE__ */
|
|
33
|
+
}), !g && o]
|
|
34
|
+
}), /* @__PURE__ */ d(t, {
|
|
35
35
|
open: T,
|
|
36
36
|
onClose: () => E(!1),
|
|
37
37
|
title: "Create Farm Task",
|
|
38
38
|
description: `Create a task linked to ${i}.`,
|
|
39
|
-
children: /* @__PURE__ */
|
|
39
|
+
children: /* @__PURE__ */ d(h, {
|
|
40
40
|
client: S,
|
|
41
|
-
children: /* @__PURE__ */
|
|
41
|
+
children: /* @__PURE__ */ d(b, {
|
|
42
42
|
client: S,
|
|
43
43
|
entityType: n,
|
|
44
44
|
entityId: r,
|
|
@@ -47,57 +47,61 @@ var _ = p`
|
|
|
47
47
|
})
|
|
48
48
|
})
|
|
49
49
|
})] });
|
|
50
|
-
},
|
|
51
|
-
let { workspaceId:
|
|
50
|
+
}, b = ({ client: t, entityType: a, entityId: c, entityLabel: l, onDone: u }) => {
|
|
51
|
+
let { workspaceId: p, currentUser: m } = e(), { projectId: h, loading: _, error: y, ensureProject: b } = i(t, p, m?.id);
|
|
52
|
+
s(() => {
|
|
53
|
+
b();
|
|
54
|
+
}, [b]);
|
|
55
|
+
let [x] = g(v), { toast: S } = n(), C = o(async (e) => {
|
|
52
56
|
try {
|
|
53
|
-
await
|
|
57
|
+
await x({ variables: { input: {
|
|
54
58
|
workItemId: e.id,
|
|
55
59
|
sourceProduct: "healthybowl",
|
|
56
60
|
entityType: a,
|
|
57
|
-
entityId:
|
|
58
|
-
displayNameSnapshot:
|
|
61
|
+
entityId: c,
|
|
62
|
+
displayNameSnapshot: l,
|
|
59
63
|
deepLinkSnapshot: window.location.pathname + window.location.search
|
|
60
|
-
} } }),
|
|
64
|
+
} } }), S({
|
|
61
65
|
title: "Task created",
|
|
62
|
-
description: `Linked to ${
|
|
66
|
+
description: `Linked to ${l}.`,
|
|
63
67
|
variant: "success"
|
|
64
68
|
});
|
|
65
69
|
} catch {
|
|
66
|
-
|
|
70
|
+
S({
|
|
67
71
|
title: "Task created",
|
|
68
72
|
description: "Saved, but it could not be linked to this record.",
|
|
69
73
|
variant: "warning"
|
|
70
74
|
});
|
|
71
75
|
}
|
|
72
|
-
|
|
76
|
+
u();
|
|
73
77
|
}, [
|
|
74
|
-
|
|
78
|
+
x,
|
|
75
79
|
a,
|
|
76
|
-
s,
|
|
77
80
|
c,
|
|
78
|
-
|
|
79
|
-
|
|
81
|
+
l,
|
|
82
|
+
S,
|
|
83
|
+
u
|
|
80
84
|
]);
|
|
81
|
-
return
|
|
85
|
+
return y ? /* @__PURE__ */ f("p", {
|
|
82
86
|
className: "text-sm text-destructive",
|
|
83
|
-
children: ["Couldn't prepare the task project: ",
|
|
84
|
-
}) :
|
|
87
|
+
children: ["Couldn't prepare the task project: ", y.message]
|
|
88
|
+
}) : _ || !h ? /* @__PURE__ */ d("p", {
|
|
85
89
|
className: "text-sm text-muted-foreground",
|
|
86
90
|
children: "Preparing…"
|
|
87
|
-
}) : /* @__PURE__ */
|
|
88
|
-
workspaceId:
|
|
89
|
-
projectId:
|
|
91
|
+
}) : /* @__PURE__ */ d(r, {
|
|
92
|
+
workspaceId: p,
|
|
93
|
+
projectId: h,
|
|
90
94
|
hideHeader: !0,
|
|
91
|
-
defaultValues: { title: `${
|
|
95
|
+
defaultValues: { title: `${l}: ` },
|
|
92
96
|
hiddenFields: [
|
|
93
97
|
"type",
|
|
94
98
|
"storyPoints",
|
|
95
99
|
"labels"
|
|
96
100
|
],
|
|
97
101
|
submitLabel: "Create & link",
|
|
98
|
-
onCreated:
|
|
99
|
-
onCancel:
|
|
102
|
+
onCreated: C,
|
|
103
|
+
onCancel: u
|
|
100
104
|
});
|
|
101
105
|
};
|
|
102
106
|
//#endregion
|
|
103
|
-
export {
|
|
107
|
+
export { y as CreateFarmTaskButton };
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { useHealthyBowl as e } from "../../context/HealthyBowlContext.js";
|
|
2
2
|
import { PageLayout as t } from "../../components/PageLayout.js";
|
|
3
3
|
import { useBasePath as n } from "../../hooks/useBasePath.js";
|
|
4
|
-
import { EmptyState as
|
|
5
|
-
import { ErrorState as
|
|
6
|
-
import { PageLoader as
|
|
7
|
-
import { useDefaultTaskProject as
|
|
4
|
+
import { EmptyState as ee } from "../../components/EmptyState.js";
|
|
5
|
+
import { ErrorState as r } from "../../components/ErrorState.js";
|
|
6
|
+
import { PageLoader as i } from "../../components/PageLoader.js";
|
|
7
|
+
import { useDefaultTaskProject as a } from "./useDefaultTaskProject.js";
|
|
8
8
|
import "../../components/index.js";
|
|
9
|
-
import { todayDateParam as
|
|
10
|
-
import { useCallback as
|
|
11
|
-
import { ClipboardList as
|
|
12
|
-
import { useNavigate as
|
|
13
|
-
import { Fragment as
|
|
14
|
-
import { Button as
|
|
15
|
-
import { useSafeGatewayClient as
|
|
16
|
-
import { useWorkspaceDirectory as
|
|
9
|
+
import { todayDateParam as o, useJobCardTasks as s } from "./useJobCardTasks.js";
|
|
10
|
+
import { useCallback as c, useMemo as l } from "react";
|
|
11
|
+
import { ClipboardList as u, Printer as d } from "lucide-react";
|
|
12
|
+
import { useNavigate as f, useSearchParams as p } from "react-router";
|
|
13
|
+
import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
14
|
+
import { Button as _ } from "@burdenoff/fe-libs/ui";
|
|
15
|
+
import { useSafeGatewayClient as v } from "@burdenoff/fe-libs/shared/graphql";
|
|
16
|
+
import { useWorkspaceDirectory as y } from "@burdenoff/fe-libs/sharing";
|
|
17
17
|
//#region src/healthybowl/pages/tasks/JobCardPage.tsx
|
|
18
|
-
var
|
|
18
|
+
var b = [
|
|
19
19
|
"@media print {",
|
|
20
20
|
" body * { visibility: hidden; }",
|
|
21
21
|
" .hb-job-card-sheet, .hb-job-card-sheet * { visibility: visible; }",
|
|
@@ -32,7 +32,7 @@ var x = [
|
|
|
32
32
|
" }",
|
|
33
33
|
" .hb-job-card-task { break-inside: avoid; }",
|
|
34
34
|
"}"
|
|
35
|
-
].join("\n"),
|
|
35
|
+
].join("\n"), x = "h-9 rounded-md border border-border-subtle bg-bg-surface px-3 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]", S = (e) => {
|
|
36
36
|
if (!e) return "No due date";
|
|
37
37
|
let t = new Date(e);
|
|
38
38
|
return Number.isNaN(t.getTime()) ? e : t.toLocaleDateString(void 0, {
|
|
@@ -40,70 +40,70 @@ var x = [
|
|
|
40
40
|
month: "short",
|
|
41
41
|
year: "numeric"
|
|
42
42
|
});
|
|
43
|
-
},
|
|
43
|
+
}, C = (e) => {
|
|
44
44
|
if (!e || e <= 0) return null;
|
|
45
45
|
if (e < 60) return `${e} min`;
|
|
46
46
|
let t = e / 60;
|
|
47
47
|
return `${Number.isInteger(t) ? t : t.toFixed(1)} h`;
|
|
48
|
-
},
|
|
49
|
-
let n =
|
|
50
|
-
return /* @__PURE__ */
|
|
48
|
+
}, w = (e) => e.toLowerCase().split("_").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" "), T = ({ task: e, assigneeName: t }) => {
|
|
49
|
+
let n = C(e.estimateMinutes);
|
|
50
|
+
return /* @__PURE__ */ h("li", {
|
|
51
51
|
className: "hb-job-card-task rounded-lg border border-border-subtle p-4",
|
|
52
|
-
children: /* @__PURE__ */
|
|
52
|
+
children: /* @__PURE__ */ g("div", {
|
|
53
53
|
className: "flex items-start gap-3",
|
|
54
|
-
children: [/* @__PURE__ */
|
|
54
|
+
children: [/* @__PURE__ */ h("span", {
|
|
55
55
|
"aria-hidden": "true",
|
|
56
56
|
className: "mt-1 inline-block h-5 w-5 shrink-0 rounded-sm border-2 border-text-primary"
|
|
57
|
-
}), /* @__PURE__ */
|
|
57
|
+
}), /* @__PURE__ */ g("div", {
|
|
58
58
|
className: "min-w-0 flex-1",
|
|
59
59
|
children: [
|
|
60
|
-
/* @__PURE__ */
|
|
60
|
+
/* @__PURE__ */ g("div", {
|
|
61
61
|
className: "flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1",
|
|
62
|
-
children: [/* @__PURE__ */
|
|
62
|
+
children: [/* @__PURE__ */ h("h3", {
|
|
63
63
|
className: "text-base font-semibold text-text-primary",
|
|
64
64
|
children: e.title
|
|
65
|
-
}), /* @__PURE__ */
|
|
65
|
+
}), /* @__PURE__ */ h("span", {
|
|
66
66
|
className: "text-xs font-medium uppercase tracking-wide text-text-secondary",
|
|
67
67
|
children: e.key
|
|
68
68
|
})]
|
|
69
69
|
}),
|
|
70
|
-
/* @__PURE__ */
|
|
70
|
+
/* @__PURE__ */ g("div", {
|
|
71
71
|
className: "mt-1 flex flex-wrap gap-x-4 gap-y-1 text-xs text-text-secondary",
|
|
72
72
|
children: [
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
-
/* @__PURE__ */
|
|
73
|
+
/* @__PURE__ */ g("span", { children: [
|
|
74
|
+
/* @__PURE__ */ h("span", {
|
|
75
75
|
className: "font-medium text-text-primary",
|
|
76
76
|
children: "Due:"
|
|
77
77
|
}),
|
|
78
78
|
" ",
|
|
79
|
-
|
|
79
|
+
S(e.dueDate)
|
|
80
80
|
] }),
|
|
81
|
-
/* @__PURE__ */
|
|
82
|
-
/* @__PURE__ */
|
|
81
|
+
/* @__PURE__ */ g("span", { children: [
|
|
82
|
+
/* @__PURE__ */ h("span", {
|
|
83
83
|
className: "font-medium text-text-primary",
|
|
84
84
|
children: "Priority:"
|
|
85
85
|
}),
|
|
86
86
|
" ",
|
|
87
|
-
|
|
87
|
+
w(e.priority)
|
|
88
88
|
] }),
|
|
89
|
-
/* @__PURE__ */
|
|
90
|
-
/* @__PURE__ */
|
|
89
|
+
/* @__PURE__ */ g("span", { children: [
|
|
90
|
+
/* @__PURE__ */ h("span", {
|
|
91
91
|
className: "font-medium text-text-primary",
|
|
92
92
|
children: "Assignee:"
|
|
93
93
|
}),
|
|
94
94
|
" ",
|
|
95
95
|
t
|
|
96
96
|
] }),
|
|
97
|
-
n ? /* @__PURE__ */
|
|
98
|
-
/* @__PURE__ */
|
|
97
|
+
n ? /* @__PURE__ */ g("span", { children: [
|
|
98
|
+
/* @__PURE__ */ h("span", {
|
|
99
99
|
className: "font-medium text-text-primary",
|
|
100
100
|
children: "Estimate:"
|
|
101
101
|
}),
|
|
102
102
|
" ",
|
|
103
103
|
n
|
|
104
104
|
] }) : null,
|
|
105
|
-
e.labels.length > 0 ? /* @__PURE__ */
|
|
106
|
-
/* @__PURE__ */
|
|
105
|
+
e.labels.length > 0 ? /* @__PURE__ */ g("span", { children: [
|
|
106
|
+
/* @__PURE__ */ h("span", {
|
|
107
107
|
className: "font-medium text-text-primary",
|
|
108
108
|
children: "Labels:"
|
|
109
109
|
}),
|
|
@@ -112,28 +112,28 @@ var x = [
|
|
|
112
112
|
] }) : null
|
|
113
113
|
]
|
|
114
114
|
}),
|
|
115
|
-
e.description ? /* @__PURE__ */
|
|
115
|
+
e.description ? /* @__PURE__ */ g("div", {
|
|
116
116
|
className: "mt-3",
|
|
117
|
-
children: [/* @__PURE__ */
|
|
117
|
+
children: [/* @__PURE__ */ h("div", {
|
|
118
118
|
className: "text-xs font-semibold uppercase tracking-wide text-text-secondary",
|
|
119
119
|
children: "Instructions"
|
|
120
|
-
}), /* @__PURE__ */
|
|
120
|
+
}), /* @__PURE__ */ h("p", {
|
|
121
121
|
className: "mt-1 whitespace-pre-line text-sm text-text-primary",
|
|
122
122
|
children: e.description
|
|
123
123
|
})]
|
|
124
124
|
}) : null,
|
|
125
|
-
/* @__PURE__ */
|
|
125
|
+
/* @__PURE__ */ g("div", {
|
|
126
126
|
className: "mt-4 flex flex-wrap items-end gap-x-8 gap-y-2 border-t border-border-subtle pt-3 text-xs text-text-secondary",
|
|
127
127
|
children: [
|
|
128
|
-
/* @__PURE__ */
|
|
128
|
+
/* @__PURE__ */ g("span", { children: ["Completed by: ", /* @__PURE__ */ h("span", {
|
|
129
129
|
className: "inline-block w-48 border-b border-text-primary",
|
|
130
130
|
"aria-hidden": "true"
|
|
131
131
|
})] }),
|
|
132
|
-
/* @__PURE__ */
|
|
132
|
+
/* @__PURE__ */ g("span", { children: ["Signature: ", /* @__PURE__ */ h("span", {
|
|
133
133
|
className: "inline-block w-48 border-b border-text-primary",
|
|
134
134
|
"aria-hidden": "true"
|
|
135
135
|
})] }),
|
|
136
|
-
/* @__PURE__ */
|
|
136
|
+
/* @__PURE__ */ g("span", { children: ["Date: ", /* @__PURE__ */ h("span", {
|
|
137
137
|
className: "inline-block w-28 border-b border-text-primary",
|
|
138
138
|
"aria-hidden": "true"
|
|
139
139
|
})] })
|
|
@@ -143,139 +143,139 @@ var x = [
|
|
|
143
143
|
})]
|
|
144
144
|
})
|
|
145
145
|
});
|
|
146
|
-
},
|
|
147
|
-
let { workspaceId:
|
|
146
|
+
}, E = () => {
|
|
147
|
+
let { workspaceId: C, currentUser: w, authToken: E, apiGatewayUrl: D } = e(), O = v("workspace"), k = w?.id, A = f(), { buildPath: j } = n(), [M] = p(), N = M.get("item"), P = M.get("date") ?? o(), F = M.get("assignee") ?? void 0, { projectId: I, loading: L, resolved: R, error: z, retry: B } = a(O, C, k), V = l(() => N ? {
|
|
148
148
|
kind: "item",
|
|
149
|
-
itemId:
|
|
149
|
+
itemId: N
|
|
150
150
|
} : {
|
|
151
151
|
kind: "day",
|
|
152
|
-
date:
|
|
153
|
-
assigneeId:
|
|
152
|
+
date: P,
|
|
153
|
+
assigneeId: F
|
|
154
154
|
}, [
|
|
155
|
+
N,
|
|
155
156
|
P,
|
|
156
|
-
F
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}), J = u(() => new Map(q.map((e) => [e.id, e.name])), [q]), Y = l((e) => e ? J.get(e) ?? e : "Unassigned", [J]), X = l(() => window.print(), []), Z = l((e, t) => {
|
|
157
|
+
F
|
|
158
|
+
]), { groups: H, tasks: U, loading: W, error: G, retry: K } = s(O, C, I, V), { members: q } = y({
|
|
159
|
+
workspaceId: C,
|
|
160
|
+
authToken: E,
|
|
161
|
+
apiGatewayUrl: D
|
|
162
|
+
}), J = l(() => new Map(q.map((e) => [e.id, e.name])), [q]), Y = c((e) => e ? J.get(e) ?? e : "Unassigned", [J]), X = c(() => window.print(), []), Z = c((e, t) => {
|
|
163
163
|
let n = new URLSearchParams({ date: e });
|
|
164
|
-
t && n.set("assignee", t),
|
|
165
|
-
}, [
|
|
164
|
+
t && n.set("assignee", t), A(`${j("tasks/job-card")}?${n.toString()}`);
|
|
165
|
+
}, [A, j]), Q = V.kind === "day", $ = Q && V.assigneeId ? Y(V.assigneeId) : "All members", te = l(() => (/* @__PURE__ */ new Date()).toLocaleDateString(void 0, {
|
|
166
166
|
day: "numeric",
|
|
167
167
|
month: "short",
|
|
168
168
|
year: "numeric"
|
|
169
|
-
}), []),
|
|
169
|
+
}), []), ne = /* @__PURE__ */ g("div", {
|
|
170
170
|
className: "flex flex-wrap items-end gap-2 print:hidden",
|
|
171
|
-
children: [Q ? /* @__PURE__ */
|
|
171
|
+
children: [Q ? /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ g("label", {
|
|
172
172
|
className: "text-xs text-text-secondary",
|
|
173
|
-
children: [/* @__PURE__ */
|
|
173
|
+
children: [/* @__PURE__ */ h("span", {
|
|
174
174
|
className: "mb-1 block",
|
|
175
175
|
children: "Date"
|
|
176
|
-
}), /* @__PURE__ */
|
|
176
|
+
}), /* @__PURE__ */ h("input", {
|
|
177
177
|
type: "date",
|
|
178
|
-
value:
|
|
178
|
+
value: P,
|
|
179
179
|
onChange: (e) => {
|
|
180
|
-
e.target.value && Z(e.target.value,
|
|
180
|
+
e.target.value && Z(e.target.value, F);
|
|
181
181
|
},
|
|
182
|
-
className:
|
|
182
|
+
className: x
|
|
183
183
|
})]
|
|
184
|
-
}), /* @__PURE__ */
|
|
184
|
+
}), /* @__PURE__ */ g("label", {
|
|
185
185
|
className: "text-xs text-text-secondary",
|
|
186
|
-
children: [/* @__PURE__ */
|
|
186
|
+
children: [/* @__PURE__ */ h("span", {
|
|
187
187
|
className: "mb-1 block",
|
|
188
188
|
children: "Crew member"
|
|
189
|
-
}), /* @__PURE__ */
|
|
190
|
-
value:
|
|
191
|
-
onChange: (e) => Z(
|
|
192
|
-
className:
|
|
193
|
-
children: [/* @__PURE__ */
|
|
189
|
+
}), /* @__PURE__ */ g("select", {
|
|
190
|
+
value: F ?? "",
|
|
191
|
+
onChange: (e) => Z(P, e.target.value || void 0),
|
|
192
|
+
className: x,
|
|
193
|
+
children: [/* @__PURE__ */ h("option", {
|
|
194
194
|
value: "",
|
|
195
195
|
children: "All members"
|
|
196
|
-
}), q.map((e) => /* @__PURE__ */
|
|
196
|
+
}), q.map((e) => /* @__PURE__ */ h("option", {
|
|
197
197
|
value: e.id,
|
|
198
198
|
children: e.name
|
|
199
199
|
}, e.id))]
|
|
200
200
|
})]
|
|
201
|
-
})] }) : null, /* @__PURE__ */ _
|
|
201
|
+
})] }) : null, /* @__PURE__ */ g(_, {
|
|
202
202
|
variant: "outline",
|
|
203
203
|
onClick: X,
|
|
204
|
-
children: [/* @__PURE__ */
|
|
204
|
+
children: [/* @__PURE__ */ h(d, {
|
|
205
205
|
className: "me-1.5 h-4 w-4",
|
|
206
206
|
"aria-hidden": "true"
|
|
207
207
|
}), " Print / Save as PDF"]
|
|
208
208
|
})]
|
|
209
209
|
});
|
|
210
|
-
return /* @__PURE__ */
|
|
210
|
+
return /* @__PURE__ */ g(t, {
|
|
211
211
|
title: Q ? "Job Card Run-Sheet" : "Job Card",
|
|
212
212
|
description: "A printable field work order built from your existing Farm Tasks — nothing here is new data.",
|
|
213
|
-
actions:
|
|
213
|
+
actions: ne,
|
|
214
214
|
helpPrompt: "How do I print a job card or run-sheet for my farm crew?",
|
|
215
215
|
purpose: "Print a field work order for a crew: pick a day (and optionally a crew member) to get every task due that day, grouped by field, with instructions and a sign-off line — or open a single task's card.",
|
|
216
|
-
purposeIcon: /* @__PURE__ */
|
|
216
|
+
purposeIcon: /* @__PURE__ */ h(u, {
|
|
217
217
|
className: "size-5",
|
|
218
218
|
"aria-hidden": "true"
|
|
219
219
|
}),
|
|
220
|
-
children: [/* @__PURE__ */
|
|
220
|
+
children: [/* @__PURE__ */ h("style", { children: b }), O ? Q && z ? /* @__PURE__ */ h(r, {
|
|
221
221
|
title: "Couldn't open Farm Tasks",
|
|
222
222
|
description: z.message,
|
|
223
223
|
onRetry: B
|
|
224
|
-
}) : Q && (
|
|
224
|
+
}) : Q && (L || !R) || W ? /* @__PURE__ */ h(i, {}) : G ? /* @__PURE__ */ h(r, {
|
|
225
225
|
title: "Couldn't build the job card",
|
|
226
226
|
description: G.message,
|
|
227
227
|
onRetry: K
|
|
228
|
-
}) : U.length === 0 ? /* @__PURE__ */
|
|
228
|
+
}) : U.length === 0 ? /* @__PURE__ */ h(ee, {
|
|
229
229
|
title: Q ? "No tasks due that day" : "Task not found",
|
|
230
|
-
description: Q ? `No to-do or in-progress Farm Tasks are due on ${
|
|
231
|
-
}) : /* @__PURE__ */
|
|
230
|
+
description: Q ? `No to-do or in-progress Farm Tasks are due on ${S(P)}${V.kind === "day" && V.assigneeId ? ` for ${$}` : ""}. Pick another date or crew member.` : "That task could not be found in this workspace."
|
|
231
|
+
}) : /* @__PURE__ */ g("div", {
|
|
232
232
|
className: "hb-job-card-sheet mx-auto max-w-3xl rounded-xl border border-border-subtle bg-bg-surface p-8 shadow-sm",
|
|
233
233
|
children: [
|
|
234
|
-
/* @__PURE__ */
|
|
234
|
+
/* @__PURE__ */ h("div", {
|
|
235
235
|
className: "mb-1 flex items-center gap-2",
|
|
236
|
-
children: /* @__PURE__ */
|
|
236
|
+
children: /* @__PURE__ */ h("span", {
|
|
237
237
|
className: "text-lg font-bold text-accent-teal",
|
|
238
238
|
children: "HealthyBowl"
|
|
239
239
|
})
|
|
240
240
|
}),
|
|
241
|
-
/* @__PURE__ */
|
|
241
|
+
/* @__PURE__ */ h("h2", {
|
|
242
242
|
className: "text-2xl font-bold text-text-primary",
|
|
243
243
|
children: Q ? "Field Work Order — Crew Run-Sheet" : "Field Work Order"
|
|
244
244
|
}),
|
|
245
|
-
/* @__PURE__ */
|
|
245
|
+
/* @__PURE__ */ g("div", {
|
|
246
246
|
className: "mt-2 grid grid-cols-1 gap-1 text-sm text-text-secondary sm:grid-cols-2",
|
|
247
247
|
children: [
|
|
248
|
-
Q ? /* @__PURE__ */
|
|
249
|
-
/* @__PURE__ */
|
|
248
|
+
Q ? /* @__PURE__ */ g("div", { children: [
|
|
249
|
+
/* @__PURE__ */ h("span", {
|
|
250
250
|
className: "font-medium text-text-primary",
|
|
251
251
|
children: "Work date:"
|
|
252
252
|
}),
|
|
253
253
|
" ",
|
|
254
|
-
|
|
254
|
+
S(P)
|
|
255
255
|
] }) : null,
|
|
256
|
-
/* @__PURE__ */
|
|
256
|
+
/* @__PURE__ */ g("div", {
|
|
257
257
|
className: "sm:text-end",
|
|
258
258
|
children: [
|
|
259
|
-
/* @__PURE__ */
|
|
259
|
+
/* @__PURE__ */ h("span", {
|
|
260
260
|
className: "font-medium text-text-primary",
|
|
261
261
|
children: "Generated:"
|
|
262
262
|
}),
|
|
263
263
|
" ",
|
|
264
|
-
|
|
264
|
+
te
|
|
265
265
|
]
|
|
266
266
|
}),
|
|
267
|
-
/* @__PURE__ */
|
|
268
|
-
/* @__PURE__ */
|
|
267
|
+
/* @__PURE__ */ g("div", { children: [
|
|
268
|
+
/* @__PURE__ */ h("span", {
|
|
269
269
|
className: "font-medium text-text-primary",
|
|
270
270
|
children: "Crew:"
|
|
271
271
|
}),
|
|
272
272
|
" ",
|
|
273
273
|
$
|
|
274
274
|
] }),
|
|
275
|
-
/* @__PURE__ */
|
|
275
|
+
/* @__PURE__ */ g("div", {
|
|
276
276
|
className: "sm:text-end",
|
|
277
277
|
children: [
|
|
278
|
-
/* @__PURE__ */
|
|
278
|
+
/* @__PURE__ */ h("span", {
|
|
279
279
|
className: "font-medium text-text-primary",
|
|
280
280
|
children: "Tasks:"
|
|
281
281
|
}),
|
|
@@ -285,31 +285,31 @@ var x = [
|
|
|
285
285
|
})
|
|
286
286
|
]
|
|
287
287
|
}),
|
|
288
|
-
/* @__PURE__ */
|
|
289
|
-
H.map((e) => /* @__PURE__ */
|
|
288
|
+
/* @__PURE__ */ h("hr", { className: "my-5 border-border-subtle" }),
|
|
289
|
+
H.map((e) => /* @__PURE__ */ g("section", {
|
|
290
290
|
className: "mb-6",
|
|
291
|
-
children: [/* @__PURE__ */
|
|
291
|
+
children: [/* @__PURE__ */ h("h3", {
|
|
292
292
|
className: "mb-2 text-sm font-bold uppercase tracking-wide text-text-secondary",
|
|
293
293
|
children: e.entityLabel ?? "General tasks"
|
|
294
|
-
}), /* @__PURE__ */
|
|
294
|
+
}), /* @__PURE__ */ h("ul", {
|
|
295
295
|
className: "space-y-3",
|
|
296
|
-
children: e.tasks.map((e) => /* @__PURE__ */
|
|
296
|
+
children: e.tasks.map((e) => /* @__PURE__ */ h(T, {
|
|
297
297
|
task: e,
|
|
298
298
|
assigneeName: Y(e.assigneeId)
|
|
299
299
|
}, e.id))
|
|
300
300
|
})]
|
|
301
301
|
}, e.entityLabel ?? "__general__")),
|
|
302
|
-
/* @__PURE__ */
|
|
303
|
-
/* @__PURE__ */
|
|
302
|
+
/* @__PURE__ */ h("hr", { className: "my-5 border-border-subtle" }),
|
|
303
|
+
/* @__PURE__ */ h("p", {
|
|
304
304
|
className: "text-xs text-text-secondary",
|
|
305
305
|
children: "Printed from HealthyBowl Farm Tasks — a print view of existing task data, not a generated document."
|
|
306
306
|
})
|
|
307
307
|
]
|
|
308
|
-
}) : /* @__PURE__ */
|
|
308
|
+
}) : /* @__PURE__ */ h(r, {
|
|
309
309
|
title: "Job card unavailable",
|
|
310
310
|
description: "The workspace connection isn't ready. Reload the page or reselect your workspace."
|
|
311
311
|
})]
|
|
312
312
|
});
|
|
313
313
|
};
|
|
314
314
|
//#endregion
|
|
315
|
-
export {
|
|
315
|
+
export { E as JobCardPage };
|
|
@@ -1,29 +1,31 @@
|
|
|
1
1
|
import { useHealthyBowl as e } from "../../context/HealthyBowlContext.js";
|
|
2
2
|
import { useTr as t } from "../../../shared/hooks/useTr.js";
|
|
3
|
-
import { PageLayout as
|
|
4
|
-
import { useBasePath as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { PageLayout as ee } from "../../components/PageLayout.js";
|
|
4
|
+
import { useBasePath as te } from "../../hooks/useBasePath.js";
|
|
5
|
+
import { EmptyState as ne } from "../../components/EmptyState.js";
|
|
6
|
+
import { ErrorState as n } from "../../components/ErrorState.js";
|
|
7
|
+
import { PageLoader as r } from "../../components/PageLoader.js";
|
|
8
|
+
import { Modal as i } from "../../components/Modal.js";
|
|
9
|
+
import { CreateTaskCore as a, TasksPageCore as o } from "../../../node_modules/@burdenoff/planmagnet-fe-sdk/dist/index.js";
|
|
8
10
|
import { useDefaultTaskProject as s } from "./useDefaultTaskProject.js";
|
|
9
11
|
import { useCanManageTasks as c } from "./useCanManageTasks.js";
|
|
10
12
|
import "../../components/index.js";
|
|
11
13
|
import { todayDateParam as l } from "./useJobCardTasks.js";
|
|
12
|
-
import { useFarmTaskLabels as
|
|
13
|
-
import { useCallback as
|
|
14
|
-
import { useI18n as
|
|
15
|
-
import { Bug as
|
|
14
|
+
import { useFarmTaskLabels as re } from "./useFarmTaskLabels.js";
|
|
15
|
+
import { useCallback as u, useMemo as d, useState as f } from "react";
|
|
16
|
+
import { useI18n as ie } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
17
|
+
import { Bug as p, ListChecks as m, MapPin as h, PawPrint as g, Plus as _, Printer as v, Sprout as y } from "lucide-react";
|
|
16
18
|
import { useNavigate as b, useSearchParams as x } from "react-router";
|
|
17
19
|
import { jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
18
20
|
import { Button as w } from "@burdenoff/fe-libs/ui";
|
|
19
21
|
import { gql as T } from "@apollo/client";
|
|
20
22
|
import { ApolloProvider as E } from "@apollo/client/react";
|
|
21
|
-
import { useSafeGatewayClient as
|
|
22
|
-
import { useWorkspaceDirectory as
|
|
23
|
+
import { useSafeGatewayClient as ae } from "@burdenoff/fe-libs/shared/graphql";
|
|
24
|
+
import { useWorkspaceDirectory as oe } from "@burdenoff/fe-libs/sharing";
|
|
23
25
|
//#region src/healthybowl/pages/tasks/TasksPage.tsx
|
|
24
|
-
var
|
|
26
|
+
var se = (e) => {
|
|
25
27
|
switch (e) {
|
|
26
|
-
case "FIELD": return /* @__PURE__ */ S(
|
|
28
|
+
case "FIELD": return /* @__PURE__ */ S(h, {
|
|
27
29
|
className: "h-3 w-3",
|
|
28
30
|
"aria-hidden": "true"
|
|
29
31
|
});
|
|
@@ -31,133 +33,180 @@ var k = (e) => {
|
|
|
31
33
|
className: "h-3 w-3",
|
|
32
34
|
"aria-hidden": "true"
|
|
33
35
|
});
|
|
34
|
-
case "ANIMAL": return /* @__PURE__ */ S(
|
|
36
|
+
case "ANIMAL": return /* @__PURE__ */ S(g, {
|
|
35
37
|
className: "h-3 w-3",
|
|
36
38
|
"aria-hidden": "true"
|
|
37
39
|
});
|
|
38
40
|
case "PEST_ISSUE":
|
|
39
|
-
case "PEST": return /* @__PURE__ */ S(
|
|
41
|
+
case "PEST": return /* @__PURE__ */ S(p, {
|
|
40
42
|
className: "h-3 w-3",
|
|
41
43
|
"aria-hidden": "true"
|
|
42
44
|
});
|
|
43
45
|
default: return null;
|
|
44
46
|
}
|
|
45
|
-
},
|
|
47
|
+
}, D = [
|
|
48
|
+
{
|
|
49
|
+
status: "BACKLOG",
|
|
50
|
+
label: "Backlog"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
status: "TODO",
|
|
54
|
+
label: "To Do"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
status: "IN_PROGRESS",
|
|
58
|
+
label: "In Progress"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
status: "IN_REVIEW",
|
|
62
|
+
label: "In Review"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
status: "DONE",
|
|
66
|
+
label: "Done"
|
|
67
|
+
}
|
|
68
|
+
], O = D.map((e) => e.status), k = T`
|
|
46
69
|
mutation HealthyBowlNotifyMention($input: HealthyBowlNotifyMentionInput!) {
|
|
47
70
|
healthybowlNotifyMention(input: $input)
|
|
48
71
|
}
|
|
49
|
-
`,
|
|
50
|
-
let { workspaceId:
|
|
72
|
+
`, A = () => {
|
|
73
|
+
let { workspaceId: p, currentUser: h, authToken: g, apiGatewayUrl: y } = e(), T = ae("workspace"), A = h?.id, [j] = x(), M = j.get("item") ?? void 0, N = b(), { buildPath: P } = te(), F = u(() => {
|
|
51
74
|
let e = new URLSearchParams({ date: l() });
|
|
52
|
-
|
|
75
|
+
A && e.set("assignee", A), N(`${P("tasks/job-card")}?${e.toString()}`);
|
|
53
76
|
}, [
|
|
77
|
+
N,
|
|
54
78
|
P,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
authToken: _,
|
|
79
|
+
A
|
|
80
|
+
]), { projectId: I, loading: L, resolved: R, error: z, retry: B, ensureProject: V } = s(T, p, A), { members: H } = oe({
|
|
81
|
+
workspaceId: p,
|
|
82
|
+
authToken: g,
|
|
60
83
|
apiGatewayUrl: y
|
|
61
|
-
}),
|
|
84
|
+
}), U = d(() => H.map((e) => ({
|
|
62
85
|
id: e.id,
|
|
63
86
|
name: e.name
|
|
64
|
-
})), [
|
|
65
|
-
let t =
|
|
87
|
+
})), [H]), W = d(() => new Map(H.map((e) => [e.id, e.name])), [H]), G = u((e) => {
|
|
88
|
+
let t = W.get(e);
|
|
66
89
|
return t ? { name: t } : null;
|
|
67
|
-
}, [
|
|
90
|
+
}, [W]), K = re(), q = t(), { locale: J } = ie(), { canManage: Y } = c(p), X = u((e) => {
|
|
68
91
|
!T || e.mentionedIds.length === 0 || T.mutate({
|
|
69
|
-
mutation:
|
|
92
|
+
mutation: k,
|
|
70
93
|
variables: { input: {
|
|
71
94
|
taskId: e.entityId,
|
|
72
95
|
mentionedUserIds: e.mentionedIds
|
|
73
96
|
} }
|
|
74
97
|
}).catch(() => {});
|
|
75
|
-
}, [T]),
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
status: "TODO",
|
|
82
|
-
label: "To Do"
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
status: "IN_PROGRESS",
|
|
86
|
-
label: "In Progress"
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
status: "IN_REVIEW",
|
|
90
|
-
label: "In Review"
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
status: "DONE",
|
|
94
|
-
label: "Done"
|
|
98
|
+
}, [T]), [ce, Z] = f(!1), [le, Q] = f(!1), ue = u(async () => {
|
|
99
|
+
Z(!0);
|
|
100
|
+
try {
|
|
101
|
+
await V() && Q(!0);
|
|
102
|
+
} finally {
|
|
103
|
+
Z(!1);
|
|
95
104
|
}
|
|
96
|
-
],
|
|
105
|
+
}, [V]), $ = u(() => Q(!1), []), de = d(() => T ? /* @__PURE__ */ S(E, {
|
|
97
106
|
client: T,
|
|
98
107
|
children: /* @__PURE__ */ S(o, {
|
|
99
|
-
columns:
|
|
100
|
-
workspaceId:
|
|
101
|
-
projectId:
|
|
102
|
-
readonly: !
|
|
103
|
-
currentActorId:
|
|
108
|
+
columns: D,
|
|
109
|
+
workspaceId: p,
|
|
110
|
+
projectId: I ?? void 0,
|
|
111
|
+
readonly: !Y,
|
|
112
|
+
currentActorId: A,
|
|
104
113
|
commentsEntityType: "planmagnet_workitem",
|
|
105
|
-
onMention:
|
|
106
|
-
openItemId:
|
|
107
|
-
labels:
|
|
108
|
-
locale:
|
|
109
|
-
assigneeOptions:
|
|
110
|
-
resolveAssignee:
|
|
114
|
+
onMention: X,
|
|
115
|
+
openItemId: M,
|
|
116
|
+
labels: K,
|
|
117
|
+
locale: J,
|
|
118
|
+
assigneeOptions: U,
|
|
119
|
+
resolveAssignee: G,
|
|
111
120
|
linkSourceProduct: "healthybowl",
|
|
112
|
-
renderLinkIcon:
|
|
121
|
+
renderLinkIcon: se,
|
|
113
122
|
enableSavedViews: !0,
|
|
114
123
|
enableShortcuts: !0,
|
|
115
124
|
onTaskSaved: () => {}
|
|
116
125
|
})
|
|
117
126
|
}) : null, [
|
|
118
127
|
T,
|
|
119
|
-
|
|
120
|
-
|
|
128
|
+
p,
|
|
129
|
+
I,
|
|
130
|
+
Y,
|
|
131
|
+
A,
|
|
132
|
+
M,
|
|
133
|
+
K,
|
|
121
134
|
J,
|
|
122
|
-
|
|
123
|
-
N,
|
|
135
|
+
U,
|
|
124
136
|
G,
|
|
125
|
-
|
|
126
|
-
H,
|
|
127
|
-
W,
|
|
128
|
-
Y
|
|
137
|
+
X
|
|
129
138
|
]);
|
|
130
|
-
return /* @__PURE__ */
|
|
131
|
-
title:
|
|
139
|
+
return /* @__PURE__ */ C(ee, {
|
|
140
|
+
title: q("healthybowl.tasks.pageTitle", "Farm Tasks"),
|
|
132
141
|
titleAccent: "Tasks",
|
|
133
|
-
description:
|
|
134
|
-
helpPrompt:
|
|
135
|
-
purpose:
|
|
136
|
-
purposeIcon: /* @__PURE__ */ S(
|
|
142
|
+
description: q("healthybowl.tasks.pageDescription", "Plan and track farm work — planting, harvesting, maintenance, and more — on a shared board."),
|
|
143
|
+
helpPrompt: q("healthybowl.tasks.helpPrompt", "How do I use Farm Tasks to plan and track work on my farm?"),
|
|
144
|
+
purpose: q("healthybowl.tasks.purpose", "Farm Tasks is your team's shared to-do board. Create tasks, set priority and due dates, drag them across columns as work progresses, and open any task for details."),
|
|
145
|
+
purposeIcon: /* @__PURE__ */ S(m, {
|
|
137
146
|
className: "size-5",
|
|
138
147
|
"aria-hidden": "true"
|
|
139
148
|
}),
|
|
140
149
|
actions: /* @__PURE__ */ C(w, {
|
|
141
150
|
variant: "outline",
|
|
142
|
-
onClick:
|
|
151
|
+
onClick: F,
|
|
143
152
|
children: [
|
|
144
153
|
/* @__PURE__ */ S(v, {
|
|
145
154
|
className: "me-1.5 h-4 w-4",
|
|
146
155
|
"aria-hidden": "true"
|
|
147
156
|
}),
|
|
148
157
|
" ",
|
|
149
|
-
|
|
158
|
+
q("healthybowl.tasks.printJobCard", "Print job card")
|
|
150
159
|
]
|
|
151
160
|
}),
|
|
152
|
-
children: T ? z ? /* @__PURE__ */ S(
|
|
161
|
+
children: [T ? z ? /* @__PURE__ */ S(n, {
|
|
153
162
|
title: "Couldn't open Farm Tasks",
|
|
154
163
|
description: z.message,
|
|
155
164
|
onRetry: B
|
|
156
|
-
}) :
|
|
165
|
+
}) : L || !R ? /* @__PURE__ */ S(r, {}) : I ? de : /* @__PURE__ */ S(ne, {
|
|
166
|
+
icon: /* @__PURE__ */ S(m, {
|
|
167
|
+
className: "size-8",
|
|
168
|
+
"aria-hidden": "true"
|
|
169
|
+
}),
|
|
170
|
+
title: q("healthybowl.tasks.emptyTitle", "No farm tasks yet"),
|
|
171
|
+
description: Y ? q("healthybowl.tasks.emptyDescription", "Add your first task to start planning farm work on a shared board.") : q("healthybowl.tasks.emptyDescriptionReadOnly", "Tasks your team adds will appear here."),
|
|
172
|
+
action: Y ? /* @__PURE__ */ C(w, {
|
|
173
|
+
onClick: () => void ue(),
|
|
174
|
+
disabled: ce,
|
|
175
|
+
children: [
|
|
176
|
+
/* @__PURE__ */ S(_, {
|
|
177
|
+
className: "me-1.5 h-4 w-4",
|
|
178
|
+
"aria-hidden": "true"
|
|
179
|
+
}),
|
|
180
|
+
" ",
|
|
181
|
+
q("healthybowl.tasks.emptyAction", "New task")
|
|
182
|
+
]
|
|
183
|
+
}) : void 0
|
|
184
|
+
}) : /* @__PURE__ */ S(n, {
|
|
157
185
|
title: "Tasks unavailable",
|
|
158
186
|
description: "The workspace connection isn't ready. Reload the page or reselect your workspace."
|
|
159
|
-
})
|
|
187
|
+
}), T && I ? /* @__PURE__ */ S(i, {
|
|
188
|
+
open: le,
|
|
189
|
+
onClose: $,
|
|
190
|
+
title: q("healthybowl.tasks.newTaskTitle", "New task"),
|
|
191
|
+
children: /* @__PURE__ */ S(E, {
|
|
192
|
+
client: T,
|
|
193
|
+
children: /* @__PURE__ */ S(a, {
|
|
194
|
+
workspaceId: p,
|
|
195
|
+
projectId: I,
|
|
196
|
+
hideHeader: !0,
|
|
197
|
+
statuses: O,
|
|
198
|
+
assigneeOptions: U,
|
|
199
|
+
hiddenFields: [
|
|
200
|
+
"type",
|
|
201
|
+
"storyPoints",
|
|
202
|
+
"labels"
|
|
203
|
+
],
|
|
204
|
+
onCreated: $,
|
|
205
|
+
onCancel: $
|
|
206
|
+
})
|
|
207
|
+
})
|
|
208
|
+
}) : null]
|
|
160
209
|
});
|
|
161
210
|
};
|
|
162
211
|
//#endregion
|
|
163
|
-
export {
|
|
212
|
+
export { A as TasksPage };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { decideAfterCreate as e } from "./defaultTaskProjectDecision.js";
|
|
2
|
+
//#region src/healthybowl/pages/tasks/defaultTaskProjectResolver.ts
|
|
3
|
+
var t = "FARM", n = "Farm Tasks";
|
|
4
|
+
function r(e) {
|
|
5
|
+
return e.find((e) => e.key === "FARM") ?? e[0];
|
|
6
|
+
}
|
|
7
|
+
function i(i, a, o) {
|
|
8
|
+
let s = null, c = async () => r(await i.listProjects(a))?.id ?? null, l = async () => {
|
|
9
|
+
let r = await c();
|
|
10
|
+
if (r) return r;
|
|
11
|
+
if (!o) throw Error("Cannot create the Farm Tasks project without a current user.");
|
|
12
|
+
let s = await i.createProject({
|
|
13
|
+
name: n,
|
|
14
|
+
key: t,
|
|
15
|
+
ownerId: o,
|
|
16
|
+
methodology: "KANBAN"
|
|
17
|
+
}), l = s.data?.planmagnetCreateProject?.id;
|
|
18
|
+
if (l) return l;
|
|
19
|
+
let u = e(s, await i.listProjects(a), t);
|
|
20
|
+
if (u.ok) return u.id;
|
|
21
|
+
throw Error(u.message);
|
|
22
|
+
};
|
|
23
|
+
return {
|
|
24
|
+
find: c,
|
|
25
|
+
ensure: () => {
|
|
26
|
+
if (!s) {
|
|
27
|
+
let e = l();
|
|
28
|
+
s = e, e.catch(() => {
|
|
29
|
+
s === e && (s = null);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return s;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { t as FARM_TASKS_PROJECT_KEY, i as createTaskProjectResolver };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useCallback as t, useEffect as n,
|
|
1
|
+
import { createTaskProjectResolver as e } from "./defaultTaskProjectResolver.js";
|
|
2
|
+
import { useCallback as t, useEffect as n, useMemo as r, useState as i } from "react";
|
|
3
3
|
import { gql as a } from "@apollo/client";
|
|
4
4
|
//#region src/healthybowl/pages/tasks/useDefaultTaskProject.ts
|
|
5
|
-
var o =
|
|
5
|
+
var o = a`
|
|
6
6
|
query HealthyBowlListTaskProjects($workspaceId: ID!) {
|
|
7
7
|
planmagnetProjects(workspaceId: $workspaceId) {
|
|
8
8
|
items {
|
|
@@ -12,7 +12,7 @@ var o = "FARM", s = "Farm Tasks", c = a`
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
`,
|
|
15
|
+
`, s = a`
|
|
16
16
|
mutation HealthyBowlCreateTaskProject($input: PlanmagnetCreateProjectInput!) {
|
|
17
17
|
planmagnetCreateProject(input: $input) {
|
|
18
18
|
id
|
|
@@ -21,64 +21,58 @@ var o = "FARM", s = "Farm Tasks", c = a`
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
`;
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
function c(e) {
|
|
25
|
+
return {
|
|
26
|
+
listProjects: async (t) => (await e.query({
|
|
27
|
+
query: o,
|
|
28
|
+
variables: { workspaceId: t },
|
|
29
|
+
fetchPolicy: "network-only"
|
|
30
|
+
})).data?.planmagnetProjects?.items ?? [],
|
|
31
|
+
createProject: (t) => e.mutate({
|
|
32
|
+
mutation: s,
|
|
33
|
+
variables: { input: t }
|
|
34
|
+
})
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function l(a, o, s) {
|
|
38
|
+
let [l, u] = i(null), [d, f] = i(!1), [p, m] = i(!1), [h, g] = i(null), [_, v] = i(0), y = r(() => a && o ? e(c(a), o, s) : null, [
|
|
39
|
+
a,
|
|
40
|
+
o,
|
|
41
|
+
s
|
|
42
|
+
]), b = t(() => {
|
|
43
|
+
g(null), u(null), f(!1), v((e) => e + 1);
|
|
27
44
|
}, []);
|
|
28
45
|
return n(() => {
|
|
29
|
-
if (!
|
|
30
|
-
|
|
46
|
+
if (u(null), f(!1), !y) {
|
|
47
|
+
m(!1);
|
|
31
48
|
return;
|
|
32
49
|
}
|
|
33
|
-
let
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
variables: { workspaceId: u },
|
|
39
|
-
fetchPolicy: "network-only"
|
|
40
|
-
})).data?.planmagnetProjects?.items ?? [], n = t.find((e) => e.key === "FARM") ?? t[0];
|
|
41
|
-
if (n) return n.id;
|
|
42
|
-
if (!d) throw Error("Cannot create the Farm Tasks project without a current user.");
|
|
43
|
-
let r = e(await a.mutate({
|
|
44
|
-
mutation: l,
|
|
45
|
-
variables: { input: {
|
|
46
|
-
name: s,
|
|
47
|
-
key: o,
|
|
48
|
-
ownerId: d,
|
|
49
|
-
methodology: "KANBAN"
|
|
50
|
-
} }
|
|
51
|
-
}), (await a.query({
|
|
52
|
-
query: c,
|
|
53
|
-
variables: { workspaceId: u },
|
|
54
|
-
fetchPolicy: "network-only"
|
|
55
|
-
})).data?.planmagnetProjects?.items ?? [], o);
|
|
56
|
-
if (r.ok) return r.id;
|
|
57
|
-
throw Error(r.message);
|
|
58
|
-
}, r = `${u}::${d ?? ""}::${v}`;
|
|
59
|
-
return (!b.current || b.current.key !== r) && (b.current = {
|
|
60
|
-
key: r,
|
|
61
|
-
promise: n()
|
|
62
|
-
}), b.current.promise.then((e) => {
|
|
63
|
-
t || p(e);
|
|
64
|
-
}).catch((e) => {
|
|
65
|
-
b.current?.key === r && (b.current = null), t || _(e instanceof Error ? e : Error(String(e)));
|
|
50
|
+
let e = !1;
|
|
51
|
+
return m(!0), g(null), y.find().then((t) => {
|
|
52
|
+
e || (u((e) => e ?? t), f(!0));
|
|
53
|
+
}).catch((t) => {
|
|
54
|
+
e || g(t instanceof Error ? t : Error(String(t)));
|
|
66
55
|
}).finally(() => {
|
|
67
|
-
|
|
56
|
+
e || m(!1);
|
|
68
57
|
}), () => {
|
|
69
|
-
|
|
58
|
+
e = !0;
|
|
70
59
|
};
|
|
71
|
-
}, [
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
d,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
60
|
+
}, [y, _]), {
|
|
61
|
+
projectId: l,
|
|
62
|
+
loading: p,
|
|
63
|
+
resolved: d,
|
|
64
|
+
error: h,
|
|
65
|
+
retry: b,
|
|
66
|
+
ensureProject: t(async () => {
|
|
67
|
+
if (!y) return null;
|
|
68
|
+
try {
|
|
69
|
+
let e = await y.ensure();
|
|
70
|
+
return g(null), u(e), f(!0), e;
|
|
71
|
+
} catch (e) {
|
|
72
|
+
return g(e instanceof Error ? e : Error(String(e))), null;
|
|
73
|
+
}
|
|
74
|
+
}, [y])
|
|
81
75
|
};
|
|
82
76
|
}
|
|
83
77
|
//#endregion
|
|
84
|
-
export {
|
|
78
|
+
export { l as useDefaultTaskProject };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@burdenoff/microfe-healthybowl",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.1013.1",
|
|
4
4
|
"description": "Burdenoff HealthyBowl Microfrontend - Comprehensive organic farming and agro-foods management platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@apollo/client": "^4.0.11",
|
|
52
|
-
"@burdenoff/fe-libs": "2026.
|
|
52
|
+
"@burdenoff/fe-libs": "2026.1011.4",
|
|
53
53
|
"@burdenoff/planmagnet-fe-sdk": "2026.831.1",
|
|
54
54
|
"@tanstack/react-query": "^5.90.16",
|
|
55
55
|
"clsx": "^2.1.1",
|