@burdenoff/microfe-healthybowl 2026.706.7 → 2026.706.8
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/pages/tasks/TasksPage.js +54 -51
- package/dist/healthybowl/pages/tasks/TasksPage.js.map +1 -1
- package/dist/node_modules/@burdenoff/planmagnet-fe-sdk/dist/index.js +1400 -1065
- package/dist/node_modules/@burdenoff/planmagnet-fe-sdk/dist/index.js.map +1 -1
- package/dist/node_modules/date-fns/isSameWeek.js +11 -0
- package/dist/node_modules/date-fns/isSameWeek.js.map +1 -0
- package/dist/node_modules/date-fns/locale/ar/_lib/formatDistance.js +101 -0
- package/dist/node_modules/date-fns/locale/ar/_lib/formatDistance.js.map +1 -0
- package/dist/node_modules/date-fns/locale/ar/_lib/formatLong.js +34 -0
- package/dist/node_modules/date-fns/locale/ar/_lib/formatLong.js.map +1 -0
- package/dist/node_modules/date-fns/locale/ar/_lib/formatRelative.js +13 -0
- package/dist/node_modules/date-fns/locale/ar/_lib/formatRelative.js.map +1 -0
- package/dist/node_modules/date-fns/locale/ar/_lib/localize.js +196 -0
- package/dist/node_modules/date-fns/locale/ar/_lib/localize.js.map +1 -0
- package/dist/node_modules/date-fns/locale/ar/_lib/match.js +135 -0
- package/dist/node_modules/date-fns/locale/ar/_lib/match.js.map +1 -0
- package/dist/node_modules/date-fns/locale/ar.js +22 -0
- package/dist/node_modules/date-fns/locale/ar.js.map +1 -0
- package/dist/node_modules/date-fns/locale/es/_lib/formatDistance.js +71 -0
- package/dist/node_modules/date-fns/locale/es/_lib/formatDistance.js.map +1 -0
- package/dist/node_modules/date-fns/locale/es/_lib/formatLong.js +34 -0
- package/dist/node_modules/date-fns/locale/es/_lib/formatLong.js.map +1 -0
- package/dist/node_modules/date-fns/locale/es/_lib/formatRelative.js +20 -0
- package/dist/node_modules/date-fns/locale/es/_lib/formatRelative.js.map +1 -0
- package/dist/node_modules/date-fns/locale/es/_lib/localize.js +196 -0
- package/dist/node_modules/date-fns/locale/es/_lib/localize.js.map +1 -0
- package/dist/node_modules/date-fns/locale/es/_lib/match.js +131 -0
- package/dist/node_modules/date-fns/locale/es/_lib/match.js.map +1 -0
- package/dist/node_modules/date-fns/locale/es.js +22 -0
- package/dist/node_modules/date-fns/locale/es.js.map +1 -0
- package/dist/node_modules/date-fns/locale/hi/_lib/formatDistance.js +72 -0
- package/dist/node_modules/date-fns/locale/hi/_lib/formatDistance.js.map +1 -0
- package/dist/node_modules/date-fns/locale/hi/_lib/formatLong.js +34 -0
- package/dist/node_modules/date-fns/locale/hi/_lib/formatLong.js.map +1 -0
- package/dist/node_modules/date-fns/locale/hi/_lib/formatRelative.js +13 -0
- package/dist/node_modules/date-fns/locale/hi/_lib/formatRelative.js.map +1 -0
- package/dist/node_modules/date-fns/locale/hi/_lib/localize.js +234 -0
- package/dist/node_modules/date-fns/locale/hi/_lib/localize.js.map +1 -0
- package/dist/node_modules/date-fns/locale/hi/_lib/match.js +127 -0
- package/dist/node_modules/date-fns/locale/hi/_lib/match.js.map +1 -0
- package/dist/node_modules/date-fns/locale/hi.js +22 -0
- package/dist/node_modules/date-fns/locale/hi.js.map +1 -0
- package/dist/node_modules/date-fns/locale/ta/_lib/formatDistance.js +198 -0
- package/dist/node_modules/date-fns/locale/ta/_lib/formatDistance.js.map +1 -0
- package/dist/node_modules/date-fns/locale/ta/_lib/formatLong.js +34 -0
- package/dist/node_modules/date-fns/locale/ta/_lib/formatLong.js.map +1 -0
- package/dist/node_modules/date-fns/locale/ta/_lib/formatRelative.js +13 -0
- package/dist/node_modules/date-fns/locale/ta/_lib/formatRelative.js.map +1 -0
- package/dist/node_modules/date-fns/locale/ta/_lib/localize.js +196 -0
- package/dist/node_modules/date-fns/locale/ta/_lib/localize.js.map +1 -0
- package/dist/node_modules/date-fns/locale/ta/_lib/match.js +134 -0
- package/dist/node_modules/date-fns/locale/ta/_lib/match.js.map +1 -0
- package/dist/node_modules/date-fns/locale/ta.js +22 -0
- package/dist/node_modules/date-fns/locale/ta.js.map +1 -0
- package/dist/node_modules/date-fns/locale/zh-CN/_lib/formatDistance.js +71 -0
- package/dist/node_modules/date-fns/locale/zh-CN/_lib/formatDistance.js.map +1 -0
- package/dist/node_modules/date-fns/locale/zh-CN/_lib/formatLong.js +34 -0
- package/dist/node_modules/date-fns/locale/zh-CN/_lib/formatLong.js.map +1 -0
- package/dist/node_modules/date-fns/locale/zh-CN/_lib/formatRelative.js +21 -0
- package/dist/node_modules/date-fns/locale/zh-CN/_lib/formatRelative.js.map +1 -0
- package/dist/node_modules/date-fns/locale/zh-CN/_lib/localize.js +205 -0
- package/dist/node_modules/date-fns/locale/zh-CN/_lib/localize.js.map +1 -0
- package/dist/node_modules/date-fns/locale/zh-CN/_lib/match.js +112 -0
- package/dist/node_modules/date-fns/locale/zh-CN/_lib/match.js.map +1 -0
- package/dist/node_modules/date-fns/locale/zh-CN.js +22 -0
- package/dist/node_modules/date-fns/locale/zh-CN.js.map +1 -0
- package/package.json +2 -2
|
@@ -8,108 +8,111 @@ import { useCanManageTasks as o } from "./useCanManageTasks.js";
|
|
|
8
8
|
import "../../components/index.js";
|
|
9
9
|
import { useFarmTaskLabels as s } from "./useFarmTaskLabels.js";
|
|
10
10
|
import { useCallback as c, useMemo as l } from "react";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
11
|
+
import { useI18n as u } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
12
|
+
import { Bug as d, ListChecks as f, MapPin as p, PawPrint as m, Sprout as h } from "lucide-react";
|
|
13
|
+
import { useSearchParams as g } from "react-router-dom";
|
|
14
|
+
import { jsx as _ } from "react/jsx-runtime";
|
|
15
|
+
import { gql as v } from "@apollo/client";
|
|
16
|
+
import { ApolloProvider as y } from "@apollo/client/react";
|
|
17
|
+
import { useSafeGatewayClient as b } from "@burdenoff/fe-libs/shared/graphql";
|
|
18
|
+
import { useWorkspaceDirectory as x } from "@burdenoff/fe-libs/sharing";
|
|
18
19
|
//#region src/healthybowl/pages/tasks/TasksPage.tsx
|
|
19
|
-
var
|
|
20
|
+
var S = (e) => {
|
|
20
21
|
switch (e) {
|
|
21
|
-
case "FIELD": return /* @__PURE__ */
|
|
22
|
+
case "FIELD": return /* @__PURE__ */ _(p, {
|
|
22
23
|
className: "h-3 w-3",
|
|
23
24
|
"aria-hidden": "true"
|
|
24
25
|
});
|
|
25
|
-
case "CROP": return /* @__PURE__ */
|
|
26
|
+
case "CROP": return /* @__PURE__ */ _(h, {
|
|
26
27
|
className: "h-3 w-3",
|
|
27
28
|
"aria-hidden": "true"
|
|
28
29
|
});
|
|
29
|
-
case "ANIMAL": return /* @__PURE__ */
|
|
30
|
+
case "ANIMAL": return /* @__PURE__ */ _(m, {
|
|
30
31
|
className: "h-3 w-3",
|
|
31
32
|
"aria-hidden": "true"
|
|
32
33
|
});
|
|
33
34
|
case "PEST_ISSUE":
|
|
34
|
-
case "PEST": return /* @__PURE__ */
|
|
35
|
+
case "PEST": return /* @__PURE__ */ _(d, {
|
|
35
36
|
className: "h-3 w-3",
|
|
36
37
|
"aria-hidden": "true"
|
|
37
38
|
});
|
|
38
39
|
default: return null;
|
|
39
40
|
}
|
|
40
|
-
},
|
|
41
|
+
}, C = v`
|
|
41
42
|
mutation HealthyBowlNotifyMention($input: HealthyBowlNotifyMentionInput!) {
|
|
42
43
|
healthybowlNotifyMention(input: $input)
|
|
43
44
|
}
|
|
44
|
-
`,
|
|
45
|
-
let { workspaceId:
|
|
46
|
-
workspaceId:
|
|
47
|
-
authToken:
|
|
48
|
-
apiGatewayUrl:
|
|
49
|
-
}),
|
|
45
|
+
`, w = () => {
|
|
46
|
+
let { workspaceId: d, currentUser: p, authToken: m, apiGatewayUrl: h } = e(), v = b("workspace"), w = p?.id, [T] = g(), E = T.get("item") ?? void 0, { projectId: D, loading: O, error: k, retry: A } = a(v, d, w), { members: j } = x({
|
|
47
|
+
workspaceId: d,
|
|
48
|
+
authToken: m,
|
|
49
|
+
apiGatewayUrl: h
|
|
50
|
+
}), M = l(() => j.map((e) => ({
|
|
50
51
|
id: e.id,
|
|
51
52
|
name: e.name
|
|
52
|
-
})), [
|
|
53
|
-
let t =
|
|
53
|
+
})), [j]), N = l(() => new Map(j.map((e) => [e.id, e.name])), [j]), P = c((e) => {
|
|
54
|
+
let t = N.get(e);
|
|
54
55
|
return t ? { name: t } : null;
|
|
55
|
-
}, [
|
|
56
|
-
!
|
|
57
|
-
mutation:
|
|
56
|
+
}, [N]), F = s(), { locale: I } = u(), { canManage: L } = o(d), R = c((e) => {
|
|
57
|
+
!v || e.mentionedIds.length === 0 || v.mutate({
|
|
58
|
+
mutation: C,
|
|
58
59
|
variables: { input: {
|
|
59
60
|
taskId: e.entityId,
|
|
60
61
|
mentionedUserIds: e.mentionedIds
|
|
61
62
|
} }
|
|
62
63
|
}).catch(() => {});
|
|
63
|
-
}, [
|
|
64
|
-
client:
|
|
65
|
-
children: /* @__PURE__ */
|
|
66
|
-
workspaceId:
|
|
67
|
-
projectId:
|
|
68
|
-
readonly: !
|
|
69
|
-
currentActorId:
|
|
64
|
+
}, [v]), z = l(() => v ? /* @__PURE__ */ _(y, {
|
|
65
|
+
client: v,
|
|
66
|
+
children: /* @__PURE__ */ _(i, {
|
|
67
|
+
workspaceId: d,
|
|
68
|
+
projectId: D ?? void 0,
|
|
69
|
+
readonly: !L,
|
|
70
|
+
currentActorId: w,
|
|
70
71
|
commentsEntityType: "planmagnet_workitem",
|
|
71
|
-
onMention:
|
|
72
|
-
openItemId:
|
|
73
|
-
labels:
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
onMention: R,
|
|
73
|
+
openItemId: E,
|
|
74
|
+
labels: F,
|
|
75
|
+
locale: I,
|
|
76
|
+
assigneeOptions: M,
|
|
77
|
+
resolveAssignee: P,
|
|
76
78
|
linkSourceProduct: "healthybowl",
|
|
77
|
-
renderLinkIcon:
|
|
79
|
+
renderLinkIcon: S,
|
|
78
80
|
onTaskSaved: () => {}
|
|
79
81
|
})
|
|
80
82
|
}) : null, [
|
|
81
|
-
|
|
82
|
-
|
|
83
|
+
v,
|
|
84
|
+
d,
|
|
85
|
+
D,
|
|
86
|
+
L,
|
|
87
|
+
w,
|
|
83
88
|
E,
|
|
84
89
|
F,
|
|
85
|
-
|
|
86
|
-
|
|
90
|
+
I,
|
|
91
|
+
M,
|
|
87
92
|
P,
|
|
88
|
-
|
|
89
|
-
N,
|
|
90
|
-
I
|
|
93
|
+
R
|
|
91
94
|
]);
|
|
92
|
-
return /* @__PURE__ */
|
|
95
|
+
return /* @__PURE__ */ _(t, {
|
|
93
96
|
title: "Farm Tasks",
|
|
94
97
|
titleAccent: "Tasks",
|
|
95
98
|
description: "Plan and track farm work — planting, harvesting, maintenance, and more — on a shared board.",
|
|
96
99
|
helpPrompt: "How do I use Farm Tasks to plan and track work on my farm?",
|
|
97
100
|
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.",
|
|
98
|
-
purposeIcon: /* @__PURE__ */
|
|
101
|
+
purposeIcon: /* @__PURE__ */ _(f, {
|
|
99
102
|
className: "size-5",
|
|
100
103
|
"aria-hidden": "true"
|
|
101
104
|
}),
|
|
102
|
-
children:
|
|
105
|
+
children: v ? k ? /* @__PURE__ */ _(n, {
|
|
103
106
|
title: "Couldn't open Farm Tasks",
|
|
104
|
-
description:
|
|
105
|
-
onRetry:
|
|
106
|
-
}) :
|
|
107
|
+
description: k.message,
|
|
108
|
+
onRetry: A
|
|
109
|
+
}) : O || !D ? /* @__PURE__ */ _(r, {}) : z : /* @__PURE__ */ _(n, {
|
|
107
110
|
title: "Tasks unavailable",
|
|
108
111
|
description: "The workspace connection isn't ready. Reload the page or reselect your workspace."
|
|
109
112
|
})
|
|
110
113
|
});
|
|
111
114
|
};
|
|
112
115
|
//#endregion
|
|
113
|
-
export {
|
|
116
|
+
export { w as TasksPage };
|
|
114
117
|
|
|
115
118
|
//# 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 { useSearchParams } from 'react-router-dom';\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 { TasksPageCore, type AssigneeOption } from '@burdenoff/planmagnet-fe-sdk';\nimport { Bug, ListChecks, MapPin, PawPrint, Sprout } from 'lucide-react';\nimport { PageLayout, ErrorState, PageLoader } from '../../components';\nimport { useHealthyBowl } from '../../context/HealthyBowlContext';\nimport { useDefaultTaskProject } from './useDefaultTaskProject';\nimport { useFarmTaskLabels } from './useFarmTaskLabels';\nimport { useCanManageTasks } from './useCanManageTasks';\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 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 // 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 const board = useMemo(() => {\n if (!workspaceClient) return null;\n return (\n <ApolloProvider client={workspaceClient}>\n <TasksPageCore\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 assigneeOptions={assigneeOptions}\n resolveAssignee={resolveAssignee}\n linkSourceProduct=\"healthybowl\"\n renderLinkIcon={renderFarmLinkIcon}\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 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 >\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":";;;;;;;;;;;;;;;;;;AAsDA,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,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GAAD;EACE,OAAM;EACN,aAAY;EACZ,aAAY;EACZ,YAAW;EACX,SAAQ;EACR,aAAa,kBAAC,GAAD;GAAY,WAAU;GAAS,eAAY;GAAS,CAAA;YAE/D,IAKE,IACF,kBAAC,GAAD;GAAY,OAAM;GAA2B,aAAa,EAAa;GAAS,SAAS;GAAS,CAAA,GAChG,KAAkB,CAAC,IACrB,kBAAC,GAAD,EAAc,CAAA,GAEd,IATA,kBAAC,GAAD;GACE,OAAM;GACN,aAAY;GACZ,CAAA;EAQO,CAAA"}
|
|
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 { useSearchParams } from 'react-router-dom';\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 { TasksPageCore, type AssigneeOption } from '@burdenoff/planmagnet-fe-sdk';\nimport { Bug, ListChecks, MapPin, PawPrint, Sprout } from 'lucide-react';\nimport { PageLayout, ErrorState, PageLoader } from '../../components';\nimport { useHealthyBowl } from '../../context/HealthyBowlContext';\nimport { useDefaultTaskProject } from './useDefaultTaskProject';\nimport { useFarmTaskLabels } from './useFarmTaskLabels';\nimport { useCanManageTasks } from './useCanManageTasks';\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 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 const board = useMemo(() => {\n if (!workspaceClient) return null;\n return (\n <ApolloProvider client={workspaceClient}>\n <TasksPageCore\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 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 >\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":";;;;;;;;;;;;;;;;;;;AAuDA,IAAM,KAAsB,MAAkC;AAC5D,SAAQ,GAAR;EACE,KAAK,QACH,QAAO,kBAAC,GAAD;G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