@burdenoff/microfe-healthybowl 2026.816.3 → 2026.817.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.
|
@@ -1,77 +1,78 @@
|
|
|
1
1
|
import { useHealthyBowl as e } from "../../context/HealthyBowlContext.js";
|
|
2
2
|
import { useBasePath as t } from "../../hooks/useBasePath.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
3
|
+
import { useTr as n } from "../../../shared/hooks/useTr.js";
|
|
4
|
+
import { PageLayout as r } from "../../components/PageLayout.js";
|
|
5
|
+
import { ErrorState as i } from "../../components/ErrorState.js";
|
|
6
|
+
import { PageLoader as a } from "../../components/PageLoader.js";
|
|
7
|
+
import { TasksPageCore as o } from "../../../node_modules/@burdenoff/planmagnet-fe-sdk/dist/index.js";
|
|
8
|
+
import { useDefaultTaskProject as s } from "./useDefaultTaskProject.js";
|
|
9
|
+
import { useCanManageTasks as c } from "./useCanManageTasks.js";
|
|
9
10
|
import "../../components/index.js";
|
|
10
|
-
import { todayDateParam as
|
|
11
|
-
import { useFarmTaskLabels as
|
|
12
|
-
import { useCallback as
|
|
13
|
-
import { useI18n as
|
|
14
|
-
import { Bug as
|
|
15
|
-
import { useNavigate as
|
|
16
|
-
import { jsx as
|
|
17
|
-
import { Button as
|
|
18
|
-
import { gql as
|
|
19
|
-
import { ApolloProvider as
|
|
20
|
-
import { useSafeGatewayClient as
|
|
21
|
-
import { useWorkspaceDirectory as
|
|
11
|
+
import { todayDateParam as l } from "./useJobCardTasks.js";
|
|
12
|
+
import { useFarmTaskLabels as u } from "./useFarmTaskLabels.js";
|
|
13
|
+
import { useCallback as d, useMemo as f } from "react";
|
|
14
|
+
import { useI18n as p } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
15
|
+
import { Bug as m, ListChecks as h, MapPin as g, PawPrint as _, Printer as v, Sprout as y } from "lucide-react";
|
|
16
|
+
import { useNavigate as b, useSearchParams as x } from "react-router";
|
|
17
|
+
import { jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
18
|
+
import { Button as w } from "@burdenoff/fe-libs/ui";
|
|
19
|
+
import { gql as T } from "@apollo/client";
|
|
20
|
+
import { ApolloProvider as E } from "@apollo/client/react";
|
|
21
|
+
import { useSafeGatewayClient as D } from "@burdenoff/fe-libs/shared/graphql";
|
|
22
|
+
import { useWorkspaceDirectory as O } from "@burdenoff/fe-libs/sharing";
|
|
22
23
|
//#region src/healthybowl/pages/tasks/TasksPage.tsx
|
|
23
|
-
var
|
|
24
|
+
var k = (e) => {
|
|
24
25
|
switch (e) {
|
|
25
|
-
case "FIELD": return /* @__PURE__ */
|
|
26
|
+
case "FIELD": return /* @__PURE__ */ S(g, {
|
|
26
27
|
className: "h-3 w-3",
|
|
27
28
|
"aria-hidden": "true"
|
|
28
29
|
});
|
|
29
|
-
case "CROP": return /* @__PURE__ */
|
|
30
|
+
case "CROP": return /* @__PURE__ */ S(y, {
|
|
30
31
|
className: "h-3 w-3",
|
|
31
32
|
"aria-hidden": "true"
|
|
32
33
|
});
|
|
33
|
-
case "ANIMAL": return /* @__PURE__ */
|
|
34
|
+
case "ANIMAL": return /* @__PURE__ */ S(_, {
|
|
34
35
|
className: "h-3 w-3",
|
|
35
36
|
"aria-hidden": "true"
|
|
36
37
|
});
|
|
37
38
|
case "PEST_ISSUE":
|
|
38
|
-
case "PEST": return /* @__PURE__ */
|
|
39
|
+
case "PEST": return /* @__PURE__ */ S(m, {
|
|
39
40
|
className: "h-3 w-3",
|
|
40
41
|
"aria-hidden": "true"
|
|
41
42
|
});
|
|
42
43
|
default: return null;
|
|
43
44
|
}
|
|
44
|
-
},
|
|
45
|
+
}, A = T`
|
|
45
46
|
mutation HealthyBowlNotifyMention($input: HealthyBowlNotifyMentionInput!) {
|
|
46
47
|
healthybowlNotifyMention(input: $input)
|
|
47
48
|
}
|
|
48
|
-
`,
|
|
49
|
-
let { workspaceId:
|
|
50
|
-
let e = new URLSearchParams({ date:
|
|
51
|
-
|
|
49
|
+
`, j = () => {
|
|
50
|
+
let { workspaceId: m, currentUser: g, authToken: _, apiGatewayUrl: y } = e(), T = D("workspace"), j = g?.id, [M] = x(), N = M.get("item") ?? void 0, P = b(), { buildPath: F } = t(), I = d(() => {
|
|
51
|
+
let e = new URLSearchParams({ date: l() });
|
|
52
|
+
j && e.set("assignee", j), P(`${F("tasks/job-card")}?${e.toString()}`);
|
|
52
53
|
}, [
|
|
53
|
-
N,
|
|
54
54
|
P,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
F,
|
|
56
|
+
j
|
|
57
|
+
]), { projectId: L, loading: R, error: z, retry: B } = s(T, m, j), { members: V } = O({
|
|
58
|
+
workspaceId: m,
|
|
59
|
+
authToken: _,
|
|
60
|
+
apiGatewayUrl: y
|
|
61
|
+
}), H = f(() => V.map((e) => ({
|
|
61
62
|
id: e.id,
|
|
62
63
|
name: e.name
|
|
63
|
-
})), [
|
|
64
|
-
let t =
|
|
64
|
+
})), [V]), U = f(() => new Map(V.map((e) => [e.id, e.name])), [V]), W = d((e) => {
|
|
65
|
+
let t = U.get(e);
|
|
65
66
|
return t ? { name: t } : null;
|
|
66
|
-
}, [
|
|
67
|
-
!
|
|
68
|
-
mutation:
|
|
67
|
+
}, [U]), G = u(), K = n(), { locale: q } = p(), { canManage: J } = c(m), Y = d((e) => {
|
|
68
|
+
!T || e.mentionedIds.length === 0 || T.mutate({
|
|
69
|
+
mutation: A,
|
|
69
70
|
variables: { input: {
|
|
70
71
|
taskId: e.entityId,
|
|
71
72
|
mentionedUserIds: e.mentionedIds
|
|
72
73
|
} }
|
|
73
74
|
}).catch(() => {});
|
|
74
|
-
}, [
|
|
75
|
+
}, [T]), X = [
|
|
75
76
|
{
|
|
76
77
|
status: "BACKLOG",
|
|
77
78
|
label: "Backlog"
|
|
@@ -92,69 +93,73 @@ var O = (e) => {
|
|
|
92
93
|
status: "DONE",
|
|
93
94
|
label: "Done"
|
|
94
95
|
}
|
|
95
|
-
],
|
|
96
|
-
client:
|
|
97
|
-
children: /* @__PURE__ */
|
|
98
|
-
columns:
|
|
99
|
-
workspaceId:
|
|
100
|
-
projectId:
|
|
101
|
-
readonly: !
|
|
102
|
-
currentActorId:
|
|
96
|
+
], Z = f(() => T ? /* @__PURE__ */ S(E, {
|
|
97
|
+
client: T,
|
|
98
|
+
children: /* @__PURE__ */ S(o, {
|
|
99
|
+
columns: X,
|
|
100
|
+
workspaceId: m,
|
|
101
|
+
projectId: L ?? void 0,
|
|
102
|
+
readonly: !J,
|
|
103
|
+
currentActorId: j,
|
|
103
104
|
commentsEntityType: "planmagnet_workitem",
|
|
104
|
-
onMention:
|
|
105
|
-
openItemId:
|
|
106
|
-
labels:
|
|
107
|
-
locale:
|
|
108
|
-
assigneeOptions:
|
|
109
|
-
resolveAssignee:
|
|
105
|
+
onMention: Y,
|
|
106
|
+
openItemId: N,
|
|
107
|
+
labels: G,
|
|
108
|
+
locale: q,
|
|
109
|
+
assigneeOptions: H,
|
|
110
|
+
resolveAssignee: W,
|
|
110
111
|
linkSourceProduct: "healthybowl",
|
|
111
|
-
renderLinkIcon:
|
|
112
|
+
renderLinkIcon: k,
|
|
112
113
|
enableSavedViews: !0,
|
|
113
114
|
enableShortcuts: !0,
|
|
114
115
|
onTaskSaved: () => {}
|
|
115
116
|
})
|
|
116
117
|
}) : null, [
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
W,
|
|
118
|
+
T,
|
|
119
|
+
m,
|
|
120
|
+
L,
|
|
121
|
+
J,
|
|
122
|
+
j,
|
|
123
|
+
N,
|
|
124
124
|
G,
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
q,
|
|
126
|
+
H,
|
|
127
|
+
W,
|
|
128
|
+
Y
|
|
128
129
|
]);
|
|
129
|
-
return /* @__PURE__ */
|
|
130
|
-
title: "Farm Tasks",
|
|
130
|
+
return /* @__PURE__ */ S(r, {
|
|
131
|
+
title: K("healthybowl.tasks.pageTitle", "Farm Tasks"),
|
|
131
132
|
titleAccent: "Tasks",
|
|
132
|
-
description: "Plan and track farm work — planting, harvesting, maintenance, and more — on a shared board.",
|
|
133
|
-
helpPrompt: "How do I use Farm Tasks to plan and track work on my farm?",
|
|
134
|
-
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.",
|
|
135
|
-
purposeIcon: /* @__PURE__ */
|
|
133
|
+
description: K("healthybowl.tasks.pageDescription", "Plan and track farm work — planting, harvesting, maintenance, and more — on a shared board."),
|
|
134
|
+
helpPrompt: K("healthybowl.tasks.helpPrompt", "How do I use Farm Tasks to plan and track work on my farm?"),
|
|
135
|
+
purpose: K("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."),
|
|
136
|
+
purposeIcon: /* @__PURE__ */ S(h, {
|
|
136
137
|
className: "size-5",
|
|
137
138
|
"aria-hidden": "true"
|
|
138
139
|
}),
|
|
139
|
-
actions: /* @__PURE__ */
|
|
140
|
+
actions: /* @__PURE__ */ C(w, {
|
|
140
141
|
variant: "outline",
|
|
141
|
-
onClick:
|
|
142
|
-
children: [
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
142
|
+
onClick: I,
|
|
143
|
+
children: [
|
|
144
|
+
/* @__PURE__ */ S(v, {
|
|
145
|
+
className: "me-1.5 h-4 w-4",
|
|
146
|
+
"aria-hidden": "true"
|
|
147
|
+
}),
|
|
148
|
+
" ",
|
|
149
|
+
K("healthybowl.tasks.printJobCard", "Print job card")
|
|
150
|
+
]
|
|
146
151
|
}),
|
|
147
|
-
children:
|
|
152
|
+
children: T ? z ? /* @__PURE__ */ S(i, {
|
|
148
153
|
title: "Couldn't open Farm Tasks",
|
|
149
|
-
description:
|
|
150
|
-
onRetry:
|
|
151
|
-
}) :
|
|
154
|
+
description: z.message,
|
|
155
|
+
onRetry: B
|
|
156
|
+
}) : R || !L ? /* @__PURE__ */ S(a, {}) : Z : /* @__PURE__ */ S(i, {
|
|
152
157
|
title: "Tasks unavailable",
|
|
153
158
|
description: "The workspace connection isn't ready. Reload the page or reselect your workspace."
|
|
154
159
|
})
|
|
155
160
|
});
|
|
156
161
|
};
|
|
157
162
|
//#endregion
|
|
158
|
-
export {
|
|
163
|
+
export { j as TasksPage };
|
|
159
164
|
|
|
160
165
|
//# sourceMappingURL=TasksPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TasksPage.js","names":[],"sources":["../../../../src/healthybowl/pages/tasks/TasksPage.tsx"],"sourcesContent":["/**\n * TasksPage — HealthyBowl \"Farm Tasks\".\n *\n * Embeds the composed `<TasksPageCore/>` from `@burdenoff/planmagnet-fe-sdk`\n * (kanban board + create flow + click-to-open detail with inline edit) so farm\n * teams can plan and track work items backed by `wspace-planmagnet-svc`.\n *\n * Wiring:\n * - workspaceId — from the HealthyBowl workspace context (`useHealthyBowl`).\n * - Apollo — the app shell's WORKSPACE gateway client (`useSafeGatewayClient\n * ('workspace')`), the same authed client every other HB page uses. The SDK\n * core is BYO-Apollo, so we wrap it in an `<ApolloProvider>` bound to that\n * client (rather than relying on the ambient default) to be explicit.\n * - projectId — a per-workspace \"Farm Tasks\" project, get-or-created via\n * `useDefaultTaskProject`. Farmers never see PlanMagnet's project concept.\n *\n * Theming: the SDK renders with semantic tokens (`bg-primary`, `text-foreground`,\n * `text-destructive`, `border-border`, …) which resolve against fe-libs' shipped\n * tokens, so the forest theme is inherited — no SDK stylesheet import and no raw\n * colors.\n *\n * Host wiring beyond Apollo + project:\n * - labels — HB's i18n catalog via `useFarmTaskLabels` (6 languages).\n * - assignee picker — the real workspace member directory\n * (`useWorkspaceDirectory`), so tasks show names/avatars and the create/edit\n * forms offer a member dropdown instead of a raw actor-id field.\n * - readonly — Viewers/Members (read-only on `planmagnet-workitem`) get\n * a read-only board via `useCanManageTasks` (fails open; server enforces).\n * - currentActorId — enables the toolbar \"My tasks\" filter.\n * - entity-linked create — shipped as `CreateFarmTaskButton` on Field/Crop/\n * Animal detail pages and Pest Issue rows (WorkItemLink); no longer a TODO.\n *\n * @module healthybowl\n */\n\nimport { useCallback, useMemo, type FC, type ReactNode } from 'react';\nimport { useNavigate, useSearchParams } from 'react-router';\nimport { gql } from '@apollo/client';\nimport { ApolloProvider } from '@apollo/client/react';\nimport { useSafeGatewayClient } from '@burdenoff/fe-libs/shared/graphql';\nimport { useWorkspaceDirectory } from '@burdenoff/fe-libs/sharing';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { Button } from '@burdenoff/fe-libs/ui';\nimport { TasksPageCore, type AssigneeOption, type BoardColumn } from '@burdenoff/planmagnet-fe-sdk';\nimport { Bug, ListChecks, MapPin, PawPrint, Printer, Sprout } from 'lucide-react';\nimport { PageLayout, ErrorState, PageLoader } from '../../components';\nimport { useHealthyBowl } from '../../context/HealthyBowlContext';\nimport { useBasePath } from '../../hooks/useBasePath';\nimport { useDefaultTaskProject } from './useDefaultTaskProject';\nimport { useFarmTaskLabels } from './useFarmTaskLabels';\nimport { useCanManageTasks } from './useCanManageTasks';\nimport { todayDateParam } from './useJobCardTasks';\n\n/**\n * Farm icon per linked-entity type, so a task's linked-record chip shows a\n * leaf / field / animal / pest issue glyph (the SDK falls back to a generic link\n * glyph for anything unmapped). Module-level so it's referentially stable.\n */\nconst renderFarmLinkIcon = (entityType: string): ReactNode => {\n switch (entityType) {\n case 'FIELD':\n return <MapPin className=\"h-3 w-3\" aria-hidden=\"true\" />;\n case 'CROP':\n return <Sprout className=\"h-3 w-3\" aria-hidden=\"true\" />;\n case 'ANIMAL':\n return <PawPrint className=\"h-3 w-3\" aria-hidden=\"true\" />;\n case 'PEST_ISSUE':\n case 'PEST':\n return <Bug className=\"h-3 w-3\" aria-hidden=\"true\" />;\n default:\n return null;\n }\n};\n\n/**\n * IN_APP-notify @-mentioned members of a task comment. The comment lives in the\n * shared conversations service (which can't carry the workspace member ids), so\n * the SDK hands us the mentioned ids via `onMention` and wspace-healthybowl-svc\n * dispatches the notifications with its own service identity.\n */\nconst NOTIFY_MENTION = gql`\n mutation HealthyBowlNotifyMention($input: HealthyBowlNotifyMentionInput!) {\n healthybowlNotifyMention(input: $input)\n }\n`;\n\nexport const TasksPage: FC = () => {\n const { workspaceId, currentUser, authToken, apiGatewayUrl } = useHealthyBowl();\n // The workspace gateway client the whole app already uses (dual-token auth +\n // x-workspace-id). Null only if the shell's GatewayProvider isn't mounted.\n const workspaceClient = useSafeGatewayClient('workspace');\n const ownerId = currentUser?.id;\n // Deep-link from the calendar: `/healthybowl/tasks?item=<id>` opens that task.\n const [searchParams] = useSearchParams();\n const openItemId = searchParams.get('item') ?? undefined;\n\n // \"Print job card\" entry point (BOFF-6120): today's run-sheet for the current\n // user, deep-linked via buildPath — never a bare relative path.\n const navigate = useNavigate();\n const { buildPath } = useBasePath();\n const openJobCard = useCallback(() => {\n const params = new URLSearchParams({ date: todayDateParam() });\n if (ownerId) params.set('assignee', ownerId);\n navigate(`${buildPath('tasks/job-card')}?${params.toString()}`);\n }, [navigate, buildPath, ownerId]);\n\n const {\n projectId,\n loading: projectLoading,\n error: projectError,\n retry,\n } = useDefaultTaskProject(workspaceClient, workspaceId, ownerId);\n\n // Farm-team member directory → real assignee names/avatars + a picker.\n const { members } = useWorkspaceDirectory({ workspaceId, authToken, apiGatewayUrl });\n const assigneeOptions = useMemo<AssigneeOption[]>(() => members.map((m) => ({ id: m.id, name: m.name })), [members]);\n const memberNameById = useMemo(() => new Map(members.map((m) => [m.id, m.name])), [members]);\n const resolveAssignee = useCallback(\n (id: string) => {\n const name = memberNameById.get(id);\n return name ? { name } : null;\n },\n [memberNameById]\n );\n\n // HB i18n → SDK label contract (6 languages, English fallback).\n const labels = useFarmTaskLabels();\n // Active language → localizes the Timeline's weekday/month names in the SDK.\n const { locale } = useI18n();\n // Read-only for Viewers/Members (fails open; server still enforces RBAC).\n const { canManage } = useCanManageTasks(workspaceId);\n\n // @mention notifications: the SDK fires this after a comment @-mentions\n // members; dispatch IN_APP notifications via wspace-healthybowl-svc (which\n // notifies with its service identity). Fire-and-forget — never blocks the UI.\n const handleMention = useCallback(\n (payload: { mentionedIds: string[]; entityId: string }) => {\n if (!workspaceClient || payload.mentionedIds.length === 0) return;\n void workspaceClient\n .mutate({\n mutation: NOTIFY_MENTION,\n variables: {\n input: { taskId: payload.entityId, mentionedUserIds: payload.mentionedIds },\n },\n })\n .catch(() => {\n // Best-effort: a notification failure must never disrupt commenting.\n });\n },\n [workspaceClient]\n );\n\n // The SDK core is BYO-Apollo: give it an ApolloProvider explicitly bound to\n // the workspace client so it never depends on the ambient default gateway.\n /**\n * The five columns the published use case promises (BOFF-6309).\n *\n * The SDK default adds Testing and Cancelled — engineering workflow states with no\n * farm meaning. A farmer moving \"spray Tomato Block A\" has no use for a Testing\n * column, and each extra column is horizontal scroll on a phone in a field.\n *\n * ★ Narrowing this also narrows what a user can SET: since planmagnet-fe-sdk\n * 2026.813.1, TasksPageCore derives the create / detail / bulk status options from\n * these columns. Before that it did not, and a task set to Testing rendered in no\n * column at all. Do not pin back below that version while this override is here.\n */\n const FARM_BOARD_COLUMNS: BoardColumn[] = [\n { status: 'BACKLOG', label: 'Backlog' },\n { status: 'TODO', label: 'To Do' },\n { status: 'IN_PROGRESS', label: 'In Progress' },\n { status: 'IN_REVIEW', label: 'In Review' },\n { status: 'DONE', label: 'Done' },\n ];\n\n const board = useMemo(() => {\n if (!workspaceClient) return null;\n return (\n <ApolloProvider client={workspaceClient}>\n <TasksPageCore\n columns={FARM_BOARD_COLUMNS}\n workspaceId={workspaceId}\n projectId={projectId ?? undefined}\n readonly={!canManage}\n currentActorId={ownerId}\n commentsEntityType=\"planmagnet_workitem\"\n onMention={handleMention}\n openItemId={openItemId}\n labels={labels}\n locale={locale}\n assigneeOptions={assigneeOptions}\n resolveAssignee={resolveAssignee}\n linkSourceProduct=\"healthybowl\"\n renderLinkIcon={renderFarmLinkIcon}\n enableSavedViews\n enableShortcuts\n onTaskSaved={() => {\n // The SDK already refetches its own board list after a save; nothing\n // else in HB depends on this data yet, so this is a deliberate no-op.\n }}\n />\n </ApolloProvider>\n );\n }, [\n workspaceClient,\n workspaceId,\n projectId,\n canManage,\n ownerId,\n openItemId,\n labels,\n locale,\n assigneeOptions,\n resolveAssignee,\n handleMention,\n ]);\n\n return (\n <PageLayout\n title=\"Farm Tasks\"\n titleAccent=\"Tasks\"\n description=\"Plan and track farm work — planting, harvesting, maintenance, and more — on a shared board.\"\n helpPrompt=\"How do I use Farm Tasks to plan and track work on my farm?\"\n 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.\"\n purposeIcon={<ListChecks className=\"size-5\" aria-hidden=\"true\" />}\n actions={\n <Button variant=\"outline\" onClick={openJobCard}>\n <Printer className=\"me-1.5 h-4 w-4\" aria-hidden=\"true\" /> Print job card\n </Button>\n }\n >\n {!workspaceClient ? (\n <ErrorState\n title=\"Tasks unavailable\"\n description=\"The workspace connection isn't ready. Reload the page or reselect your workspace.\"\n />\n ) : projectError ? (\n <ErrorState title=\"Couldn't open Farm Tasks\" description={projectError.message} onRetry={retry} />\n ) : projectLoading || !projectId ? (\n <PageLoader />\n ) : (\n board\n )}\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA0DA,IAAM,KAAsB,MAAkC;AAC5D,SAAQ,GAAR;EACE,KAAK,QACH,QAAO,kBAAC,GAAD;GAAQ,WAAU;GAAU,eAAY;GAAS,CAAA;EAC1D,KAAK,OACH,QAAO,kBAAC,GAAD;GAAQ,WAAU;GAAU,eAAY;GAAS,CAAA;EAC1D,KAAK,SACH,QAAO,kBAAC,GAAD;GAAU,WAAU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,"file":"TasksPage.js","names":[],"sources":["../../../../src/healthybowl/pages/tasks/TasksPage.tsx"],"sourcesContent":["/**\n * TasksPage — HealthyBowl \"Farm Tasks\".\n *\n * Embeds the composed `<TasksPageCore/>` from `@burdenoff/planmagnet-fe-sdk`\n * (kanban board + create flow + click-to-open detail with inline edit) so farm\n * teams can plan and track work items backed by `wspace-planmagnet-svc`.\n *\n * Wiring:\n * - workspaceId — from the HealthyBowl workspace context (`useHealthyBowl`).\n * - Apollo — the app shell's WORKSPACE gateway client (`useSafeGatewayClient\n * ('workspace')`), the same authed client every other HB page uses. The SDK\n * core is BYO-Apollo, so we wrap it in an `<ApolloProvider>` bound to that\n * client (rather than relying on the ambient default) to be explicit.\n * - projectId — a per-workspace \"Farm Tasks\" project, get-or-created via\n * `useDefaultTaskProject`. Farmers never see PlanMagnet's project concept.\n *\n * Theming: the SDK renders with semantic tokens (`bg-primary`, `text-foreground`,\n * `text-destructive`, `border-border`, …) which resolve against fe-libs' shipped\n * tokens, so the forest theme is inherited — no SDK stylesheet import and no raw\n * colors.\n *\n * Host wiring beyond Apollo + project:\n * - labels — HB's i18n catalog via `useFarmTaskLabels` (6 languages).\n * - assignee picker — the real workspace member directory\n * (`useWorkspaceDirectory`), so tasks show names/avatars and the create/edit\n * forms offer a member dropdown instead of a raw actor-id field.\n * - readonly — Viewers/Members (read-only on `planmagnet-workitem`) get\n * a read-only board via `useCanManageTasks` (fails open; server enforces).\n * - currentActorId — enables the toolbar \"My tasks\" filter.\n * - entity-linked create — shipped as `CreateFarmTaskButton` on Field/Crop/\n * Animal detail pages and Pest Issue rows (WorkItemLink); no longer a TODO.\n *\n * @module healthybowl\n */\n\nimport { useCallback, useMemo, type FC, type ReactNode } from 'react';\nimport { useNavigate, useSearchParams } from 'react-router';\nimport { gql } from '@apollo/client';\nimport { ApolloProvider } from '@apollo/client/react';\nimport { useSafeGatewayClient } from '@burdenoff/fe-libs/shared/graphql';\nimport { useWorkspaceDirectory } from '@burdenoff/fe-libs/sharing';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { Button } from '@burdenoff/fe-libs/ui';\nimport { TasksPageCore, type AssigneeOption, type BoardColumn } from '@burdenoff/planmagnet-fe-sdk';\nimport { Bug, ListChecks, MapPin, PawPrint, Printer, Sprout } from 'lucide-react';\nimport { PageLayout, ErrorState, PageLoader } from '../../components';\nimport { useHealthyBowl } from '../../context/HealthyBowlContext';\nimport { useBasePath } from '../../hooks/useBasePath';\nimport { useDefaultTaskProject } from './useDefaultTaskProject';\nimport { useFarmTaskLabels } from './useFarmTaskLabels';\nimport { useTr } from '../../../shared/hooks/useTr';\nimport { useCanManageTasks } from './useCanManageTasks';\nimport { todayDateParam } from './useJobCardTasks';\n\n/**\n * Farm icon per linked-entity type, so a task's linked-record chip shows a\n * leaf / field / animal / pest issue glyph (the SDK falls back to a generic link\n * glyph for anything unmapped). Module-level so it's referentially stable.\n */\nconst renderFarmLinkIcon = (entityType: string): ReactNode => {\n switch (entityType) {\n case 'FIELD':\n return <MapPin className=\"h-3 w-3\" aria-hidden=\"true\" />;\n case 'CROP':\n return <Sprout className=\"h-3 w-3\" aria-hidden=\"true\" />;\n case 'ANIMAL':\n return <PawPrint className=\"h-3 w-3\" aria-hidden=\"true\" />;\n case 'PEST_ISSUE':\n case 'PEST':\n return <Bug className=\"h-3 w-3\" aria-hidden=\"true\" />;\n default:\n return null;\n }\n};\n\n/**\n * IN_APP-notify @-mentioned members of a task comment. The comment lives in the\n * shared conversations service (which can't carry the workspace member ids), so\n * the SDK hands us the mentioned ids via `onMention` and wspace-healthybowl-svc\n * dispatches the notifications with its own service identity.\n */\nconst NOTIFY_MENTION = gql`\n mutation HealthyBowlNotifyMention($input: HealthyBowlNotifyMentionInput!) {\n healthybowlNotifyMention(input: $input)\n }\n`;\n\nexport const TasksPage: FC = () => {\n const { workspaceId, currentUser, authToken, apiGatewayUrl } = useHealthyBowl();\n // The workspace gateway client the whole app already uses (dual-token auth +\n // x-workspace-id). Null only if the shell's GatewayProvider isn't mounted.\n const workspaceClient = useSafeGatewayClient('workspace');\n const ownerId = currentUser?.id;\n // Deep-link from the calendar: `/healthybowl/tasks?item=<id>` opens that task.\n const [searchParams] = useSearchParams();\n const openItemId = searchParams.get('item') ?? undefined;\n\n // \"Print job card\" entry point (BOFF-6120): today's run-sheet for the current\n // user, deep-linked via buildPath — never a bare relative path.\n const navigate = useNavigate();\n const { buildPath } = useBasePath();\n const openJobCard = useCallback(() => {\n const params = new URLSearchParams({ date: todayDateParam() });\n if (ownerId) params.set('assignee', ownerId);\n navigate(`${buildPath('tasks/job-card')}?${params.toString()}`);\n }, [navigate, buildPath, ownerId]);\n\n const {\n projectId,\n loading: projectLoading,\n error: projectError,\n retry,\n } = useDefaultTaskProject(workspaceClient, workspaceId, ownerId);\n\n // Farm-team member directory → real assignee names/avatars + a picker.\n const { members } = useWorkspaceDirectory({ workspaceId, authToken, apiGatewayUrl });\n const assigneeOptions = useMemo<AssigneeOption[]>(() => members.map((m) => ({ id: m.id, name: m.name })), [members]);\n const memberNameById = useMemo(() => new Map(members.map((m) => [m.id, m.name])), [members]);\n const resolveAssignee = useCallback(\n (id: string) => {\n const name = memberNameById.get(id);\n return name ? { name } : null;\n },\n [memberNameById]\n );\n\n // HB i18n → SDK label contract (6 languages, English fallback).\n const labels = useFarmTaskLabels();\n const tr = useTr();\n // Active language → localizes the Timeline's weekday/month names in the SDK.\n const { locale } = useI18n();\n // Read-only for Viewers/Members (fails open; server still enforces RBAC).\n const { canManage } = useCanManageTasks(workspaceId);\n\n // @mention notifications: the SDK fires this after a comment @-mentions\n // members; dispatch IN_APP notifications via wspace-healthybowl-svc (which\n // notifies with its service identity). Fire-and-forget — never blocks the UI.\n const handleMention = useCallback(\n (payload: { mentionedIds: string[]; entityId: string }) => {\n if (!workspaceClient || payload.mentionedIds.length === 0) return;\n void workspaceClient\n .mutate({\n mutation: NOTIFY_MENTION,\n variables: {\n input: { taskId: payload.entityId, mentionedUserIds: payload.mentionedIds },\n },\n })\n .catch(() => {\n // Best-effort: a notification failure must never disrupt commenting.\n });\n },\n [workspaceClient]\n );\n\n // The SDK core is BYO-Apollo: give it an ApolloProvider explicitly bound to\n // the workspace client so it never depends on the ambient default gateway.\n /**\n * The five columns the published use case promises (BOFF-6309).\n *\n * The SDK default adds Testing and Cancelled — engineering workflow states with no\n * farm meaning. A farmer moving \"spray Tomato Block A\" has no use for a Testing\n * column, and each extra column is horizontal scroll on a phone in a field.\n *\n * ★ Narrowing this also narrows what a user can SET: since planmagnet-fe-sdk\n * 2026.813.1, TasksPageCore derives the create / detail / bulk status options from\n * these columns. Before that it did not, and a task set to Testing rendered in no\n * column at all. Do not pin back below that version while this override is here.\n */\n const FARM_BOARD_COLUMNS: BoardColumn[] = [\n { status: 'BACKLOG', label: 'Backlog' },\n { status: 'TODO', label: 'To Do' },\n { status: 'IN_PROGRESS', label: 'In Progress' },\n { status: 'IN_REVIEW', label: 'In Review' },\n { status: 'DONE', label: 'Done' },\n ];\n\n const board = useMemo(() => {\n if (!workspaceClient) return null;\n return (\n <ApolloProvider client={workspaceClient}>\n <TasksPageCore\n columns={FARM_BOARD_COLUMNS}\n workspaceId={workspaceId}\n projectId={projectId ?? undefined}\n readonly={!canManage}\n currentActorId={ownerId}\n commentsEntityType=\"planmagnet_workitem\"\n onMention={handleMention}\n openItemId={openItemId}\n labels={labels}\n locale={locale}\n assigneeOptions={assigneeOptions}\n resolveAssignee={resolveAssignee}\n linkSourceProduct=\"healthybowl\"\n renderLinkIcon={renderFarmLinkIcon}\n enableSavedViews\n enableShortcuts\n onTaskSaved={() => {\n // The SDK already refetches its own board list after a save; nothing\n // else in HB depends on this data yet, so this is a deliberate no-op.\n }}\n />\n </ApolloProvider>\n );\n }, [\n workspaceClient,\n workspaceId,\n projectId,\n canManage,\n ownerId,\n openItemId,\n labels,\n locale,\n assigneeOptions,\n resolveAssignee,\n handleMention,\n ]);\n\n return (\n <PageLayout\n title={tr('healthybowl.tasks.pageTitle', 'Farm Tasks')}\n titleAccent=\"Tasks\"\n description={tr(\n 'healthybowl.tasks.pageDescription',\n 'Plan and track farm work — planting, harvesting, maintenance, and more — on a shared board.'\n )}\n helpPrompt={tr('healthybowl.tasks.helpPrompt', 'How do I use Farm Tasks to plan and track work on my farm?')}\n purpose={tr(\n 'healthybowl.tasks.purpose',\n \"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.\"\n )}\n purposeIcon={<ListChecks className=\"size-5\" aria-hidden=\"true\" />}\n actions={\n <Button variant=\"outline\" onClick={openJobCard}>\n <Printer className=\"me-1.5 h-4 w-4\" aria-hidden=\"true\" />{' '}\n {tr('healthybowl.tasks.printJobCard', 'Print job card')}\n </Button>\n }\n >\n {!workspaceClient ? (\n <ErrorState\n title=\"Tasks unavailable\"\n description=\"The workspace connection isn't ready. Reload the page or reselect your workspace.\"\n />\n ) : projectError ? (\n <ErrorState title=\"Couldn't open Farm Tasks\" description={projectError.message} onRetry={retry} />\n ) : projectLoading || !projectId ? (\n <PageLoader />\n ) : (\n board\n )}\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA2DA,IAAM,KAAsB,MAAkC;AAC5D,SAAQ,GAAR;EACE,KAAK,QACH,QAAO,kBAAC,GAAD;GAAQ,WAAU;GAAU,eAAY;GAAS,CAAA;EAC1D,KAAK,OACH,QAAO,kBAAC,GAAD;GAAQ,WAAU;GAAU,eAAY;GAAS,CAAA;EAC1D,KAAK,SACH,QAAO,kBAAC,GAAD;GAAU,WAAU;GAAU,eAAY;GAAS,CAAA;EAC5D,KAAK;EACL,KAAK,OACH,QAAO,kBAAC,GAAD;GAAK,WAAU;GAAU,eAAY;GAAS,CAAA;EACvD,QACE,QAAO;;GAUP,IAAiB,CAAG;;;;GAMb,UAAsB;CACjC,IAAM,EAAE,gBAAa,gBAAa,cAAW,qBAAkB,GAAgB,EAGzE,IAAkB,EAAqB,YAAY,EACnD,IAAU,G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