@burdenoff/microfe-planmagnet 2026.930.5 → 2026.930.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"GoalsObjectiveDetailPagePage.d.ts","sourceRoot":"","sources":["../../../src/planmagnet/pages/GoalsObjectiveDetailPagePage.tsx"],"names":[],"mappings":"AAiQA,wBAAgB,4BAA4B,4CA0Q3C"}
1
+ {"version":3,"file":"GoalsObjectiveDetailPagePage.d.ts","sourceRoot":"","sources":["../../../src/planmagnet/pages/GoalsObjectiveDetailPagePage.tsx"],"names":[],"mappings":"AAgUA,wBAAgB,4BAA4B,4CAuR3C"}
@@ -32,6 +32,7 @@ var D = h`
32
32
  startValue
33
33
  targetValue
34
34
  currentValue
35
+ progressSource
35
36
  unit
36
37
  status
37
38
  ownerId
@@ -39,6 +40,7 @@ var D = h`
39
40
  linkedWorkItemRollup {
40
41
  totalLinked
41
42
  doneCount
43
+ cancelledCount
42
44
  completionRatio
43
45
  }
44
46
  linkedWorkItems {
@@ -61,6 +63,8 @@ var D = h`
61
63
  planmagnetUpdateKeyResult(id: $id, input: $input) {
62
64
  id
63
65
  currentValue
66
+ progressSource
67
+ progress
64
68
  status
65
69
  }
66
70
  }
@@ -101,7 +105,18 @@ function P({ kr: e, onUpdated: t, onDeleted: n }) {
101
105
  h(e instanceof Error ? e.message : "The progress could not be saved.");
102
106
  }
103
107
  }
104
- }, b = async () => {
108
+ }, b = e.progressSource === "LINKED_WORK_ITEMS", S = async () => {
109
+ h(null);
110
+ try {
111
+ let n = (await i(l({ variables: {
112
+ id: e.id,
113
+ input: { progressSource: b ? "MANUAL" : "LINKED_WORK_ITEMS" }
114
+ } })))?.data?.planmagnetUpdateKeyResult;
115
+ n && s(String(n.currentValue)), t();
116
+ } catch (e) {
117
+ h(e instanceof Error ? e.message : "The progress source could not be changed.");
118
+ }
119
+ }, C = e.linkedWorkItemRollup, w = C.totalLinked - C.cancelledCount, T = async () => {
105
120
  h(null);
106
121
  try {
107
122
  await i(d({ variables: { id: e.id } })), n();
@@ -143,7 +158,7 @@ function P({ kr: e, onUpdated: t, onDeleted: n }) {
143
158
  confirmLabel: "Delete key result",
144
159
  destructive: !0,
145
160
  disabled: f,
146
- onConfirm: () => void b()
161
+ onConfirm: () => void T()
147
162
  })]
148
163
  })]
149
164
  }),
@@ -152,15 +167,24 @@ function P({ kr: e, onUpdated: t, onDeleted: n }) {
152
167
  className: "flex items-center justify-between text-xs text-muted-foreground",
153
168
  children: [/* @__PURE__ */ v("span", { children: e.metricType === "BOOLEAN" ? e.currentValue > 0 ? "Done" : "Not done" : `${e.currentValue}${e.unit ? ` ${e.unit}` : ""} of ${e.targetValue}${e.unit ? ` ${e.unit}` : ""}` }), /* @__PURE__ */ y("span", { children: [Math.round(e.progress), "%"] })]
154
169
  }),
155
- e.linkedWorkItemRollup.totalLinked > 0 && /* @__PURE__ */ y("p", {
170
+ b ? /* @__PURE__ */ y("p", {
156
171
  className: "text-xs text-muted-foreground",
172
+ "data-testid": "kr-measured-from-work",
157
173
  children: [
158
- e.linkedWorkItemRollup.doneCount,
159
- "/",
160
- e.linkedWorkItemRollup.totalLinked,
161
- " linked work items done (",
162
- Math.round(e.linkedWorkItemRollup.completionRatio * 100),
163
- "%) — informational, update progress above manually"
174
+ "Measured from linked work:",
175
+ " ",
176
+ w > 0 ? `${C.doneCount} of ${w} done (${Math.round(C.completionRatio * 100)}%)` : "no linked work items to count yet",
177
+ C.cancelledCount > 0 ? ` · ${C.cancelledCount} cancelled, not counted` : ""
178
+ ]
179
+ }) : C.totalLinked > 0 && /* @__PURE__ */ y("p", {
180
+ className: "text-xs text-muted-foreground",
181
+ children: [
182
+ "Linked work:",
183
+ " ",
184
+ w > 0 ? `${C.doneCount} of ${w} done (${Math.round(C.completionRatio * 100)}%)` : "nothing left to count",
185
+ C.cancelledCount > 0 ? ` · ${C.cancelledCount} cancelled, not counted` : "",
186
+ " ",
187
+ "— not used for progress while it is entered by hand"
164
188
  ]
165
189
  }),
166
190
  /* @__PURE__ */ v(o, {
@@ -169,87 +193,97 @@ function P({ kr: e, onUpdated: t, onDeleted: n }) {
169
193
  linked: e.linkedWorkItems ?? []
170
194
  }),
171
195
  /* @__PURE__ */ y("div", {
172
- className: "flex items-center gap-2",
173
- children: [e.metricType === "BOOLEAN" ? /* @__PURE__ */ y("select", {
174
- className: "rounded-md border border-input bg-background px-3 py-1.5 text-sm",
175
- value: r,
176
- onChange: (e) => s(e.target.value),
177
- children: [/* @__PURE__ */ v("option", {
178
- value: "0",
179
- children: "Not done"
180
- }), /* @__PURE__ */ v("option", {
181
- value: "1",
182
- children: "Done"
183
- })]
184
- }) : /* @__PURE__ */ v(E, {
185
- type: "number",
186
- value: r,
187
- onChange: (e) => s(e.target.value),
188
- className: "w-32"
189
- }), /* @__PURE__ */ v(x, {
190
- size: "sm",
191
- variant: "outline",
192
- disabled: u,
193
- onClick: _,
194
- children: u ? "Saving..." : "Update progress"
195
- })]
196
+ className: "flex flex-wrap items-center gap-2",
197
+ children: [
198
+ !b && (e.metricType === "BOOLEAN" ? /* @__PURE__ */ y("select", {
199
+ "aria-label": `Progress of ${e.title}`,
200
+ className: "rounded-md border border-input bg-background px-3 py-1.5 text-sm",
201
+ value: r,
202
+ onChange: (e) => s(e.target.value),
203
+ children: [/* @__PURE__ */ v("option", {
204
+ value: "0",
205
+ children: "Not done"
206
+ }), /* @__PURE__ */ v("option", {
207
+ value: "1",
208
+ children: "Done"
209
+ })]
210
+ }) : /* @__PURE__ */ v(E, {
211
+ type: "number",
212
+ "aria-label": `Current value of ${e.title}`,
213
+ value: r,
214
+ onChange: (e) => s(e.target.value),
215
+ className: "w-32"
216
+ })),
217
+ !b && /* @__PURE__ */ v(x, {
218
+ size: "sm",
219
+ variant: "outline",
220
+ disabled: u,
221
+ onClick: _,
222
+ children: u ? "Saving..." : "Update progress"
223
+ }),
224
+ /* @__PURE__ */ v(x, {
225
+ size: "sm",
226
+ variant: "ghost",
227
+ disabled: u,
228
+ onClick: () => void S(),
229
+ "data-testid": "kr-switch-source",
230
+ children: b ? "Enter progress by hand" : "Measure from linked work"
231
+ })
232
+ ]
196
233
  })
197
234
  ]
198
235
  });
199
236
  }
200
237
  function F() {
201
- let { workspaceId: o } = e(), h = t(), k = new URLSearchParams(window.location.search).get("objectiveId") ?? "", [A, M] = c(!1), [F, I] = c({
238
+ let { workspaceId: o } = e(), h = t(), k = new URLSearchParams(window.location.search).get("objectiveId") ?? "", [A, M] = c(!1), F = {
202
239
  title: "",
203
240
  metricType: "NUMERIC",
204
241
  targetValue: "100",
205
- unit: ""
206
- }), { data: L, loading: R, error: z, refetch: B } = _(D, {
242
+ unit: "",
243
+ progressSource: "MANUAL"
244
+ }, [I, L] = c(F), { data: R, loading: z, error: B, refetch: V } = _(D, {
207
245
  variables: { id: k },
208
246
  skip: !o || !k
209
- }), [V, { loading: H }] = g(O), [U, { loading: W }] = g(j, { context: r }), [G, K] = c(null);
210
- if (R && !L) return /* @__PURE__ */ v("div", {
247
+ }), [H, { loading: U }] = g(O), [W, { loading: G }] = g(j, { context: r }), [K, q] = c(null);
248
+ if (z && !R) return /* @__PURE__ */ v("div", {
211
249
  className: "flex items-center justify-center p-12",
212
250
  children: /* @__PURE__ */ v("div", { className: "animate-spin h-8 w-8 border-2 border-primary border-t-transparent rounded-full" })
213
251
  });
214
- if (z) return /* @__PURE__ */ y("div", {
252
+ if (B) return /* @__PURE__ */ y("div", {
215
253
  className: "p-6 text-red-500",
216
- children: ["Error: ", z.message]
254
+ children: ["Error: ", B.message]
217
255
  });
218
- let q = L?.planmagnetObjective;
219
- if (!q) return /* @__PURE__ */ v("div", {
256
+ let J = R?.planmagnetObjective;
257
+ if (!J) return /* @__PURE__ */ v("div", {
220
258
  className: "p-6 text-muted-foreground",
221
259
  children: "Objective not found."
222
260
  });
223
- let J = async () => {
224
- if (!F.title.trim() || !k) return;
225
- let e = Number(F.metricType === "BOOLEAN" ? 1 : F.targetValue);
261
+ let Y = async () => {
262
+ if (!I.title.trim() || !k) return;
263
+ let e = Number(I.metricType === "BOOLEAN" ? 1 : I.targetValue);
226
264
  if (!Number.isNaN(e)) {
227
- K(null);
265
+ q(null);
228
266
  try {
229
- await i(V({ variables: { input: {
267
+ await i(H({ variables: { input: {
230
268
  objectiveId: k,
231
- title: F.title.trim(),
232
- metricType: F.metricType,
269
+ title: I.title.trim(),
270
+ metricType: I.metricType,
233
271
  targetValue: e,
234
- unit: F.unit.trim() || void 0
272
+ unit: I.unit.trim() || void 0,
273
+ progressSource: I.progressSource
235
274
  } } }));
236
275
  } catch (e) {
237
- K(e instanceof Error ? e.message : "The key result could not be added.");
276
+ q(e instanceof Error ? e.message : "The key result could not be added.");
238
277
  return;
239
278
  }
240
- I({
241
- title: "",
242
- metricType: "NUMERIC",
243
- targetValue: "100",
244
- unit: ""
245
- }), M(!1), B();
279
+ L(F), M(!1), V();
246
280
  }
247
- }, Y = async () => {
248
- K(null);
281
+ }, X = async () => {
282
+ q(null);
249
283
  try {
250
- await i(U({ variables: { id: k } }));
284
+ await i(W({ variables: { id: k } }));
251
285
  } catch (e) {
252
- K(e instanceof Error ? e.message : "The objective could not be deleted.");
286
+ q(e instanceof Error ? e.message : "The objective could not be deleted.");
253
287
  return;
254
288
  }
255
289
  h("/goals/goals-page");
@@ -257,10 +291,10 @@ function F() {
257
291
  return /* @__PURE__ */ y("div", {
258
292
  className: "space-y-6 p-6",
259
293
  children: [
260
- G && /* @__PURE__ */ v("p", {
294
+ K && /* @__PURE__ */ v("p", {
261
295
  role: "alert",
262
296
  className: "text-sm text-destructive",
263
- children: G
297
+ children: K
264
298
  }),
265
299
  /* @__PURE__ */ y("div", {
266
300
  className: "flex items-center justify-between",
@@ -276,24 +310,24 @@ function F() {
276
310
  /* @__PURE__ */ v(d, { className: "h-6 w-6 text-primary" }),
277
311
  /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("h1", {
278
312
  className: "text-2xl font-semibold",
279
- children: q.title
313
+ children: J.title
280
314
  }), /* @__PURE__ */ v("p", {
281
315
  className: "text-sm text-muted-foreground",
282
- children: q.periodLabel
316
+ children: J.periodLabel
283
317
  })] })
284
318
  ]
285
319
  }), /* @__PURE__ */ y("div", {
286
320
  className: "flex items-start gap-2",
287
- children: [/* @__PURE__ */ v(s, { objective: q }), /* @__PURE__ */ v(a, {
321
+ children: [/* @__PURE__ */ v(s, { objective: J }), /* @__PURE__ */ v(a, {
288
322
  label: "Delete",
289
323
  variant: "outline",
290
324
  icon: /* @__PURE__ */ v(p, { className: "mr-1 h-4 w-4" }),
291
- title: `Delete "${q.title}"?`,
325
+ title: `Delete "${J.title}"?`,
292
326
  description: "The objective and its key results are deleted. This cannot be undone here.",
293
327
  confirmLabel: "Delete objective",
294
328
  destructive: !0,
295
- disabled: W,
296
- onConfirm: () => void Y()
329
+ disabled: G,
330
+ onConfirm: () => void X()
297
331
  })]
298
332
  })]
299
333
  }),
@@ -305,14 +339,14 @@ function F() {
305
339
  className: "flex flex-row items-center justify-between space-y-0",
306
340
  children: [/* @__PURE__ */ v(T, { children: "Overview" }), /* @__PURE__ */ y(b, {
307
341
  variant: "outline",
308
- children: [Math.round(q.progress), "% complete"]
342
+ children: [Math.round(J.progress), "% complete"]
309
343
  })]
310
344
  }), /* @__PURE__ */ y(C, {
311
345
  className: "space-y-4",
312
346
  children: [/* @__PURE__ */ v("p", {
313
347
  className: "text-sm",
314
- children: q.description ?? "No description provided."
315
- }), /* @__PURE__ */ v(N, { progress: q.progress })]
348
+ children: J.description ?? "No description provided."
349
+ }), /* @__PURE__ */ v(N, { progress: J.progress })]
316
350
  })] }), /* @__PURE__ */ y(S, { children: [/* @__PURE__ */ y(w, {
317
351
  className: "flex flex-row items-center justify-between space-y-0",
318
352
  children: [/* @__PURE__ */ v(T, { children: "Key Results" }), !A && /* @__PURE__ */ y(x, {
@@ -329,9 +363,9 @@ function F() {
329
363
  children: [
330
364
  /* @__PURE__ */ v(E, {
331
365
  placeholder: "Key result title, e.g. Sign 10 new enterprise customers",
332
- value: F.title,
333
- onChange: (e) => I({
334
- ...F,
366
+ value: I.title,
367
+ onChange: (e) => L({
368
+ ...I,
335
369
  title: e.target.value
336
370
  })
337
371
  }),
@@ -340,9 +374,9 @@ function F() {
340
374
  children: [
341
375
  /* @__PURE__ */ y("select", {
342
376
  className: "rounded-md border border-input bg-background px-3 py-2 text-sm",
343
- value: F.metricType,
344
- onChange: (e) => I({
345
- ...F,
377
+ value: I.metricType,
378
+ onChange: (e) => L({
379
+ ...I,
346
380
  metricType: e.target.value
347
381
  }),
348
382
  children: [
@@ -360,56 +394,71 @@ function F() {
360
394
  })
361
395
  ]
362
396
  }),
363
- F.metricType !== "BOOLEAN" && /* @__PURE__ */ v(E, {
397
+ I.metricType !== "BOOLEAN" && /* @__PURE__ */ v(E, {
364
398
  type: "number",
365
399
  placeholder: "Target value",
366
- value: F.targetValue,
367
- onChange: (e) => I({
368
- ...F,
400
+ value: I.targetValue,
401
+ onChange: (e) => L({
402
+ ...I,
369
403
  targetValue: e.target.value
370
404
  })
371
405
  }),
372
- F.metricType === "NUMERIC" && /* @__PURE__ */ v(E, {
406
+ I.metricType === "NUMERIC" && /* @__PURE__ */ v(E, {
373
407
  placeholder: "Unit (optional)",
374
- value: F.unit,
375
- onChange: (e) => I({
376
- ...F,
408
+ value: I.unit,
409
+ onChange: (e) => L({
410
+ ...I,
377
411
  unit: e.target.value
378
412
  })
379
413
  })
380
414
  ]
381
415
  }),
416
+ /* @__PURE__ */ y("label", {
417
+ className: "flex flex-col gap-1 text-xs text-muted-foreground",
418
+ children: ["Progress", /* @__PURE__ */ y("select", {
419
+ "aria-label": "How progress is measured",
420
+ "data-testid": "kr-new-progress-source",
421
+ className: "rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground",
422
+ value: I.progressSource,
423
+ onChange: (e) => L({
424
+ ...I,
425
+ progressSource: e.target.value
426
+ }),
427
+ children: [/* @__PURE__ */ v("option", {
428
+ value: "MANUAL",
429
+ children: "Entered by hand"
430
+ }), /* @__PURE__ */ v("option", {
431
+ value: "LINKED_WORK_ITEMS",
432
+ children: "Measured from linked work items (share of them done)"
433
+ })]
434
+ })]
435
+ }),
382
436
  /* @__PURE__ */ y("div", {
383
437
  className: "flex gap-2 justify-end",
384
438
  children: [/* @__PURE__ */ v(x, {
385
439
  size: "sm",
386
440
  variant: "ghost",
387
441
  onClick: () => {
388
- M(!1), I({
389
- title: "",
390
- metricType: "NUMERIC",
391
- targetValue: "100",
392
- unit: ""
393
- });
442
+ M(!1), L(F);
394
443
  },
395
444
  children: "Cancel"
396
445
  }), /* @__PURE__ */ v(x, {
397
446
  size: "sm",
398
- disabled: H || !F.title.trim(),
399
- onClick: J,
400
- children: H ? "Adding..." : "Add Key Result"
447
+ disabled: U || !I.title.trim(),
448
+ onClick: Y,
449
+ children: U ? "Adding..." : "Add Key Result"
401
450
  })]
402
451
  })
403
452
  ]
404
453
  }),
405
- q.keyResults.length === 0 && !A && /* @__PURE__ */ v("p", {
454
+ J.keyResults.length === 0 && !A && /* @__PURE__ */ v("p", {
406
455
  className: "text-sm text-muted-foreground",
407
456
  children: "No key results yet. Add one to make this objective measurable."
408
457
  }),
409
- q.keyResults.map((e) => /* @__PURE__ */ v(P, {
458
+ J.keyResults.map((e) => /* @__PURE__ */ v(P, {
410
459
  kr: e,
411
- onUpdated: () => void B(),
412
- onDeleted: () => void B()
460
+ onUpdated: () => void V(),
461
+ onDeleted: () => void V()
413
462
  }, e.id))
414
463
  ]
415
464
  })] })]
@@ -426,7 +475,7 @@ function F() {
426
475
  }),
427
476
  /* @__PURE__ */ v("span", {
428
477
  className: "font-medium",
429
- children: /* @__PURE__ */ v(n, { id: q.ownerId })
478
+ children: /* @__PURE__ */ v(n, { id: J.ownerId })
430
479
  })
431
480
  ]
432
481
  }),
@@ -440,11 +489,11 @@ function F() {
440
489
  }),
441
490
  /* @__PURE__ */ v("span", {
442
491
  className: "font-medium",
443
- children: q.periodLabel
492
+ children: J.periodLabel
444
493
  })
445
494
  ]
446
495
  }),
447
- q.endDate && /* @__PURE__ */ y("div", {
496
+ J.endDate && /* @__PURE__ */ y("div", {
448
497
  className: "flex items-center gap-2",
449
498
  children: [
450
499
  /* @__PURE__ */ v(u, { className: "h-4 w-4 text-muted-foreground" }),
@@ -454,7 +503,7 @@ function F() {
454
503
  }),
455
504
  /* @__PURE__ */ v("span", {
456
505
  className: "font-medium",
457
- children: new Date(q.endDate).toLocaleDateString()
506
+ children: new Date(J.endDate).toLocaleDateString()
458
507
  })
459
508
  ]
460
509
  }),
@@ -468,7 +517,7 @@ function F() {
468
517
  }),
469
518
  /* @__PURE__ */ v("span", {
470
519
  className: "font-medium",
471
- children: q.createdAt ? new Date(q.createdAt).toLocaleDateString() : "—"
520
+ children: J.createdAt ? new Date(J.createdAt).toLocaleDateString() : "—"
472
521
  })
473
522
  ]
474
523
  })
@@ -1 +1 @@
1
- {"version":3,"file":"GoalsObjectiveDetailPagePage.js","names":[],"sources":["../../../src/planmagnet/pages/GoalsObjectiveDetailPagePage.tsx"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\nimport { useState } from 'react';\nimport { throwOnError, LEAVES_PAGE_CONTEXT } from '../utils/mutationResult';\nimport { gql } from '@apollo/client';\nimport { useMutation, useQuery } from '@apollo/client/react';\nimport {\n Card,\n CardContent,\n CardHeader,\n CardTitle,\n Button,\n Input,\n Badge,\n} from '@burdenoff/fe-libs/ui';\nimport { Flag, Calendar, User, Plus, Trash2, ArrowLeft } from 'lucide-react';\nimport { usePlanMagnet, usePlanMagnetNavigate } from '../providers/PlanMagnetProvider';\nimport { PersonName } from '../people/People';\nimport { ConfirmButton } from '../controls/ConfirmButton';\nimport { KeyResultWorkItems, ObjectiveHeaderControls } from '../controls/ObjectiveControls';\n\n// BOFF-4441: OKR detail — real Objective + KeyResult data via GraphQL.\n// `progress` (on both the objective and each key result) is computed live\n// server-side from current/target values; this page only ever reads it,\n// never derives it client-side. `linkedWorkItemRollup` surfaces a real,\n// live-computed completion ratio over WorkItems linked to a key result --\n// informational only, it does not drive `currentValue` (see the backend\n// module header for the explicit deferral of that automation).\nconst GET_OBJECTIVE = gql`\n query GetObjectiveDetail($id: ID!) {\n planmagnetObjective(id: $id) {\n id\n workspaceId\n title\n description\n ownerId\n periodLabel\n startDate\n endDate\n status\n progress\n createdAt\n keyResults {\n id\n title\n description\n metricType\n startValue\n targetValue\n currentValue\n unit\n status\n ownerId\n progress\n linkedWorkItemRollup {\n totalLinked\n doneCount\n completionRatio\n }\n linkedWorkItems {\n id\n key\n title\n status\n }\n }\n }\n }\n`;\n\nconst CREATE_KEY_RESULT = gql`\n mutation CreateKeyResult($input: PlanmagnetCreateKeyResultInput!) {\n planmagnetCreateKeyResult(input: $input) {\n id\n }\n }\n`;\n\nconst UPDATE_KEY_RESULT = gql`\n mutation UpdateKeyResult($id: ID!, $input: PlanmagnetUpdateKeyResultInput!) {\n planmagnetUpdateKeyResult(id: $id, input: $input) {\n id\n currentValue\n status\n }\n }\n`;\n\nconst DELETE_KEY_RESULT = gql`\n mutation DeleteKeyResult($id: ID!) {\n planmagnetDeleteKeyResult(id: $id)\n }\n`;\n\nconst DELETE_OBJECTIVE = gql`\n mutation DeleteObjective($id: ID!) {\n planmagnetDeleteObjective(id: $id)\n }\n`;\n\nconst krStatusColor: Record<string, string> = {\n NOT_STARTED: 'bg-gray-100 text-gray-800',\n IN_PROGRESS: 'bg-blue-100 text-blue-800',\n AT_RISK: 'bg-orange-100 text-orange-800',\n COMPLETED: 'bg-green-100 text-green-800',\n};\n\nfunction ProgressBar({ progress }: { progress: number }) {\n const pct = Math.max(0, Math.min(100, Math.round(progress)));\n return (\n <div className=\"h-2 w-full rounded-full bg-muted overflow-hidden\">\n <div className=\"h-full rounded-full bg-primary transition-all\" style={{ width: `${pct}%` }} />\n </div>\n );\n}\n\ninterface KeyResultNode {\n id: string;\n title: string;\n description: string | null;\n metricType: 'NUMERIC' | 'PERCENTAGE' | 'BOOLEAN';\n startValue: number;\n targetValue: number;\n currentValue: number;\n unit: string | null;\n status: string;\n ownerId: string | null;\n progress: number;\n linkedWorkItemRollup: { totalLinked: number; doneCount: number; completionRatio: number };\n linkedWorkItems: { id: string; key: string; title: string; status: string }[];\n}\n\nfunction KeyResultRow({\n kr,\n onUpdated,\n onDeleted,\n}: {\n kr: KeyResultNode;\n onUpdated: () => void;\n onDeleted: () => void;\n}) {\n const [draftValue, setDraftValue] = useState(String(kr.currentValue));\n const [updateKeyResult, { loading: updating }] = useMutation(UPDATE_KEY_RESULT);\n const [deleteKeyResult, { loading: deleting }] = useMutation(DELETE_KEY_RESULT);\n // fe-libs sets mutate errorPolicy 'all': a refused mutation RESOLVES with\n // { error }. These handlers used to carry on as if it had worked.\n const [actionError, setActionError] = useState<string | null>(null);\n\n const handleSaveProgress = async () => {\n const parsed = kr.metricType === 'BOOLEAN' ? (draftValue === '1' ? 1 : 0) : Number(draftValue);\n if (Number.isNaN(parsed)) return;\n setActionError(null);\n try {\n await throwOnError(\n updateKeyResult({ variables: { id: kr.id, input: { currentValue: parsed } } })\n );\n onUpdated();\n } catch (e) {\n setActionError(e instanceof Error ? e.message : 'The progress could not be saved.');\n }\n };\n\n const handleDelete = async () => {\n setActionError(null);\n try {\n await throwOnError(deleteKeyResult({ variables: { id: kr.id } }));\n onDeleted();\n } catch (e) {\n setActionError(e instanceof Error ? e.message : 'The key result could not be deleted.');\n }\n };\n\n return (\n <div className=\"rounded-md border border-input p-4 space-y-3\">\n {actionError && (\n <p role=\"alert\" className=\"text-sm text-destructive\">\n {actionError}\n </p>\n )}\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"min-w-0\">\n <p className=\"text-sm font-medium\">{kr.title}</p>\n {kr.description && (\n <p className=\"text-xs text-muted-foreground mt-0.5\">{kr.description}</p>\n )}\n </div>\n <div className=\"flex items-center gap-2 shrink-0\">\n <span\n className={`text-xs px-2 py-0.5 rounded-full capitalize ${krStatusColor[kr.status] ?? ''}`}\n >\n {kr.status.toLowerCase().replace('_', ' ')}\n </span>\n {/* Deleting used to happen on the first click, with no confirmation. */}\n <ConfirmButton\n label=\"\"\n ariaLabel={`Delete ${kr.title}`}\n variant=\"outline\"\n icon={<Trash2 className=\"h-4 w-4\" />}\n title={`Delete \"${kr.title}\"?`}\n description=\"The key result and its progress are deleted. This cannot be undone here.\"\n confirmLabel=\"Delete key result\"\n destructive\n disabled={deleting}\n onConfirm={() => void handleDelete()}\n />\n </div>\n </div>\n <ProgressBar progress={kr.progress} />\n <div className=\"flex items-center justify-between text-xs text-muted-foreground\">\n <span>\n {kr.metricType === 'BOOLEAN'\n ? kr.currentValue > 0\n ? 'Done'\n : 'Not done'\n : `${kr.currentValue}${kr.unit ? ` ${kr.unit}` : ''} of ${kr.targetValue}${kr.unit ? ` ${kr.unit}` : ''}`}\n </span>\n <span>{Math.round(kr.progress)}%</span>\n </div>\n {kr.linkedWorkItemRollup.totalLinked > 0 && (\n <p className=\"text-xs text-muted-foreground\">\n {kr.linkedWorkItemRollup.doneCount}/{kr.linkedWorkItemRollup.totalLinked} linked work\n items done ({Math.round(kr.linkedWorkItemRollup.completionRatio * 100)}%) &mdash;\n informational, update progress above manually\n </p>\n )}\n {/* BOFF-7956: a key result could not be linked to work items, so the rollup above never appeared. */}\n <KeyResultWorkItems\n keyResultId={kr.id}\n keyResultTitle={kr.title}\n linked={kr.linkedWorkItems ?? []}\n />\n <div className=\"flex items-center gap-2\">\n {kr.metricType === 'BOOLEAN' ? (\n <select\n className=\"rounded-md border border-input bg-background px-3 py-1.5 text-sm\"\n value={draftValue}\n onChange={(e) => setDraftValue(e.target.value)}\n >\n <option value=\"0\">Not done</option>\n <option value=\"1\">Done</option>\n </select>\n ) : (\n <Input\n type=\"number\"\n value={draftValue}\n onChange={(e) => setDraftValue(e.target.value)}\n className=\"w-32\"\n />\n )}\n <Button size=\"sm\" variant=\"outline\" disabled={updating} onClick={handleSaveProgress}>\n {updating ? 'Saving...' : 'Update progress'}\n </Button>\n </div>\n </div>\n );\n}\n\nexport function GoalsObjectiveDetailPagePage() {\n const { workspaceId } = usePlanMagnet();\n const navigate = usePlanMagnetNavigate();\n const objectiveId = new URLSearchParams(window.location.search).get('objectiveId') ?? '';\n\n const [isAddingKr, setIsAddingKr] = useState(false);\n const [krForm, setKrForm] = useState({\n title: '',\n metricType: 'NUMERIC',\n targetValue: '100',\n unit: '',\n });\n\n const { data, loading, error, refetch } = useQuery<{\n planmagnetObjective: {\n id: string;\n title: string;\n description: string | null;\n ownerId: string;\n periodLabel: string;\n startDate: string | null;\n endDate: string | null;\n status: string;\n progress: number;\n createdAt: string;\n keyResults: KeyResultNode[];\n } | null;\n }>(GET_OBJECTIVE, {\n variables: { id: objectiveId },\n skip: !workspaceId || !objectiveId,\n });\n\n const [createKeyResult, { loading: creatingKr }] = useMutation(CREATE_KEY_RESULT);\n const [deleteObjective, { loading: deletingObjective }] = useMutation(DELETE_OBJECTIVE, {\n context: LEAVES_PAGE_CONTEXT,\n });\n const [actionError, setActionError] = useState<string | null>(null);\n\n // Only before the first load: a refetch must not blank the page (it\n\n // unmounts every component on it and loses their state).\n\n if (loading && !data) {\n return (\n <div className=\"flex items-center justify-center p-12\">\n <div className=\"animate-spin h-8 w-8 border-2 border-primary border-t-transparent rounded-full\" />\n </div>\n );\n }\n if (error) return <div className=\"p-6 text-red-500\">Error: {error.message}</div>;\n\n const objective = data?.planmagnetObjective;\n if (!objective) return <div className=\"p-6 text-muted-foreground\">Objective not found.</div>;\n\n const handleAddKeyResult = async () => {\n if (!krForm.title.trim() || !objectiveId) return;\n const target = Number(krForm.metricType === 'BOOLEAN' ? 1 : krForm.targetValue);\n if (Number.isNaN(target)) return;\n setActionError(null);\n try {\n await throwOnError(\n createKeyResult({\n variables: {\n input: {\n objectiveId,\n title: krForm.title.trim(),\n metricType: krForm.metricType,\n targetValue: target,\n unit: krForm.unit.trim() || undefined,\n },\n },\n })\n );\n } catch (e) {\n setActionError(e instanceof Error ? e.message : 'The key result could not be added.');\n return;\n }\n setKrForm({ title: '', metricType: 'NUMERIC', targetValue: '100', unit: '' });\n setIsAddingKr(false);\n void refetch();\n };\n\n const handleDeleteObjective = async () => {\n setActionError(null);\n try {\n await throwOnError(deleteObjective({ variables: { id: objectiveId } }));\n } catch (e) {\n setActionError(e instanceof Error ? e.message : 'The objective could not be deleted.');\n return;\n }\n navigate('/goals/goals-page');\n };\n\n return (\n <div className=\"space-y-6 p-6\">\n {actionError && (\n <p role=\"alert\" className=\"text-sm text-destructive\">\n {actionError}\n </p>\n )}\n <div className=\"flex items-center justify-between\">\n <div className=\"flex items-center gap-3\">\n <Button variant=\"ghost\" size=\"icon\" onClick={() => navigate('/goals/goals-page')}>\n <ArrowLeft className=\"h-4 w-4\" />\n </Button>\n <Flag className=\"h-6 w-6 text-primary\" />\n <div>\n <h1 className=\"text-2xl font-semibold\">{objective.title}</h1>\n <p className=\"text-sm text-muted-foreground\">{objective.periodLabel}</p>\n </div>\n </div>\n <div className=\"flex items-start gap-2\">\n {/* Status and Edit (BOFF-7956): an objective stayed ACTIVE forever. Delete now asks first. */}\n <ObjectiveHeaderControls objective={objective} />\n <ConfirmButton\n label=\"Delete\"\n variant=\"outline\"\n icon={<Trash2 className=\"mr-1 h-4 w-4\" />}\n title={`Delete \"${objective.title}\"?`}\n description=\"The objective and its key results are deleted. This cannot be undone here.\"\n confirmLabel=\"Delete objective\"\n destructive\n disabled={deletingObjective}\n onConfirm={() => void handleDeleteObjective()}\n />\n </div>\n </div>\n\n <div className=\"grid grid-cols-1 lg:grid-cols-3 gap-6\">\n <div className=\"lg:col-span-2 space-y-6\">\n <Card>\n <CardHeader className=\"flex flex-row items-center justify-between space-y-0\">\n <CardTitle>Overview</CardTitle>\n <Badge variant=\"outline\">{Math.round(objective.progress)}% complete</Badge>\n </CardHeader>\n <CardContent className=\"space-y-4\">\n <p className=\"text-sm\">{objective.description ?? 'No description provided.'}</p>\n <ProgressBar progress={objective.progress} />\n </CardContent>\n </Card>\n\n <Card>\n <CardHeader className=\"flex flex-row items-center justify-between space-y-0\">\n <CardTitle>Key Results</CardTitle>\n {!isAddingKr && (\n <Button size=\"sm\" variant=\"outline\" onClick={() => setIsAddingKr(true)}>\n <Plus className=\"mr-1 h-4 w-4\" />\n Add Key Result\n </Button>\n )}\n </CardHeader>\n <CardContent className=\"space-y-4\">\n {isAddingKr && (\n <div className=\"space-y-3 rounded-md border border-input p-3\">\n <Input\n placeholder=\"Key result title, e.g. Sign 10 new enterprise customers\"\n value={krForm.title}\n onChange={(e) => setKrForm({ ...krForm, title: e.target.value })}\n />\n <div className=\"grid grid-cols-3 gap-3\">\n <select\n className=\"rounded-md border border-input bg-background px-3 py-2 text-sm\"\n value={krForm.metricType}\n onChange={(e) => setKrForm({ ...krForm, metricType: e.target.value })}\n >\n <option value=\"NUMERIC\">Numeric</option>\n <option value=\"PERCENTAGE\">Percentage</option>\n <option value=\"BOOLEAN\">Yes / No</option>\n </select>\n {krForm.metricType !== 'BOOLEAN' && (\n <Input\n type=\"number\"\n placeholder=\"Target value\"\n value={krForm.targetValue}\n onChange={(e) => setKrForm({ ...krForm, targetValue: e.target.value })}\n />\n )}\n {krForm.metricType === 'NUMERIC' && (\n <Input\n placeholder=\"Unit (optional)\"\n value={krForm.unit}\n onChange={(e) => setKrForm({ ...krForm, unit: e.target.value })}\n />\n )}\n </div>\n <div className=\"flex gap-2 justify-end\">\n <Button\n size=\"sm\"\n variant=\"ghost\"\n onClick={() => {\n setIsAddingKr(false);\n setKrForm({\n title: '',\n metricType: 'NUMERIC',\n targetValue: '100',\n unit: '',\n });\n }}\n >\n Cancel\n </Button>\n <Button\n size=\"sm\"\n disabled={creatingKr || !krForm.title.trim()}\n onClick={handleAddKeyResult}\n >\n {creatingKr ? 'Adding...' : 'Add Key Result'}\n </Button>\n </div>\n </div>\n )}\n {objective.keyResults.length === 0 && !isAddingKr && (\n <p className=\"text-sm text-muted-foreground\">\n No key results yet. Add one to make this objective measurable.\n </p>\n )}\n {objective.keyResults.map((kr) => (\n <KeyResultRow\n key={kr.id}\n kr={kr}\n onUpdated={() => void refetch()}\n onDeleted={() => void refetch()}\n />\n ))}\n </CardContent>\n </Card>\n </div>\n\n <Card>\n <CardHeader>\n <CardTitle>Details</CardTitle>\n </CardHeader>\n <CardContent className=\"space-y-3 text-sm\">\n <div className=\"flex items-center gap-2\">\n <User className=\"h-4 w-4 text-muted-foreground\" />\n <span className=\"text-muted-foreground\">Owner:</span>\n <span className=\"font-medium\">\n <PersonName id={objective.ownerId} />\n </span>\n </div>\n <div className=\"flex items-center gap-2\">\n <Calendar className=\"h-4 w-4 text-muted-foreground\" />\n <span className=\"text-muted-foreground\">Period:</span>\n <span className=\"font-medium\">{objective.periodLabel}</span>\n </div>\n {objective.endDate && (\n <div className=\"flex items-center gap-2\">\n <Calendar className=\"h-4 w-4 text-muted-foreground\" />\n <span className=\"text-muted-foreground\">Target end:</span>\n <span className=\"font-medium\">\n {new Date(objective.endDate).toLocaleDateString()}\n </span>\n </div>\n )}\n <div className=\"flex items-center gap-2\">\n <Calendar className=\"h-4 w-4 text-muted-foreground\" />\n <span className=\"text-muted-foreground\">Created:</span>\n <span className=\"font-medium\">\n {objective.createdAt ? new Date(objective.createdAt).toLocaleDateString() : '—'}\n </span>\n </div>\n </CardContent>\n </Card>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;AA4BA,IAAM,IAAgB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CnB,IAAoB,CAAG;;;;;;GAQvB,IAAoB,CAAG;;;;;;;;GAUvB,IAAoB,CAAG;;;;GAMvB,IAAmB,CAAG;;;;GAMtB,IAAwC;CAC5C,aAAa;CACb,aAAa;CACb,SAAS;CACT,WAAW;CACZ;AAED,SAAS,EAAY,EAAE,eAAkC;AAEvD,QACE,kBAAC,OAAD;EAAK,WAAU;YACb,kBAAC,OAAD;GAAK,WAAU;GAAgD,OAAO,EAAE,OAAO,GAHvE,KAAK,I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B,CAAA,EACb,kBAAC,GAAD;KAAa,WAAU;eAAvB;MACE,kBAAC,OAAD;OAAK,WAAU;iBAAf;QACE,kBAAC,GAAD,EAAM,WAAU,iCAAkC,CAAA;QAClD,kBAAC,QAAD;SAAM,WAAU;mBAAwB;SAAa,CAAA;QACrD,kBAAC,QAAD;SAAM,WAAU;mBACd,kBAAC,GAAD,EAAY,IAAI,EAAU,SAAW,CAAA;SAChC,CAAA;QACH;;MACN,kBAAC,OAAD;OAAK,WAAU;iBAAf;QACE,kBAAC,GAAD,EAAU,WAAU,iCAAkC,CAAA;QACtD,kBAAC,QAAD;SAAM,WAAU;mBAAwB;SAAc,CAAA;QACtD,kBAAC,QAAD;SAAM,WAAU;mBAAe,EAAU;SAAmB,CAAA;QACxD;;MACL,EAAU,WACT,kBAAC,OAAD;OAAK,WAAU;iBAAf;QACE,kBAAC,GAAD,EAAU,WAAU,iCAAkC,CAAA;QACtD,kBAAC,QAAD;SAAM,WAAU;mBAAwB;SAAkB,CAAA;QAC1D,kBAAC,QAAD;SAAM,WAAU;mBACb,IAAI,KAAK,EAAU,QAAQ,CAAC,oBAAoB;SAC5C,CAAA;QACH;;MAER,kBAAC,OAAD;OAAK,WAAU;iBAAf;QACE,kBAAC,GAAD,EAAU,WAAU,iCAAkC,CAAA;QACtD,kBAAC,QAAD;SAAM,WAAU;mBAAwB;SAAe,CAAA;QACvD,kBAAC,QAAD;SAAM,WAAU;mBACb,EAAU,YAAY,IAAI,KAAK,EAAU,UAAU,CAAC,oBAAoB,GAAG;SACvE,CAAA;QACH;;MACM;OACT,EAAA,CAAA,CACH;;GACF"}
1
+ {"version":3,"file":"GoalsObjectiveDetailPagePage.js","names":[],"sources":["../../../src/planmagnet/pages/GoalsObjectiveDetailPagePage.tsx"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\nimport { useState } from 'react';\nimport { throwOnError, LEAVES_PAGE_CONTEXT } from '../utils/mutationResult';\nimport { gql } from '@apollo/client';\nimport { useMutation, useQuery } from '@apollo/client/react';\nimport {\n Card,\n CardContent,\n CardHeader,\n CardTitle,\n Button,\n Input,\n Badge,\n} from '@burdenoff/fe-libs/ui';\nimport { Flag, Calendar, User, Plus, Trash2, ArrowLeft } from 'lucide-react';\nimport { usePlanMagnet, usePlanMagnetNavigate } from '../providers/PlanMagnetProvider';\nimport { PersonName } from '../people/People';\nimport { ConfirmButton } from '../controls/ConfirmButton';\nimport { KeyResultWorkItems, ObjectiveHeaderControls } from '../controls/ObjectiveControls';\n\n// BOFF-4441: OKR detail — real Objective + KeyResult data via GraphQL.\n// `progress` (on both the objective and each key result) is computed live\n// server-side from current/target values; this page only ever reads it,\n// never derives it client-side. GAP-04: a key result's value is either\n// entered (MANUAL) or measured from its linked work items\n// (LINKED_WORK_ITEMS) — then the SERVER computes currentValue from\n// `linkedWorkItemRollup` and refuses a typed value, so this page shows no\n// value editor for it.\nconst GET_OBJECTIVE = gql`\n query GetObjectiveDetail($id: ID!) {\n planmagnetObjective(id: $id) {\n id\n workspaceId\n title\n description\n ownerId\n periodLabel\n startDate\n endDate\n status\n progress\n createdAt\n keyResults {\n id\n title\n description\n metricType\n startValue\n targetValue\n currentValue\n progressSource\n unit\n status\n ownerId\n progress\n linkedWorkItemRollup {\n totalLinked\n doneCount\n cancelledCount\n completionRatio\n }\n linkedWorkItems {\n id\n key\n title\n status\n }\n }\n }\n }\n`;\n\nconst CREATE_KEY_RESULT = gql`\n mutation CreateKeyResult($input: PlanmagnetCreateKeyResultInput!) {\n planmagnetCreateKeyResult(input: $input) {\n id\n }\n }\n`;\n\nconst UPDATE_KEY_RESULT = gql`\n mutation UpdateKeyResult($id: ID!, $input: PlanmagnetUpdateKeyResultInput!) {\n planmagnetUpdateKeyResult(id: $id, input: $input) {\n id\n currentValue\n progressSource\n progress\n status\n }\n }\n`;\n\nconst DELETE_KEY_RESULT = gql`\n mutation DeleteKeyResult($id: ID!) {\n planmagnetDeleteKeyResult(id: $id)\n }\n`;\n\nconst DELETE_OBJECTIVE = gql`\n mutation DeleteObjective($id: ID!) {\n planmagnetDeleteObjective(id: $id)\n }\n`;\n\nconst krStatusColor: Record<string, string> = {\n NOT_STARTED: 'bg-gray-100 text-gray-800',\n IN_PROGRESS: 'bg-blue-100 text-blue-800',\n AT_RISK: 'bg-orange-100 text-orange-800',\n COMPLETED: 'bg-green-100 text-green-800',\n};\n\nfunction ProgressBar({ progress }: { progress: number }) {\n const pct = Math.max(0, Math.min(100, Math.round(progress)));\n return (\n <div className=\"h-2 w-full rounded-full bg-muted overflow-hidden\">\n <div className=\"h-full rounded-full bg-primary transition-all\" style={{ width: `${pct}%` }} />\n </div>\n );\n}\n\ninterface KeyResultNode {\n id: string;\n title: string;\n description: string | null;\n metricType: 'NUMERIC' | 'PERCENTAGE' | 'BOOLEAN';\n startValue: number;\n targetValue: number;\n currentValue: number;\n progressSource: 'MANUAL' | 'LINKED_WORK_ITEMS';\n unit: string | null;\n status: string;\n ownerId: string | null;\n progress: number;\n linkedWorkItemRollup: {\n totalLinked: number;\n doneCount: number;\n cancelledCount: number;\n completionRatio: number;\n };\n linkedWorkItems: { id: string; key: string; title: string; status: string }[];\n}\n\nfunction KeyResultRow({\n kr,\n onUpdated,\n onDeleted,\n}: {\n kr: KeyResultNode;\n onUpdated: () => void;\n onDeleted: () => void;\n}) {\n const [draftValue, setDraftValue] = useState(String(kr.currentValue));\n const [updateKeyResult, { loading: updating }] = useMutation(UPDATE_KEY_RESULT);\n const [deleteKeyResult, { loading: deleting }] = useMutation(DELETE_KEY_RESULT);\n // fe-libs sets mutate errorPolicy 'all': a refused mutation RESOLVES with\n // { error }. These handlers used to carry on as if it had worked.\n const [actionError, setActionError] = useState<string | null>(null);\n\n const handleSaveProgress = async () => {\n const parsed = kr.metricType === 'BOOLEAN' ? (draftValue === '1' ? 1 : 0) : Number(draftValue);\n if (Number.isNaN(parsed)) return;\n setActionError(null);\n try {\n await throwOnError(\n updateKeyResult({ variables: { id: kr.id, input: { currentValue: parsed } } })\n );\n onUpdated();\n } catch (e) {\n setActionError(e instanceof Error ? e.message : 'The progress could not be saved.');\n }\n };\n\n // GAP-04: switch between an entered value and one measured from the linked work. Switching back to MANUAL keeps\n // the last measured value (the server snapshots it), so progress does not jump.\n const linked = kr.progressSource === 'LINKED_WORK_ITEMS';\n const handleSwitchSource = async () => {\n setActionError(null);\n try {\n const result = await throwOnError(\n updateKeyResult({\n variables: {\n id: kr.id,\n input: { progressSource: linked ? 'MANUAL' : 'LINKED_WORK_ITEMS' },\n },\n })\n );\n const next = result?.data?.planmagnetUpdateKeyResult;\n if (next) setDraftValue(String(next.currentValue));\n onUpdated();\n } catch (e) {\n setActionError(e instanceof Error ? e.message : 'The progress source could not be changed.');\n }\n };\n\n const rollup = kr.linkedWorkItemRollup;\n const counted = rollup.totalLinked - rollup.cancelledCount;\n\n const handleDelete = async () => {\n setActionError(null);\n try {\n await throwOnError(deleteKeyResult({ variables: { id: kr.id } }));\n onDeleted();\n } catch (e) {\n setActionError(e instanceof Error ? e.message : 'The key result could not be deleted.');\n }\n };\n\n return (\n <div className=\"rounded-md border border-input p-4 space-y-3\">\n {actionError && (\n <p role=\"alert\" className=\"text-sm text-destructive\">\n {actionError}\n </p>\n )}\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"min-w-0\">\n <p className=\"text-sm font-medium\">{kr.title}</p>\n {kr.description && (\n <p className=\"text-xs text-muted-foreground mt-0.5\">{kr.description}</p>\n )}\n </div>\n <div className=\"flex items-center gap-2 shrink-0\">\n <span\n className={`text-xs px-2 py-0.5 rounded-full capitalize ${krStatusColor[kr.status] ?? ''}`}\n >\n {kr.status.toLowerCase().replace('_', ' ')}\n </span>\n {/* Deleting used to happen on the first click, with no confirmation. */}\n <ConfirmButton\n label=\"\"\n ariaLabel={`Delete ${kr.title}`}\n variant=\"outline\"\n icon={<Trash2 className=\"h-4 w-4\" />}\n title={`Delete \"${kr.title}\"?`}\n description=\"The key result and its progress are deleted. This cannot be undone here.\"\n confirmLabel=\"Delete key result\"\n destructive\n disabled={deleting}\n onConfirm={() => void handleDelete()}\n />\n </div>\n </div>\n <ProgressBar progress={kr.progress} />\n <div className=\"flex items-center justify-between text-xs text-muted-foreground\">\n <span>\n {kr.metricType === 'BOOLEAN'\n ? kr.currentValue > 0\n ? 'Done'\n : 'Not done'\n : `${kr.currentValue}${kr.unit ? ` ${kr.unit}` : ''} of ${kr.targetValue}${kr.unit ? ` ${kr.unit}` : ''}`}\n </span>\n <span>{Math.round(kr.progress)}%</span>\n </div>\n {linked ? (\n <p className=\"text-xs text-muted-foreground\" data-testid=\"kr-measured-from-work\">\n Measured from linked work:{' '}\n {counted > 0\n ? `${rollup.doneCount} of ${counted} done (${Math.round(rollup.completionRatio * 100)}%)`\n : 'no linked work items to count yet'}\n {rollup.cancelledCount > 0 ? ` · ${rollup.cancelledCount} cancelled, not counted` : ''}\n </p>\n ) : (\n rollup.totalLinked > 0 && (\n <p className=\"text-xs text-muted-foreground\">\n Linked work:{' '}\n {counted > 0\n ? `${rollup.doneCount} of ${counted} done (${Math.round(rollup.completionRatio * 100)}%)`\n : 'nothing left to count'}\n {rollup.cancelledCount > 0 ? ` · ${rollup.cancelledCount} cancelled, not counted` : ''}{' '}\n &mdash; not used for progress while it is entered by hand\n </p>\n )\n )}\n {/* BOFF-7956: a key result could not be linked to work items, so the rollup above never appeared. */}\n <KeyResultWorkItems\n keyResultId={kr.id}\n keyResultTitle={kr.title}\n linked={kr.linkedWorkItems ?? []}\n />\n <div className=\"flex flex-wrap items-center gap-2\">\n {!linked &&\n (kr.metricType === 'BOOLEAN' ? (\n <select\n aria-label={`Progress of ${kr.title}`}\n className=\"rounded-md border border-input bg-background px-3 py-1.5 text-sm\"\n value={draftValue}\n onChange={(e) => setDraftValue(e.target.value)}\n >\n <option value=\"0\">Not done</option>\n <option value=\"1\">Done</option>\n </select>\n ) : (\n <Input\n type=\"number\"\n aria-label={`Current value of ${kr.title}`}\n value={draftValue}\n onChange={(e) => setDraftValue(e.target.value)}\n className=\"w-32\"\n />\n ))}\n {!linked && (\n <Button size=\"sm\" variant=\"outline\" disabled={updating} onClick={handleSaveProgress}>\n {updating ? 'Saving...' : 'Update progress'}\n </Button>\n )}\n <Button\n size=\"sm\"\n variant=\"ghost\"\n disabled={updating}\n onClick={() => void handleSwitchSource()}\n data-testid=\"kr-switch-source\"\n >\n {linked ? 'Enter progress by hand' : 'Measure from linked work'}\n </Button>\n </div>\n </div>\n );\n}\n\nexport function GoalsObjectiveDetailPagePage() {\n const { workspaceId } = usePlanMagnet();\n const navigate = usePlanMagnetNavigate();\n const objectiveId = new URLSearchParams(window.location.search).get('objectiveId') ?? '';\n\n const [isAddingKr, setIsAddingKr] = useState(false);\n const EMPTY_KR_FORM = {\n title: '',\n metricType: 'NUMERIC',\n targetValue: '100',\n unit: '',\n progressSource: 'MANUAL',\n };\n const [krForm, setKrForm] = useState(EMPTY_KR_FORM);\n\n const { data, loading, error, refetch } = useQuery<{\n planmagnetObjective: {\n id: string;\n title: string;\n description: string | null;\n ownerId: string;\n periodLabel: string;\n startDate: string | null;\n endDate: string | null;\n status: string;\n progress: number;\n createdAt: string;\n keyResults: KeyResultNode[];\n } | null;\n }>(GET_OBJECTIVE, {\n variables: { id: objectiveId },\n skip: !workspaceId || !objectiveId,\n });\n\n const [createKeyResult, { loading: creatingKr }] = useMutation(CREATE_KEY_RESULT);\n const [deleteObjective, { loading: deletingObjective }] = useMutation(DELETE_OBJECTIVE, {\n context: LEAVES_PAGE_CONTEXT,\n });\n const [actionError, setActionError] = useState<string | null>(null);\n\n // Only before the first load: a refetch must not blank the page (it\n\n // unmounts every component on it and loses their state).\n\n if (loading && !data) {\n return (\n <div className=\"flex items-center justify-center p-12\">\n <div className=\"animate-spin h-8 w-8 border-2 border-primary border-t-transparent rounded-full\" />\n </div>\n );\n }\n if (error) return <div className=\"p-6 text-red-500\">Error: {error.message}</div>;\n\n const objective = data?.planmagnetObjective;\n if (!objective) return <div className=\"p-6 text-muted-foreground\">Objective not found.</div>;\n\n const handleAddKeyResult = async () => {\n if (!krForm.title.trim() || !objectiveId) return;\n const target = Number(krForm.metricType === 'BOOLEAN' ? 1 : krForm.targetValue);\n if (Number.isNaN(target)) return;\n setActionError(null);\n try {\n await throwOnError(\n createKeyResult({\n variables: {\n input: {\n objectiveId,\n title: krForm.title.trim(),\n metricType: krForm.metricType,\n targetValue: target,\n unit: krForm.unit.trim() || undefined,\n progressSource: krForm.progressSource,\n },\n },\n })\n );\n } catch (e) {\n setActionError(e instanceof Error ? e.message : 'The key result could not be added.');\n return;\n }\n setKrForm(EMPTY_KR_FORM);\n setIsAddingKr(false);\n void refetch();\n };\n\n const handleDeleteObjective = async () => {\n setActionError(null);\n try {\n await throwOnError(deleteObjective({ variables: { id: objectiveId } }));\n } catch (e) {\n setActionError(e instanceof Error ? e.message : 'The objective could not be deleted.');\n return;\n }\n navigate('/goals/goals-page');\n };\n\n return (\n <div className=\"space-y-6 p-6\">\n {actionError && (\n <p role=\"alert\" className=\"text-sm text-destructive\">\n {actionError}\n </p>\n )}\n <div className=\"flex items-center justify-between\">\n <div className=\"flex items-center gap-3\">\n <Button variant=\"ghost\" size=\"icon\" onClick={() => navigate('/goals/goals-page')}>\n <ArrowLeft className=\"h-4 w-4\" />\n </Button>\n <Flag className=\"h-6 w-6 text-primary\" />\n <div>\n <h1 className=\"text-2xl font-semibold\">{objective.title}</h1>\n <p className=\"text-sm text-muted-foreground\">{objective.periodLabel}</p>\n </div>\n </div>\n <div className=\"flex items-start gap-2\">\n {/* Status and Edit (BOFF-7956): an objective stayed ACTIVE forever. Delete now asks first. */}\n <ObjectiveHeaderControls objective={objective} />\n <ConfirmButton\n label=\"Delete\"\n variant=\"outline\"\n icon={<Trash2 className=\"mr-1 h-4 w-4\" />}\n title={`Delete \"${objective.title}\"?`}\n description=\"The objective and its key results are deleted. This cannot be undone here.\"\n confirmLabel=\"Delete objective\"\n destructive\n disabled={deletingObjective}\n onConfirm={() => void handleDeleteObjective()}\n />\n </div>\n </div>\n\n <div className=\"grid grid-cols-1 lg:grid-cols-3 gap-6\">\n <div className=\"lg:col-span-2 space-y-6\">\n <Card>\n <CardHeader className=\"flex flex-row items-center justify-between space-y-0\">\n <CardTitle>Overview</CardTitle>\n <Badge variant=\"outline\">{Math.round(objective.progress)}% complete</Badge>\n </CardHeader>\n <CardContent className=\"space-y-4\">\n <p className=\"text-sm\">{objective.description ?? 'No description provided.'}</p>\n <ProgressBar progress={objective.progress} />\n </CardContent>\n </Card>\n\n <Card>\n <CardHeader className=\"flex flex-row items-center justify-between space-y-0\">\n <CardTitle>Key Results</CardTitle>\n {!isAddingKr && (\n <Button size=\"sm\" variant=\"outline\" onClick={() => setIsAddingKr(true)}>\n <Plus className=\"mr-1 h-4 w-4\" />\n Add Key Result\n </Button>\n )}\n </CardHeader>\n <CardContent className=\"space-y-4\">\n {isAddingKr && (\n <div className=\"space-y-3 rounded-md border border-input p-3\">\n <Input\n placeholder=\"Key result title, e.g. Sign 10 new enterprise customers\"\n value={krForm.title}\n onChange={(e) => setKrForm({ ...krForm, title: e.target.value })}\n />\n <div className=\"grid grid-cols-3 gap-3\">\n <select\n className=\"rounded-md border border-input bg-background px-3 py-2 text-sm\"\n value={krForm.metricType}\n onChange={(e) => setKrForm({ ...krForm, metricType: e.target.value })}\n >\n <option value=\"NUMERIC\">Numeric</option>\n <option value=\"PERCENTAGE\">Percentage</option>\n <option value=\"BOOLEAN\">Yes / No</option>\n </select>\n {krForm.metricType !== 'BOOLEAN' && (\n <Input\n type=\"number\"\n placeholder=\"Target value\"\n value={krForm.targetValue}\n onChange={(e) => setKrForm({ ...krForm, targetValue: e.target.value })}\n />\n )}\n {krForm.metricType === 'NUMERIC' && (\n <Input\n placeholder=\"Unit (optional)\"\n value={krForm.unit}\n onChange={(e) => setKrForm({ ...krForm, unit: e.target.value })}\n />\n )}\n </div>\n <label className=\"flex flex-col gap-1 text-xs text-muted-foreground\">\n Progress\n <select\n aria-label=\"How progress is measured\"\n data-testid=\"kr-new-progress-source\"\n className=\"rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground\"\n value={krForm.progressSource}\n onChange={(e) => setKrForm({ ...krForm, progressSource: e.target.value })}\n >\n <option value=\"MANUAL\">Entered by hand</option>\n <option value=\"LINKED_WORK_ITEMS\">\n Measured from linked work items (share of them done)\n </option>\n </select>\n </label>\n <div className=\"flex gap-2 justify-end\">\n <Button\n size=\"sm\"\n variant=\"ghost\"\n onClick={() => {\n setIsAddingKr(false);\n setKrForm(EMPTY_KR_FORM);\n }}\n >\n Cancel\n </Button>\n <Button\n size=\"sm\"\n disabled={creatingKr || !krForm.title.trim()}\n onClick={handleAddKeyResult}\n >\n {creatingKr ? 'Adding...' : 'Add Key Result'}\n </Button>\n </div>\n </div>\n )}\n {objective.keyResults.length === 0 && !isAddingKr && (\n <p className=\"text-sm text-muted-foreground\">\n No key results yet. Add one to make this objective measurable.\n </p>\n )}\n {objective.keyResults.map((kr) => (\n <KeyResultRow\n key={kr.id}\n kr={kr}\n onUpdated={() => void refetch()}\n onDeleted={() => void refetch()}\n />\n ))}\n </CardContent>\n </Card>\n </div>\n\n <Card>\n <CardHeader>\n <CardTitle>Details</CardTitle>\n </CardHeader>\n <CardContent className=\"space-y-3 text-sm\">\n <div className=\"flex items-center gap-2\">\n <User className=\"h-4 w-4 text-muted-foreground\" />\n <span className=\"text-muted-foreground\">Owner:</span>\n <span className=\"font-medium\">\n <PersonName id={objective.ownerId} />\n </span>\n </div>\n <div className=\"flex items-center gap-2\">\n <Calendar className=\"h-4 w-4 text-muted-foreground\" />\n <span className=\"text-muted-foreground\">Period:</span>\n <span className=\"font-medium\">{objective.periodLabel}</span>\n </div>\n {objective.endDate && (\n <div className=\"flex items-center gap-2\">\n <Calendar className=\"h-4 w-4 text-muted-foreground\" />\n <span className=\"text-muted-foreground\">Target end:</span>\n <span className=\"font-medium\">\n {new Date(objective.endDate).toLocaleDateString()}\n </span>\n </div>\n )}\n <div className=\"flex items-center gap-2\">\n <Calendar className=\"h-4 w-4 text-muted-foreground\" />\n <span className=\"text-muted-foreground\">Created:</span>\n <span className=\"font-medium\">\n {objective.createdAt ? new Date(objective.createdAt).toLocaleDateString() : '—'}\n </span>\n </div>\n </CardContent>\n </Card>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;AA6BA,IAAM,IAAgB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CnB,IAAoB,CAAG;;;;;;GAQvB,IAAoB,CAAG;;;;;;;;;;GAYvB,IAAoB,CAAG;;;;GAMvB,IAAmB,CAAG;;;;GAMtB,IAAwC;CAC5C,aAAa;CACb,aAAa;CACb,SAAS;CACT,WAAW;CACZ;AAED,SAAS,EAAY,EAAE,eAAkC;AAEvD,QACE,kBAAC,OAAD;EAAK,WAAU;YACb,kBAAC,OAAD;GAAK,WAAU;GAAgD,OAAO,EAAE,OAAO,GAHvE,KAAK,IAAI,GAAG,KAAK,IAAI,KAAK,KAAK,MAAM,EAAS,CAAC,CAAC,CAG8B,IAAI;GAAI,CAAA;EAC1F,CAAA;;AA0BV,SAAS,EAAa,EACpB,OACA,cACA,gBAKC;CACD,IAAM,CAAC,GAAY,KAAiB,EAAS,OAAO,EAAG,aAAa,CAAC,EAC/D,CAAC,GAAiB,EAAE,SAAS,OAAc,EAAY,EAAkB,EACzE,CAAC,GAAiB,EAAE,SAAS,OAAc,EAAY,EAAkB,EAGzE,CAAC,GAAa,KAAkB,EAAwB,KAAK,EAE7D,IAAqB,YAAY;EACrC,IAAM,IAAS,EAAG,eAAe,YAAa,QAAe,OAAe,OAAO,EAAW;AAC1F,cAAO,MAAM,EAAO,EACxB;KAAe,KAAK;AACpB,OAAI;AAIF,IAHA,MAAM,EACJ,EAAgB,EAAE,WAAW;KAAE,IAAI,EAAG;KAAI,OAAO,EAAE,cAAc,GAAQ;KAAE,EAAE,CAAC,CAC/E,EACD,GAAW;YACJ,GAAG;AACV,MAAe,aAAa,QAAQ,EAAE,UAA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K,WAAU;iBAAf;QACE,kBAAC,GAAD,EAAU,WAAU,iCAAkC,CAAA;QACtD,kBAAC,QAAD;SAAM,WAAU;mBAAwB;SAAe,CAAA;QACvD,kBAAC,QAAD;SAAM,WAAU;mBACb,EAAU,YAAY,IAAI,KAAK,EAAU,UAAU,CAAC,oBAAoB,GAAG;SACvE,CAAA;QACH;;MACM;OACT,EAAA,CAAA,CACH;;GACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-planmagnet",
3
- "version": "2026.930.5",
3
+ "version": "2026.930.6",
4
4
  "description": "Burdenoff PlanMagnet Microfrontend",
5
5
  "type": "module",
6
6
  "files": [