@burdenoff/microfe-timecampus 2026.1030.4 → 2026.1031.2

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/generated/wspace-operations.d.ts +611 -0
  2. package/dist/generated/wspace-operations.d.ts.map +1 -1
  3. package/dist/generated/wspace-operations.js +1502 -1191
  4. package/dist/generated/wspace-operations.js.map +1 -1
  5. package/dist/generated/wspace-types.d.ts +9 -3
  6. package/dist/generated/wspace-types.d.ts.map +1 -1
  7. package/dist/generated/wspace-types.js.map +1 -1
  8. package/dist/index.js +7 -7
  9. package/dist/timecampus/TimeCampusRoutes.d.ts.map +1 -1
  10. package/dist/timecampus/TimeCampusRoutes.js +38 -26
  11. package/dist/timecampus/TimeCampusRoutes.js.map +1 -1
  12. package/dist/timecampus/index.js +7 -7
  13. package/dist/timecampus/pages/extend/AppletStorePage.d.ts +2 -0
  14. package/dist/timecampus/pages/extend/AppletStorePage.d.ts.map +1 -0
  15. package/dist/timecampus/pages/extend/AppletStorePage.js +248 -0
  16. package/dist/timecampus/pages/extend/AppletStorePage.js.map +1 -0
  17. package/dist/timecampus/pages/extend/TemplateGalleryPage.d.ts +2 -0
  18. package/dist/timecampus/pages/extend/TemplateGalleryPage.d.ts.map +1 -0
  19. package/dist/timecampus/pages/extend/TemplateGalleryPage.js +339 -0
  20. package/dist/timecampus/pages/extend/TemplateGalleryPage.js.map +1 -0
  21. package/dist/timecampus/pages/extend/WidgetDashboardPage.d.ts +2 -0
  22. package/dist/timecampus/pages/extend/WidgetDashboardPage.d.ts.map +1 -0
  23. package/dist/timecampus/pages/extend/WidgetDashboardPage.js +434 -0
  24. package/dist/timecampus/pages/extend/WidgetDashboardPage.js.map +1 -0
  25. package/dist/timecampus/pages/extend/extendHelpers.d.ts +36 -0
  26. package/dist/timecampus/pages/extend/extendHelpers.d.ts.map +1 -0
  27. package/dist/timecampus/pages/extend/extendHelpers.js +105 -0
  28. package/dist/timecampus/pages/extend/extendHelpers.js.map +1 -0
  29. package/dist/timecampus/pages/extend/useOpenRoute.d.ts +7 -0
  30. package/dist/timecampus/pages/extend/useOpenRoute.d.ts.map +1 -0
  31. package/dist/timecampus/pages/extend/useOpenRoute.js +19 -0
  32. package/dist/timecampus/pages/extend/useOpenRoute.js.map +1 -0
  33. package/dist/timecampus/pages/timeline/TimelinePage.d.ts.map +1 -1
  34. package/dist/timecampus/pages/timeline/TimelinePage.js +336 -151
  35. package/dist/timecampus/pages/timeline/TimelinePage.js.map +1 -1
  36. package/dist/timecampus/pages/timeline/timelineSuggestions.d.ts +41 -0
  37. package/dist/timecampus/pages/timeline/timelineSuggestions.d.ts.map +1 -0
  38. package/dist/timecampus/pages/timeline/timelineSuggestions.js +33 -0
  39. package/dist/timecampus/pages/timeline/timelineSuggestions.js.map +1 -0
  40. package/package.json +1 -1
@@ -3,64 +3,66 @@ import { formatDuration as t, formatTime as n } from "../../utils/helpers.js";
3
3
  import { StatCard as r } from "../../components/StatCard.js";
4
4
  import { LoadingSkeleton as i } from "../../components/LoadingSkeleton.js";
5
5
  import { EmptyState as a } from "../../components/EmptyState.js";
6
- import { useGetTimeCampusTimelineQuery as o, useListProjectsQuery as s, useRecategorizeTimeCampusCaptureEventMutation as c } from "../../../generated/wspace-operations.js";
7
- import { PageLayout as l } from "../../components/PageLayout.js";
8
- import { calendarHoldLabel as u } from "../focus/focusHelpers.js";
9
- import { hasAiCategorizedSegment as d, segmentProvenance as f } from "./timelineProvenance.js";
10
- import { driftLabel as p, focusStatusLabel as m, plannedDrift as h, protectedPercent as g } from "./timelineFocus.js";
11
- import { useMemo as _, useState as v } from "react";
12
- import { Activity as y, Brain as b, Calendar as x, CalendarClock as S, Coffee as C, FolderOpen as w, Github as T, GripVertical as E, MessageSquare as D, Shield as O, Sparkles as k, Users as A, Zap as j } from "lucide-react";
6
+ import { useAcceptTimeCampusCaptureEventSuggestionMutation as o, useGetTimeCampusTimelineQuery as s, useListProjectsQuery as c, useRecategorizeTimeCampusCaptureEventMutation as l, useRejectTimeCampusCaptureEventSuggestionMutation as u, useSetTimeCampusCaptureEventProjectMutation as d, useSuggestTimeCampusCaptureEventProjectMutation as f } from "../../../generated/wspace-operations.js";
7
+ import { PageLayout as ee } from "../../components/PageLayout.js";
8
+ import { ToastContainer as te, useToast as p } from "../../components/Toast.js";
9
+ import { calendarHoldLabel as m } from "../focus/focusHelpers.js";
10
+ import { hasAiCategorizedSegment as h, segmentProvenance as g } from "./timelineProvenance.js";
11
+ import { driftLabel as _, focusStatusLabel as ne, plannedDrift as v, protectedPercent as re } from "./timelineFocus.js";
12
+ import { pendingSuggestion as ie, pendingSuggestions as ae } from "./timelineSuggestions.js";
13
+ import { useMemo as y, useState as b } from "react";
14
+ import { Activity as x, Brain as S, Calendar as oe, CalendarClock as C, Check as w, Coffee as T, FolderOpen as se, Github as ce, GripVertical as le, MessageSquare as E, Shield as D, Sparkles as O, Users as k, X as A, Zap as j } from "lucide-react";
13
15
  import { jsx as M, jsxs as N } from "react/jsx-runtime";
14
16
  import { GlassCard as P } from "@burdenoff/fe-libs/ui";
15
- import { DndContext as F, DragOverlay as I, KeyboardSensor as L, PointerSensor as R, useDraggable as z, useDroppable as B, useSensor as V, useSensors as H } from "@dnd-kit/core";
17
+ import { DndContext as ue, DragOverlay as de, KeyboardSensor as fe, PointerSensor as pe, useDraggable as F, useDroppable as I, useSensor as L, useSensors as me } from "@dnd-kit/core";
16
18
  //#region src/timecampus/pages/timeline/TimelinePage.tsx
17
- var U = {
19
+ var R = {
18
20
  DEEP_WORK: {
19
21
  label: "Deep work",
20
- icon: b,
22
+ icon: S,
21
23
  dot: "bg-status-success-bg",
22
24
  chip: "bg-status-success-bg text-status-success-text"
23
25
  },
24
26
  MEETING: {
25
27
  label: "Meeting",
26
- icon: A,
28
+ icon: k,
27
29
  dot: "bg-status-info-bg",
28
30
  chip: "bg-status-info-bg text-status-info-text"
29
31
  },
30
32
  COMMUNICATION: {
31
33
  label: "Communication",
32
- icon: D,
34
+ icon: E,
33
35
  dot: "bg-status-warning-bg",
34
36
  chip: "bg-status-warning-bg text-status-warning-text"
35
37
  },
36
38
  BREAK: {
37
39
  label: "Break",
38
- icon: C,
40
+ icon: T,
39
41
  dot: "bg-bg-sunken",
40
42
  chip: "bg-bg-sunken text-text-secondary"
41
43
  },
42
44
  OTHER: {
43
45
  label: "Other",
44
- icon: y,
46
+ icon: x,
45
47
  dot: "bg-bg-sunken",
46
48
  chip: "bg-bg-sunken text-text-secondary"
47
49
  }
48
- }, W = {
50
+ }, z = {
49
51
  TIME_ENTRY: j,
50
- MEETING: A,
51
- POMODORO: b,
52
- EMAIL: D,
53
- CAPTURE: T,
54
- FOCUS_SESSION: O,
55
- FOCUS_BLOCK: S
52
+ MEETING: k,
53
+ POMODORO: S,
54
+ EMAIL: E,
55
+ CAPTURE: ce,
56
+ FOCUS_SESSION: D,
57
+ FOCUS_BLOCK: C
56
58
  };
57
- function G(e) {
59
+ function he(e) {
58
60
  return e.source === "FOCUS_SESSION" || e.source === "FOCUS_BLOCK";
59
61
  }
60
- function K({ segment: e }) {
62
+ function ge({ segment: e }) {
61
63
  let r = e.focus;
62
64
  if (!r) return null;
63
- let i = e.isPlanned, a = i ? S : O, o = m(i, r, e.endTime), s = i ? null : g(r), c = i ? null : h(e.startTime, e.endTime, r), l = u(r.calendarHoldStatus);
65
+ let i = e.isPlanned, a = i ? C : D, o = ne(i, r, e.endTime), s = i ? null : re(r), c = i ? null : v(e.startTime, e.endTime, r), l = m(r.calendarHoldStatus);
64
66
  return /* @__PURE__ */ N("li", {
65
67
  className: `flex items-start gap-3 p-4 ${i ? "bg-bg-sunken/30" : ""}`,
66
68
  "data-testid": i ? "timeline-focus-block" : "timeline-focus-session",
@@ -119,8 +121,8 @@ function K({ segment: e }) {
119
121
  className: "text-xs text-text-tertiary",
120
122
  children: [
121
123
  "Started ",
122
- p(c.startMinutes),
123
- c.endMinutes !== null && `, ended ${p(c.endMinutes, "over", "short")}`
124
+ _(c.startMinutes),
125
+ c.endMinutes !== null && `, ended ${_(c.endMinutes, "over", "short")}`
124
126
  ]
125
127
  }),
126
128
  l && /* @__PURE__ */ M("span", {
@@ -169,15 +171,61 @@ function K({ segment: e }) {
169
171
  ]
170
172
  });
171
173
  }
172
- var q = [
174
+ var B = [
173
175
  "DEEP_WORK",
174
176
  "MEETING",
175
177
  "COMMUNICATION",
176
178
  "BREAK",
177
179
  "OTHER"
178
180
  ];
179
- function J({ category: e, label: n, dotClassName: r, totalSeconds: i }) {
180
- let { isOver: a, setNodeRef: o } = B({ id: `category:${e}` });
181
+ function V({ suggestion: e, busy: t, onAccept: n, onReject: r }) {
182
+ return /* @__PURE__ */ N("div", {
183
+ className: "mt-2 flex flex-wrap items-center gap-2 rounded-lg border border-dashed border-border-seam bg-bg-sunken/40 px-2.5 py-1.5",
184
+ "data-testid": "timeline-project-suggestion",
185
+ children: [
186
+ /* @__PURE__ */ M(O, {
187
+ className: "h-3.5 w-3.5 shrink-0 text-primary",
188
+ "aria-hidden": !0
189
+ }),
190
+ /* @__PURE__ */ N("span", {
191
+ className: "text-xs text-text-secondary",
192
+ children: [
193
+ "Suggested project",
194
+ " ",
195
+ /* @__PURE__ */ M("span", {
196
+ className: "font-medium text-text-primary",
197
+ children: e.projectName
198
+ }),
199
+ " ",
200
+ "· ",
201
+ e.confidencePercent,
202
+ "% · ",
203
+ e.reason
204
+ ]
205
+ }),
206
+ /* @__PURE__ */ N("span", {
207
+ className: "ml-auto flex items-center gap-1",
208
+ children: [/* @__PURE__ */ N("button", {
209
+ type: "button",
210
+ disabled: t,
211
+ onClick: () => n(e),
212
+ "aria-label": `Accept project ${e.projectName}`,
213
+ className: "inline-flex items-center gap-1 rounded-md bg-action-primary-bg px-2 py-0.5 text-xs font-medium text-action-primary-text hover:bg-action-primary-bg/90 disabled:opacity-50",
214
+ children: [/* @__PURE__ */ M(w, { className: "h-3 w-3" }), "Accept"]
215
+ }), /* @__PURE__ */ N("button", {
216
+ type: "button",
217
+ disabled: t,
218
+ onClick: () => r(e),
219
+ "aria-label": `Dismiss suggested project ${e.projectName}`,
220
+ className: "inline-flex items-center gap-1 rounded-md border border-border-seam bg-bg-surface px-2 py-0.5 text-xs font-medium text-text-secondary hover:bg-bg-sunken disabled:opacity-50",
221
+ children: [/* @__PURE__ */ M(A, { className: "h-3 w-3" }), "Dismiss"]
222
+ })]
223
+ })
224
+ ]
225
+ });
226
+ }
227
+ function _e({ category: e, label: n, dotClassName: r, totalSeconds: i }) {
228
+ let { isOver: a, setNodeRef: o } = I({ id: `category:${e}` });
181
229
  return /* @__PURE__ */ N("div", {
182
230
  ref: o,
183
231
  className: `flex items-center gap-2 rounded-lg border px-3 py-2 transition-colors ${a ? "border-action-primary-bg bg-action-primary-bg/10" : "border-border-seam bg-bg-surface"}`,
@@ -201,15 +249,15 @@ function J({ category: e, label: n, dotClassName: r, totalSeconds: i }) {
201
249
  ]
202
250
  });
203
251
  }
204
- function ee({ segment: e, category: r, projectName: i, recategorizing: a, onRecategorize: o }) {
205
- let s = U[r] ?? U.OTHER, c = W[e.source] ?? y, l = f(e), { attributes: u, listeners: d, setNodeRef: p, isDragging: m } = z({
252
+ function ve({ segment: e, category: r, projectName: i, suggestion: a, recategorizing: o, onRecategorize: s, projectActions: c }) {
253
+ let l = R[r] ?? R.OTHER, u = z[e.source] ?? x, d = g(e), f = e.source === "CAPTURE", ee = f && !e.projectId && !a && c.projects.length > 0, { attributes: te, listeners: p, setNodeRef: m, isDragging: h } = F({
206
254
  id: e.id,
207
255
  data: { segment: e },
208
256
  disabled: !e.isRecategorizable
209
257
  });
210
258
  return /* @__PURE__ */ N("li", {
211
- ref: p,
212
- className: `flex items-start gap-3 p-4 transition-colors hover:bg-bg-sunken/50 ${m ? "opacity-40" : ""}`,
259
+ ref: m,
260
+ className: `flex items-start gap-3 p-4 transition-colors hover:bg-bg-sunken/50 ${h ? "opacity-40" : ""}`,
213
261
  children: [
214
262
  /* @__PURE__ */ N("div", {
215
263
  className: "flex w-16 shrink-0 flex-col items-end pt-0.5 text-xs tabular-nums text-text-secondary",
@@ -220,131 +268,233 @@ function ee({ segment: e, category: r, projectName: i, recategorizing: a, onReca
220
268
  }),
221
269
  e.isRecategorizable && /* @__PURE__ */ M("button", {
222
270
  type: "button",
223
- "aria-label": `Drag to recategorize ${e.title || s.label}`,
271
+ "aria-label": `Drag to recategorize ${e.title || l.label}`,
224
272
  className: "mt-1.5 shrink-0 cursor-grab touch-none text-text-tertiary hover:text-text-secondary active:cursor-grabbing",
225
- ...u,
226
- ...d,
227
- children: /* @__PURE__ */ M(E, { className: "h-4 w-4" })
273
+ ...te,
274
+ ...p,
275
+ children: /* @__PURE__ */ M(le, { className: "h-4 w-4" })
228
276
  }),
229
277
  /* @__PURE__ */ M("div", {
230
- className: `mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg ${s.chip}`,
231
- children: /* @__PURE__ */ M(c, { className: "h-4 w-4" })
278
+ className: `mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg ${l.chip}`,
279
+ children: /* @__PURE__ */ M(u, { className: "h-4 w-4" })
232
280
  }),
233
281
  /* @__PURE__ */ N("div", {
234
282
  className: "min-w-0 flex-1",
235
- children: [/* @__PURE__ */ M("p", {
236
- className: "truncate text-sm font-medium text-text-primary",
237
- children: e.title || s.label
238
- }), /* @__PURE__ */ N("div", {
239
- className: "mt-1 flex flex-wrap items-center gap-2",
240
- children: [
241
- /* @__PURE__ */ M("span", {
242
- className: `inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${s.chip}`,
243
- children: s.label
244
- }),
245
- i !== void 0 && /* @__PURE__ */ N("span", {
246
- className: "inline-flex max-w-[12rem] items-center gap-1 rounded-full bg-bg-sunken px-2 py-0.5 text-xs font-medium text-text-secondary",
247
- children: [/* @__PURE__ */ M(w, { className: "h-3 w-3 shrink-0" }), /* @__PURE__ */ M("span", {
248
- className: "truncate",
249
- children: i
250
- })]
251
- }),
252
- e.app && /* @__PURE__ */ M("span", {
253
- className: "text-xs text-text-secondary",
254
- children: e.app
255
- }),
256
- l && (l.isAi ? /* @__PURE__ */ N("span", {
257
- className: "inline-flex items-center gap-1 rounded-full bg-bg-sunken px-2 py-0.5 text-xs font-medium text-text-secondary",
258
- title: l.detail,
259
- "data-testid": "timeline-ai-provenance",
260
- children: [
261
- /* @__PURE__ */ M(k, {
262
- className: "h-3 w-3 shrink-0",
263
- "aria-hidden": !0
264
- }),
265
- l.label,
266
- /* @__PURE__ */ N("span", {
267
- className: "sr-only",
268
- children: [". ", l.detail]
269
- })
270
- ]
271
- }) : /* @__PURE__ */ M("span", {
272
- className: "text-xs text-text-tertiary",
273
- title: l.detail,
274
- children: l.label
275
- }))
276
- ]
277
- })]
283
+ children: [
284
+ /* @__PURE__ */ M("p", {
285
+ className: "truncate text-sm font-medium text-text-primary",
286
+ children: e.title || l.label
287
+ }),
288
+ /* @__PURE__ */ N("div", {
289
+ className: "mt-1 flex flex-wrap items-center gap-2",
290
+ children: [
291
+ /* @__PURE__ */ M("span", {
292
+ className: `inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${l.chip}`,
293
+ children: l.label
294
+ }),
295
+ i !== void 0 && /* @__PURE__ */ N("span", {
296
+ className: "inline-flex max-w-[12rem] items-center gap-1 rounded-full bg-bg-sunken px-2 py-0.5 text-xs font-medium text-text-secondary",
297
+ children: [/* @__PURE__ */ M(se, { className: "h-3 w-3 shrink-0" }), /* @__PURE__ */ M("span", {
298
+ className: "truncate",
299
+ children: i
300
+ })]
301
+ }),
302
+ e.app && /* @__PURE__ */ M("span", {
303
+ className: "text-xs text-text-secondary",
304
+ children: e.app
305
+ }),
306
+ d && (d.isAi ? /* @__PURE__ */ N("span", {
307
+ className: "inline-flex items-center gap-1 rounded-full bg-bg-sunken px-2 py-0.5 text-xs font-medium text-text-secondary",
308
+ title: d.detail,
309
+ "data-testid": "timeline-ai-provenance",
310
+ children: [
311
+ /* @__PURE__ */ M(O, {
312
+ className: "h-3 w-3 shrink-0",
313
+ "aria-hidden": !0
314
+ }),
315
+ d.label,
316
+ /* @__PURE__ */ N("span", {
317
+ className: "sr-only",
318
+ children: [". ", d.detail]
319
+ })
320
+ ]
321
+ }) : /* @__PURE__ */ M("span", {
322
+ className: "text-xs text-text-tertiary",
323
+ title: d.detail,
324
+ children: d.label
325
+ }))
326
+ ]
327
+ }),
328
+ a && /* @__PURE__ */ M(V, {
329
+ suggestion: a,
330
+ busy: c.busy,
331
+ onAccept: c.onAccept,
332
+ onReject: c.onReject
333
+ })
334
+ ]
278
335
  }),
279
- e.isRecategorizable && /* @__PURE__ */ M("select", {
280
- "aria-label": "Recategorize activity",
281
- disabled: a,
282
- value: r,
283
- onChange: (t) => o(e, t.target.value),
284
- className: "shrink-0 rounded-md border border-border-seam bg-bg-surface px-2 py-1 text-xs text-text-secondary focus:outline-none focus:ring-2 focus:ring-action-primary-bg/40",
285
- children: q.map((e) => /* @__PURE__ */ M("option", {
286
- value: e,
287
- children: U[e].label
288
- }, e))
336
+ /* @__PURE__ */ N("div", {
337
+ className: "flex shrink-0 flex-col items-end gap-1.5",
338
+ children: [
339
+ e.isRecategorizable && /* @__PURE__ */ M("select", {
340
+ "aria-label": "Recategorize activity",
341
+ disabled: o,
342
+ value: r,
343
+ onChange: (t) => s(e, t.target.value),
344
+ className: "rounded-md border border-border-seam bg-bg-surface px-2 py-1 text-xs text-text-secondary focus:outline-none focus:ring-2 focus:ring-action-primary-bg/40",
345
+ children: B.map((e) => /* @__PURE__ */ M("option", {
346
+ value: e,
347
+ children: R[e].label
348
+ }, e))
349
+ }),
350
+ f && c.projects.length > 0 && /* @__PURE__ */ N("select", {
351
+ "aria-label": "Assign project",
352
+ disabled: c.busy,
353
+ value: e.projectId ?? "",
354
+ onChange: (t) => c.onSetProject(e, t.target.value || null),
355
+ className: "max-w-[10rem] rounded-md border border-border-seam bg-bg-surface px-2 py-1 text-xs text-text-secondary focus:outline-none focus:ring-2 focus:ring-action-primary-bg/40",
356
+ children: [/* @__PURE__ */ M("option", {
357
+ value: "",
358
+ children: "No project"
359
+ }), c.projects.map((e) => /* @__PURE__ */ M("option", {
360
+ value: e.id,
361
+ children: e.name
362
+ }, e.id))]
363
+ }),
364
+ ee && /* @__PURE__ */ N("button", {
365
+ type: "button",
366
+ disabled: c.busy,
367
+ onClick: () => c.onSuggest(e),
368
+ className: "inline-flex items-center gap-1 text-xs font-medium text-primary hover:underline disabled:opacity-50",
369
+ children: [/* @__PURE__ */ M(O, { className: "h-3 w-3" }), "Suggest project"]
370
+ })
371
+ ]
289
372
  })
290
373
  ]
291
374
  });
292
375
  }
293
- function Y(e) {
376
+ function H(e) {
377
+ return e instanceof Error ? e.message : "Something went wrong";
378
+ }
379
+ function U(e) {
294
380
  let t = e.getTimezoneOffset();
295
381
  return (/* @__PURE__ */ new Date(e.getTime() - t * 60 * 1e3)).toISOString().slice(0, 10);
296
382
  }
297
- var X = 14;
298
- function te() {
383
+ var ye = 14;
384
+ function be() {
299
385
  let e = /* @__PURE__ */ new Date();
300
- return e.setDate(e.getDate() + X), Y(e);
386
+ return e.setDate(e.getDate() + ye), U(e);
301
387
  }
302
- function ne(e) {
388
+ function xe(e) {
303
389
  let t = /* @__PURE__ */ new Date(`${e}T00:00:00`), n = /* @__PURE__ */ new Date(`${e}T23:59:59.999`);
304
390
  return {
305
391
  from: t.toISOString(),
306
392
  to: n.toISOString()
307
393
  };
308
394
  }
309
- function Z() {
310
- let { workspaceId: u = "" } = e(), [f, p] = v(() => Y(/* @__PURE__ */ new Date())), [m, h] = v(null), { from: g, to: S } = _(() => ne(f), [f]), { data: C, loading: w, error: T, refetch: D } = o({
395
+ function W() {
396
+ let { workspaceId: m = "" } = e(), { toasts: g, addToast: _, dismissToast: ne } = p(), [v, re] = b(() => U(/* @__PURE__ */ new Date())), [C, T] = b(null), { from: se, to: ce } = y(() => xe(v), [v]), { data: E, loading: D, error: k, refetch: A } = s({
311
397
  variables: {
312
- from: g,
313
- to: S
398
+ from: se,
399
+ to: ce
314
400
  },
315
- skip: !u,
401
+ skip: !m,
316
402
  fetchPolicy: "cache-and-network"
317
- }), { data: O } = s({
403
+ }), { data: F } = c({
318
404
  variables: { pagination: { limit: 200 } },
319
- skip: !u
320
- }), [A, { loading: z }] = c(), B = H(V(R, { activationConstraint: { distance: 6 } }), V(L)), W = C?.timeCampusTimeline, X = W?.segments ?? [], Z = W?.summary, re = _(() => {
405
+ skip: !m
406
+ }), [I, { loading: z }] = l(), [V, { loading: ye }] = o(), [W, { loading: Se }] = u(), [Ce, { loading: we }] = d(), [Te, { loading: Ee }] = f(), G = ye || Se || we || Ee, De = me(L(pe, { activationConstraint: { distance: 6 } }), L(fe)), K = E?.timeCampusTimeline, q = y(() => K?.segments ?? [], [K]), J = K?.summary, Y = y(() => {
321
407
  let e = /* @__PURE__ */ new Map();
322
- for (let t of O?.projects?.items ?? []) e.set(t.id, t.name);
408
+ for (let t of F?.projects?.items ?? []) e.set(t.id, t.name);
323
409
  return e;
324
- }, [O?.projects?.items]), ie = _(() => {
410
+ }, [F?.projects?.items]), Oe = y(() => Array.from(Y, ([e, t]) => ({
411
+ id: e,
412
+ name: t
413
+ })), [Y]), X = y(() => ae(q, Y), [q, Y]), ke = y(() => {
325
414
  let e = /* @__PURE__ */ new Map();
326
- for (let t of Z?.byCategory ?? []) e.set(t.category, {
415
+ for (let t of J?.byCategory ?? []) e.set(t.category, {
327
416
  totalSeconds: t.totalSeconds,
328
417
  segmentCount: t.segmentCount
329
418
  });
330
419
  return e;
331
- }, [Z]), Q = async (e, t) => {
332
- !e.isRecategorizable || e.category === t || (await A({ variables: {
420
+ }, [J]), Z = async (e, t) => {
421
+ !e.isRecategorizable || e.category === t || (await I({ variables: {
333
422
  id: e.sourceId,
334
423
  category: t
335
- } }), await D());
336
- }, ae = (e) => {
424
+ } }), await A());
425
+ }, Q = async (e, t) => {
426
+ try {
427
+ await e(), await A(), _({
428
+ title: t,
429
+ variant: "success"
430
+ });
431
+ } catch (e) {
432
+ _({
433
+ title: H(e),
434
+ variant: "error"
435
+ });
436
+ }
437
+ }, Ae = (e) => Q(() => V({ variables: { id: e.captureEventId } }), `Assigned to ${e.projectName}`), je = (e) => Q(() => W({ variables: { id: e.captureEventId } }), "Suggestion dismissed"), Me = (e, t) => {
438
+ if ((e.projectId ?? null) === t) return;
439
+ let n = t ? Y.get(t) : void 0;
440
+ return Q(() => Ce({ variables: {
441
+ id: e.sourceId,
442
+ projectId: t
443
+ } }), n ? `Assigned to ${n}` : "Project removed");
444
+ }, Ne = async (e) => {
445
+ try {
446
+ let t = (await Te({ variables: { id: e.sourceId } })).data?.suggestTimeCampusCaptureEventCategory;
447
+ await A(), _(t?.suggestedProjectId ? {
448
+ title: `Suggested ${t.suggestedProjectName ?? "a project"}`,
449
+ description: "Accept or dismiss it on the activity.",
450
+ variant: "info"
451
+ } : {
452
+ title: "No confident project match",
453
+ description: "Pick a project from the list instead.",
454
+ variant: "info"
455
+ });
456
+ } catch (e) {
457
+ _({
458
+ title: H(e),
459
+ variant: "error"
460
+ });
461
+ }
462
+ }, Pe = async () => {
463
+ let e = 0;
464
+ try {
465
+ for (let t of X) await V({ variables: { id: t.captureEventId } }), e++;
466
+ _({
467
+ title: `Accepted ${e} project ${e === 1 ? "suggestion" : "suggestions"}`,
468
+ variant: "success"
469
+ });
470
+ } catch (t) {
471
+ _({
472
+ title: `Accepted ${e} of ${X.length}`,
473
+ description: H(t),
474
+ variant: "error"
475
+ });
476
+ } finally {
477
+ await A();
478
+ }
479
+ }, Fe = {
480
+ projects: Oe,
481
+ busy: G,
482
+ onAccept: (e) => void Ae(e),
483
+ onReject: (e) => void je(e),
484
+ onSetProject: (e, t) => void Me(e, t),
485
+ onSuggest: (e) => void Ne(e)
486
+ }, Ie = (e) => {
337
487
  let t = e.active.data.current?.segment;
338
- h(t ?? null);
339
- }, oe = (e) => {
488
+ T(t ?? null);
489
+ }, Le = (e) => {
340
490
  let t = e.active.data.current?.segment;
341
- h(null);
491
+ T(null);
342
492
  let n = e.over?.id;
343
493
  if (!t || typeof n != "string") return;
344
494
  let r = n.replace(/^category:/, "");
345
- q.includes(r) && Q(t, r);
346
- }, se = Z && Z.focusRatio != null ? Math.round(Z.focusRatio * 100) : 0, $ = Z?.firstActivityAt && Z?.lastActivityAt ? `${n(Z.firstActivityAt)} – ${n(Z.lastActivityAt)}` : null;
347
- return /* @__PURE__ */ M(l, {
495
+ B.includes(r) && Z(t, r);
496
+ }, Re = J && J.focusRatio != null ? Math.round(J.focusRatio * 100) : 0, $ = J?.firstActivityAt && J?.lastActivityAt ? `${n(J.firstActivityAt)} – ${n(J.lastActivityAt)}` : null;
497
+ return /* @__PURE__ */ N(ee, {
348
498
  title: "Timeline",
349
499
  description: "Your day, assembled automatically",
350
500
  purpose: "See where your time actually went — meetings, deep work, communication and breaks stitched into one honest, chronological view from everything TimeCampus captures, so you can spot the patterns worth changing.",
@@ -352,19 +502,19 @@ function Z() {
352
502
  className: "flex flex-wrap items-center gap-3",
353
503
  children: [$ && /* @__PURE__ */ N("span", {
354
504
  className: "inline-flex items-center gap-1.5 rounded-full bg-bg-sunken px-2.5 py-1 text-xs font-medium tabular-nums text-text-secondary",
355
- children: [/* @__PURE__ */ M(y, { className: "h-3.5 w-3.5" }), $]
505
+ children: [/* @__PURE__ */ M(x, { className: "h-3.5 w-3.5" }), $]
356
506
  }), /* @__PURE__ */ N("label", {
357
507
  className: "flex items-center gap-2 text-sm text-text-secondary",
358
- children: [/* @__PURE__ */ M(x, { className: "h-4 w-4" }), /* @__PURE__ */ M("input", {
508
+ children: [/* @__PURE__ */ M(oe, { className: "h-4 w-4" }), /* @__PURE__ */ M("input", {
359
509
  type: "date",
360
- value: f,
361
- max: te(),
362
- onChange: (e) => p(e.target.value),
510
+ value: v,
511
+ max: be(),
512
+ onChange: (e) => re(e.target.value),
363
513
  className: "rounded-md border border-border-seam bg-bg-surface px-3 py-1.5 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-action-primary-bg/40"
364
514
  })]
365
515
  })]
366
516
  }),
367
- children: w && !W ? /* @__PURE__ */ N("div", {
517
+ children: [D && !K ? /* @__PURE__ */ N("div", {
368
518
  className: "space-y-6",
369
519
  children: [/* @__PURE__ */ M(i, {
370
520
  variant: "card",
@@ -373,13 +523,13 @@ function Z() {
373
523
  variant: "list",
374
524
  count: 6
375
525
  })]
376
- }) : T ? /* @__PURE__ */ M("div", {
526
+ }) : k ? /* @__PURE__ */ M("div", {
377
527
  className: "rounded-lg border border-status-error-bg/40 bg-status-error-bg p-4 text-sm text-status-error-text",
378
528
  children: "Failed to load your timeline. Please try again later."
379
- }) : /* @__PURE__ */ N(F, {
380
- sensors: B,
381
- onDragStart: ae,
382
- onDragEnd: oe,
529
+ }) : /* @__PURE__ */ N(ue, {
530
+ sensors: De,
531
+ onDragStart: Ie,
532
+ onDragEnd: Le,
383
533
  children: [/* @__PURE__ */ N("div", {
384
534
  className: "space-y-6",
385
535
  children: [
@@ -389,31 +539,31 @@ function Z() {
389
539
  /* @__PURE__ */ M(r, {
390
540
  featured: !0,
391
541
  title: "Tracked time",
392
- value: t(Z?.totalTrackedSeconds ?? 0),
393
- icon: /* @__PURE__ */ M(y, { className: "h-5 w-5" }),
542
+ value: t(J?.totalTrackedSeconds ?? 0),
543
+ icon: /* @__PURE__ */ M(x, { className: "h-5 w-5" }),
394
544
  description: "Total activity across the day"
395
545
  }),
396
546
  /* @__PURE__ */ M(r, {
397
547
  title: "Focus ratio",
398
- value: `${se}%`,
399
- icon: /* @__PURE__ */ M(b, { className: "h-5 w-5" }),
548
+ value: `${Re}%`,
549
+ icon: /* @__PURE__ */ M(S, { className: "h-5 w-5" }),
400
550
  description: "Share of time in deep work"
401
551
  }),
402
552
  /* @__PURE__ */ M(r, {
403
553
  title: "Context switches",
404
- value: Z?.contextSwitches ?? 0,
554
+ value: J?.contextSwitches ?? 0,
405
555
  icon: /* @__PURE__ */ M(j, { className: "h-5 w-5" }),
406
556
  description: "Category changes through the day"
407
557
  }),
408
558
  /* @__PURE__ */ M(r, {
409
559
  title: "Longest focus block",
410
- value: t(Z?.longestFocusBlockSeconds ?? 0),
411
- icon: /* @__PURE__ */ M(b, { className: "h-5 w-5" }),
560
+ value: t(J?.longestFocusBlockSeconds ?? 0),
561
+ icon: /* @__PURE__ */ M(S, { className: "h-5 w-5" }),
412
562
  description: "Your deepest uninterrupted stretch"
413
563
  })
414
564
  ]
415
565
  }),
416
- X.length > 0 && /* @__PURE__ */ N(P, {
566
+ q.length > 0 && /* @__PURE__ */ N(P, {
417
567
  treatment: "glass",
418
568
  className: "p-4 sm:p-6",
419
569
  children: [
@@ -425,10 +575,10 @@ function Z() {
425
575
  className: "mb-4 text-xs text-text-secondary",
426
576
  children: "Drag a segment from the timeline below onto a category to recategorize it — or use its dropdown."
427
577
  }),
428
- d(X) && /* @__PURE__ */ N("p", {
578
+ h(q) && /* @__PURE__ */ N("p", {
429
579
  className: "mb-4 flex items-start gap-1.5 text-xs text-text-secondary",
430
580
  "data-testid": "timeline-ai-disclaimer",
431
- children: [/* @__PURE__ */ M(k, {
581
+ children: [/* @__PURE__ */ M(O, {
432
582
  className: "mt-0.5 h-3 w-3 shrink-0",
433
583
  "aria-hidden": !0
434
584
  }), /* @__PURE__ */ N("span", { children: [
@@ -439,9 +589,9 @@ function Z() {
439
589
  }),
440
590
  /* @__PURE__ */ M("div", {
441
591
  className: "flex flex-wrap gap-4",
442
- children: q.map((e) => {
443
- let t = U[e], n = ie.get(e);
444
- return /* @__PURE__ */ M(J, {
592
+ children: B.map((e) => {
593
+ let t = R[e], n = ke.get(e);
594
+ return /* @__PURE__ */ M(_e, {
445
595
  category: e,
446
596
  label: t.label,
447
597
  dotClassName: t.dot,
@@ -451,7 +601,37 @@ function Z() {
451
601
  })
452
602
  ]
453
603
  }),
454
- X.length === 0 ? /* @__PURE__ */ M(a, {
604
+ X.length > 0 && /* @__PURE__ */ N("div", {
605
+ className: "flex flex-wrap items-center gap-3 rounded-lg border border-border-seam bg-bg-sunken/40 px-4 py-3",
606
+ "data-testid": "timeline-suggestions-banner",
607
+ children: [
608
+ /* @__PURE__ */ M(O, { className: "h-4 w-4 shrink-0 text-primary" }),
609
+ /* @__PURE__ */ N("p", {
610
+ className: "text-sm text-text-secondary",
611
+ children: [
612
+ /* @__PURE__ */ N("span", {
613
+ className: "font-medium text-text-primary",
614
+ children: [
615
+ X.length,
616
+ " project",
617
+ " ",
618
+ X.length === 1 ? "suggestion" : "suggestions"
619
+ ]
620
+ }),
621
+ " ",
622
+ "waiting for review. Nothing is assigned until you accept."
623
+ ]
624
+ }),
625
+ /* @__PURE__ */ N("button", {
626
+ type: "button",
627
+ disabled: G,
628
+ onClick: () => void Pe(),
629
+ className: "ml-auto inline-flex items-center gap-1 rounded-md bg-action-primary-bg px-3 py-1 text-xs font-medium text-action-primary-text hover:bg-action-primary-bg/90 disabled:opacity-50",
630
+ children: [/* @__PURE__ */ M(w, { className: "h-3.5 w-3.5" }), "Accept all"]
631
+ })
632
+ ]
633
+ }),
634
+ q.length === 0 ? /* @__PURE__ */ M(a, {
455
635
  illustration: "empty-generic",
456
636
  title: "No activity captured for this day",
457
637
  description: "As you track time, hold meetings, run focus sessions, and connect shared integrations, your day assembles here automatically — categorized and in order."
@@ -461,27 +641,32 @@ function Z() {
461
641
  className: "overflow-hidden",
462
642
  children: /* @__PURE__ */ M("ol", {
463
643
  className: "divide-y divide-border-seam",
464
- children: X.map((e) => G(e) ? /* @__PURE__ */ M(K, { segment: e }, e.id) : /* @__PURE__ */ M(ee, {
644
+ children: q.map((e) => he(e) ? /* @__PURE__ */ M(ge, { segment: e }, e.id) : /* @__PURE__ */ M(ve, {
465
645
  segment: e,
466
646
  category: e.category ?? "OTHER",
467
- projectName: e.projectId ? re.get(e.projectId) : void 0,
647
+ projectName: e.projectId ? Y.get(e.projectId) : void 0,
648
+ suggestion: ie(e, Y),
468
649
  recategorizing: z,
469
- onRecategorize: Q
650
+ onRecategorize: Z,
651
+ projectActions: Fe
470
652
  }, e.id))
471
653
  })
472
654
  })
473
655
  ]
474
- }), /* @__PURE__ */ M(I, { children: m && /* @__PURE__ */ N("div", {
656
+ }), /* @__PURE__ */ M(de, { children: C && /* @__PURE__ */ N("div", {
475
657
  className: "flex items-center gap-2 rounded-lg border border-border-seam bg-bg-surface px-3 py-2 shadow-pop",
476
- children: [/* @__PURE__ */ M(E, { className: "h-4 w-4 text-text-tertiary" }), /* @__PURE__ */ M("span", {
658
+ children: [/* @__PURE__ */ M(le, { className: "h-4 w-4 text-text-tertiary" }), /* @__PURE__ */ M("span", {
477
659
  className: "text-sm font-medium text-text-primary",
478
- children: m.title || U[m.category ?? "OTHER"].label
660
+ children: C.title || R[C.category ?? "OTHER"].label
479
661
  })]
480
662
  }) })]
481
- })
663
+ }), /* @__PURE__ */ M(te, {
664
+ toasts: g,
665
+ onDismiss: ne
666
+ })]
482
667
  });
483
668
  }
484
669
  //#endregion
485
- export { Z as TimelinePage };
670
+ export { W as TimelinePage };
486
671
 
487
672
  //# sourceMappingURL=TimelinePage.js.map