@burdenoff/microfe-planmagnet 2026.930.15 → 2026.930.16

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.
@@ -0,0 +1,29 @@
1
+ /**
2
+ * The list + composer, with no Card of its own: `RoadmapDiscussionPanel` wraps it in one for the roadmap-level
3
+ * panel, `RoadmapItemCommentsButton` drops it straight into a dialog for an item's thread (a second nested Card
4
+ * there would just be visual noise inside the dialog's own chrome).
5
+ */
6
+ export declare function RoadmapCommentThread({ roadmapId, roadmapItemId, onTotalCount, }: {
7
+ roadmapId: string;
8
+ /** Omitted = the roadmap's own thread; set = one item's thread. */
9
+ roadmapItemId?: string;
10
+ /** Reports the thread's live total up to the caller (e.g. for a "Discussion (n)" title) once known. */
11
+ onTotalCount?: (count: number) => void;
12
+ }): import("react/jsx-runtime").JSX.Element;
13
+ /** The roadmap-level Discussion panel (`roadmapItemId` omitted — the roadmap's own thread, not any item's). */
14
+ export declare function RoadmapDiscussionPanel({ roadmapId }: {
15
+ roadmapId: string;
16
+ }): import("react/jsx-runtime").JSX.Element;
17
+ /**
18
+ * The small "Comments" affordance opened from a roadmap item, in both the Timeline and Now/Next/Later views. It
19
+ * deliberately does NOT pre-fetch a count for the collapsed label: `RoadmapItem` carries no `commentCount` field
20
+ * of its own (unlike `WorkItem`), and both views already render every item on the roadmap unwindowed (Now/Next/
21
+ * Later loads up to 2,000) — firing one count query per row would turn a single page load into a query-per-item
22
+ * burst. The count instead comes from the thread itself, once it has been opened in this session.
23
+ */
24
+ export declare function RoadmapItemCommentsButton({ roadmapId, itemId, itemTitle, }: {
25
+ roadmapId: string;
26
+ itemId: string;
27
+ itemTitle: string;
28
+ }): import("react/jsx-runtime").JSX.Element;
29
+ //# sourceMappingURL=RoadmapComments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RoadmapComments.d.ts","sourceRoot":"","sources":["../../../src/planmagnet/comments/RoadmapComments.tsx"],"names":[],"mappings":"AAwGA;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,SAAS,EACT,aAAa,EACb,YAAY,GACb,EAAE;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,mEAAmE;IACnE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,uGAAuG;IACvG,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC,2CAkHA;AAqHD,+GAA+G;AAC/G,wBAAgB,sBAAsB,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,2CAe1E;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,EACxC,SAAS,EACT,MAAM,EACN,SAAS,GACV,EAAE;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,2CAsCA"}
@@ -0,0 +1,310 @@
1
+ import { usePlanMagnet as e } from "../providers/PlanMagnetProvider.js";
2
+ import { PersonName as t } from "../people/People.js";
3
+ import { throwOnError as n } from "../utils/mutationResult.js";
4
+ import { ConfirmButton as r, ErrorLine as i } from "../controls/ConfirmButton.js";
5
+ import { isForbidden as a, mutationErrorMessage as o } from "../utils/graphqlErrors.js";
6
+ import { useEffect as s, useState as c } from "react";
7
+ import { MessageSquare as l, Trash2 as u } from "lucide-react";
8
+ import { gql as d } from "@apollo/client";
9
+ import { useMutation as f, useQuery as p } from "@apollo/client/react";
10
+ import { jsx as m, jsxs as h } from "react/jsx-runtime";
11
+ import { Button as g, Card as _, CardContent as v, CardHeader as y, CardTitle as b, ResponsiveDialog as x, ResponsiveDialogContent as S, ResponsiveDialogDescription as C, ResponsiveDialogHeader as w, ResponsiveDialogTitle as T, ResponsiveDialogTrigger as E } from "@burdenoff/fe-libs/ui";
12
+ //#region src/planmagnet/comments/RoadmapComments.tsx
13
+ var D = 5e3, O = 20, k = d`
14
+ query RoadmapCommentsThread(
15
+ $roadmapId: ID!
16
+ $roadmapItemId: ID
17
+ $pagination: PlanmagnetPaginationInput
18
+ ) {
19
+ planmagnetRoadmapComments(
20
+ roadmapId: $roadmapId
21
+ roadmapItemId: $roadmapItemId
22
+ pagination: $pagination
23
+ ) {
24
+ totalCount
25
+ pageInfo {
26
+ hasNextPage
27
+ endCursor
28
+ }
29
+ items {
30
+ id
31
+ authorId
32
+ body
33
+ createdAt
34
+ editedAt
35
+ }
36
+ }
37
+ }
38
+ `, A = d`
39
+ mutation RoadmapCommentAdd($input: PlanmagnetAddRoadmapCommentInput!) {
40
+ planmagnetAddRoadmapComment(input: $input) {
41
+ id
42
+ }
43
+ }
44
+ `, j = d`
45
+ mutation RoadmapCommentEdit($id: ID!, $body: String!) {
46
+ planmagnetEditRoadmapComment(id: $id, body: $body) {
47
+ id
48
+ body
49
+ editedAt
50
+ }
51
+ }
52
+ `, M = d`
53
+ mutation RoadmapCommentDelete($id: ID!) {
54
+ planmagnetDeleteRoadmapComment(id: $id)
55
+ }
56
+ `, N = (e) => new Date(e).toLocaleString(), P = {
57
+ refetchQueries: ["RoadmapCommentsThread"],
58
+ awaitRefetchQueries: !0
59
+ };
60
+ function F({ roadmapId: t, roadmapItemId: r, onTotalCount: l }) {
61
+ let { currentUser: u } = e(), [d, _] = c(""), [v, y] = c(null), [b, x] = c(!1), { data: S, loading: C, error: w, fetchMore: T } = p(k, {
62
+ variables: {
63
+ roadmapId: t,
64
+ roadmapItemId: r ?? null,
65
+ pagination: { first: O }
66
+ },
67
+ skip: !t
68
+ }), [E, j] = f(A, P), M = S?.planmagnetRoadmapComments, N = M?.items ?? [], F = d.trim(), L = F.length > D;
69
+ s(() => {
70
+ M && l?.(M.totalCount);
71
+ }, [M, l]);
72
+ let R = async () => {
73
+ y(null);
74
+ try {
75
+ await n(E({ variables: { input: {
76
+ roadmapId: t,
77
+ roadmapItemId: r ?? null,
78
+ body: F
79
+ } } })), _("");
80
+ } catch (e) {
81
+ y(a(e) ? "Your role can read but not comment." : o(e, "The comment could not be posted."));
82
+ }
83
+ }, z = async () => {
84
+ let e = M?.pageInfo.endCursor;
85
+ if (e) {
86
+ x(!0);
87
+ try {
88
+ await T({
89
+ variables: { pagination: {
90
+ first: O,
91
+ after: e
92
+ } },
93
+ updateQuery: (e, { fetchMoreResult: t }) => ({ planmagnetRoadmapComments: {
94
+ ...t.planmagnetRoadmapComments,
95
+ items: [...e.planmagnetRoadmapComments.items, ...t.planmagnetRoadmapComments.items]
96
+ } })
97
+ });
98
+ } finally {
99
+ x(!1);
100
+ }
101
+ }
102
+ };
103
+ return /* @__PURE__ */ h("div", {
104
+ className: "space-y-4",
105
+ children: [
106
+ v && /* @__PURE__ */ m(i, { message: v }),
107
+ C && !S && /* @__PURE__ */ m("p", {
108
+ className: "text-sm text-muted-foreground",
109
+ children: "Loading comments…"
110
+ }),
111
+ w && /* @__PURE__ */ m(i, { message: `Comments could not be loaded: ${w.message}` }),
112
+ M && N.length === 0 && /* @__PURE__ */ m("p", {
113
+ className: "text-sm text-muted-foreground",
114
+ children: "No comments yet."
115
+ }),
116
+ /* @__PURE__ */ m("ol", {
117
+ className: "space-y-3",
118
+ children: N.map((e) => /* @__PURE__ */ m(I, {
119
+ comment: e,
120
+ mine: e.authorId === u?.id,
121
+ onError: y
122
+ }, e.id))
123
+ }),
124
+ M?.pageInfo.hasNextPage && /* @__PURE__ */ m(g, {
125
+ size: "sm",
126
+ variant: "outline",
127
+ onClick: () => void z(),
128
+ disabled: b,
129
+ children: b ? "Loading…" : `Show more (${N.length} of ${M.totalCount})`
130
+ }),
131
+ /* @__PURE__ */ h("div", {
132
+ className: "space-y-2 border-t pt-4",
133
+ children: [
134
+ /* @__PURE__ */ m("label", {
135
+ htmlFor: `roadmap-comment-draft-${r ?? t}`,
136
+ className: "sr-only",
137
+ children: "Add a comment"
138
+ }),
139
+ /* @__PURE__ */ m("textarea", {
140
+ id: `roadmap-comment-draft-${r ?? t}`,
141
+ className: "w-full min-h-[72px] rounded-md border border-input bg-background px-3 py-2 text-sm",
142
+ placeholder: "Add a comment…",
143
+ value: d,
144
+ onChange: (e) => _(e.target.value)
145
+ }),
146
+ L && /* @__PURE__ */ m(i, { message: `A comment can be at most ${D} characters.` }),
147
+ /* @__PURE__ */ m("div", {
148
+ className: "flex justify-end",
149
+ children: /* @__PURE__ */ m(g, {
150
+ size: "sm",
151
+ onClick: () => void R(),
152
+ disabled: !F || L || j.loading,
153
+ "data-testid": "roadmap-comment-add",
154
+ children: j.loading ? "Posting…" : "Comment"
155
+ })
156
+ })
157
+ ]
158
+ })
159
+ ]
160
+ });
161
+ }
162
+ function I({ comment: e, mine: a, onError: s }) {
163
+ let [l, d] = c(!1), [p, _] = c(e.body), v = p.trim().length > D, y = s, [b, x] = f(j, P), [S, C] = f(M, P), w = async () => {
164
+ y(null);
165
+ try {
166
+ await n(b({ variables: {
167
+ id: e.id,
168
+ body: p.trim()
169
+ } })), d(!1);
170
+ } catch (e) {
171
+ y(o(e, "The comment could not be saved."));
172
+ }
173
+ }, T = async () => {
174
+ y(null);
175
+ try {
176
+ await n(S({ variables: { id: e.id } }));
177
+ } catch (e) {
178
+ y(o(e, "The comment could not be deleted."));
179
+ }
180
+ };
181
+ return /* @__PURE__ */ h("li", {
182
+ className: "rounded-md border p-3 space-y-1",
183
+ "data-testid": "roadmap-comment",
184
+ children: [/* @__PURE__ */ h("div", {
185
+ className: "flex items-center justify-between gap-2 text-xs text-muted-foreground",
186
+ children: [/* @__PURE__ */ h("span", { children: [
187
+ /* @__PURE__ */ m("span", {
188
+ className: "font-medium text-foreground",
189
+ children: /* @__PURE__ */ m(t, { id: e.authorId })
190
+ }),
191
+ " ",
192
+ "· ",
193
+ N(e.createdAt),
194
+ e.editedAt && /* @__PURE__ */ m("span", {
195
+ title: `Edited ${N(e.editedAt)}`,
196
+ children: " · edited"
197
+ })
198
+ ] }), a && !l && /* @__PURE__ */ h("span", {
199
+ className: "flex items-center gap-1",
200
+ children: [/* @__PURE__ */ m(g, {
201
+ size: "sm",
202
+ variant: "ghost",
203
+ className: "h-6 px-2 text-xs",
204
+ onClick: () => d(!0),
205
+ children: "Edit"
206
+ }), /* @__PURE__ */ m(r, {
207
+ label: "",
208
+ ariaLabel: "Delete comment",
209
+ variant: "outline",
210
+ icon: /* @__PURE__ */ m(u, { className: "h-3.5 w-3.5" }),
211
+ title: "Delete this comment?",
212
+ description: "It is removed from the discussion for everyone. This cannot be undone here.",
213
+ confirmLabel: "Delete",
214
+ destructive: !0,
215
+ disabled: C.loading,
216
+ onConfirm: () => void T()
217
+ })]
218
+ })]
219
+ }), l ? /* @__PURE__ */ h("div", {
220
+ className: "space-y-2",
221
+ children: [
222
+ /* @__PURE__ */ m("textarea", {
223
+ "aria-label": "Edit comment",
224
+ className: "w-full min-h-[60px] rounded-md border border-input bg-background px-3 py-2 text-sm",
225
+ value: p,
226
+ onChange: (e) => _(e.target.value)
227
+ }),
228
+ v && /* @__PURE__ */ m(i, { message: `A comment can be at most ${D} characters.` }),
229
+ /* @__PURE__ */ h("div", {
230
+ className: "flex justify-end gap-2",
231
+ children: [/* @__PURE__ */ m(g, {
232
+ size: "sm",
233
+ variant: "outline",
234
+ onClick: () => {
235
+ d(!1), _(e.body), y(null);
236
+ },
237
+ children: "Cancel"
238
+ }), /* @__PURE__ */ m(g, {
239
+ size: "sm",
240
+ onClick: () => void w(),
241
+ disabled: !p.trim() || v || x.loading,
242
+ children: x.loading ? "Saving…" : "Save"
243
+ })]
244
+ })
245
+ ]
246
+ }) : /* @__PURE__ */ m("p", {
247
+ className: "text-sm whitespace-pre-wrap break-words",
248
+ children: e.body
249
+ })]
250
+ });
251
+ }
252
+ function L({ roadmapId: e }) {
253
+ let [t, n] = c(null);
254
+ return /* @__PURE__ */ h(_, {
255
+ "data-testid": "roadmap-discussion",
256
+ children: [/* @__PURE__ */ m(y, { children: /* @__PURE__ */ h(b, {
257
+ className: "flex items-center gap-2",
258
+ children: [
259
+ /* @__PURE__ */ m(l, {
260
+ className: "h-4 w-4",
261
+ "aria-hidden": "true"
262
+ }),
263
+ "Discussion",
264
+ t === null ? "" : ` (${t})`
265
+ ]
266
+ }) }), /* @__PURE__ */ m(v, { children: /* @__PURE__ */ m(F, {
267
+ roadmapId: e,
268
+ onTotalCount: n
269
+ }) })]
270
+ });
271
+ }
272
+ function R({ roadmapId: e, itemId: t, itemTitle: n }) {
273
+ let [r, i] = c(!1), [a, o] = c(null);
274
+ return /* @__PURE__ */ h(x, {
275
+ open: r,
276
+ onOpenChange: i,
277
+ children: [/* @__PURE__ */ m(E, {
278
+ asChild: !0,
279
+ children: /* @__PURE__ */ h(g, {
280
+ size: "sm",
281
+ variant: "ghost",
282
+ className: "h-7 px-2 text-xs",
283
+ "data-testid": "roadmap-item-comments",
284
+ "aria-label": `Comments on ${n}`,
285
+ children: [
286
+ /* @__PURE__ */ m(l, {
287
+ className: "mr-1 h-3.5 w-3.5",
288
+ "aria-hidden": "true"
289
+ }),
290
+ "Comments",
291
+ a !== null && a > 0 ? ` (${a})` : ""
292
+ ]
293
+ })
294
+ }), /* @__PURE__ */ h(S, {
295
+ className: "max-w-lg",
296
+ children: [/* @__PURE__ */ h(w, { children: [/* @__PURE__ */ h(T, { children: ["Comments — ", n] }), /* @__PURE__ */ m(C, { children: "Visible to everyone who can read this roadmap." })] }), /* @__PURE__ */ m("div", {
297
+ className: "max-h-[60vh] overflow-y-auto pr-1",
298
+ children: r && /* @__PURE__ */ m(F, {
299
+ roadmapId: e,
300
+ roadmapItemId: t,
301
+ onTotalCount: o
302
+ })
303
+ })]
304
+ })]
305
+ });
306
+ }
307
+ //#endregion
308
+ export { L as RoadmapDiscussionPanel, R as RoadmapItemCommentsButton };
309
+
310
+ //# sourceMappingURL=RoadmapComments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RoadmapComments.js","names":[],"sources":["../../../src/planmagnet/comments/RoadmapComments.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport { gql } from '@apollo/client';\nimport { useMutation, useQuery } from '@apollo/client/react';\nimport {\n Button,\n Card,\n CardContent,\n CardHeader,\n CardTitle,\n ResponsiveDialog,\n ResponsiveDialogContent,\n ResponsiveDialogDescription,\n ResponsiveDialogHeader,\n ResponsiveDialogTitle,\n ResponsiveDialogTrigger,\n} from '@burdenoff/fe-libs/ui';\nimport { MessageSquare, Trash2 } from 'lucide-react';\nimport { usePlanMagnet } from '../providers/PlanMagnetProvider';\nimport { PersonName } from '../people/People';\nimport { ConfirmButton, ErrorLine } from '../controls/ConfirmButton';\nimport { throwOnError } from '../utils/mutationResult';\nimport { isForbidden, mutationErrorMessage } from '../utils/graphqlErrors';\n\n/**\n * Roadmap collaboration: discussion (PRM-11). `PlanmagnetRoadmapComment`'s own doc comment says it is the \"same\n * shape as PlanmagnetWorkItemComment\" — this mirrors `WorkItemComments.tsx`'s list/add/author-only-edit/delete\n * thread, parameterized on `roadmapItemId` so ONE component serves both the roadmap-level Discussion panel\n * (`roadmapItemId` omitted) and a per-item thread opened from an item (`roadmapItemId` set) — the server's own\n * \"filter present = exact match, absent = unplaced/unattached\" convention on that field.\n *\n * Posting needs the roadmap's write tier; a Stakeholder-Viewer role that can read but not comment gets FORBIDDEN,\n * shown here as a fixed, specific message (per BOFF-8168-style precedent elsewhere in this MFE) rather than the\n * server's generic one.\n */\n\nconst MAX_LENGTH = 5_000; // PlanmagnetAddRoadmapCommentInput: \"1 to 5,000 characters after trimming\"\nconst PAGE = 20;\n\nconst ROADMAP_COMMENTS = gql`\n query RoadmapCommentsThread(\n $roadmapId: ID!\n $roadmapItemId: ID\n $pagination: PlanmagnetPaginationInput\n ) {\n planmagnetRoadmapComments(\n roadmapId: $roadmapId\n roadmapItemId: $roadmapItemId\n pagination: $pagination\n ) {\n totalCount\n pageInfo {\n hasNextPage\n endCursor\n }\n items {\n id\n authorId\n body\n createdAt\n editedAt\n }\n }\n }\n`;\nconst ADD_ROADMAP_COMMENT = gql`\n mutation RoadmapCommentAdd($input: PlanmagnetAddRoadmapCommentInput!) {\n planmagnetAddRoadmapComment(input: $input) {\n id\n }\n }\n`;\nconst EDIT_ROADMAP_COMMENT = gql`\n mutation RoadmapCommentEdit($id: ID!, $body: String!) {\n planmagnetEditRoadmapComment(id: $id, body: $body) {\n id\n body\n editedAt\n }\n }\n`;\nconst DELETE_ROADMAP_COMMENT = gql`\n mutation RoadmapCommentDelete($id: ID!) {\n planmagnetDeleteRoadmapComment(id: $id)\n }\n`;\n\ninterface RoadmapComment {\n id: string;\n authorId: string;\n body: string;\n createdAt: string;\n editedAt: string | null;\n}\ninterface RoadmapCommentsData {\n planmagnetRoadmapComments: {\n totalCount: number;\n pageInfo: { hasNextPage: boolean; endCursor: string | null };\n items: RoadmapComment[];\n };\n}\n\nconst when = (iso: string) => new Date(iso).toLocaleString();\nconst THREAD_REFETCH = { refetchQueries: ['RoadmapCommentsThread'], awaitRefetchQueries: true };\n\n/**\n * The list + composer, with no Card of its own: `RoadmapDiscussionPanel` wraps it in one for the roadmap-level\n * panel, `RoadmapItemCommentsButton` drops it straight into a dialog for an item's thread (a second nested Card\n * there would just be visual noise inside the dialog's own chrome).\n */\nexport function RoadmapCommentThread({\n roadmapId,\n roadmapItemId,\n onTotalCount,\n}: {\n roadmapId: string;\n /** Omitted = the roadmap's own thread; set = one item's thread. */\n roadmapItemId?: string;\n /** Reports the thread's live total up to the caller (e.g. for a \"Discussion (n)\" title) once known. */\n onTotalCount?: (count: number) => void;\n}) {\n const { currentUser } = usePlanMagnet();\n const [draft, setDraft] = useState('');\n const [error, setError] = useState<string | null>(null);\n const [loadingMore, setLoadingMore] = useState(false);\n\n const {\n data,\n loading,\n error: loadError,\n fetchMore,\n } = useQuery<RoadmapCommentsData>(ROADMAP_COMMENTS, {\n variables: { roadmapId, roadmapItemId: roadmapItemId ?? null, pagination: { first: PAGE } },\n skip: !roadmapId,\n });\n const [add, addState] = useMutation(ADD_ROADMAP_COMMENT, THREAD_REFETCH);\n\n const thread = data?.planmagnetRoadmapComments;\n const comments = thread?.items ?? [];\n const trimmed = draft.trim();\n const tooLong = trimmed.length > MAX_LENGTH;\n\n useEffect(() => {\n if (thread) onTotalCount?.(thread.totalCount);\n }, [thread, onTotalCount]);\n\n const post = async () => {\n setError(null);\n try {\n await throwOnError(\n add({\n variables: { input: { roadmapId, roadmapItemId: roadmapItemId ?? null, body: trimmed } },\n })\n );\n setDraft('');\n } catch (e) {\n setError(\n isForbidden(e)\n ? 'Your role can read but not comment.'\n : mutationErrorMessage(e, 'The comment could not be posted.')\n );\n }\n };\n\n const loadMore = async () => {\n const after = thread?.pageInfo.endCursor;\n if (!after) return;\n setLoadingMore(true);\n try {\n await fetchMore({\n variables: { pagination: { first: PAGE, after } },\n updateQuery: (prev, { fetchMoreResult }) => ({\n planmagnetRoadmapComments: {\n ...fetchMoreResult.planmagnetRoadmapComments,\n items: [\n ...prev.planmagnetRoadmapComments.items,\n ...fetchMoreResult.planmagnetRoadmapComments.items,\n ],\n },\n }),\n });\n } finally {\n setLoadingMore(false);\n }\n };\n\n return (\n <div className=\"space-y-4\">\n {error && <ErrorLine message={error} />}\n {loading && !data && <p className=\"text-sm text-muted-foreground\">Loading comments…</p>}\n {loadError && <ErrorLine message={`Comments could not be loaded: ${loadError.message}`} />}\n {thread && comments.length === 0 && (\n <p className=\"text-sm text-muted-foreground\">No comments yet.</p>\n )}\n <ol className=\"space-y-3\">\n {comments.map((comment) => (\n <CommentRow\n key={comment.id}\n comment={comment}\n mine={comment.authorId === currentUser?.id}\n onError={setError}\n />\n ))}\n </ol>\n {thread?.pageInfo.hasNextPage && (\n <Button size=\"sm\" variant=\"outline\" onClick={() => void loadMore()} disabled={loadingMore}>\n {loadingMore ? 'Loading…' : `Show more (${comments.length} of ${thread.totalCount})`}\n </Button>\n )}\n <div className=\"space-y-2 border-t pt-4\">\n <label htmlFor={`roadmap-comment-draft-${roadmapItemId ?? roadmapId}`} className=\"sr-only\">\n Add a comment\n </label>\n <textarea\n id={`roadmap-comment-draft-${roadmapItemId ?? roadmapId}`}\n className=\"w-full min-h-[72px] rounded-md border border-input bg-background px-3 py-2 text-sm\"\n placeholder=\"Add a comment…\"\n value={draft}\n onChange={(e) => setDraft(e.target.value)}\n />\n {tooLong && <ErrorLine message={`A comment can be at most ${MAX_LENGTH} characters.`} />}\n <div className=\"flex justify-end\">\n <Button\n size=\"sm\"\n onClick={() => void post()}\n disabled={!trimmed || tooLong || addState.loading}\n data-testid=\"roadmap-comment-add\"\n >\n {addState.loading ? 'Posting…' : 'Comment'}\n </Button>\n </div>\n </div>\n </div>\n );\n}\n\n/**\n * Refusals are reported to the PANEL, not kept in the row — same reasoning as `WorkItemComments.tsx`'s\n * `CommentRow`: a refused edit/delete still refetches the thread, and a row that vanished with it (deleted\n * elsewhere) would take a row-level message down with it.\n */\nfunction CommentRow({\n comment,\n mine,\n onError,\n}: {\n comment: RoadmapComment;\n mine: boolean;\n onError: (message: string | null) => void;\n}) {\n const [editing, setEditing] = useState(false);\n const [text, setText] = useState(comment.body);\n // Same limit as the Add composer (the edit mutation takes the same 1..5,000 characters after trimming).\n const editTooLong = text.trim().length > MAX_LENGTH;\n const setError = onError;\n const [edit, editState] = useMutation(EDIT_ROADMAP_COMMENT, THREAD_REFETCH);\n const [remove, removeState] = useMutation(DELETE_ROADMAP_COMMENT, THREAD_REFETCH);\n\n const save = async () => {\n setError(null);\n try {\n await throwOnError(edit({ variables: { id: comment.id, body: text.trim() } }));\n setEditing(false);\n } catch (e) {\n setError(mutationErrorMessage(e, 'The comment could not be saved.'));\n }\n };\n\n const onRemove = async () => {\n setError(null);\n try {\n await throwOnError(remove({ variables: { id: comment.id } }));\n } catch (e) {\n setError(mutationErrorMessage(e, 'The comment could not be deleted.'));\n }\n };\n\n return (\n <li className=\"rounded-md border p-3 space-y-1\" data-testid=\"roadmap-comment\">\n <div className=\"flex items-center justify-between gap-2 text-xs text-muted-foreground\">\n <span>\n <span className=\"font-medium text-foreground\">\n <PersonName id={comment.authorId} />\n </span>{' '}\n · {when(comment.createdAt)}\n {comment.editedAt && <span title={`Edited ${when(comment.editedAt)}`}> · edited</span>}\n </span>\n {mine && !editing && (\n <span className=\"flex items-center gap-1\">\n <Button\n size=\"sm\"\n variant=\"ghost\"\n className=\"h-6 px-2 text-xs\"\n onClick={() => setEditing(true)}\n >\n Edit\n </Button>\n <ConfirmButton\n label=\"\"\n ariaLabel=\"Delete comment\"\n variant=\"outline\"\n icon={<Trash2 className=\"h-3.5 w-3.5\" />}\n title=\"Delete this comment?\"\n description=\"It is removed from the discussion for everyone. This cannot be undone here.\"\n confirmLabel=\"Delete\"\n destructive\n disabled={removeState.loading}\n onConfirm={() => void onRemove()}\n />\n </span>\n )}\n </div>\n {editing ? (\n <div className=\"space-y-2\">\n <textarea\n aria-label=\"Edit comment\"\n className=\"w-full min-h-[60px] rounded-md border border-input bg-background px-3 py-2 text-sm\"\n value={text}\n onChange={(e) => setText(e.target.value)}\n />\n {editTooLong && (\n <ErrorLine message={`A comment can be at most ${MAX_LENGTH} characters.`} />\n )}\n <div className=\"flex justify-end gap-2\">\n <Button\n size=\"sm\"\n variant=\"outline\"\n onClick={() => {\n setEditing(false);\n setText(comment.body);\n setError(null);\n }}\n >\n Cancel\n </Button>\n <Button\n size=\"sm\"\n onClick={() => void save()}\n disabled={!text.trim() || editTooLong || editState.loading}\n >\n {editState.loading ? 'Saving…' : 'Save'}\n </Button>\n </div>\n </div>\n ) : (\n <p className=\"text-sm whitespace-pre-wrap break-words\">{comment.body}</p>\n )}\n </li>\n );\n}\n\n/** The roadmap-level Discussion panel (`roadmapItemId` omitted — the roadmap's own thread, not any item's). */\nexport function RoadmapDiscussionPanel({ roadmapId }: { roadmapId: string }) {\n const [totalCount, setTotalCount] = useState<number | null>(null);\n return (\n <Card data-testid=\"roadmap-discussion\">\n <CardHeader>\n <CardTitle className=\"flex items-center gap-2\">\n <MessageSquare className=\"h-4 w-4\" aria-hidden=\"true\" />\n Discussion{totalCount !== null ? ` (${totalCount})` : ''}\n </CardTitle>\n </CardHeader>\n <CardContent>\n <RoadmapCommentThread roadmapId={roadmapId} onTotalCount={setTotalCount} />\n </CardContent>\n </Card>\n );\n}\n\n/**\n * The small \"Comments\" affordance opened from a roadmap item, in both the Timeline and Now/Next/Later views. It\n * deliberately does NOT pre-fetch a count for the collapsed label: `RoadmapItem` carries no `commentCount` field\n * of its own (unlike `WorkItem`), and both views already render every item on the roadmap unwindowed (Now/Next/\n * Later loads up to 2,000) — firing one count query per row would turn a single page load into a query-per-item\n * burst. The count instead comes from the thread itself, once it has been opened in this session.\n */\nexport function RoadmapItemCommentsButton({\n roadmapId,\n itemId,\n itemTitle,\n}: {\n roadmapId: string;\n itemId: string;\n itemTitle: string;\n}) {\n const [open, setOpen] = useState(false);\n const [count, setCount] = useState<number | null>(null);\n\n return (\n <ResponsiveDialog open={open} onOpenChange={setOpen}>\n <ResponsiveDialogTrigger asChild>\n <Button\n size=\"sm\"\n variant=\"ghost\"\n className=\"h-7 px-2 text-xs\"\n data-testid=\"roadmap-item-comments\"\n aria-label={`Comments on ${itemTitle}`}\n >\n <MessageSquare className=\"mr-1 h-3.5 w-3.5\" aria-hidden=\"true\" />\n Comments{count !== null && count > 0 ? ` (${count})` : ''}\n </Button>\n </ResponsiveDialogTrigger>\n <ResponsiveDialogContent className=\"max-w-lg\">\n <ResponsiveDialogHeader>\n <ResponsiveDialogTitle>Comments — {itemTitle}</ResponsiveDialogTitle>\n <ResponsiveDialogDescription>\n Visible to everyone who can read this roadmap.\n </ResponsiveDialogDescription>\n </ResponsiveDialogHeader>\n <div className=\"max-h-[60vh] overflow-y-auto pr-1\">\n {/* Mounted only while open: the thread's own query never fires just because the row rendered. */}\n {open && (\n <RoadmapCommentThread\n roadmapId={roadmapId}\n roadmapItemId={itemId}\n onTotalCount={setCount}\n />\n )}\n </div>\n </ResponsiveDialogContent>\n </ResponsiveDialog>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAmCA,IAAM,IAAa,KACb,IAAO,IAEP,IAAmB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;GA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gBAKC;CACD,IAAM,CAAC,GAAM,KAAW,EAAS,GAAM,EACjC,CAAC,GAAO,KAAY,EAAwB,KAAK;AAEvD,QACE,kBAAC,GAAD;EAAwB;EAAM,cAAc;YAA5C,CACE,kBAAC,GAAD;GAAyB,SAAA;aACvB,kBAAC,GAAD;IACE,MAAK;IACL,SAAQ;IACR,WAAU;IACV,eAAY;IACZ,cAAY,eAAe;cAL7B;KAOE,kBAAC,GAAD;MAAe,WAAU;MAAmB,eAAY;MAAS,CAAA;;KACxD,MAAU,QAAQ,IAAQ,IAAI,KAAK,EAAM,KAAK;KAChD;;GACe,CAAA,EAC1B,kBAAC,GAAD;GAAyB,WAAU;aAAnC,CACE,kBAAC,GAAD,EAAA,UAAA,CACE,kBAAC,GAAD,EAAA,UAAA,CAAuB,eAAY,EAAkC,EAAA,CAAA,EACrE,kBAAC,GAAD,EAAA,UAA6B,kDAEC,CAAA,CACP,EAAA,CAAA,EACzB,kBAAC,OAAD;IAAK,WAAU;cAEZ,KACC,kBAAC,GAAD;KACa;KACX,eAAe;KACf,cAAc;KACd,CAAA;IAEA,CAAA,CACkB;KACT"}
@@ -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"}