@burdenoff/microfe-planmagnet 2026.930.15 → 2026.930.17

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 (40) hide show
  1. package/dist/planmagnet/comments/CommentThread.d.ts +44 -0
  2. package/dist/planmagnet/comments/CommentThread.d.ts.map +1 -0
  3. package/dist/planmagnet/comments/CommentThread.js +513 -0
  4. package/dist/planmagnet/comments/CommentThread.js.map +1 -0
  5. package/dist/planmagnet/comments/MentionComposer.d.ts +25 -0
  6. package/dist/planmagnet/comments/MentionComposer.d.ts.map +1 -0
  7. package/dist/planmagnet/comments/MentionComposer.js +148 -0
  8. package/dist/planmagnet/comments/MentionComposer.js.map +1 -0
  9. package/dist/planmagnet/comments/RoadmapComments.d.ts +29 -0
  10. package/dist/planmagnet/comments/RoadmapComments.d.ts.map +1 -0
  11. package/dist/planmagnet/comments/RoadmapComments.js +310 -0
  12. package/dist/planmagnet/comments/RoadmapComments.js.map +1 -0
  13. package/dist/planmagnet/comments/TargetComments.d.ts +7 -0
  14. package/dist/planmagnet/comments/TargetComments.d.ts.map +1 -0
  15. package/dist/planmagnet/comments/TargetComments.js +207 -0
  16. package/dist/planmagnet/comments/TargetComments.js.map +1 -0
  17. package/dist/planmagnet/comments/WorkItemComments.d.ts.map +1 -1
  18. package/dist/planmagnet/comments/WorkItemComments.js +68 -216
  19. package/dist/planmagnet/comments/WorkItemComments.js.map +1 -1
  20. package/dist/planmagnet/pages/DocsDocDetailPagePage.d.ts.map +1 -1
  21. package/dist/planmagnet/pages/DocsDocDetailPagePage.js +74 -72
  22. package/dist/planmagnet/pages/DocsDocDetailPagePage.js.map +1 -1
  23. package/dist/planmagnet/pages/ProductsRoadmapDetailPagePage.d.ts.map +1 -1
  24. package/dist/planmagnet/pages/ProductsRoadmapDetailPagePage.js +130 -112
  25. package/dist/planmagnet/pages/ProductsRoadmapDetailPagePage.js.map +1 -1
  26. package/dist/planmagnet/pages/ProjectsProjectDetailPagePage.d.ts.map +1 -1
  27. package/dist/planmagnet/pages/ProjectsProjectDetailPagePage.js +76 -74
  28. package/dist/planmagnet/pages/ProjectsProjectDetailPagePage.js.map +1 -1
  29. package/dist/planmagnet/roadmaps/RoadmapNowNextLater.d.ts.map +1 -1
  30. package/dist/planmagnet/roadmaps/RoadmapNowNextLater.js +157 -151
  31. package/dist/planmagnet/roadmaps/RoadmapNowNextLater.js.map +1 -1
  32. package/dist/planmagnet/roadmaps/RoadmapReviewPanel.d.ts +4 -0
  33. package/dist/planmagnet/roadmaps/RoadmapReviewPanel.d.ts.map +1 -0
  34. package/dist/planmagnet/roadmaps/RoadmapReviewPanel.js +370 -0
  35. package/dist/planmagnet/roadmaps/RoadmapReviewPanel.js.map +1 -0
  36. package/dist/planmagnet/roadmaps/RoadmapVersionsPanel.d.ts +4 -0
  37. package/dist/planmagnet/roadmaps/RoadmapVersionsPanel.d.ts.map +1 -0
  38. package/dist/planmagnet/roadmaps/RoadmapVersionsPanel.js +396 -0
  39. package/dist/planmagnet/roadmaps/RoadmapVersionsPanel.js.map +1 -0
  40. package/package.json +1 -1
@@ -4,15 +4,16 @@ import { LEAVES_PAGE_CONTEXT as n, throwOnError as ee } from "../utils/mutationR
4
4
  import { WorkItemSearchSelect as te } from "../controls/Pickers.js";
5
5
  import { MarkdownEditor as ne } from "../../components/MarkdownEditor.js";
6
6
  import { DOC_STATUSES as re, DocStatusBadge as ie } from "../docs/DocStatusBadge.js";
7
+ import { DocComments as ae } from "../comments/TargetComments.js";
7
8
  import { useState as r } from "react";
8
- import { ArrowLeft as ae, History as oe, Link2 as i, X as se } from "lucide-react";
9
- import { useSearchParams as ce } from "react-router";
9
+ import { ArrowLeft as oe, History as se, Link2 as i, X as ce } from "lucide-react";
10
+ import { useSearchParams as le } from "react-router";
10
11
  import { gql as a } from "@apollo/client";
11
- import { useApolloClient as le, useMutation as o, useQuery as ue } from "@apollo/client/react";
12
+ import { useApolloClient as ue, useMutation as o, useQuery as de } from "@apollo/client/react";
12
13
  import { jsx as s, jsxs as c } from "react/jsx-runtime";
13
14
  import { AlertDialog as l, AlertDialogAction as u, AlertDialogCancel as d, AlertDialogContent as f, AlertDialogDescription as p, AlertDialogFooter as m, AlertDialogHeader as h, AlertDialogTitle as g, AlertDialogTrigger as _, Button as v, Card as y, CardContent as b, CardHeader as x, CardTitle as S, Input as C } from "@burdenoff/fe-libs/ui";
14
15
  import { Markdown as w } from "@burdenoff/fe-libs/shared/components";
15
- import { clearGraphqlFetchResponseCache as de } from "@burdenoff/fe-libs/shared/graphql";
16
+ import { clearGraphqlFetchResponseCache as fe } from "@burdenoff/fe-libs/shared/graphql";
16
17
  //#region src/planmagnet/pages/DocsDocDetailPagePage.tsx
17
18
  var T = a`
18
19
  query DocDetail($id: ID!) {
@@ -42,7 +43,7 @@ var T = a`
42
43
  }
43
44
  }
44
45
  }
45
- `, fe = a`
46
+ `, pe = a`
46
47
  mutation DocUpdate($id: ID!, $input: PlanmagnetUpdateDocInput!) {
47
48
  planmagnetUpdateDoc(id: $id, input: $input) {
48
49
  id
@@ -50,66 +51,66 @@ var T = a`
50
51
  status
51
52
  }
52
53
  }
53
- `, pe = a`
54
+ `, me = a`
54
55
  mutation DocRevert($id: ID!, $toVersion: Int!, $expectedVersion: Int) {
55
56
  planmagnetRevertDoc(id: $id, toVersion: $toVersion, expectedVersion: $expectedVersion) {
56
57
  id
57
58
  version
58
59
  }
59
60
  }
60
- `, me = a`
61
+ `, he = a`
61
62
  mutation DocDelete($id: ID!) {
62
63
  planmagnetDeleteDoc(id: $id)
63
64
  }
64
- `, he = a`
65
+ `, ge = a`
65
66
  mutation DocLinkWorkItem($docId: ID!, $workItemId: ID!) {
66
67
  planmagnetLinkDocToWorkItem(docId: $docId, workItemId: $workItemId) {
67
68
  id
68
69
  }
69
70
  }
70
- `, ge = a`
71
+ `, _e = a`
71
72
  mutation DocUnlinkWorkItem($docId: ID!, $workItemId: ID!) {
72
73
  planmagnetUnlinkDocFromWorkItem(docId: $docId, workItemId: $workItemId)
73
74
  }
74
- `, _e = (e, t) => e instanceof Error ? e.message : t, E = (e) => new Date(e).toLocaleString();
75
- function D() {
76
- let [a] = ce(), D = a.get("docId") ?? "", O = e(), [k, A] = r(!1), [j, M] = r(""), [N, P] = r(""), [F, I] = r(""), [L, R] = r(null), [z, ve] = r(null), [B, ye] = r(null), { data: V, loading: be, error: H } = ue(T, {
77
- variables: { id: D },
78
- skip: !D,
75
+ `, E = (e, t) => e instanceof Error ? e.message : t, D = (e) => new Date(e).toLocaleString();
76
+ function O() {
77
+ let [a] = le(), O = a.get("docId") ?? "", k = e(), [A, j] = r(!1), [M, N] = r(""), [P, F] = r(""), [I, L] = r(""), [R, z] = r(null), [B, ve] = r(null), [V, ye] = r(null), { data: H, loading: be, error: U } = de(T, {
78
+ variables: { id: O },
79
+ skip: !O,
79
80
  fetchPolicy: "cache-and-network"
80
- }), xe = le(), U = {
81
+ }), xe = ue(), W = {
81
82
  refetchQueries: ["DocDetail"],
82
83
  awaitRefetchQueries: !0
83
- }, [W, G] = o(fe, U), [Se, Ce] = o(pe, U), [we, Te] = o(me, {
84
+ }, [G, K] = o(pe, W), [Se, Ce] = o(me, W), [we, Te] = o(he, {
84
85
  refetchQueries: ["DocsList"],
85
86
  context: n
86
- }), [Ee, De] = o(ge, U), [K, Oe] = o(he, {
87
- ...U,
87
+ }), [Ee, De] = o(_e, W), [Oe, ke] = o(ge, {
88
+ ...W,
88
89
  refetchQueries: ["DocDetail", "GetWorkItemDocs"]
89
- }), [q, J] = r(""), Y = V?.planmagnetDoc, X = G.loading || Ce.loading || Te.loading, Z = async (e, t) => {
90
- R(null);
90
+ }), [q, J] = r(""), Y = H?.planmagnetDoc, X = K.loading || Ce.loading || Te.loading, Z = async (e, t) => {
91
+ z(null);
91
92
  try {
92
93
  return await ee(e()), !0;
93
94
  } catch (e) {
94
- return R(_e(e, t)), de(), await xe.query({
95
+ return z(E(e, t)), fe(), await xe.query({
95
96
  query: T,
96
- variables: { id: D },
97
+ variables: { id: O },
97
98
  fetchPolicy: "network-only"
98
99
  }).catch(() => void 0), !1;
99
100
  }
100
101
  };
101
- if (!D) return /* @__PURE__ */ s("div", {
102
+ if (!O) return /* @__PURE__ */ s("div", {
102
103
  className: "p-6 text-sm text-muted-foreground",
103
104
  children: "No doc selected."
104
105
  });
105
- if (be && !V) return /* @__PURE__ */ s("div", {
106
+ if (be && !H) return /* @__PURE__ */ s("div", {
106
107
  className: "p-6 text-sm text-muted-foreground",
107
108
  children: "Loading doc…"
108
109
  });
109
- if (H && !Y) return /* @__PURE__ */ c("p", {
110
+ if (U && !Y) return /* @__PURE__ */ c("p", {
110
111
  role: "alert",
111
112
  className: "p-6 text-sm text-destructive",
112
- children: ["The doc could not be loaded: ", H.message]
113
+ children: ["The doc could not be loaded: ", U.message]
113
114
  });
114
115
  if (!Y) return /* @__PURE__ */ c("div", {
115
116
  className: "space-y-3 p-6",
@@ -119,23 +120,23 @@ function D() {
119
120
  }), /* @__PURE__ */ s(v, {
120
121
  size: "sm",
121
122
  variant: "outline",
122
- onClick: () => O("/docs/docs-page"),
123
+ onClick: () => k("/docs/docs-page"),
123
124
  children: "Back to docs"
124
125
  })]
125
126
  });
126
- let ke = () => {
127
- M(Y.title), P(Y.content), I(""), R(null), ye(Y.version), A(!0);
128
- }, Ae = async () => {
129
- await Z(() => W({ variables: {
127
+ let Ae = () => {
128
+ N(Y.title), F(Y.content), L(""), z(null), ye(Y.version), j(!0);
129
+ }, je = async () => {
130
+ await Z(() => G({ variables: {
130
131
  id: Y.id,
131
132
  input: {
132
- title: j.trim(),
133
- content: N,
134
- ...F.trim() ? { changeNote: F.trim() } : {},
135
- expectedVersion: B
133
+ title: M.trim(),
134
+ content: P,
135
+ ...I.trim() ? { changeNote: I.trim() } : {},
136
+ expectedVersion: V
136
137
  }
137
- } }), "The doc could not be saved.") && A(!1);
138
- }, Q = [...Y.revisions].sort((e, t) => t.version - e.version), $ = z === null ? null : Q.find((e) => e.version === z);
138
+ } }), "The doc could not be saved.") && j(!1);
139
+ }, Q = [...Y.revisions].sort((e, t) => t.version - e.version), $ = B === null ? null : Q.find((e) => e.version === B);
139
140
  return /* @__PURE__ */ c("div", {
140
141
  className: "space-y-6 p-6",
141
142
  "data-testid": "doc-detail",
@@ -143,8 +144,8 @@ function D() {
143
144
  /* @__PURE__ */ c(v, {
144
145
  size: "sm",
145
146
  variant: "ghost",
146
- onClick: () => O("/docs/docs-page"),
147
- children: [/* @__PURE__ */ s(ae, { className: "mr-1 h-4 w-4" }), "All docs"]
147
+ onClick: () => k("/docs/docs-page"),
148
+ children: [/* @__PURE__ */ s(oe, { className: "mr-1 h-4 w-4" }), "All docs"]
148
149
  }),
149
150
  /* @__PURE__ */ c("div", {
150
151
  className: "flex flex-wrap items-start justify-between gap-3",
@@ -162,19 +163,19 @@ function D() {
162
163
  Y.version,
163
164
  " · updated",
164
165
  " ",
165
- E(Y.updatedAt),
166
+ D(Y.updatedAt),
166
167
  " by ",
167
168
  /* @__PURE__ */ s(t, { id: Y.updatedBy ?? Y.createdBy })
168
169
  ]
169
170
  })]
170
- }), !k && /* @__PURE__ */ c("div", {
171
+ }), !A && /* @__PURE__ */ c("div", {
171
172
  className: "flex flex-wrap gap-2",
172
173
  children: [
173
174
  re.filter((e) => e !== Y.status).map((e) => /* @__PURE__ */ s(v, {
174
175
  size: "sm",
175
176
  variant: "outline",
176
177
  disabled: X,
177
- onClick: () => Z(() => W({ variables: {
178
+ onClick: () => Z(() => G({ variables: {
178
179
  id: Y.id,
179
180
  input: {
180
181
  status: e,
@@ -185,7 +186,7 @@ function D() {
185
186
  }, e)),
186
187
  /* @__PURE__ */ s(v, {
187
188
  size: "sm",
188
- onClick: ke,
189
+ onClick: Ae,
189
190
  "data-testid": "doc-edit",
190
191
  children: "Edit"
191
192
  }),
@@ -211,48 +212,48 @@ function D() {
211
212
  ] })] }), /* @__PURE__ */ c(m, { children: [/* @__PURE__ */ s(d, { children: "Keep it" }), /* @__PURE__ */ s(u, {
212
213
  className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
213
214
  onClick: async () => {
214
- await Z(() => we({ variables: { id: Y.id } }), "The doc could not be deleted.") && O("/docs/docs-page");
215
+ await Z(() => we({ variables: { id: Y.id } }), "The doc could not be deleted.") && k("/docs/docs-page");
215
216
  },
216
217
  children: "Delete"
217
218
  })] })] })] })
218
219
  ]
219
220
  })]
220
221
  }),
221
- L && /* @__PURE__ */ s("p", {
222
+ R && /* @__PURE__ */ s("p", {
222
223
  role: "alert",
223
224
  className: "text-sm text-destructive",
224
225
  "data-testid": "doc-error",
225
- children: L
226
+ children: R
226
227
  }),
227
- k && B !== Y.version && /* @__PURE__ */ c("p", {
228
+ A && V !== Y.version && /* @__PURE__ */ c("p", {
228
229
  className: "text-sm text-status-warning-text",
229
230
  "data-testid": "doc-moved-on",
230
231
  children: [
231
232
  "Someone saved version ",
232
233
  Y.version,
233
234
  " after you started editing version ",
234
- B,
235
+ V,
235
236
  ". Your text is kept below; copy what you need, then discard and edit the latest."
236
237
  ]
237
238
  }),
238
- k ? /* @__PURE__ */ s(y, { children: /* @__PURE__ */ c(b, {
239
+ A ? /* @__PURE__ */ s(y, { children: /* @__PURE__ */ c(b, {
239
240
  className: "space-y-3 pt-6",
240
241
  children: [
241
242
  /* @__PURE__ */ s(C, {
242
243
  "aria-label": "Doc title",
243
- value: j,
244
- onChange: (e) => M(e.target.value)
244
+ value: M,
245
+ onChange: (e) => N(e.target.value)
245
246
  }),
246
247
  /* @__PURE__ */ s(ne, {
247
- value: N,
248
- onChange: P,
248
+ value: P,
249
+ onChange: F,
249
250
  minHeight: 240
250
251
  }),
251
252
  /* @__PURE__ */ s(C, {
252
253
  "aria-label": "Change note",
253
254
  placeholder: "What changed? (optional, shown in the history)",
254
- value: F,
255
- onChange: (e) => I(e.target.value)
255
+ value: I,
256
+ onChange: (e) => L(e.target.value)
256
257
  }),
257
258
  /* @__PURE__ */ c("div", {
258
259
  className: "flex justify-end gap-2",
@@ -260,15 +261,15 @@ function D() {
260
261
  size: "sm",
261
262
  variant: "ghost",
262
263
  onClick: () => {
263
- A(!1), R(null);
264
+ j(!1), z(null);
264
265
  },
265
- children: B === Y.version ? "Cancel" : "Discard my edits"
266
+ children: V === Y.version ? "Cancel" : "Discard my edits"
266
267
  }), /* @__PURE__ */ s(v, {
267
268
  size: "sm",
268
- onClick: Ae,
269
- disabled: G.loading || B !== Y.version,
269
+ onClick: je,
270
+ disabled: K.loading || V !== Y.version,
270
271
  "data-testid": "doc-save",
271
- children: G.loading ? "Saving…" : "Save new version"
272
+ children: K.loading ? "Saving…" : "Save new version"
272
273
  })]
273
274
  })
274
275
  ]
@@ -286,7 +287,7 @@ function D() {
286
287
  children: [/* @__PURE__ */ s(x, { children: /* @__PURE__ */ c(S, {
287
288
  className: "flex items-center gap-2",
288
289
  children: [
289
- /* @__PURE__ */ s(oe, { className: "h-4 w-4" }),
290
+ /* @__PURE__ */ s(se, { className: "h-4 w-4" }),
290
291
  " History (",
291
292
  Q.length,
292
293
  ")"
@@ -315,10 +316,10 @@ function D() {
315
316
  size: "sm",
316
317
  variant: "ghost",
317
318
  className: "h-7 text-xs",
318
- "aria-expanded": z === e.version,
319
- onClick: () => ve(z === e.version ? null : e.version),
320
- children: z === e.version ? "Hide" : "View"
321
- }), !n && !k && /* @__PURE__ */ c(l, { children: [/* @__PURE__ */ s(_, {
319
+ "aria-expanded": B === e.version,
320
+ onClick: () => ve(B === e.version ? null : e.version),
321
+ children: B === e.version ? "Hide" : "View"
322
+ }), !n && !A && /* @__PURE__ */ c(l, { children: [/* @__PURE__ */ s(_, {
322
323
  asChild: !0,
323
324
  children: /* @__PURE__ */ s(v, {
324
325
  size: "sm",
@@ -350,7 +351,7 @@ function D() {
350
351
  }), /* @__PURE__ */ c("p", {
351
352
  className: "text-xs text-muted-foreground",
352
353
  children: [
353
- E(e.createdAt),
354
+ D(e.createdAt),
354
355
  " · ",
355
356
  /* @__PURE__ */ s(t, { id: e.createdBy }),
356
357
  e.changeNote ? ` · ${e.changeNote}` : ""
@@ -397,7 +398,7 @@ function D() {
397
398
  children: [/* @__PURE__ */ c("button", {
398
399
  type: "button",
399
400
  className: "min-w-0 truncate text-left text-sm hover:underline",
400
- onClick: () => O(`/tasks/task-detail-page?taskId=${encodeURIComponent(e.id)}`),
401
+ onClick: () => k(`/tasks/task-detail-page?taskId=${encodeURIComponent(e.id)}`),
401
402
  children: [
402
403
  /* @__PURE__ */ s("span", {
403
404
  className: "text-muted-foreground",
@@ -415,7 +416,7 @@ function D() {
415
416
  docId: Y.id,
416
417
  workItemId: e.id
417
418
  } }), "The work item could not be unlinked."),
418
- children: /* @__PURE__ */ s(se, { className: "h-4 w-4" })
419
+ children: /* @__PURE__ */ s(ce, { className: "h-4 w-4" })
419
420
  })]
420
421
  }, e.id)),
421
422
  /* @__PURE__ */ c("div", {
@@ -429,9 +430,9 @@ function D() {
429
430
  }), /* @__PURE__ */ c(v, {
430
431
  size: "sm",
431
432
  variant: "outline",
432
- disabled: !q || Oe.loading,
433
+ disabled: !q || ke.loading,
433
434
  onClick: async () => {
434
- await Z(() => K({ variables: {
435
+ await Z(() => Oe({ variables: {
435
436
  docId: Y.id,
436
437
  workItemId: q
437
438
  } }), "The work item could not be linked.") && J("");
@@ -442,11 +443,12 @@ function D() {
442
443
  ]
443
444
  })]
444
445
  })]
445
- })
446
+ }),
447
+ /* @__PURE__ */ s(ae, { docId: Y.id })
446
448
  ]
447
449
  });
448
450
  }
449
451
  //#endregion
450
- export { D as DocsDocDetailPagePage };
452
+ export { O as DocsDocDetailPagePage };
451
453
 
452
454
  //# sourceMappingURL=DocsDocDetailPagePage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DocsDocDetailPagePage.js","names":[],"sources":["../../../src/planmagnet/pages/DocsDocDetailPagePage.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { useSearchParams } from 'react-router';\nimport { gql } from '@apollo/client';\nimport { useApolloClient, useMutation, useQuery } from '@apollo/client/react';\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n AlertDialogTrigger,\n Button,\n Card,\n CardContent,\n CardHeader,\n CardTitle,\n Input,\n} from '@burdenoff/fe-libs/ui';\nimport { Markdown } from '@burdenoff/fe-libs/shared/components';\nimport { clearGraphqlFetchResponseCache } from '@burdenoff/fe-libs/shared/graphql';\nimport { ArrowLeft, History, Link2, X } from 'lucide-react';\nimport { WorkItemSearchSelect } from '../controls/Pickers';\nimport { MarkdownEditor } from '#src/components/MarkdownEditor';\nimport { usePlanMagnetNavigate } from '../providers/PlanMagnetProvider';\nimport { PersonName } from '../people/People';\nimport { throwOnError, LEAVES_PAGE_CONTEXT } from '../utils/mutationResult';\nimport { DOC_STATUSES, DocStatusBadge, type DocStatus } from '../docs/DocStatusBadge';\n\n/**\n * One doc (P1.4): read it, edit it with a change note, publish or archive it,\n * browse its history and restore an older version, see and unlink the work\n * items it is attached to, and delete it.\n *\n * Every write carries `expectedVersion` — the version on screen — so a save\n * over someone else's newer edit is refused with the reason, and the editor\n * keeps the unsaved text rather than overwriting theirs.\n */\n\nconst DOC = gql`\n query DocDetail($id: ID!) {\n planmagnetDoc(id: $id) {\n id\n title\n content\n status\n version\n createdBy\n createdAt\n updatedBy\n updatedAt\n revisions {\n id\n version\n title\n content\n changeNote\n createdBy\n createdAt\n }\n linkedWorkItems {\n id\n key\n title\n }\n }\n }\n`;\nconst UPDATE = gql`\n mutation DocUpdate($id: ID!, $input: PlanmagnetUpdateDocInput!) {\n planmagnetUpdateDoc(id: $id, input: $input) {\n id\n version\n status\n }\n }\n`;\nconst REVERT = gql`\n mutation DocRevert($id: ID!, $toVersion: Int!, $expectedVersion: Int) {\n planmagnetRevertDoc(id: $id, toVersion: $toVersion, expectedVersion: $expectedVersion) {\n id\n version\n }\n }\n`;\nconst DELETE = gql`\n mutation DocDelete($id: ID!) {\n planmagnetDeleteDoc(id: $id)\n }\n`;\nconst LINK = gql`\n mutation DocLinkWorkItem($docId: ID!, $workItemId: ID!) {\n planmagnetLinkDocToWorkItem(docId: $docId, workItemId: $workItemId) {\n id\n }\n }\n`;\n\nconst UNLINK = gql`\n mutation DocUnlinkWorkItem($docId: ID!, $workItemId: ID!) {\n planmagnetUnlinkDocFromWorkItem(docId: $docId, workItemId: $workItemId)\n }\n`;\n\ninterface Revision {\n id: string;\n version: number;\n title: string;\n content: string;\n changeNote: string | null;\n createdBy: string;\n createdAt: string;\n}\n\ninterface Doc {\n id: string;\n title: string;\n content: string;\n status: string;\n version: number;\n createdBy: string;\n createdAt: string;\n updatedBy: string | null;\n updatedAt: string;\n revisions: Revision[];\n linkedWorkItems: { id: string; key: string; title: string }[];\n}\n\nconst messageOf = (e: unknown, fallback: string) => (e instanceof Error ? e.message : fallback);\nconst when = (iso: string) => new Date(iso).toLocaleString();\n\nexport function DocsDocDetailPagePage() {\n const [params] = useSearchParams();\n const docId = params.get('docId') ?? '';\n const navigate = usePlanMagnetNavigate();\n const [editing, setEditing] = useState(false);\n const [title, setTitle] = useState('');\n const [content, setContent] = useState('');\n const [changeNote, setChangeNote] = useState('');\n const [error, setError] = useState<string | null>(null);\n const [viewing, setViewing] = useState<number | null>(null);\n // The version the editor started from — not the one on screen now, which a\n // refetch after someone else's save may already have moved past.\n const [editBase, setEditBase] = useState<number | null>(null);\n\n const {\n data,\n loading,\n error: loadError,\n } = useQuery<{ planmagnetDoc: Doc | null }>(DOC, {\n variables: { id: docId },\n skip: !docId,\n // Cached copies go stale here: a deleted doc, or someone else's newer version.\n fetchPolicy: 'cache-and-network',\n });\n const client = useApolloClient();\n const after = { refetchQueries: ['DocDetail'], awaitRefetchQueries: true };\n const [update, updateState] = useMutation(UPDATE, after);\n const [revert, revertState] = useMutation(REVERT, after);\n const [remove, removeState] = useMutation(DELETE, {\n refetchQueries: ['DocsList'],\n context: LEAVES_PAGE_CONTEXT,\n });\n const [unlink, unlinkState] = useMutation(UNLINK, after);\n const [link, linkState] = useMutation(LINK, {\n ...after,\n refetchQueries: ['DocDetail', 'GetWorkItemDocs'],\n });\n // BOFF-7961: link this doc to a work item from here too (it could only be linked when created from a task).\n const [linkChoice, setLinkChoice] = useState('');\n\n const doc = data?.planmagnetDoc;\n const busy = updateState.loading || revertState.loading || removeState.loading;\n\n // Refusals are panel-level: a refused write refetches, and anything the\n // refetch re-renders must not take the reason with it.\n const run = async (action: () => Promise<{ error?: unknown }>, fallback: string) => {\n setError(null);\n try {\n await throwOnError(action());\n return true;\n } catch (e) {\n setError(messageOf(e, fallback));\n // A refusal because the doc moved on: show the current version, but\n // leave the editor's text alone so nothing typed is lost.\n //\n // fe-libs replays any identical query answered in the last 15 s\n // (fetch.ts RECENT_QUERY_CACHE_TTL_MS) underneath Apollo's fetch\n // policies, and only a SUCCESSFUL mutation clears that cache. Measured in\n // prod 2026-09-25: after a refused save, even a network-only read was\n // served the pre-refusal response, so the page kept the old version and\n // never said the doc had moved on. A refused write is still a write\n // attempt: clear the cache (the public API fe-libs documents for this),\n // then read the doc; it lands in the normalized cache the page renders.\n clearGraphqlFetchResponseCache();\n await client\n .query({ query: DOC, variables: { id: docId }, fetchPolicy: 'network-only' })\n .catch(() => undefined);\n return false;\n }\n };\n\n if (!docId) {\n return <div className=\"p-6 text-sm text-muted-foreground\">No doc selected.</div>;\n }\n if (loading && !data) {\n return <div className=\"p-6 text-sm text-muted-foreground\">Loading doc…</div>;\n }\n if (loadError && !doc) {\n return (\n <p role=\"alert\" className=\"p-6 text-sm text-destructive\">\n The doc could not be loaded: {loadError.message}\n </p>\n );\n }\n if (!doc) {\n return (\n <div className=\"space-y-3 p-6\">\n <p className=\"text-sm text-muted-foreground\">\n This doc does not exist in this workspace, or it was deleted.\n </p>\n <Button size=\"sm\" variant=\"outline\" onClick={() => navigate('/docs/docs-page')}>\n Back to docs\n </Button>\n </div>\n );\n }\n\n const startEditing = () => {\n setTitle(doc.title);\n setContent(doc.content);\n setChangeNote('');\n setError(null);\n setEditBase(doc.version);\n setEditing(true);\n };\n const save = async () => {\n const saved = await run(\n () =>\n update({\n variables: {\n id: doc.id,\n input: {\n title: title.trim(),\n content,\n ...(changeNote.trim() ? { changeNote: changeNote.trim() } : {}),\n expectedVersion: editBase,\n },\n },\n }),\n 'The doc could not be saved.'\n );\n if (saved) setEditing(false);\n };\n\n const revisions = [...doc.revisions].sort((a, b) => b.version - a.version);\n const shown = viewing === null ? null : revisions.find((r) => r.version === viewing);\n\n return (\n <div className=\"space-y-6 p-6\" data-testid=\"doc-detail\">\n <Button size=\"sm\" variant=\"ghost\" onClick={() => navigate('/docs/docs-page')}>\n <ArrowLeft className=\"mr-1 h-4 w-4\" />\n All docs\n </Button>\n\n <div className=\"flex flex-wrap items-start justify-between gap-3\">\n <div className=\"min-w-0 space-y-1\">\n <h1 className=\"text-2xl font-semibold break-words\" data-testid=\"doc-title\">\n {doc.title}\n </h1>\n <p className=\"text-xs text-muted-foreground\">\n <DocStatusBadge status={doc.status} /> · version {doc.version} · updated{' '}\n {when(doc.updatedAt)} by <PersonName id={doc.updatedBy ?? doc.createdBy} />\n </p>\n </div>\n {!editing && (\n <div className=\"flex flex-wrap gap-2\">\n {DOC_STATUSES.filter((s) => s !== doc.status).map((s: DocStatus) => (\n <Button\n key={s}\n size=\"sm\"\n variant=\"outline\"\n disabled={busy}\n onClick={() =>\n run(\n () =>\n update({\n variables: {\n id: doc.id,\n input: { status: s, expectedVersion: doc.version },\n },\n }),\n 'The status could not be changed.'\n )\n }\n >\n {s === 'PUBLISHED' ? 'Publish' : s === 'ARCHIVED' ? 'Archive' : 'Back to draft'}\n </Button>\n ))}\n <Button size=\"sm\" onClick={startEditing} data-testid=\"doc-edit\">\n Edit\n </Button>\n <AlertDialog>\n <AlertDialogTrigger asChild>\n <Button size=\"sm\" variant=\"outline\" disabled={busy}>\n Delete\n </Button>\n </AlertDialogTrigger>\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>Delete “{doc.title}”?</AlertDialogTitle>\n <AlertDialogDescription>\n The doc and its history are removed for everyone, and it is unlinked from{' '}\n {doc.linkedWorkItems.length} work item\n {doc.linkedWorkItems.length === 1 ? '' : 's'}.\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel>Keep it</AlertDialogCancel>\n <AlertDialogAction\n className=\"bg-destructive text-destructive-foreground hover:bg-destructive/90\"\n onClick={async () => {\n const deleted = await run(\n () => remove({ variables: { id: doc.id } }),\n 'The doc could not be deleted.'\n );\n if (deleted) navigate('/docs/docs-page');\n }}\n >\n Delete\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n </div>\n )}\n </div>\n\n {error && (\n <p role=\"alert\" className=\"text-sm text-destructive\" data-testid=\"doc-error\">\n {error}\n </p>\n )}\n {editing && editBase !== doc.version && (\n <p className=\"text-sm text-status-warning-text\" data-testid=\"doc-moved-on\">\n Someone saved version {doc.version} after you started editing version {editBase}. Your\n text is kept below; copy what you need, then discard and edit the latest.\n </p>\n )}\n\n {editing ? (\n <Card>\n <CardContent className=\"space-y-3 pt-6\">\n <Input\n aria-label=\"Doc title\"\n value={title}\n onChange={(e) => setTitle(e.target.value)}\n />\n <MarkdownEditor value={content} onChange={setContent} minHeight={240} />\n <Input\n aria-label=\"Change note\"\n placeholder=\"What changed? (optional, shown in the history)\"\n value={changeNote}\n onChange={(e) => setChangeNote(e.target.value)}\n />\n <div className=\"flex justify-end gap-2\">\n <Button\n size=\"sm\"\n variant=\"ghost\"\n onClick={() => {\n setEditing(false);\n setError(null);\n }}\n >\n {editBase !== doc.version ? 'Discard my edits' : 'Cancel'}\n </Button>\n <Button\n size=\"sm\"\n onClick={save}\n disabled={updateState.loading || editBase !== doc.version}\n data-testid=\"doc-save\"\n >\n {updateState.loading ? 'Saving…' : 'Save new version'}\n </Button>\n </div>\n </CardContent>\n </Card>\n ) : (\n <Card>\n <CardContent className=\"prose prose-sm max-w-none pt-6 dark:prose-invert\">\n {doc.content.trim() ? (\n <Markdown>{doc.content}</Markdown>\n ) : (\n <p className=\"text-sm text-muted-foreground\">This doc is empty.</p>\n )}\n </CardContent>\n </Card>\n )}\n\n <div className=\"grid grid-cols-1 gap-6 lg:grid-cols-2\">\n <Card data-testid=\"doc-history\">\n <CardHeader>\n <CardTitle className=\"flex items-center gap-2\">\n <History className=\"h-4 w-4\" /> History ({revisions.length})\n </CardTitle>\n </CardHeader>\n <CardContent className=\"space-y-2\">\n <ol className=\"space-y-2\">\n {revisions.map((rev) => {\n const current = rev.version === doc.version;\n return (\n <li\n key={rev.id}\n className=\"space-y-1 rounded-md border p-2\"\n data-testid=\"doc-revision\"\n >\n <div className=\"flex flex-wrap items-center justify-between gap-2\">\n <span className=\"text-sm font-medium\">\n Version {rev.version}\n {current ? ' (current)' : ''}\n </span>\n <span className=\"flex gap-1\">\n <Button\n size=\"sm\"\n variant=\"ghost\"\n className=\"h-7 text-xs\"\n aria-expanded={viewing === rev.version}\n onClick={() => setViewing(viewing === rev.version ? null : rev.version)}\n >\n {viewing === rev.version ? 'Hide' : 'View'}\n </Button>\n {!current && !editing && (\n <AlertDialog>\n <AlertDialogTrigger asChild>\n <Button\n size=\"sm\"\n variant=\"outline\"\n className=\"h-7 text-xs\"\n disabled={busy}\n data-testid=\"doc-restore\"\n >\n Restore\n </Button>\n </AlertDialogTrigger>\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>Restore version {rev.version}?</AlertDialogTitle>\n <AlertDialogDescription>\n Its title and text become version {doc.version + 1}. Nothing is\n deleted: version {doc.version} stays in the history.\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel>Cancel</AlertDialogCancel>\n <AlertDialogAction\n onClick={() =>\n run(\n () =>\n revert({\n variables: {\n id: doc.id,\n toVersion: rev.version,\n expectedVersion: doc.version,\n },\n }),\n 'The version could not be restored.'\n )\n }\n >\n Restore\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n )}\n </span>\n </div>\n <p className=\"text-xs text-muted-foreground\">\n {when(rev.createdAt)} · <PersonName id={rev.createdBy} />\n {rev.changeNote ? ` · ${rev.changeNote}` : ''}\n </p>\n </li>\n );\n })}\n </ol>\n {shown && (\n <div\n className=\"space-y-1 rounded-md border bg-muted/40 p-3\"\n data-testid=\"doc-revision-view\"\n >\n <p className=\"text-sm font-medium\">\n Version {shown.version}: {shown.title}\n </p>\n <div className=\"prose prose-sm max-w-none dark:prose-invert\">\n <Markdown>{shown.content}</Markdown>\n </div>\n </div>\n )}\n </CardContent>\n </Card>\n\n <Card data-testid=\"doc-linked-items\">\n <CardHeader>\n <CardTitle className=\"flex items-center gap-2\">\n <Link2 className=\"h-4 w-4\" /> Linked work items ({doc.linkedWorkItems.length})\n </CardTitle>\n </CardHeader>\n <CardContent className=\"space-y-2\">\n {doc.linkedWorkItems.length === 0 && (\n <p className=\"text-sm text-muted-foreground\">\n Not linked to any work item yet. Pick one below, or use &ldquo;Link existing\n doc&rdquo; on the task.\n </p>\n )}\n {doc.linkedWorkItems.map((item) => (\n <div\n key={item.id}\n className=\"flex items-center justify-between gap-2 rounded-md border p-2\"\n >\n <button\n type=\"button\"\n className=\"min-w-0 truncate text-left text-sm hover:underline\"\n onClick={() =>\n navigate(`/tasks/task-detail-page?taskId=${encodeURIComponent(item.id)}`)\n }\n >\n <span className=\"text-muted-foreground\">{item.key}</span> {item.title}\n </button>\n <Button\n size=\"icon\"\n variant=\"ghost\"\n disabled={unlinkState.loading}\n aria-label={`Unlink ${item.title}`}\n onClick={() =>\n run(\n () => unlink({ variables: { docId: doc.id, workItemId: item.id } }),\n 'The work item could not be unlinked.'\n )\n }\n >\n <X className=\"h-4 w-4\" />\n </Button>\n </div>\n ))}\n <div className=\"space-y-2 pt-2\" data-testid=\"doc-link-work-item\">\n <WorkItemSearchSelect\n id=\"doc-link-work-item-select\"\n value={linkChoice}\n onChange={setLinkChoice}\n exclude={doc.linkedWorkItems.map((w) => w.id)}\n />\n <Button\n size=\"sm\"\n variant=\"outline\"\n disabled={!linkChoice || linkState.loading}\n onClick={async () => {\n const done = await run(\n () => link({ variables: { docId: doc.id, workItemId: linkChoice } }),\n 'The work item could not be linked.'\n );\n if (done) setLinkChoice('');\n }}\n >\n <Link2 className=\"mr-1 h-4 w-4\" />\n Link work item\n </Button>\n </div>\n </CardContent>\n </Card>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAyCA,IAAM,IAAM,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BT,KAAS,CAAG;;;;;;;;GASZ,KAAS,CAAG;;;;;;;GAQZ,KAAS,CAAG;;;;GAKZ,KAAO,CAAG;;;;;;GAQV,KAAS,CAAG;;;;GA8BZ,MAAa,GAAY,MAAsB,aAAa,QAAQ,EAAE,UAAU,GAChF,KAAQ,MAAgB,IAAI,KAAK,EAAI,CAAC,gBAAgB;AAE5D,SAAgB,IAAwB;CACtC,IAAM,CAAC,KAAU,IAAiB,EAC5B,IAAQ,EAAO,IAAI,QAAQ,IAAI,IAC/B,IAAW,GAAuB,EAClC,CAAC,GAAS,KAAc,EAAS,GAAM,EACvC,CAAC,GAAO,KAAY,EAAS,GAAG,EAChC,CAAC,GAAS,KAAc,EAAS,GAAG,EACpC,CAAC,GAAY,KAAiB,EAAS,GAAG,EAC1C,CAAC,GAAO,KAAY,EAAwB,KAAK,EACjD,CAAC,GAAS,MAAc,EAAwB,KAAK,EAGrD,CAAC,GAAU,MAAe,EAAwB,KAAK,EAEvD,EACJ,SACA,aACA,OAAO,MACL,GAAwC,GAAK;EAC/C,WAAW,EAAE,IAAI,GAAO;EACxB,MAAM,CAAC;EAEP,aAAa;EACd,CAAC,EACI,KAAS,IAAiB,EAC1B,IAAQ;EAAE,gBAAgB,CAAC,YAAY;EAAE,qBAAqB;EAAM,EACpE,CAAC,GAAQ,KAAe,EAAY,IAAQ,EAAM,EAClD,CAAC,IAAQ,MAA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7C,CAAA,EACF,kBAAC,GAAD;SACE,MAAK;SACL,SAAQ;SACR,UAAU,CAAC,KAAc,GAAU;SACnC,SAAS,YAAY;AAKnB,UAJa,MAAM,QACX,EAAK,EAAE,WAAW;WAAE,OAAO,EAAI;WAAI,YAAY;WAAY,EAAE,CAAC,EACpE,qCACD,IACS,EAAc,GAAG;;mBAT/B,CAYE,kBAAC,GAAD,EAAO,WAAU,gBAAiB,CAAA,EAAA,iBAE3B;WACL;;OACM;QACT;OACH;;GACF"}
1
+ {"version":3,"file":"DocsDocDetailPagePage.js","names":[],"sources":["../../../src/planmagnet/pages/DocsDocDetailPagePage.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { useSearchParams } from 'react-router';\nimport { gql } from '@apollo/client';\nimport { useApolloClient, useMutation, useQuery } from '@apollo/client/react';\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n AlertDialogTrigger,\n Button,\n Card,\n CardContent,\n CardHeader,\n CardTitle,\n Input,\n} from '@burdenoff/fe-libs/ui';\nimport { Markdown } from '@burdenoff/fe-libs/shared/components';\nimport { clearGraphqlFetchResponseCache } from '@burdenoff/fe-libs/shared/graphql';\nimport { ArrowLeft, History, Link2, X } from 'lucide-react';\nimport { WorkItemSearchSelect } from '../controls/Pickers';\nimport { MarkdownEditor } from '#src/components/MarkdownEditor';\nimport { usePlanMagnetNavigate } from '../providers/PlanMagnetProvider';\nimport { PersonName } from '../people/People';\nimport { throwOnError, LEAVES_PAGE_CONTEXT } from '../utils/mutationResult';\nimport { DOC_STATUSES, DocStatusBadge, type DocStatus } from '../docs/DocStatusBadge';\nimport { DocComments } from '../comments/TargetComments';\n\n/**\n * One doc (P1.4): read it, edit it with a change note, publish or archive it,\n * browse its history and restore an older version, see and unlink the work\n * items it is attached to, and delete it.\n *\n * Every write carries `expectedVersion` — the version on screen — so a save\n * over someone else's newer edit is refused with the reason, and the editor\n * keeps the unsaved text rather than overwriting theirs.\n */\n\nconst DOC = gql`\n query DocDetail($id: ID!) {\n planmagnetDoc(id: $id) {\n id\n title\n content\n status\n version\n createdBy\n createdAt\n updatedBy\n updatedAt\n revisions {\n id\n version\n title\n content\n changeNote\n createdBy\n createdAt\n }\n linkedWorkItems {\n id\n key\n title\n }\n }\n }\n`;\nconst UPDATE = gql`\n mutation DocUpdate($id: ID!, $input: PlanmagnetUpdateDocInput!) {\n planmagnetUpdateDoc(id: $id, input: $input) {\n id\n version\n status\n }\n }\n`;\nconst REVERT = gql`\n mutation DocRevert($id: ID!, $toVersion: Int!, $expectedVersion: Int) {\n planmagnetRevertDoc(id: $id, toVersion: $toVersion, expectedVersion: $expectedVersion) {\n id\n version\n }\n }\n`;\nconst DELETE = gql`\n mutation DocDelete($id: ID!) {\n planmagnetDeleteDoc(id: $id)\n }\n`;\nconst LINK = gql`\n mutation DocLinkWorkItem($docId: ID!, $workItemId: ID!) {\n planmagnetLinkDocToWorkItem(docId: $docId, workItemId: $workItemId) {\n id\n }\n }\n`;\n\nconst UNLINK = gql`\n mutation DocUnlinkWorkItem($docId: ID!, $workItemId: ID!) {\n planmagnetUnlinkDocFromWorkItem(docId: $docId, workItemId: $workItemId)\n }\n`;\n\ninterface Revision {\n id: string;\n version: number;\n title: string;\n content: string;\n changeNote: string | null;\n createdBy: string;\n createdAt: string;\n}\n\ninterface Doc {\n id: string;\n title: string;\n content: string;\n status: string;\n version: number;\n createdBy: string;\n createdAt: string;\n updatedBy: string | null;\n updatedAt: string;\n revisions: Revision[];\n linkedWorkItems: { id: string; key: string; title: string }[];\n}\n\nconst messageOf = (e: unknown, fallback: string) => (e instanceof Error ? e.message : fallback);\nconst when = (iso: string) => new Date(iso).toLocaleString();\n\nexport function DocsDocDetailPagePage() {\n const [params] = useSearchParams();\n const docId = params.get('docId') ?? '';\n const navigate = usePlanMagnetNavigate();\n const [editing, setEditing] = useState(false);\n const [title, setTitle] = useState('');\n const [content, setContent] = useState('');\n const [changeNote, setChangeNote] = useState('');\n const [error, setError] = useState<string | null>(null);\n const [viewing, setViewing] = useState<number | null>(null);\n // The version the editor started from — not the one on screen now, which a\n // refetch after someone else's save may already have moved past.\n const [editBase, setEditBase] = useState<number | null>(null);\n\n const {\n data,\n loading,\n error: loadError,\n } = useQuery<{ planmagnetDoc: Doc | null }>(DOC, {\n variables: { id: docId },\n skip: !docId,\n // Cached copies go stale here: a deleted doc, or someone else's newer version.\n fetchPolicy: 'cache-and-network',\n });\n const client = useApolloClient();\n const after = { refetchQueries: ['DocDetail'], awaitRefetchQueries: true };\n const [update, updateState] = useMutation(UPDATE, after);\n const [revert, revertState] = useMutation(REVERT, after);\n const [remove, removeState] = useMutation(DELETE, {\n refetchQueries: ['DocsList'],\n context: LEAVES_PAGE_CONTEXT,\n });\n const [unlink, unlinkState] = useMutation(UNLINK, after);\n const [link, linkState] = useMutation(LINK, {\n ...after,\n refetchQueries: ['DocDetail', 'GetWorkItemDocs'],\n });\n // BOFF-7961: link this doc to a work item from here too (it could only be linked when created from a task).\n const [linkChoice, setLinkChoice] = useState('');\n\n const doc = data?.planmagnetDoc;\n const busy = updateState.loading || revertState.loading || removeState.loading;\n\n // Refusals are panel-level: a refused write refetches, and anything the\n // refetch re-renders must not take the reason with it.\n const run = async (action: () => Promise<{ error?: unknown }>, fallback: string) => {\n setError(null);\n try {\n await throwOnError(action());\n return true;\n } catch (e) {\n setError(messageOf(e, fallback));\n // A refusal because the doc moved on: show the current version, but\n // leave the editor's text alone so nothing typed is lost.\n //\n // fe-libs replays any identical query answered in the last 15 s\n // (fetch.ts RECENT_QUERY_CACHE_TTL_MS) underneath Apollo's fetch\n // policies, and only a SUCCESSFUL mutation clears that cache. Measured in\n // prod 2026-09-25: after a refused save, even a network-only read was\n // served the pre-refusal response, so the page kept the old version and\n // never said the doc had moved on. A refused write is still a write\n // attempt: clear the cache (the public API fe-libs documents for this),\n // then read the doc; it lands in the normalized cache the page renders.\n clearGraphqlFetchResponseCache();\n await client\n .query({ query: DOC, variables: { id: docId }, fetchPolicy: 'network-only' })\n .catch(() => undefined);\n return false;\n }\n };\n\n if (!docId) {\n return <div className=\"p-6 text-sm text-muted-foreground\">No doc selected.</div>;\n }\n if (loading && !data) {\n return <div className=\"p-6 text-sm text-muted-foreground\">Loading doc…</div>;\n }\n if (loadError && !doc) {\n return (\n <p role=\"alert\" className=\"p-6 text-sm text-destructive\">\n The doc could not be loaded: {loadError.message}\n </p>\n );\n }\n if (!doc) {\n return (\n <div className=\"space-y-3 p-6\">\n <p className=\"text-sm text-muted-foreground\">\n This doc does not exist in this workspace, or it was deleted.\n </p>\n <Button size=\"sm\" variant=\"outline\" onClick={() => navigate('/docs/docs-page')}>\n Back to docs\n </Button>\n </div>\n );\n }\n\n const startEditing = () => {\n setTitle(doc.title);\n setContent(doc.content);\n setChangeNote('');\n setError(null);\n setEditBase(doc.version);\n setEditing(true);\n };\n const save = async () => {\n const saved = await run(\n () =>\n update({\n variables: {\n id: doc.id,\n input: {\n title: title.trim(),\n content,\n ...(changeNote.trim() ? { changeNote: changeNote.trim() } : {}),\n expectedVersion: editBase,\n },\n },\n }),\n 'The doc could not be saved.'\n );\n if (saved) setEditing(false);\n };\n\n const revisions = [...doc.revisions].sort((a, b) => b.version - a.version);\n const shown = viewing === null ? null : revisions.find((r) => r.version === viewing);\n\n return (\n <div className=\"space-y-6 p-6\" data-testid=\"doc-detail\">\n <Button size=\"sm\" variant=\"ghost\" onClick={() => navigate('/docs/docs-page')}>\n <ArrowLeft className=\"mr-1 h-4 w-4\" />\n All docs\n </Button>\n\n <div className=\"flex flex-wrap items-start justify-between gap-3\">\n <div className=\"min-w-0 space-y-1\">\n <h1 className=\"text-2xl font-semibold break-words\" data-testid=\"doc-title\">\n {doc.title}\n </h1>\n <p className=\"text-xs text-muted-foreground\">\n <DocStatusBadge status={doc.status} /> · version {doc.version} · updated{' '}\n {when(doc.updatedAt)} by <PersonName id={doc.updatedBy ?? doc.createdBy} />\n </p>\n </div>\n {!editing && (\n <div className=\"flex flex-wrap gap-2\">\n {DOC_STATUSES.filter((s) => s !== doc.status).map((s: DocStatus) => (\n <Button\n key={s}\n size=\"sm\"\n variant=\"outline\"\n disabled={busy}\n onClick={() =>\n run(\n () =>\n update({\n variables: {\n id: doc.id,\n input: { status: s, expectedVersion: doc.version },\n },\n }),\n 'The status could not be changed.'\n )\n }\n >\n {s === 'PUBLISHED' ? 'Publish' : s === 'ARCHIVED' ? 'Archive' : 'Back to draft'}\n </Button>\n ))}\n <Button size=\"sm\" onClick={startEditing} data-testid=\"doc-edit\">\n Edit\n </Button>\n <AlertDialog>\n <AlertDialogTrigger asChild>\n <Button size=\"sm\" variant=\"outline\" disabled={busy}>\n Delete\n </Button>\n </AlertDialogTrigger>\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>Delete “{doc.title}”?</AlertDialogTitle>\n <AlertDialogDescription>\n The doc and its history are removed for everyone, and it is unlinked from{' '}\n {doc.linkedWorkItems.length} work item\n {doc.linkedWorkItems.length === 1 ? '' : 's'}.\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel>Keep it</AlertDialogCancel>\n <AlertDialogAction\n className=\"bg-destructive text-destructive-foreground hover:bg-destructive/90\"\n onClick={async () => {\n const deleted = await run(\n () => remove({ variables: { id: doc.id } }),\n 'The doc could not be deleted.'\n );\n if (deleted) navigate('/docs/docs-page');\n }}\n >\n Delete\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n </div>\n )}\n </div>\n\n {error && (\n <p role=\"alert\" className=\"text-sm text-destructive\" data-testid=\"doc-error\">\n {error}\n </p>\n )}\n {editing && editBase !== doc.version && (\n <p className=\"text-sm text-status-warning-text\" data-testid=\"doc-moved-on\">\n Someone saved version {doc.version} after you started editing version {editBase}. Your\n text is kept below; copy what you need, then discard and edit the latest.\n </p>\n )}\n\n {editing ? (\n <Card>\n <CardContent className=\"space-y-3 pt-6\">\n <Input\n aria-label=\"Doc title\"\n value={title}\n onChange={(e) => setTitle(e.target.value)}\n />\n <MarkdownEditor value={content} onChange={setContent} minHeight={240} />\n <Input\n aria-label=\"Change note\"\n placeholder=\"What changed? (optional, shown in the history)\"\n value={changeNote}\n onChange={(e) => setChangeNote(e.target.value)}\n />\n <div className=\"flex justify-end gap-2\">\n <Button\n size=\"sm\"\n variant=\"ghost\"\n onClick={() => {\n setEditing(false);\n setError(null);\n }}\n >\n {editBase !== doc.version ? 'Discard my edits' : 'Cancel'}\n </Button>\n <Button\n size=\"sm\"\n onClick={save}\n disabled={updateState.loading || editBase !== doc.version}\n data-testid=\"doc-save\"\n >\n {updateState.loading ? 'Saving…' : 'Save new version'}\n </Button>\n </div>\n </CardContent>\n </Card>\n ) : (\n <Card>\n <CardContent className=\"prose prose-sm max-w-none pt-6 dark:prose-invert\">\n {doc.content.trim() ? (\n <Markdown>{doc.content}</Markdown>\n ) : (\n <p className=\"text-sm text-muted-foreground\">This doc is empty.</p>\n )}\n </CardContent>\n </Card>\n )}\n\n <div className=\"grid grid-cols-1 gap-6 lg:grid-cols-2\">\n <Card data-testid=\"doc-history\">\n <CardHeader>\n <CardTitle className=\"flex items-center gap-2\">\n <History className=\"h-4 w-4\" /> History ({revisions.length})\n </CardTitle>\n </CardHeader>\n <CardContent className=\"space-y-2\">\n <ol className=\"space-y-2\">\n {revisions.map((rev) => {\n const current = rev.version === doc.version;\n return (\n <li\n key={rev.id}\n className=\"space-y-1 rounded-md border p-2\"\n data-testid=\"doc-revision\"\n >\n <div className=\"flex flex-wrap items-center justify-between gap-2\">\n <span className=\"text-sm font-medium\">\n Version {rev.version}\n {current ? ' (current)' : ''}\n </span>\n <span className=\"flex gap-1\">\n <Button\n size=\"sm\"\n variant=\"ghost\"\n className=\"h-7 text-xs\"\n aria-expanded={viewing === rev.version}\n onClick={() => setViewing(viewing === rev.version ? null : rev.version)}\n >\n {viewing === rev.version ? 'Hide' : 'View'}\n </Button>\n {!current && !editing && (\n <AlertDialog>\n <AlertDialogTrigger asChild>\n <Button\n size=\"sm\"\n variant=\"outline\"\n className=\"h-7 text-xs\"\n disabled={busy}\n data-testid=\"doc-restore\"\n >\n Restore\n </Button>\n </AlertDialogTrigger>\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>Restore version {rev.version}?</AlertDialogTitle>\n <AlertDialogDescription>\n Its title and text become version {doc.version + 1}. Nothing is\n deleted: version {doc.version} stays in the history.\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel>Cancel</AlertDialogCancel>\n <AlertDialogAction\n onClick={() =>\n run(\n () =>\n revert({\n variables: {\n id: doc.id,\n toVersion: rev.version,\n expectedVersion: doc.version,\n },\n }),\n 'The version could not be restored.'\n )\n }\n >\n Restore\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n )}\n </span>\n </div>\n <p className=\"text-xs text-muted-foreground\">\n {when(rev.createdAt)} · <PersonName id={rev.createdBy} />\n {rev.changeNote ? ` · ${rev.changeNote}` : ''}\n </p>\n </li>\n );\n })}\n </ol>\n {shown && (\n <div\n className=\"space-y-1 rounded-md border bg-muted/40 p-3\"\n data-testid=\"doc-revision-view\"\n >\n <p className=\"text-sm font-medium\">\n Version {shown.version}: {shown.title}\n </p>\n <div className=\"prose prose-sm max-w-none dark:prose-invert\">\n <Markdown>{shown.content}</Markdown>\n </div>\n </div>\n )}\n </CardContent>\n </Card>\n\n <Card data-testid=\"doc-linked-items\">\n <CardHeader>\n <CardTitle className=\"flex items-center gap-2\">\n <Link2 className=\"h-4 w-4\" /> Linked work items ({doc.linkedWorkItems.length})\n </CardTitle>\n </CardHeader>\n <CardContent className=\"space-y-2\">\n {doc.linkedWorkItems.length === 0 && (\n <p className=\"text-sm text-muted-foreground\">\n Not linked to any work item yet. Pick one below, or use &ldquo;Link existing\n doc&rdquo; on the task.\n </p>\n )}\n {doc.linkedWorkItems.map((item) => (\n <div\n key={item.id}\n className=\"flex items-center justify-between gap-2 rounded-md border p-2\"\n >\n <button\n type=\"button\"\n className=\"min-w-0 truncate text-left text-sm hover:underline\"\n onClick={() =>\n navigate(`/tasks/task-detail-page?taskId=${encodeURIComponent(item.id)}`)\n }\n >\n <span className=\"text-muted-foreground\">{item.key}</span> {item.title}\n </button>\n <Button\n size=\"icon\"\n variant=\"ghost\"\n disabled={unlinkState.loading}\n aria-label={`Unlink ${item.title}`}\n onClick={() =>\n run(\n () => unlink({ variables: { docId: doc.id, workItemId: item.id } }),\n 'The work item could not be unlinked.'\n )\n }\n >\n <X className=\"h-4 w-4\" />\n </Button>\n </div>\n ))}\n <div className=\"space-y-2 pt-2\" data-testid=\"doc-link-work-item\">\n <WorkItemSearchSelect\n id=\"doc-link-work-item-select\"\n value={linkChoice}\n onChange={setLinkChoice}\n exclude={doc.linkedWorkItems.map((w) => w.id)}\n />\n <Button\n size=\"sm\"\n variant=\"outline\"\n disabled={!linkChoice || linkState.loading}\n onClick={async () => {\n const done = await run(\n () => link({ variables: { docId: doc.id, workItemId: linkChoice } }),\n 'The work item could not be linked.'\n );\n if (done) setLinkChoice('');\n }}\n >\n <Link2 className=\"mr-1 h-4 w-4\" />\n Link work item\n </Button>\n </div>\n </CardContent>\n </Card>\n </div>\n\n <DocComments docId={doc.id} />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA0CA,IAAM,IAAM,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BT,KAAS,CAAG;;;;;;;;GASZ,KAAS,CAAG;;;;;;;GAQZ,KAAS,CAAG;;;;GAKZ,KAAO,CAAG;;;;;;GAQV,KAAS,CAAG;;;;GA8BZ,KAAa,GAAY,MAAsB,aAAa,QAAQ,EAAE,UAAU,GAChF,KAAQ,MAAgB,IAAI,KAAK,EAAI,CAAC,gBAAgB;AAE5D,SAAgB,IAAwB;CACtC,IAAM,CAAC,KAAU,IAAiB,EAC5B,IAAQ,EAAO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AU;SACV,eACE,EAAS,kCAAkC,mBAAmB,EAAK,GAAG,GAAG;mBAJ7E;UAOE,kBAAC,QAAD;WAAM,WAAU;qBAAyB,EAAK;WAAW,CAAA;;UAAE,EAAK;UACzD;YACT,kBAAC,GAAD;SACE,MAAK;SACL,SAAQ;SACR,UAAU,GAAY;SACtB,cAAY,UAAU,EAAK;SAC3B,eACE,QACQ,GAAO,EAAE,WAAW;UAAE,OAAO,EAAI;UAAI,YAAY,EAAK;UAAI,EAAE,CAAC,EACnE,uCACD;mBAGH,kBAAC,IAAD,EAAG,WAAU,WAAY,CAAA;SAClB,CAAA,CACL;UA1BC,EAAK,GA0BN,CACN;OACF,kBAAC,OAAD;QAAK,WAAU;QAAiB,eAAY;kBAA5C,CACE,kBAAC,IAAD;SACE,IAAG;SACH,OAAO;SACP,UAAU;SACV,SAAS,EAAI,gBAAgB,KAAK,MAAM,EAAE,GAAG;SAC7C,CAAA,EACF,kBAAC,GAAD;SACE,MAAK;SACL,SAAQ;SACR,UAAU,CAAC,KAAc,GAAU;SACnC,SAAS,YAAY;AAKnB,UAJa,MAAM,QACX,GAAK,EAAE,WAAW;WAAE,OAAO,EAAI;WAAI,YAAY;WAAY,EAAE,CAAC,EACpE,qCACD,IACS,EAAc,GAAG;;mBAT/B,CAYE,kBAAC,GAAD,EAAO,WAAU,gBAAiB,CAAA,EAAA,iBAE3B;WACL;;OACM;QACT;OACH;;GAEN,kBAAC,IAAD,EAAa,OAAO,EAAI,IAAM,CAAA;GAC1B"}
@@ -1 +1 @@
1
- {"version":3,"file":"ProductsRoadmapDetailPagePage.d.ts","sourceRoot":"","sources":["../../../src/planmagnet/pages/ProductsRoadmapDetailPagePage.tsx"],"names":[],"mappings":"AA2FA,wBAAgB,6BAA6B,4CAsQ5C"}
1
+ {"version":3,"file":"ProductsRoadmapDetailPagePage.d.ts","sourceRoot":"","sources":["../../../src/planmagnet/pages/ProductsRoadmapDetailPagePage.tsx"],"names":[],"mappings":"AA8FA,wBAAgB,6BAA6B,4CAuR5C"}