@burdenoff/microfe-planmagnet 2026.930.8 → 2026.930.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/planmagnet/PlanMagnetRoot.d.ts.map +1 -1
  2. package/dist/planmagnet/PlanMagnetRoot.js +126 -120
  3. package/dist/planmagnet/PlanMagnetRoot.js.map +1 -1
  4. package/dist/planmagnet/PlanMagnetRoutes.d.ts.map +1 -1
  5. package/dist/planmagnet/PlanMagnetRoutes.js +83 -75
  6. package/dist/planmagnet/PlanMagnetRoutes.js.map +1 -1
  7. package/dist/planmagnet/dependency/DependencyGraph.d.ts +43 -0
  8. package/dist/planmagnet/dependency/DependencyGraph.d.ts.map +1 -0
  9. package/dist/planmagnet/dependency/DependencyGraph.js +225 -0
  10. package/dist/planmagnet/dependency/DependencyGraph.js.map +1 -0
  11. package/dist/planmagnet/dependency/DependencyPanel.d.ts.map +1 -1
  12. package/dist/planmagnet/dependency/DependencyPanel.js +136 -90
  13. package/dist/planmagnet/dependency/DependencyPanel.js.map +1 -1
  14. package/dist/planmagnet/dependency/GanttChart.d.ts +40 -0
  15. package/dist/planmagnet/dependency/GanttChart.d.ts.map +1 -0
  16. package/dist/planmagnet/dependency/GanttChart.js +326 -0
  17. package/dist/planmagnet/dependency/GanttChart.js.map +1 -0
  18. package/dist/planmagnet/dependency/useProjectWorkItemsGraph.d.ts +40 -0
  19. package/dist/planmagnet/dependency/useProjectWorkItemsGraph.d.ts.map +1 -0
  20. package/dist/planmagnet/dependency/useProjectWorkItemsGraph.js +106 -0
  21. package/dist/planmagnet/dependency/useProjectWorkItemsGraph.js.map +1 -0
  22. package/dist/planmagnet/pages/ProjectsCriticalPathPagePage.d.ts.map +1 -1
  23. package/dist/planmagnet/pages/ProjectsCriticalPathPagePage.js +169 -100
  24. package/dist/planmagnet/pages/ProjectsCriticalPathPagePage.js.map +1 -1
  25. package/dist/planmagnet/pages/ProjectsGanttPagePage.d.ts +2 -0
  26. package/dist/planmagnet/pages/ProjectsGanttPagePage.d.ts.map +1 -0
  27. package/dist/planmagnet/pages/ProjectsGanttPagePage.js +143 -0
  28. package/dist/planmagnet/pages/ProjectsGanttPagePage.js.map +1 -0
  29. package/dist/planmagnet/utils/rowNavigation.d.ts +7 -2
  30. package/dist/planmagnet/utils/rowNavigation.d.ts.map +1 -1
  31. package/dist/planmagnet/utils/rowNavigation.js.map +1 -1
  32. package/dist/planmagnet/utils/statusColor.d.ts +26 -0
  33. package/dist/planmagnet/utils/statusColor.d.ts.map +1 -0
  34. package/dist/planmagnet/utils/statusColor.js +51 -0
  35. package/dist/planmagnet/utils/statusColor.js.map +1 -0
  36. package/package.json +1 -1
@@ -0,0 +1,326 @@
1
+ import { enumLabel as e } from "../controls/WorkItemControls.js";
2
+ import { STATUS_LEGEND_ORDER as t, statusVisual as n } from "../utils/statusColor.js";
3
+ import { dependencyTypeLabel as r, lagLabel as i, truncate as a } from "./DependencyGraph.js";
4
+ import { useMemo as o } from "react";
5
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
6
+ //#region src/planmagnet/dependency/GanttChart.tsx
7
+ var l = 864e5, u = 224, d = 28, f = d + 8, p = 28, m = 18, h = 12, g = 12, _ = 3, v = {
8
+ week: 28,
9
+ month: 6
10
+ };
11
+ function y(e) {
12
+ return Math.floor(Date.UTC(e.getUTCFullYear(), e.getUTCMonth(), e.getUTCDate()) / l);
13
+ }
14
+ function b(e) {
15
+ return y(new Date(e));
16
+ }
17
+ function x(e) {
18
+ return new Date(e * l).toLocaleDateString(void 0, {
19
+ month: "short",
20
+ day: "numeric",
21
+ timeZone: "UTC"
22
+ });
23
+ }
24
+ function S(e) {
25
+ return new Date(e * l).toLocaleDateString(void 0, {
26
+ month: "short",
27
+ year: "numeric",
28
+ timeZone: "UTC"
29
+ });
30
+ }
31
+ function C(e) {
32
+ if (!e.dueDate) return null;
33
+ let t = b(e.dueDate);
34
+ if (e.estimateMinutes && e.estimateMinutes > 0) {
35
+ let n = t - (Math.max(1, Math.ceil(e.estimateMinutes / 1440)) - 1);
36
+ return {
37
+ kind: "bar",
38
+ item: e,
39
+ startDay: n,
40
+ dueDay: t,
41
+ sortDay: n
42
+ };
43
+ }
44
+ return {
45
+ kind: "milestone",
46
+ item: e,
47
+ dueDay: t,
48
+ sortDay: t
49
+ };
50
+ }
51
+ function w(e, t) {
52
+ return e.kind === "milestone" ? e.dueDay + .5 : t === "start" ? e.startDay : e.dueDay + 1;
53
+ }
54
+ function T({ items: b, criticalIds: T, criticalEdgeIds: E, zoom: D, onActivateRow: O, today: k }) {
55
+ let A = o(() => {
56
+ let e = [], t = [];
57
+ for (let n of b) {
58
+ let r = C(n);
59
+ r ? e.push(r) : t.push(n);
60
+ }
61
+ e.sort((e, t) => e.sortDay - t.sortDay || e.item.key.localeCompare(t.item.key));
62
+ let n = new Map(e.map((e, t) => [e.item.id, {
63
+ row: e,
64
+ index: t
65
+ }])), r = y(k ?? /* @__PURE__ */ new Date()), i = e.flatMap((e) => e.kind === "bar" ? [e.startDay, e.dueDay] : [e.dueDay]);
66
+ i.push(r);
67
+ let a = Math.min(...i) - _, o = Math.max(...i) + _, s = v[D], c = (e) => g + (e - a) * s, u = g * 2 + (o - a + 1) * s, m = p + Math.max(1, e.length) * f + g, h = [];
68
+ for (let e = a; e <= o; e++) {
69
+ let t = new Date(e * l);
70
+ D === "week" && t.getUTCDay() === 1 && h.push({
71
+ day: e,
72
+ label: x(e)
73
+ }), D === "month" && t.getUTCDate() === 1 && h.push({
74
+ day: e,
75
+ label: S(e)
76
+ });
77
+ }
78
+ let T = e.flatMap(({ item: e }) => {
79
+ let t = n.get(e.id);
80
+ return t ? e.dependencies.flatMap((e) => {
81
+ let r = n.get(e.successorId);
82
+ if (!r) return [];
83
+ let i = e.type === "START_TO_START" || e.type === "START_TO_FINISH" ? "start" : "end", a = e.type === "FINISH_TO_FINISH" || e.type === "START_TO_FINISH" ? "end" : "start";
84
+ return [{
85
+ id: e.id,
86
+ type: e.type,
87
+ lagMinutes: e.lagMinutes,
88
+ x1: c(w(t.row, i)),
89
+ y1: p + t.index * f + d / 2,
90
+ x2: c(w(r.row, a)),
91
+ y2: p + r.index * f + d / 2
92
+ }];
93
+ }) : [];
94
+ });
95
+ return {
96
+ scheduled: e,
97
+ unscheduled: t,
98
+ todayX: c(r),
99
+ ticks: h,
100
+ arrows: T,
101
+ plotWidth: u,
102
+ plotHeight: m,
103
+ x: c
104
+ };
105
+ }, [
106
+ b,
107
+ D,
108
+ k
109
+ ]), j = o(() => t.filter((e) => b.some((t) => t.status === e)), [b]);
110
+ return /* @__PURE__ */ c("div", {
111
+ className: "rounded-md border border-input bg-background",
112
+ "data-testid": "gantt-chart",
113
+ children: [
114
+ /* @__PURE__ */ c("p", {
115
+ className: "sr-only",
116
+ children: [
117
+ "Gantt timeline with ",
118
+ A.scheduled.length,
119
+ " scheduled work item",
120
+ A.scheduled.length === 1 ? "" : "s",
121
+ A.unscheduled.length > 0 ? ` and ${A.unscheduled.length} unscheduled item${A.unscheduled.length === 1 ? "" : "s"} listed below the chart` : "",
122
+ ". Row labels open the task detail page."
123
+ ]
124
+ }),
125
+ /* @__PURE__ */ c("div", {
126
+ className: "flex",
127
+ children: [/* @__PURE__ */ c("div", {
128
+ style: { width: u },
129
+ className: "shrink-0 border-r border-input",
130
+ children: [
131
+ /* @__PURE__ */ s("div", {
132
+ style: { height: p },
133
+ className: "border-b border-input"
134
+ }),
135
+ A.scheduled.map((e) => {
136
+ let t = T?.has(e.item.id) ?? !1;
137
+ return /* @__PURE__ */ s("div", {
138
+ "data-testid": "gantt-row",
139
+ style: { height: f },
140
+ className: "flex items-center px-2",
141
+ children: /* @__PURE__ */ c("button", {
142
+ type: "button",
143
+ onClick: () => O(e.item.id),
144
+ className: `min-w-0 truncate text-left text-xs hover:underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary ${t ? "font-semibold text-primary" : "text-foreground"}`,
145
+ title: `${e.item.key} ${e.item.title}`,
146
+ children: [
147
+ e.item.key,
148
+ " ",
149
+ /* @__PURE__ */ s("span", {
150
+ className: "font-normal",
151
+ children: a(e.item.title, 28)
152
+ })
153
+ ]
154
+ })
155
+ }, e.item.id);
156
+ }),
157
+ A.scheduled.length === 0 && /* @__PURE__ */ s("p", {
158
+ className: "px-2 py-3 text-xs text-muted-foreground",
159
+ children: "No scheduled work items."
160
+ })
161
+ ]
162
+ }), /* @__PURE__ */ s("div", {
163
+ className: "overflow-x-auto",
164
+ children: /* @__PURE__ */ c("svg", {
165
+ "aria-label": "Project timeline",
166
+ width: A.plotWidth,
167
+ height: A.plotHeight,
168
+ viewBox: `0 0 ${A.plotWidth} ${A.plotHeight}`,
169
+ className: "block",
170
+ children: [
171
+ /* @__PURE__ */ c("defs", { children: [/* @__PURE__ */ s("marker", {
172
+ id: "gantt-arrow",
173
+ viewBox: "0 0 10 10",
174
+ refX: "9",
175
+ refY: "5",
176
+ markerWidth: "6",
177
+ markerHeight: "6",
178
+ orient: "auto-start-reverse",
179
+ className: "text-border-strong",
180
+ children: /* @__PURE__ */ s("path", {
181
+ d: "M0,0 L10,5 L0,10 z",
182
+ fill: "currentColor"
183
+ })
184
+ }), /* @__PURE__ */ s("marker", {
185
+ id: "gantt-arrow-critical",
186
+ viewBox: "0 0 10 10",
187
+ refX: "9",
188
+ refY: "5",
189
+ markerWidth: "6",
190
+ markerHeight: "6",
191
+ orient: "auto-start-reverse",
192
+ className: "text-primary",
193
+ children: /* @__PURE__ */ s("path", {
194
+ d: "M0,0 L10,5 L0,10 z",
195
+ fill: "currentColor"
196
+ })
197
+ })] }),
198
+ A.ticks.map((e) => /* @__PURE__ */ c("g", { children: [/* @__PURE__ */ s("line", {
199
+ x1: A.x(e.day),
200
+ x2: A.x(e.day),
201
+ y1: 0,
202
+ y2: A.plotHeight,
203
+ className: "text-chart-grid",
204
+ stroke: "currentColor",
205
+ strokeWidth: 1
206
+ }), /* @__PURE__ */ s("text", {
207
+ x: A.x(e.day) + 3,
208
+ y: p - 10,
209
+ className: "fill-chart-axis text-[10px]",
210
+ children: e.label
211
+ })] }, e.day)),
212
+ /* @__PURE__ */ s("line", {
213
+ x1: A.todayX,
214
+ x2: A.todayX,
215
+ y1: 0,
216
+ y2: A.plotHeight,
217
+ className: "text-status-info-bg",
218
+ stroke: "currentColor",
219
+ strokeWidth: 2,
220
+ strokeDasharray: "4 3"
221
+ }),
222
+ /* @__PURE__ */ s("text", {
223
+ x: A.todayX + 4,
224
+ y: 12,
225
+ className: "fill-status-info-text text-[10px] font-medium",
226
+ children: "Today"
227
+ }),
228
+ A.arrows.map((e) => {
229
+ let t = (e.x1 + e.x2) / 2, n = E?.has(e.id) ?? !1;
230
+ return /* @__PURE__ */ s("path", {
231
+ "data-testid": "gantt-arrow",
232
+ d: `M ${e.x1},${e.y1} C ${t},${e.y1} ${t},${e.y2} ${e.x2},${e.y2}`,
233
+ fill: "none",
234
+ stroke: "currentColor",
235
+ strokeWidth: n ? 2 : 1.25,
236
+ className: n ? "text-primary" : "text-border-strong",
237
+ markerEnd: `url(#${n ? "gantt-arrow-critical" : "gantt-arrow"})`,
238
+ children: /* @__PURE__ */ c("title", { children: [r(e.type), i(e.lagMinutes) ? ` (${i(e.lagMinutes)})` : ""] })
239
+ }, e.id);
240
+ }),
241
+ A.scheduled.map((t, r) => {
242
+ let i = p + r * f + d / 2, a = T?.has(t.item.id) ?? !1, o = n(t.item.status), l = `${t.item.key} — ${t.item.title} (${e(t.item.status)})${a ? ", on critical path" : ""}`;
243
+ if (t.kind === "milestone") {
244
+ let e = A.x(t.dueDay) + v[D] / 2, n = h / 2;
245
+ return /* @__PURE__ */ c("g", {
246
+ "data-testid": "gantt-bar",
247
+ children: [/* @__PURE__ */ c("title", { children: [l, " — milestone"] }), /* @__PURE__ */ s("rect", {
248
+ x: e - n,
249
+ y: i - n,
250
+ width: h,
251
+ height: h,
252
+ transform: `rotate(45 ${e} ${i})`,
253
+ className: `${o.fill} ${a ? "stroke-primary" : "stroke-input"}`,
254
+ strokeWidth: a ? 2 : 1
255
+ })]
256
+ }, t.item.id);
257
+ }
258
+ let u = A.x(t.startDay), g = A.x(t.dueDay) + v[D], _ = Math.max(v[D], g - u);
259
+ return /* @__PURE__ */ c("g", {
260
+ "data-testid": "gantt-bar",
261
+ children: [/* @__PURE__ */ s("title", { children: l }), /* @__PURE__ */ s("rect", {
262
+ x: u,
263
+ y: i - m / 2,
264
+ width: _,
265
+ height: m,
266
+ rx: 4,
267
+ className: `${o.fill} ${a ? "stroke-primary" : "stroke-input"}`,
268
+ strokeWidth: a ? 2 : 1
269
+ })]
270
+ }, t.item.id);
271
+ })
272
+ ]
273
+ })
274
+ })]
275
+ }),
276
+ /* @__PURE__ */ c("div", {
277
+ className: "flex flex-wrap items-center gap-x-4 gap-y-1 border-t border-input px-3 py-2 text-[11px] text-muted-foreground",
278
+ children: [
279
+ j.map((t) => /* @__PURE__ */ c("span", {
280
+ className: "inline-flex items-center gap-1.5",
281
+ children: [/* @__PURE__ */ s("span", { className: `h-2.5 w-2.5 rounded-full ${n(t).swatch}` }), e(t)]
282
+ }, t)),
283
+ /* @__PURE__ */ c("span", {
284
+ className: "inline-flex items-center gap-1.5",
285
+ children: [/* @__PURE__ */ s("span", { className: "h-2.5 w-2.5 rotate-45 border-2 border-muted-foreground bg-background" }), "Milestone"]
286
+ }),
287
+ T && T.size > 0 && /* @__PURE__ */ c("span", {
288
+ className: "inline-flex items-center gap-1.5",
289
+ children: [/* @__PURE__ */ s("span", { className: "h-2.5 w-2.5 rounded-full border-2 border-primary bg-background" }), "Critical path"]
290
+ }),
291
+ /* @__PURE__ */ c("span", {
292
+ className: "inline-flex items-center gap-1.5",
293
+ children: [/* @__PURE__ */ s("span", { className: "h-2.5 w-0.5 bg-status-info-bg" }), "Today"]
294
+ })
295
+ ]
296
+ }),
297
+ A.unscheduled.length > 0 && /* @__PURE__ */ c("div", {
298
+ "data-testid": "gantt-unscheduled",
299
+ className: "border-t border-input px-3 py-2 text-xs text-muted-foreground",
300
+ children: [/* @__PURE__ */ c("p", {
301
+ className: "font-medium text-foreground",
302
+ children: [
303
+ A.unscheduled.length,
304
+ " item",
305
+ A.unscheduled.length === 1 ? "" : "s",
306
+ " without a due date ",
307
+ A.unscheduled.length === 1 ? "isn't" : "aren't",
308
+ " shown above:"
309
+ ]
310
+ }), /* @__PURE__ */ s("div", {
311
+ className: "mt-1 flex flex-wrap gap-x-3 gap-y-1",
312
+ children: A.unscheduled.map((e) => /* @__PURE__ */ s("button", {
313
+ type: "button",
314
+ onClick: () => O(e.id),
315
+ className: "hover:underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary",
316
+ children: e.key
317
+ }, e.id))
318
+ })]
319
+ })
320
+ ]
321
+ });
322
+ }
323
+ //#endregion
324
+ export { T as GanttChart };
325
+
326
+ //# sourceMappingURL=GanttChart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GanttChart.js","names":[],"sources":["../../../src/planmagnet/dependency/GanttChart.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport { enumLabel } from '../controls/WorkItemControls';\nimport { statusVisual, STATUS_LEGEND_ORDER } from '../utils/statusColor';\nimport { dependencyTypeLabel, lagLabel, truncate } from './DependencyGraph';\n\n/**\n * Gantt timeline (ANR-24) for one project's work items. Plain SVG (recharts has no Gantt/timeline mark) — see\n * ProjectsGanttPagePage.tsx for data fetching, project choice, and the week/month zoom control this renders to.\n *\n * SCHEDULE SOURCE: `WorkItem` has no persisted start date in the current schema (`graphql/wspace.graphql` —\n * only `dueDate` and `estimateMinutes`). A bar's start is therefore DERIVED, backward from the due date, as\n * `dueDate - estimateMinutes`: an item with a due date AND a positive estimate draws as a bar; an item with a\n * due date but no (or a zero/negative) estimate draws as a milestone diamond, since there is no span to show; an\n * item with no due date at all has no anchor to place it on the axis and is counted in the unscheduled note\n * instead. This is called out again in the delivery notes — it is a real deviation from a literal \"has its own\n * start date\" reading, forced by the schema as it stands today.\n */\n\nexport interface GanttDependency {\n id: string;\n successorId: string;\n type: string;\n lagMinutes: number | null;\n}\n\nexport interface GanttWorkItem {\n id: string;\n key: string;\n title: string;\n status: string;\n dueDate: string | null;\n estimateMinutes: number | null;\n dependencies: GanttDependency[];\n}\n\nexport interface GanttChartProps {\n items: GanttWorkItem[];\n /** Work item ids on the critical path — their bars/diamonds are emphasised. */\n criticalIds?: ReadonlySet<string>;\n /** WorkItemDependency ids connecting two CONSECUTIVE critical-path items — their arrows are emphasised. */\n criticalEdgeIds?: ReadonlySet<string>;\n zoom: 'week' | 'month';\n onActivateRow: (id: string) => void;\n /** Injectable for predictable output; defaults to the real current time. */\n today?: Date;\n}\n\nconst MS_PER_DAY = 86_400_000;\nconst LABEL_COL_WIDTH = 224;\nconst ROW_HEIGHT = 28;\nconst ROW_GAP = 8;\nconst ROW_STEP = ROW_HEIGHT + ROW_GAP;\nconst AXIS_HEIGHT = 28;\nconst BAR_HEIGHT = 18;\nconst DIAMOND_SIZE = 12;\nconst SVG_PADDING = 12;\nconst DOMAIN_PAD_DAYS = 3;\n\nconst ZOOM_PX_PER_DAY: Record<GanttChartProps['zoom'], number> = { week: 28, month: 6 };\n\nfunction utcDayNumber(d: Date): number {\n return Math.floor(Date.UTC(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate()) / MS_PER_DAY);\n}\n\nfunction dayNumberFromIso(iso: string): number {\n return utcDayNumber(new Date(iso));\n}\n\nfunction formatShortDate(dayNum: number): string {\n const d = new Date(dayNum * MS_PER_DAY);\n return d.toLocaleDateString(undefined, { month: 'short', day: 'numeric', timeZone: 'UTC' });\n}\n\nfunction formatMonth(dayNum: number): string {\n const d = new Date(dayNum * MS_PER_DAY);\n return d.toLocaleDateString(undefined, { month: 'short', year: 'numeric', timeZone: 'UTC' });\n}\n\ntype ScheduledRow =\n | {\n kind: 'bar';\n item: GanttWorkItem;\n startDay: number;\n dueDay: number;\n sortDay: number;\n }\n | {\n kind: 'milestone';\n item: GanttWorkItem;\n dueDay: number;\n sortDay: number;\n };\n\nfunction scheduleItem(item: GanttWorkItem): ScheduledRow | null {\n if (!item.dueDate) return null;\n const dueDay = dayNumberFromIso(item.dueDate);\n if (item.estimateMinutes && item.estimateMinutes > 0) {\n const estimateDays = Math.max(1, Math.ceil(item.estimateMinutes / (60 * 24)));\n const startDay = dueDay - (estimateDays - 1);\n return { kind: 'bar', item, startDay, dueDay, sortDay: startDay };\n }\n return { kind: 'milestone', item, dueDay, sortDay: dueDay };\n}\n\n/**\n * Anchor x (in fractional day units, fed straight into `x()`) for one end of a row's mark. Must match the\n * geometry the row actually renders at: a bar spans a full day-width per day, so its true right edge sits one\n * day past `dueDay` (see `x2` at the bar render site below), and a milestone diamond is centered half a\n * day-width past `dueDay` (see `cx` at the milestone render site below) — not at `dueDay` itself either end.\n */\nfunction anchorDay(row: ScheduledRow, end: 'start' | 'end'): number {\n if (row.kind === 'milestone') return row.dueDay + 0.5;\n return end === 'start' ? row.startDay : row.dueDay + 1;\n}\n\nexport function GanttChart({\n items,\n criticalIds,\n criticalEdgeIds,\n zoom,\n onActivateRow,\n today,\n}: GanttChartProps) {\n const layout = useMemo(() => {\n const scheduled: ScheduledRow[] = [];\n const unscheduled: GanttWorkItem[] = [];\n for (const item of items) {\n const row = scheduleItem(item);\n if (row) scheduled.push(row);\n else unscheduled.push(item);\n }\n scheduled.sort((a, b) => a.sortDay - b.sortDay || a.item.key.localeCompare(b.item.key));\n\n const rowByItemId = new Map(scheduled.map((r, i) => [r.item.id, { row: r, index: i }]));\n const todayDay = utcDayNumber(today ?? new Date());\n\n const days = scheduled.flatMap((r) => (r.kind === 'bar' ? [r.startDay, r.dueDay] : [r.dueDay]));\n days.push(todayDay);\n const domainStart = Math.min(...days) - DOMAIN_PAD_DAYS;\n const domainEnd = Math.max(...days) + DOMAIN_PAD_DAYS;\n const pxPerDay = ZOOM_PX_PER_DAY[zoom];\n const x = (day: number) => SVG_PADDING + (day - domainStart) * pxPerDay;\n\n const plotWidth = SVG_PADDING * 2 + (domainEnd - domainStart + 1) * pxPerDay;\n const plotHeight = AXIS_HEIGHT + Math.max(1, scheduled.length) * ROW_STEP + SVG_PADDING;\n\n const ticks: { day: number; label: string }[] = [];\n for (let d = domainStart; d <= domainEnd; d++) {\n const date = new Date(d * MS_PER_DAY);\n if (zoom === 'week' && date.getUTCDay() === 1)\n ticks.push({ day: d, label: formatShortDate(d) });\n if (zoom === 'month' && date.getUTCDate() === 1)\n ticks.push({ day: d, label: formatMonth(d) });\n }\n\n const arrows = scheduled.flatMap(({ item: predecessorItem }) => {\n const from = rowByItemId.get(predecessorItem.id);\n if (!from) return [];\n return predecessorItem.dependencies.flatMap((dep) => {\n const to = rowByItemId.get(dep.successorId);\n if (!to) return [];\n const fromEnd =\n dep.type === 'START_TO_START' || dep.type === 'START_TO_FINISH' ? 'start' : 'end';\n const toEnd =\n dep.type === 'FINISH_TO_FINISH' || dep.type === 'START_TO_FINISH' ? 'end' : 'start';\n return [\n {\n id: dep.id,\n type: dep.type,\n lagMinutes: dep.lagMinutes,\n x1: x(anchorDay(from.row, fromEnd)),\n y1: AXIS_HEIGHT + from.index * ROW_STEP + ROW_HEIGHT / 2,\n x2: x(anchorDay(to.row, toEnd)),\n y2: AXIS_HEIGHT + to.index * ROW_STEP + ROW_HEIGHT / 2,\n },\n ];\n });\n });\n\n return {\n scheduled,\n unscheduled,\n todayX: x(todayDay),\n ticks,\n arrows,\n plotWidth,\n plotHeight,\n x,\n };\n }, [items, zoom, today]);\n\n const presentStatuses = useMemo(\n () => STATUS_LEGEND_ORDER.filter((s) => items.some((i) => i.status === s)),\n [items]\n );\n\n return (\n <div className=\"rounded-md border border-input bg-background\" data-testid=\"gantt-chart\">\n <p className=\"sr-only\">\n Gantt timeline with {layout.scheduled.length} scheduled work item\n {layout.scheduled.length === 1 ? '' : 's'}\n {layout.unscheduled.length > 0\n ? ` and ${layout.unscheduled.length} unscheduled item${layout.unscheduled.length === 1 ? '' : 's'} listed below the chart`\n : ''}\n . Row labels open the task detail page.\n </p>\n <div className=\"flex\">\n <div style={{ width: LABEL_COL_WIDTH }} className=\"shrink-0 border-r border-input\">\n <div style={{ height: AXIS_HEIGHT }} className=\"border-b border-input\" />\n {layout.scheduled.map((row) => {\n const critical = criticalIds?.has(row.item.id) ?? false;\n return (\n <div\n key={row.item.id}\n data-testid=\"gantt-row\"\n style={{ height: ROW_STEP }}\n className=\"flex items-center px-2\"\n >\n <button\n type=\"button\"\n onClick={() => onActivateRow(row.item.id)}\n className={`min-w-0 truncate text-left text-xs hover:underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary ${critical ? 'font-semibold text-primary' : 'text-foreground'}`}\n title={`${row.item.key} ${row.item.title}`}\n >\n {row.item.key} <span className=\"font-normal\">{truncate(row.item.title, 28)}</span>\n </button>\n </div>\n );\n })}\n {layout.scheduled.length === 0 && (\n <p className=\"px-2 py-3 text-xs text-muted-foreground\">No scheduled work items.</p>\n )}\n </div>\n\n <div className=\"overflow-x-auto\">\n <svg\n aria-label=\"Project timeline\"\n width={layout.plotWidth}\n height={layout.plotHeight}\n viewBox={`0 0 ${layout.plotWidth} ${layout.plotHeight}`}\n className=\"block\"\n >\n <defs>\n <marker\n id=\"gantt-arrow\"\n viewBox=\"0 0 10 10\"\n refX=\"9\"\n refY=\"5\"\n markerWidth=\"6\"\n markerHeight=\"6\"\n orient=\"auto-start-reverse\"\n className=\"text-border-strong\"\n >\n <path d=\"M0,0 L10,5 L0,10 z\" fill=\"currentColor\" />\n </marker>\n <marker\n id=\"gantt-arrow-critical\"\n viewBox=\"0 0 10 10\"\n refX=\"9\"\n refY=\"5\"\n markerWidth=\"6\"\n markerHeight=\"6\"\n orient=\"auto-start-reverse\"\n className=\"text-primary\"\n >\n <path d=\"M0,0 L10,5 L0,10 z\" fill=\"currentColor\" />\n </marker>\n </defs>\n\n {layout.ticks.map((tick) => (\n <g key={tick.day}>\n <line\n x1={layout.x(tick.day)}\n x2={layout.x(tick.day)}\n y1={0}\n y2={layout.plotHeight}\n className=\"text-chart-grid\"\n stroke=\"currentColor\"\n strokeWidth={1}\n />\n <text\n x={layout.x(tick.day) + 3}\n y={AXIS_HEIGHT - 10}\n className=\"fill-chart-axis text-[10px]\"\n >\n {tick.label}\n </text>\n </g>\n ))}\n\n <line\n x1={layout.todayX}\n x2={layout.todayX}\n y1={0}\n y2={layout.plotHeight}\n className=\"text-status-info-bg\"\n stroke=\"currentColor\"\n strokeWidth={2}\n strokeDasharray=\"4 3\"\n />\n <text\n x={layout.todayX + 4}\n y={12}\n className=\"fill-status-info-text text-[10px] font-medium\"\n >\n Today\n </text>\n\n {layout.arrows.map((arrow) => {\n const midX = (arrow.x1 + arrow.x2) / 2;\n const critical = criticalEdgeIds?.has(arrow.id) ?? false;\n return (\n <path\n key={arrow.id}\n data-testid=\"gantt-arrow\"\n d={`M ${arrow.x1},${arrow.y1} C ${midX},${arrow.y1} ${midX},${arrow.y2} ${arrow.x2},${arrow.y2}`}\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={critical ? 2 : 1.25}\n className={critical ? 'text-primary' : 'text-border-strong'}\n markerEnd={`url(#${critical ? 'gantt-arrow-critical' : 'gantt-arrow'})`}\n >\n <title>\n {dependencyTypeLabel(arrow.type)}\n {lagLabel(arrow.lagMinutes) ? ` (${lagLabel(arrow.lagMinutes)})` : ''}\n </title>\n </path>\n );\n })}\n\n {layout.scheduled.map((row, index) => {\n const y = AXIS_HEIGHT + index * ROW_STEP + ROW_HEIGHT / 2;\n const critical = criticalIds?.has(row.item.id) ?? false;\n const visual = statusVisual(row.item.status);\n const label = `${row.item.key} — ${row.item.title} (${enumLabel(row.item.status)})${critical ? ', on critical path' : ''}`;\n if (row.kind === 'milestone') {\n const cx = layout.x(row.dueDay) + ZOOM_PX_PER_DAY[zoom] / 2;\n const r = DIAMOND_SIZE / 2;\n return (\n <g key={row.item.id} data-testid=\"gantt-bar\">\n <title>{label} — milestone</title>\n <rect\n x={cx - r}\n y={y - r}\n width={DIAMOND_SIZE}\n height={DIAMOND_SIZE}\n transform={`rotate(45 ${cx} ${y})`}\n className={`${visual.fill} ${critical ? 'stroke-primary' : 'stroke-input'}`}\n strokeWidth={critical ? 2 : 1}\n />\n </g>\n );\n }\n const x1 = layout.x(row.startDay);\n const x2 = layout.x(row.dueDay) + ZOOM_PX_PER_DAY[zoom];\n const width = Math.max(ZOOM_PX_PER_DAY[zoom], x2 - x1);\n return (\n <g key={row.item.id} data-testid=\"gantt-bar\">\n <title>{label}</title>\n <rect\n x={x1}\n y={y - BAR_HEIGHT / 2}\n width={width}\n height={BAR_HEIGHT}\n rx={4}\n className={`${visual.fill} ${critical ? 'stroke-primary' : 'stroke-input'}`}\n strokeWidth={critical ? 2 : 1}\n />\n </g>\n );\n })}\n </svg>\n </div>\n </div>\n\n <div className=\"flex flex-wrap items-center gap-x-4 gap-y-1 border-t border-input px-3 py-2 text-[11px] text-muted-foreground\">\n {presentStatuses.map((status) => (\n <span key={status} className=\"inline-flex items-center gap-1.5\">\n <span className={`h-2.5 w-2.5 rounded-full ${statusVisual(status).swatch}`} />\n {enumLabel(status)}\n </span>\n ))}\n <span className=\"inline-flex items-center gap-1.5\">\n <span className=\"h-2.5 w-2.5 rotate-45 border-2 border-muted-foreground bg-background\" />\n Milestone\n </span>\n {criticalIds && criticalIds.size > 0 && (\n <span className=\"inline-flex items-center gap-1.5\">\n <span className=\"h-2.5 w-2.5 rounded-full border-2 border-primary bg-background\" />\n Critical path\n </span>\n )}\n <span className=\"inline-flex items-center gap-1.5\">\n <span className=\"h-2.5 w-0.5 bg-status-info-bg\" />\n Today\n </span>\n </div>\n\n {layout.unscheduled.length > 0 && (\n <div\n data-testid=\"gantt-unscheduled\"\n className=\"border-t border-input px-3 py-2 text-xs text-muted-foreground\"\n >\n <p className=\"font-medium text-foreground\">\n {layout.unscheduled.length} item{layout.unscheduled.length === 1 ? '' : 's'} without a\n due date {layout.unscheduled.length === 1 ? \"isn't\" : \"aren't\"} shown above:\n </p>\n <div className=\"mt-1 flex flex-wrap gap-x-3 gap-y-1\">\n {layout.unscheduled.map((item) => (\n <button\n key={item.id}\n type=\"button\"\n onClick={() => onActivateRow(item.id)}\n className=\"hover:underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary\"\n >\n {item.key}\n </button>\n ))}\n </div>\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;AA+CA,IAAM,IAAa,OACb,IAAkB,KAClB,IAAa,IAEb,IAAW,IADD,GAEV,IAAc,IACd,IAAa,IACb,IAAe,IACf,IAAc,IACd,IAAkB,GAElB,IAA2D;CAAE,MAAM;CAAI,OAAO;CAAG;AAEvF,SAAS,EAAa,GAAiB;AACrC,QAAO,KAAK,MAAM,KAAK,IAAI,EAAE,gBAAgB,EAAE,EAAE,aAAa,EAAE,EAAE,YAAY,CAAC,GAAG,EAAW;;AAG/F,SAAS,EAAiB,GAAqB;AAC7C,QAAO,EAAa,IAAI,KAAK,EAAI,CAAC;;AAGpC,SAAS,EAAgB,GAAwB;AAE/C,QADU,IAAI,KAAK,IAAS,EAAW,CAC9B,mBAAmB,KAAA,GAAW;EAAE,OAAO;EAAS,KAAK;EAAW,UAAU;EAAO,CAAC;;AAG7F,SAAS,EAAY,GAAwB;AAE3C,QADU,IAAI,KAAK,IAAS,EAAW,CAC9B,mBAAmB,KAAA,GAAW;EAAE,OAAO;EAAS,MAAM;EAAW,UAAU;EAAO,CAAC;;AAkB9F,SAAS,EAAa,GAA0C;AAC9D,KAAI,CAAC,EAAK,QAAS,QAAO;CAC1B,IAAM,IAAS,EAAiB,EAAK,QAAQ;AAC7C,KAAI,EAAK,mBAAmB,EAAK,kBAAkB,GAAG;EAEpD,IAAM,IAAW,KADI,KAAK,IAAI,GAAG,KAAK,KAAK,EAAK,kBAAmB,KAAS,CAAC,GACnC;AAC1C,SAAO;GAAE,MAAM;GAAO;GAAM;GAAU;GAAQ,SAAS;GAAU;;AAEnE,QAAO;EAAE,MAAM;EAAa;EAAM;EAAQ,SAAS;EAAQ;;AAS7D,SAAS,EAAU,GAAmB,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;IAAK,WAAU;cAAf;KACG,EAAgB,KAAK,MACpB,kBAAC,QAAD;MAAmB,WAAU;gBAA7B,CACE,kBAAC,QAAD,EAAM,WAAW,4BAA4B,EAAa,EAAO,CAAC,UAAY,CAAA,EAC7E,EAAU,EAAO,CACb;QAHI,EAGJ,CACP;KACF,kBAAC,QAAD;MAAM,WAAU;gBAAhB,CACE,kBAAC,QAAD,EAAM,WAAU,wEAAyE,CAAA,EAAA,YAEpF;;KACN,KAAe,EAAY,OAAO,KACjC,kBAAC,QAAD;MAAM,WAAU;gBAAhB,CACE,kBAAC,QAAD,EAAM,WAAU,kEAAmE,CAAA,EAAA,gBAE9E;;KAET,kBAAC,QAAD;MAAM,WAAU;gBAAhB,CACE,kBAAC,QAAD,EAAM,WAAU,iCAAkC,CAAA,EAAA,QAE7C;;KACH;;GAEL,EAAO,YAAY,SAAS,KAC3B,kBAAC,OAAD;IACE,eAAY;IACZ,WAAU;cAFZ,CAIE,kBAAC,KAAD;KAAG,WAAU;eAAb;MACG,EAAO,YAAY;MAAO;MAAM,EAAO,YAAY,WAAW,IAAI,KAAK;MAAI;MAClE,EAAO,YAAY,WAAW,IAAI,UAAU;MAAS;MAC7D;QACJ,kBAAC,OAAD;KAAK,WAAU;eACZ,EAAO,YAAY,KAAK,MACvB,kBAAC,UAAD;MAEE,MAAK;MACL,eAAe,EAAc,EAAK,GAAG;MACrC,WAAU;gBAET,EAAK;MACC,EANF,EAAK,GAMH,CACT;KACE,CAAA,CACF;;GAEJ"}
@@ -0,0 +1,40 @@
1
+ import { ErrorLike } from '@apollo/client';
2
+
3
+ export interface ProjectGraphDependency {
4
+ id: string;
5
+ successorId: string;
6
+ type: string;
7
+ lagMinutes: number | null;
8
+ status: string;
9
+ }
10
+ export interface ProjectGraphWorkItem {
11
+ id: string;
12
+ key: string;
13
+ title: string;
14
+ status: string;
15
+ dueDate: string | null;
16
+ estimateMinutes: number | null;
17
+ dependencies: ProjectGraphDependency[];
18
+ }
19
+ /**
20
+ * The WorkItemDependency ids that connect two CONSECUTIVE nodes of a critical-path chain (as returned by
21
+ * `planmagnetCriticalPath.path`), so the graph/Gantt views can emphasise those specific edges rather than every
22
+ * edge touching a critical node (a critical item can also have a NON-critical dependency, e.g. to an item with
23
+ * slack — only the chain's own edges are "the critical path" in the CPM sense).
24
+ */
25
+ export declare function criticalEdgeIdsFromPath(path: {
26
+ id: string;
27
+ }[], items: ProjectGraphWorkItem[]): Set<string>;
28
+ export interface UseProjectWorkItemsGraphResult {
29
+ items: ProjectGraphWorkItem[];
30
+ totalCount: number;
31
+ loading: boolean;
32
+ error: ErrorLike | undefined;
33
+ /** A later page failed to load — the list already shown may be incomplete. */
34
+ moreError: string | null;
35
+ /** Paging stopped at MAX_ITEMS while more work items remained. */
36
+ truncated: boolean;
37
+ }
38
+ /** Every work item (and its outgoing dependencies) in a project, paged in full up to MAX_ITEMS. */
39
+ export declare function useProjectWorkItemsGraph(projectId: string | null | undefined): UseProjectWorkItemsGraphResult;
40
+ //# sourceMappingURL=useProjectWorkItemsGraph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useProjectWorkItemsGraph.d.ts","sourceRoot":"","sources":["../../../src/planmagnet/dependency/useProjectWorkItemsGraph.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAkDrD,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,YAAY,EAAE,sBAAsB,EAAE,CAAC;CACxC;AAkBD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EAAE,EACtB,KAAK,EAAE,oBAAoB,EAAE,GAC5B,GAAG,CAAC,MAAM,CAAC,CAYb;AAED,MAAM,WAAW,8BAA8B;IAC7C,KAAK,EAAE,oBAAoB,EAAE,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,SAAS,GAAG,SAAS,CAAC;IAC7B,8EAA8E;IAC9E,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,kEAAkE;IAClE,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,mGAAmG;AACnG,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GACnC,8BAA8B,CAwDhC"}
@@ -0,0 +1,106 @@
1
+ import { usePlanMagnet as e } from "../providers/PlanMagnetProvider.js";
2
+ import { useEffect as t, useState as n } from "react";
3
+ import { gql as r } from "@apollo/client";
4
+ import { useQuery as i } from "@apollo/client/react";
5
+ //#region src/planmagnet/dependency/useProjectWorkItemsGraph.ts
6
+ var a = r`
7
+ query GetProjectWorkItemsGraph(
8
+ $workspaceId: ID!
9
+ $projectId: String
10
+ $pagination: PlanmagnetPaginationInput
11
+ ) {
12
+ planmagnetWorkItems(
13
+ workspaceId: $workspaceId
14
+ filter: { projectId: $projectId }
15
+ pagination: $pagination
16
+ ) {
17
+ items {
18
+ id
19
+ key
20
+ title
21
+ status
22
+ dueDate
23
+ estimateMinutes
24
+ dependencies {
25
+ id
26
+ successorId
27
+ type
28
+ lagMinutes
29
+ status
30
+ }
31
+ }
32
+ pageInfo {
33
+ hasNextPage
34
+ endCursor
35
+ }
36
+ totalCount
37
+ }
38
+ }
39
+ `, o = 100, s = 2e3;
40
+ function c(e, t) {
41
+ let n = new Map(t.map((e) => [e.id, e.dependencies])), r = /* @__PURE__ */ new Set();
42
+ for (let t = 0; t < e.length - 1; t++) {
43
+ let i = e[t].id, a = e[t + 1].id, o = (n.get(i) ?? []).find((e) => e.successorId === a);
44
+ o && r.add(o.id);
45
+ }
46
+ return r;
47
+ }
48
+ function l(r) {
49
+ let { workspaceId: c } = e(), { data: l, loading: u, error: d, fetchMore: f } = i(a, {
50
+ variables: {
51
+ workspaceId: c ?? "",
52
+ projectId: r,
53
+ pagination: { first: o }
54
+ },
55
+ skip: !c || !r
56
+ }), p = l?.planmagnetWorkItems.pageInfo, m = l?.planmagnetWorkItems.items.length ?? 0, [h, g] = n({
57
+ projectId: r,
58
+ error: null
59
+ });
60
+ h.projectId !== r && g({
61
+ projectId: r,
62
+ error: null
63
+ });
64
+ let _ = h.projectId === r ? h.error : null;
65
+ return t(() => {
66
+ if (_ || !p?.hasNextPage || !p.endCursor || m >= s) return;
67
+ let e = p.endCursor;
68
+ f({
69
+ variables: { pagination: {
70
+ first: o,
71
+ after: e
72
+ } },
73
+ updateQuery: (e, { fetchMoreResult: t }) => ({ planmagnetWorkItems: {
74
+ ...t.planmagnetWorkItems,
75
+ items: [...e.planmagnetWorkItems.items, ...t.planmagnetWorkItems.items]
76
+ } })
77
+ }).then((e) => {
78
+ let t = e?.error;
79
+ t && g({
80
+ projectId: r,
81
+ error: t.message ?? "Unknown error"
82
+ });
83
+ }).catch((e) => g({
84
+ projectId: r,
85
+ error: e instanceof Error ? e.message : String(e)
86
+ }));
87
+ }, [
88
+ _,
89
+ p?.hasNextPage,
90
+ p?.endCursor,
91
+ m,
92
+ f,
93
+ r
94
+ ]), {
95
+ items: l?.planmagnetWorkItems.items ?? [],
96
+ totalCount: l?.planmagnetWorkItems.totalCount ?? 0,
97
+ loading: u,
98
+ error: d,
99
+ moreError: _,
100
+ truncated: m >= s && !!p?.hasNextPage
101
+ };
102
+ }
103
+ //#endregion
104
+ export { c as criticalEdgeIdsFromPath, l as useProjectWorkItemsGraph };
105
+
106
+ //# sourceMappingURL=useProjectWorkItemsGraph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useProjectWorkItemsGraph.js","names":[],"sources":["../../../src/planmagnet/dependency/useProjectWorkItemsGraph.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport { gql, type ErrorLike } from '@apollo/client';\nimport { useQuery } from '@apollo/client/react';\nimport { usePlanMagnet } from '../providers/PlanMagnetProvider';\n\n/**\n * Every work item in a project, each with its OWN outgoing dependencies inline (PDM-27's project graph view and\n * ANR-24's Gantt page both need this — see DependencyGraph.tsx / GanttChart.tsx). `WorkItemDependency` has no\n * `projectId` filter of its own (`PlanmagnetDependencyFilter` only takes predecessorId/successorId/status/type),\n * so pulling the full edge set for a project through `planmagnetDependencies` would mean paging the WHOLE\n * workspace's dependencies and filtering client-side. `WorkItem.dependencies` — \"dependencies where this item is\n * the source\" — sidesteps that: the union of every fetched item's outgoing edges already covers the project's\n * whole graph (any edge whose successor sits outside the project is dropped by DependencyGraph's own node-scope\n * filter, same as a cross-project WorkItemLink already is elsewhere).\n */\n\nconst GET_PROJECT_WORK_ITEMS_GRAPH = gql`\n query GetProjectWorkItemsGraph(\n $workspaceId: ID!\n $projectId: String\n $pagination: PlanmagnetPaginationInput\n ) {\n planmagnetWorkItems(\n workspaceId: $workspaceId\n filter: { projectId: $projectId }\n pagination: $pagination\n ) {\n items {\n id\n key\n title\n status\n dueDate\n estimateMinutes\n dependencies {\n id\n successorId\n type\n lagMinutes\n status\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n totalCount\n }\n }\n`;\n\nexport interface ProjectGraphDependency {\n id: string;\n successorId: string;\n type: string;\n lagMinutes: number | null;\n status: string;\n}\n\nexport interface ProjectGraphWorkItem {\n id: string;\n key: string;\n title: string;\n status: string;\n dueDate: string | null;\n estimateMinutes: number | null;\n dependencies: ProjectGraphDependency[];\n}\n\ninterface WorkItemsGraphPage {\n planmagnetWorkItems: {\n items: ProjectGraphWorkItem[];\n pageInfo: { hasNextPage: boolean; endCursor: string | null };\n totalCount: number;\n };\n}\n\nconst PAGE_SIZE = 100;\n/**\n * Stated cap: a project with more work items than this stops paging and says so (`truncated`) instead of\n * fetching indefinitely — same discipline as ExportWorkItemsButton's MAX_PAGES and ProjectSelect's\n * MAX_PROJECT_OPTIONS, just expressed as an item count since the caller needs that to size the cap message.\n */\nconst MAX_ITEMS = 2000;\n\n/**\n * The WorkItemDependency ids that connect two CONSECUTIVE nodes of a critical-path chain (as returned by\n * `planmagnetCriticalPath.path`), so the graph/Gantt views can emphasise those specific edges rather than every\n * edge touching a critical node (a critical item can also have a NON-critical dependency, e.g. to an item with\n * slack — only the chain's own edges are \"the critical path\" in the CPM sense).\n */\nexport function criticalEdgeIdsFromPath(\n path: { id: string }[],\n items: ProjectGraphWorkItem[]\n): Set<string> {\n const dependenciesByPredecessor = new Map(items.map((item) => [item.id, item.dependencies]));\n const edgeIds = new Set<string>();\n for (let i = 0; i < path.length - 1; i++) {\n const predecessorId = path[i].id;\n const successorId = path[i + 1].id;\n const edge = (dependenciesByPredecessor.get(predecessorId) ?? []).find(\n (d) => d.successorId === successorId\n );\n if (edge) edgeIds.add(edge.id);\n }\n return edgeIds;\n}\n\nexport interface UseProjectWorkItemsGraphResult {\n items: ProjectGraphWorkItem[];\n totalCount: number;\n loading: boolean;\n error: ErrorLike | undefined;\n /** A later page failed to load — the list already shown may be incomplete. */\n moreError: string | null;\n /** Paging stopped at MAX_ITEMS while more work items remained. */\n truncated: boolean;\n}\n\n/** Every work item (and its outgoing dependencies) in a project, paged in full up to MAX_ITEMS. */\nexport function useProjectWorkItemsGraph(\n projectId: string | null | undefined\n): UseProjectWorkItemsGraphResult {\n const { workspaceId } = usePlanMagnet();\n const { data, loading, error, fetchMore } = useQuery<WorkItemsGraphPage>(\n GET_PROJECT_WORK_ITEMS_GRAPH,\n {\n variables: { workspaceId: workspaceId ?? '', projectId, pagination: { first: PAGE_SIZE } },\n skip: !workspaceId || !projectId,\n }\n );\n\n const pageInfo = data?.planmagnetWorkItems.pageInfo;\n const loadedCount = data?.planmagnetWorkItems.items.length ?? 0;\n const [moreErrorState, setMoreErrorState] = useState<{\n projectId: string | null | undefined;\n error: string | null;\n }>({ projectId, error: null });\n // A different project must not keep a stale \"a later page failed\" flag from the last one. Reset during\n // render (React's documented \"adjusting state when a prop changes\" pattern) rather than in an effect, so\n // the reset lands in the SAME commit as the project change instead of one render later.\n if (moreErrorState.projectId !== projectId) {\n setMoreErrorState({ projectId, error: null });\n }\n const moreError = moreErrorState.projectId === projectId ? moreErrorState.error : null;\n\n useEffect(() => {\n if (moreError || !pageInfo?.hasNextPage || !pageInfo.endCursor || loadedCount >= MAX_ITEMS) {\n return;\n }\n const after = pageInfo.endCursor;\n fetchMore({\n variables: { pagination: { first: PAGE_SIZE, after } },\n updateQuery: (prev, { fetchMoreResult }) => ({\n planmagnetWorkItems: {\n ...fetchMoreResult.planmagnetWorkItems,\n items: [...prev.planmagnetWorkItems.items, ...fetchMoreResult.planmagnetWorkItems.items],\n },\n }),\n })\n .then((result) => {\n // fe-libs queries resolve with { error } instead of rejecting.\n const failure = (result as { error?: { message?: string } } | undefined)?.error;\n if (failure) setMoreErrorState({ projectId, error: failure.message ?? 'Unknown error' });\n })\n .catch((e: unknown) =>\n setMoreErrorState({ projectId, error: e instanceof Error ? e.message : String(e) })\n );\n }, [moreError, pageInfo?.hasNextPage, pageInfo?.endCursor, loadedCount, fetchMore, projectId]);\n\n return {\n items: data?.planmagnetWorkItems.items ?? [],\n totalCount: data?.planmagnetWorkItems.totalCount ?? 0,\n loading,\n error,\n moreError,\n truncated: loadedCount >= MAX_ITEMS && !!pageInfo?.hasNextPage,\n };\n}\n"],"mappings":";;;;;AAgBA,IAAM,IAA+B,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DlC,IAAY,KAMZ,IAAY;AAQlB,SAAgB,EACd,GACA,GACa;CACb,IAAM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AAI,KAAS,EAAkB;IAAE;IAAW,OAAO,EAAQ,WAAW;IAAiB,CAAC;IACxF,CACD,OAAO,MACN,EAAkB;GAAE;GAAW,OAAO,aAAa,QAAQ,EAAE,UAAU,OAAO,EAAE;GAAE,CAAC,CACpF;IACF;EAAC;EAAW,GAAU;EAAa,GAAU;EAAW;EAAa;EAAW;EAAU,CAAC,EAEvF;EACL,OAAO,GAAM,oBAAoB,SAAS,EAAE;EAC5C,YAAY,GAAM,oBAAoB,cAAc;EACpD;EACA;EACA;EACA,WAAW,KAAe,KAAa,CAAC,CAAC,GAAU;EACpD"}
@@ -1 +1 @@
1
- {"version":3,"file":"ProjectsCriticalPathPagePage.d.ts","sourceRoot":"","sources":["../../../src/planmagnet/pages/ProjectsCriticalPathPagePage.tsx"],"names":[],"mappings":"AAkFA,wBAAgB,4BAA4B,4CAmR3C"}
1
+ {"version":3,"file":"ProjectsCriticalPathPagePage.d.ts","sourceRoot":"","sources":["../../../src/planmagnet/pages/ProjectsCriticalPathPagePage.tsx"],"names":[],"mappings":"AA2FA,wBAAgB,4BAA4B,4CA0W3C"}