@burdenoff/microfe-timecampus 2026.1107.2 → 2026.1107.4

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.
@@ -3,106 +3,107 @@ 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 { 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 { useTimelineViewed as ee } from "../../analytics/useTimeCampusAnalytics.js";
6
+ import { useAcceptTimeCampusCaptureEventSuggestionMutation as o, useGetTimeCampusTimelineQuery as s, useListProjectsQuery as c, useMergeTimeCampusCaptureEventsMutation as l, useRecategorizeTimeCampusCaptureEventMutation as u, useRejectTimeCampusCaptureEventSuggestionMutation as d, useSetTimeCampusCaptureEventProjectMutation as f, useSplitTimeCampusCaptureEventMutation as p, useSuggestTimeCampusCaptureEventProjectMutation as ee } from "../../../generated/wspace-operations.js";
7
+ import { useTimelineViewed as m } from "../../analytics/useTimeCampusAnalytics.js";
8
8
  import "../../analytics/index.js";
9
- import { PageLayout as p } from "../../components/PageLayout.js";
10
- import { ToastContainer as m, useToast as h } from "../../components/Toast.js";
11
- import { calendarHoldLabel as g } from "../focus/focusHelpers.js";
12
- import { PhoneViewLink as te } from "../mobile/MobileScreen.js";
13
- import { parseTimelineDateParam as ne } from "../lifetime/recommendationEvidence.js";
9
+ import { PageLayout as te } from "../../components/PageLayout.js";
10
+ import { ToastContainer as h, useToast as g } from "../../components/Toast.js";
11
+ import { calendarHoldLabel as _ } from "../focus/focusHelpers.js";
12
+ import { PhoneViewLink as ne } from "../mobile/MobileScreen.js";
13
+ import { parseTimelineDateParam as v } from "../lifetime/recommendationEvidence.js";
14
14
  import { hasAiCategorizedSegment as re, segmentProvenance as ie } from "./timelineProvenance.js";
15
- import { driftLabel as _, focusStatusLabel as ae, plannedDrift as v, protectedPercent as y } from "./timelineFocus.js";
16
- import { pendingSuggestion as oe, pendingSuggestions as se } from "./timelineSuggestions.js";
17
- import { useMemo as b, useState as x } from "react";
18
- import { Activity as S, Brain as C, Calendar as ce, CalendarClock as w, Check as T, Coffee as E, FolderOpen as D, Github as le, GripVertical as ue, MessageSquare as O, Shield as k, Sparkles as A, Users as j, X as M, Zap as N } from "lucide-react";
19
- import { useSearchParams as de } from "react-router";
20
- import { jsx as P, jsxs as F } from "react/jsx-runtime";
21
- import { GlassCard as I } from "@burdenoff/fe-libs/ui";
22
- import { DndContext as fe, DragOverlay as pe, KeyboardSensor as me, PointerSensor as he, useDraggable as L, useDroppable as R, useSensor as z, useSensors as ge } from "@dnd-kit/core";
15
+ import { driftLabel as y, focusStatusLabel as ae, plannedDrift as oe, protectedPercent as b } from "./timelineFocus.js";
16
+ import { pendingSuggestion as se, pendingSuggestions as ce } from "./timelineSuggestions.js";
17
+ import { awaitsCategoryApproval as le, canSplit as x, categoriesAwaitingApproval as ue, categoryDropId as S, defaultSplitTime as de, mergeCandidate as fe, parseDropTarget as pe, projectDropId as me, resolveSplitTime as he } from "./timelineEditing.js";
18
+ import { useMemo as C, useState as w } from "react";
19
+ import { Activity as T, BadgeCheck as E, Brain as D, Calendar as ge, CalendarClock as O, Check as _e, Coffee as ve, FolderOpen as k, Github as A, GripVertical as ye, Merge as j, MessageSquare as M, Scissors as N, Shield as P, Sparkles as F, Users as I, X as be, Zap as xe } from "lucide-react";
20
+ import { useSearchParams as Se } from "react-router";
21
+ import { jsx as L, jsxs as R } from "react/jsx-runtime";
22
+ import { GlassCard as z } from "@burdenoff/fe-libs/ui";
23
+ import { DndContext as Ce, DragOverlay as we, KeyboardSensor as Te, PointerSensor as Ee, useDraggable as De, useDroppable as B, useSensor as Oe, useSensors as ke } from "@dnd-kit/core";
23
24
  //#region src/timecampus/pages/timeline/TimelinePage.tsx
24
- var B = {
25
+ var V = {
25
26
  DEEP_WORK: {
26
27
  label: "Deep work",
27
- icon: C,
28
+ icon: D,
28
29
  dot: "bg-status-success-bg",
29
30
  chip: "bg-status-success-bg text-status-success-text"
30
31
  },
31
32
  MEETING: {
32
33
  label: "Meeting",
33
- icon: j,
34
+ icon: I,
34
35
  dot: "bg-status-info-bg",
35
36
  chip: "bg-status-info-bg text-status-info-text"
36
37
  },
37
38
  COMMUNICATION: {
38
39
  label: "Communication",
39
- icon: O,
40
+ icon: M,
40
41
  dot: "bg-status-warning-bg",
41
42
  chip: "bg-status-warning-bg text-status-warning-text"
42
43
  },
43
44
  BREAK: {
44
45
  label: "Break",
45
- icon: E,
46
+ icon: ve,
46
47
  dot: "bg-bg-sunken",
47
48
  chip: "bg-bg-sunken text-text-secondary"
48
49
  },
49
50
  OTHER: {
50
51
  label: "Other",
51
- icon: S,
52
+ icon: T,
52
53
  dot: "bg-bg-sunken",
53
54
  chip: "bg-bg-sunken text-text-secondary"
54
55
  }
55
- }, V = {
56
- TIME_ENTRY: N,
57
- MEETING: j,
58
- POMODORO: C,
59
- EMAIL: O,
60
- CAPTURE: le,
61
- FOCUS_SESSION: k,
62
- FOCUS_BLOCK: w
56
+ }, Ae = {
57
+ TIME_ENTRY: xe,
58
+ MEETING: I,
59
+ POMODORO: D,
60
+ EMAIL: M,
61
+ CAPTURE: A,
62
+ FOCUS_SESSION: P,
63
+ FOCUS_BLOCK: O
63
64
  };
64
- function _e(e) {
65
+ function je(e) {
65
66
  return e.source === "FOCUS_SESSION" || e.source === "FOCUS_BLOCK";
66
67
  }
67
- function ve({ segment: e }) {
68
+ function Me({ segment: e }) {
68
69
  let r = e.focus;
69
70
  if (!r) return null;
70
- let i = e.isPlanned, a = i ? w : k, o = ae(i, r, e.endTime), s = i ? null : y(r), c = i ? null : v(e.startTime, e.endTime, r), l = g(r.calendarHoldStatus);
71
- return /* @__PURE__ */ F("li", {
71
+ let i = e.isPlanned, a = i ? O : P, o = ae(i, r, e.endTime), s = i ? null : b(r), c = i ? null : oe(e.startTime, e.endTime, r), l = _(r.calendarHoldStatus);
72
+ return /* @__PURE__ */ R("li", {
72
73
  className: `flex items-start gap-3 p-4 ${i ? "bg-bg-sunken/30" : ""}`,
73
74
  "data-testid": i ? "timeline-focus-block" : "timeline-focus-session",
74
75
  children: [
75
- /* @__PURE__ */ F("div", {
76
+ /* @__PURE__ */ R("div", {
76
77
  className: "flex w-16 shrink-0 flex-col items-end pt-0.5 text-xs tabular-nums text-text-secondary",
77
- children: [/* @__PURE__ */ P("span", { children: n(e.startTime) }), /* @__PURE__ */ P("span", {
78
+ children: [/* @__PURE__ */ L("span", { children: n(e.startTime) }), /* @__PURE__ */ L("span", {
78
79
  className: "text-text-tertiary",
79
80
  children: t(e.durationSeconds)
80
81
  })]
81
82
  }),
82
- /* @__PURE__ */ P("div", {
83
+ /* @__PURE__ */ L("div", {
83
84
  className: `mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg ${i ? "border border-dashed border-status-success-text/60 text-status-success-text" : "bg-status-success-bg text-status-success-text"}`,
84
- children: /* @__PURE__ */ P(a, { className: "h-4 w-4" })
85
+ children: /* @__PURE__ */ L(a, { className: "h-4 w-4" })
85
86
  }),
86
- /* @__PURE__ */ F("div", {
87
+ /* @__PURE__ */ R("div", {
87
88
  className: "min-w-0 flex-1",
88
89
  children: [
89
- /* @__PURE__ */ P("p", {
90
+ /* @__PURE__ */ L("p", {
90
91
  className: "truncate text-sm font-medium text-text-primary",
91
92
  children: e.title || (i ? "Planned focus block" : "Focus session")
92
93
  }),
93
- /* @__PURE__ */ F("div", {
94
+ /* @__PURE__ */ R("div", {
94
95
  className: "mt-1 flex flex-wrap items-center gap-2",
95
96
  children: [
96
- /* @__PURE__ */ P("span", {
97
+ /* @__PURE__ */ L("span", {
97
98
  className: `inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${i ? "border border-dashed border-border-seam text-text-secondary" : "bg-status-success-bg text-status-success-text"}`,
98
99
  "data-testid": "timeline-focus-status",
99
100
  children: o
100
101
  }),
101
- r.protectionLevel === "STRICT" && /* @__PURE__ */ P("span", {
102
+ r.protectionLevel === "STRICT" && /* @__PURE__ */ L("span", {
102
103
  className: "text-xs text-text-secondary",
103
104
  children: "Strict"
104
105
  }),
105
- r.plannedStartTime && r.plannedEndTime && /* @__PURE__ */ F("span", {
106
+ r.plannedStartTime && r.plannedEndTime && /* @__PURE__ */ R("span", {
106
107
  className: "text-xs tabular-nums text-text-secondary",
107
108
  children: [
108
109
  "Planned ",
@@ -112,7 +113,7 @@ function ve({ segment: e }) {
112
113
  n(r.plannedEndTime)
113
114
  ]
114
115
  }),
115
- !i && e.endTime && /* @__PURE__ */ F("span", {
116
+ !i && e.endTime && /* @__PURE__ */ R("span", {
116
117
  className: "text-xs tabular-nums text-text-secondary",
117
118
  children: [
118
119
  "Actual ",
@@ -122,35 +123,35 @@ function ve({ segment: e }) {
122
123
  n(e.endTime)
123
124
  ]
124
125
  }),
125
- c && /* @__PURE__ */ F("span", {
126
+ c && /* @__PURE__ */ R("span", {
126
127
  className: "text-xs text-text-tertiary",
127
128
  children: [
128
129
  "Started ",
129
- _(c.startMinutes),
130
- c.endMinutes !== null && `, ended ${_(c.endMinutes, "over", "short")}`
130
+ y(c.startMinutes),
131
+ c.endMinutes !== null && `, ended ${y(c.endMinutes, "over", "short")}`
131
132
  ]
132
133
  }),
133
- l && /* @__PURE__ */ P("span", {
134
+ l && /* @__PURE__ */ L("span", {
134
135
  className: "text-xs text-text-tertiary",
135
136
  children: l
136
137
  })
137
138
  ]
138
139
  }),
139
- !i && /* @__PURE__ */ F("div", {
140
+ !i && /* @__PURE__ */ R("div", {
140
141
  className: "mt-2",
141
142
  "data-testid": "timeline-focus-protection",
142
- children: [/* @__PURE__ */ F("div", {
143
+ children: [/* @__PURE__ */ R("div", {
143
144
  className: "flex h-1.5 w-full max-w-xs overflow-hidden rounded-full bg-bg-sunken",
144
145
  role: "img",
145
146
  "aria-label": `${s ?? 0}% of this session stayed protected`,
146
- children: [/* @__PURE__ */ P("span", {
147
+ children: [/* @__PURE__ */ L("span", {
147
148
  className: "h-full bg-status-success-text",
148
149
  style: { width: `${s ?? 0}%` }
149
- }), /* @__PURE__ */ P("span", {
150
+ }), /* @__PURE__ */ L("span", {
150
151
  className: "h-full bg-status-warning-text",
151
152
  style: { width: `${s === null ? 0 : 100 - s}%` }
152
153
  })]
153
- }), /* @__PURE__ */ F("p", {
154
+ }), /* @__PURE__ */ R("p", {
154
155
  className: "mt-1 text-xs tabular-nums text-text-secondary",
155
156
  children: [
156
157
  "Protected ",
@@ -167,7 +168,7 @@ function ve({ segment: e }) {
167
168
  ]
168
169
  })]
169
170
  }),
170
- i && /* @__PURE__ */ P("p", {
171
+ i && /* @__PURE__ */ L("p", {
171
172
  className: "mt-1 text-xs text-text-tertiary",
172
173
  children: "Not counted in the day's totals until you run it."
173
174
  })
@@ -183,21 +184,21 @@ var H = [
183
184
  "BREAK",
184
185
  "OTHER"
185
186
  ];
186
- function U({ suggestion: e, busy: t, onAccept: n, onReject: r }) {
187
- return /* @__PURE__ */ F("div", {
187
+ function Ne({ suggestion: e, busy: t, onAccept: n, onReject: r }) {
188
+ return /* @__PURE__ */ R("div", {
188
189
  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",
189
190
  "data-testid": "timeline-project-suggestion",
190
191
  children: [
191
- /* @__PURE__ */ P(A, {
192
+ /* @__PURE__ */ L(F, {
192
193
  className: "h-3.5 w-3.5 shrink-0 text-primary",
193
194
  "aria-hidden": !0
194
195
  }),
195
- /* @__PURE__ */ F("span", {
196
+ /* @__PURE__ */ R("span", {
196
197
  className: "text-xs text-text-secondary",
197
198
  children: [
198
199
  "Suggested project",
199
200
  " ",
200
- /* @__PURE__ */ P("span", {
201
+ /* @__PURE__ */ L("span", {
201
202
  className: "font-medium text-text-primary",
202
203
  children: e.projectName
203
204
  }),
@@ -208,170 +209,280 @@ function U({ suggestion: e, busy: t, onAccept: n, onReject: r }) {
208
209
  e.reason
209
210
  ]
210
211
  }),
211
- /* @__PURE__ */ F("span", {
212
+ /* @__PURE__ */ R("span", {
212
213
  className: "ml-auto flex items-center gap-1",
213
- children: [/* @__PURE__ */ F("button", {
214
+ children: [/* @__PURE__ */ R("button", {
214
215
  type: "button",
215
216
  disabled: t,
216
217
  onClick: () => n(e),
217
218
  "aria-label": `Accept project ${e.projectName}`,
218
219
  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",
219
- children: [/* @__PURE__ */ P(T, { className: "h-3 w-3" }), "Accept"]
220
- }), /* @__PURE__ */ F("button", {
220
+ children: [/* @__PURE__ */ L(_e, { className: "h-3 w-3" }), "Accept"]
221
+ }), /* @__PURE__ */ R("button", {
221
222
  type: "button",
222
223
  disabled: t,
223
224
  onClick: () => r(e),
224
225
  "aria-label": `Dismiss suggested project ${e.projectName}`,
225
226
  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",
226
- children: [/* @__PURE__ */ P(M, { className: "h-3 w-3" }), "Dismiss"]
227
+ children: [/* @__PURE__ */ L(be, { className: "h-3 w-3" }), "Dismiss"]
227
228
  })]
228
229
  })
229
230
  ]
230
231
  });
231
232
  }
232
- function ye({ category: e, label: n, dotClassName: r, totalSeconds: i }) {
233
- let { isOver: a, setNodeRef: o } = R({ id: `category:${e}` });
234
- return /* @__PURE__ */ F("div", {
233
+ function Pe({ category: e, label: n, dotClassName: r, totalSeconds: i }) {
234
+ let { isOver: a, setNodeRef: o } = B({ id: S(e) });
235
+ return /* @__PURE__ */ R("div", {
235
236
  ref: o,
236
237
  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"}`,
237
238
  children: [
238
- /* @__PURE__ */ P("span", {
239
+ /* @__PURE__ */ L("span", {
239
240
  className: `inline-block h-2.5 w-2.5 rounded-full ${r}`,
240
241
  "aria-hidden": !0
241
242
  }),
242
- /* @__PURE__ */ P("span", {
243
+ /* @__PURE__ */ L("span", {
243
244
  className: "text-sm font-medium text-text-primary",
244
245
  children: n
245
246
  }),
246
- /* @__PURE__ */ P("span", {
247
+ /* @__PURE__ */ L("span", {
247
248
  className: "text-sm tabular-nums text-text-secondary",
248
249
  children: t(i)
249
250
  }),
250
- a && /* @__PURE__ */ P("span", {
251
+ a && /* @__PURE__ */ L("span", {
251
252
  className: "text-xs font-medium text-primary",
252
253
  children: "Drop here"
253
254
  })
254
255
  ]
255
256
  });
256
257
  }
257
- function be({ segment: e, category: r, projectName: i, suggestion: a, recategorizing: o, onRecategorize: s, projectActions: c }) {
258
- let l = B[r] ?? B.OTHER, u = V[e.source] ?? S, d = ie(e), f = e.source === "CAPTURE", ee = f && !e.projectId && !a && c.projects.length > 0, { attributes: p, listeners: m, setNodeRef: h, isDragging: g } = L({
258
+ var Fe = 5;
259
+ function Ie({ projectId: e, label: t }) {
260
+ let { isOver: n, setNodeRef: r } = B({ id: me(e) });
261
+ return /* @__PURE__ */ R("div", {
262
+ ref: r,
263
+ "data-testid": "timeline-project-drop",
264
+ className: `flex max-w-[14rem] items-center gap-1.5 rounded-lg border px-3 py-2 transition-colors ${n ? "border-action-primary-bg bg-action-primary-bg/10" : e ? "border-border-seam bg-bg-surface" : "border-dashed border-border-seam bg-bg-surface"}`,
265
+ children: [
266
+ /* @__PURE__ */ L(k, { className: "h-3.5 w-3.5 shrink-0 text-text-tertiary" }),
267
+ /* @__PURE__ */ L("span", {
268
+ className: "truncate text-sm font-medium text-text-primary",
269
+ children: t
270
+ }),
271
+ n && /* @__PURE__ */ L("span", {
272
+ className: "shrink-0 text-xs font-medium text-primary",
273
+ children: "Drop here"
274
+ })
275
+ ]
276
+ });
277
+ }
278
+ function U({ segment: e, busy: t, onSplit: r, onCancel: i }) {
279
+ let [a, o] = w(() => de(e)), s = he(e, a);
280
+ return /* @__PURE__ */ R("form", {
281
+ className: "mt-2 flex flex-wrap items-center gap-2 rounded-lg border border-border-seam bg-bg-sunken/40 px-2.5 py-1.5",
282
+ "data-testid": "timeline-split-form",
283
+ onSubmit: (e) => {
284
+ e.preventDefault(), s.ok && r(s.at);
285
+ },
286
+ children: [
287
+ /* @__PURE__ */ L(N, {
288
+ className: "h-3.5 w-3.5 shrink-0 text-text-tertiary",
289
+ "aria-hidden": !0
290
+ }),
291
+ /* @__PURE__ */ R("label", {
292
+ className: "flex items-center gap-1.5 text-xs text-text-secondary",
293
+ children: ["Split at", /* @__PURE__ */ L("input", {
294
+ type: "time",
295
+ value: a,
296
+ onChange: (e) => o(e.target.value),
297
+ "aria-label": "Split time",
298
+ className: "rounded-md border border-border-seam bg-bg-surface px-2 py-0.5 text-xs text-text-primary focus:outline-none focus:ring-2 focus:ring-action-primary-bg/40"
299
+ })]
300
+ }),
301
+ /* @__PURE__ */ R("span", {
302
+ className: "text-xs text-text-tertiary",
303
+ children: [
304
+ n(e.startTime),
305
+ " –",
306
+ " ",
307
+ e.endTime ? n(e.endTime) : "now"
308
+ ]
309
+ }),
310
+ !s.ok && /* @__PURE__ */ L("span", {
311
+ className: "text-xs text-status-error-text",
312
+ role: "alert",
313
+ children: s.reason
314
+ }),
315
+ /* @__PURE__ */ R("span", {
316
+ className: "ml-auto flex items-center gap-1",
317
+ children: [/* @__PURE__ */ R("button", {
318
+ type: "submit",
319
+ disabled: t || !s.ok,
320
+ 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",
321
+ children: [/* @__PURE__ */ L(N, { className: "h-3 w-3" }), "Split"]
322
+ }), /* @__PURE__ */ L("button", {
323
+ type: "button",
324
+ onClick: i,
325
+ 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",
326
+ children: "Cancel"
327
+ })]
328
+ })
329
+ ]
330
+ });
331
+ }
332
+ function Le({ segment: e, category: r, projectName: i, suggestion: a, recategorizing: o, onRecategorize: s, projectActions: c, mergeTarget: l, editActions: u }) {
333
+ let [d, f] = w(!1), p = V[r] ?? V.OTHER, ee = le(e), m = x(e), te = Ae[e.source] ?? T, h = ie(e), g = e.source === "CAPTURE", _ = g && !e.projectId && !a && c.projects.length > 0, { attributes: ne, listeners: v, setNodeRef: re, isDragging: y } = De({
259
334
  id: e.id,
260
335
  data: { segment: e },
261
336
  disabled: !e.isRecategorizable
262
337
  });
263
- return /* @__PURE__ */ F("li", {
264
- ref: h,
265
- className: `flex items-start gap-3 p-4 transition-colors hover:bg-bg-sunken/50 ${g ? "opacity-40" : ""}`,
338
+ return /* @__PURE__ */ R("li", {
339
+ ref: re,
340
+ className: `flex items-start gap-3 p-4 transition-colors hover:bg-bg-sunken/50 ${y ? "opacity-40" : ""}`,
266
341
  children: [
267
- /* @__PURE__ */ F("div", {
342
+ /* @__PURE__ */ R("div", {
268
343
  className: "flex w-16 shrink-0 flex-col items-end pt-0.5 text-xs tabular-nums text-text-secondary",
269
- children: [/* @__PURE__ */ P("span", { children: n(e.startTime) }), /* @__PURE__ */ P("span", {
344
+ children: [/* @__PURE__ */ L("span", { children: n(e.startTime) }), /* @__PURE__ */ L("span", {
270
345
  className: "text-text-tertiary",
271
346
  children: t(e.durationSeconds)
272
347
  })]
273
348
  }),
274
- e.isRecategorizable && /* @__PURE__ */ P("button", {
349
+ e.isRecategorizable && /* @__PURE__ */ L("button", {
275
350
  type: "button",
276
- "aria-label": `Drag to recategorize ${e.title || l.label}`,
351
+ "aria-label": `Drag ${e.title || p.label} onto a category or project`,
277
352
  className: "mt-1.5 shrink-0 cursor-grab touch-none text-text-tertiary hover:text-text-secondary active:cursor-grabbing",
278
- ...p,
279
- ...m,
280
- children: /* @__PURE__ */ P(ue, { className: "h-4 w-4" })
353
+ ...ne,
354
+ ...v,
355
+ children: /* @__PURE__ */ L(ye, { className: "h-4 w-4" })
281
356
  }),
282
- /* @__PURE__ */ P("div", {
283
- className: `mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg ${l.chip}`,
284
- children: /* @__PURE__ */ P(u, { className: "h-4 w-4" })
357
+ /* @__PURE__ */ L("div", {
358
+ className: `mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg ${p.chip}`,
359
+ children: /* @__PURE__ */ L(te, { className: "h-4 w-4" })
285
360
  }),
286
- /* @__PURE__ */ F("div", {
361
+ /* @__PURE__ */ R("div", {
287
362
  className: "min-w-0 flex-1",
288
363
  children: [
289
- /* @__PURE__ */ P("p", {
364
+ /* @__PURE__ */ L("p", {
290
365
  className: "truncate text-sm font-medium text-text-primary",
291
- children: e.title || l.label
366
+ children: e.title || p.label
292
367
  }),
293
- /* @__PURE__ */ F("div", {
368
+ /* @__PURE__ */ R("div", {
294
369
  className: "mt-1 flex flex-wrap items-center gap-2",
295
370
  children: [
296
- /* @__PURE__ */ P("span", {
297
- className: `inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${l.chip}`,
298
- children: l.label
371
+ /* @__PURE__ */ L("span", {
372
+ className: `inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${p.chip}`,
373
+ children: p.label
299
374
  }),
300
- i !== void 0 && /* @__PURE__ */ F("span", {
375
+ i !== void 0 && /* @__PURE__ */ R("span", {
301
376
  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",
302
- children: [/* @__PURE__ */ P(D, { className: "h-3 w-3 shrink-0" }), /* @__PURE__ */ P("span", {
377
+ children: [/* @__PURE__ */ L(k, { className: "h-3 w-3 shrink-0" }), /* @__PURE__ */ L("span", {
303
378
  className: "truncate",
304
379
  children: i
305
380
  })]
306
381
  }),
307
- e.app && /* @__PURE__ */ P("span", {
382
+ e.app && /* @__PURE__ */ L("span", {
308
383
  className: "text-xs text-text-secondary",
309
384
  children: e.app
310
385
  }),
311
- d && (d.isAi ? /* @__PURE__ */ F("span", {
386
+ h && (h.isAi ? /* @__PURE__ */ R("span", {
312
387
  className: "inline-flex items-center gap-1 rounded-full bg-bg-sunken px-2 py-0.5 text-xs font-medium text-text-secondary",
313
- title: d.detail,
388
+ title: h.detail,
314
389
  "data-testid": "timeline-ai-provenance",
315
390
  children: [
316
- /* @__PURE__ */ P(A, {
391
+ /* @__PURE__ */ L(F, {
317
392
  className: "h-3 w-3 shrink-0",
318
393
  "aria-hidden": !0
319
394
  }),
320
- d.label,
321
- /* @__PURE__ */ F("span", {
395
+ h.label,
396
+ /* @__PURE__ */ R("span", {
322
397
  className: "sr-only",
323
- children: [". ", d.detail]
398
+ children: [". ", h.detail]
324
399
  })
325
400
  ]
326
- }) : /* @__PURE__ */ P("span", {
401
+ }) : /* @__PURE__ */ L("span", {
327
402
  className: "text-xs text-text-tertiary",
328
- title: d.detail,
329
- children: d.label
330
- }))
403
+ title: h.detail,
404
+ children: h.label
405
+ })),
406
+ ee && /* @__PURE__ */ R("button", {
407
+ type: "button",
408
+ disabled: u.busy || o,
409
+ onClick: () => u.onApprove(e),
410
+ "aria-label": `Approve the AI category ${p.label} for ${e.title || "this activity"}`,
411
+ "data-testid": "timeline-approve-category",
412
+ className: "inline-flex items-center gap-1 rounded-full 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",
413
+ children: [/* @__PURE__ */ L(E, { className: "h-3 w-3" }), "Approve"]
414
+ })
331
415
  ]
332
416
  }),
333
- a && /* @__PURE__ */ P(U, {
417
+ a && /* @__PURE__ */ L(Ne, {
334
418
  suggestion: a,
335
419
  busy: c.busy,
336
420
  onAccept: c.onAccept,
337
421
  onReject: c.onReject
422
+ }),
423
+ d && /* @__PURE__ */ L(U, {
424
+ segment: e,
425
+ busy: u.busy,
426
+ onSplit: (t) => {
427
+ f(!1), u.onSplit(e, t);
428
+ },
429
+ onCancel: () => f(!1)
338
430
  })
339
431
  ]
340
432
  }),
341
- /* @__PURE__ */ F("div", {
433
+ /* @__PURE__ */ R("div", {
342
434
  className: "flex shrink-0 flex-col items-end gap-1.5",
343
435
  children: [
344
- e.isRecategorizable && /* @__PURE__ */ P("select", {
436
+ e.isRecategorizable && /* @__PURE__ */ L("select", {
345
437
  "aria-label": "Recategorize activity",
346
438
  disabled: o,
347
439
  value: r,
348
440
  onChange: (t) => s(e, t.target.value),
349
441
  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",
350
- children: H.map((e) => /* @__PURE__ */ P("option", {
442
+ children: H.map((e) => /* @__PURE__ */ L("option", {
351
443
  value: e,
352
- children: B[e].label
444
+ children: V[e].label
353
445
  }, e))
354
446
  }),
355
- f && c.projects.length > 0 && /* @__PURE__ */ F("select", {
447
+ g && c.projects.length > 0 && /* @__PURE__ */ R("select", {
356
448
  "aria-label": "Assign project",
357
449
  disabled: c.busy,
358
450
  value: e.projectId ?? "",
359
451
  onChange: (t) => c.onSetProject(e, t.target.value || null),
360
452
  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",
361
- children: [/* @__PURE__ */ P("option", {
453
+ children: [/* @__PURE__ */ L("option", {
362
454
  value: "",
363
455
  children: "No project"
364
- }), c.projects.map((e) => /* @__PURE__ */ P("option", {
456
+ }), c.projects.map((e) => /* @__PURE__ */ L("option", {
365
457
  value: e.id,
366
458
  children: e.name
367
459
  }, e.id))]
368
460
  }),
369
- ee && /* @__PURE__ */ F("button", {
461
+ _ && /* @__PURE__ */ R("button", {
370
462
  type: "button",
371
463
  disabled: c.busy,
372
464
  onClick: () => c.onSuggest(e),
373
465
  className: "inline-flex items-center gap-1 text-xs font-medium text-primary hover:underline disabled:opacity-50",
374
- children: [/* @__PURE__ */ P(A, { className: "h-3 w-3" }), "Suggest project"]
466
+ children: [/* @__PURE__ */ L(F, { className: "h-3 w-3" }), "Suggest project"]
467
+ }),
468
+ (l || m) && /* @__PURE__ */ R("span", {
469
+ className: "flex items-center gap-2",
470
+ children: [l && /* @__PURE__ */ R("button", {
471
+ type: "button",
472
+ disabled: u.busy,
473
+ onClick: () => u.onMerge(e, l),
474
+ title: `Merge with ${l.title || "the next activity"} (${n(l.startTime)})`,
475
+ "data-testid": "timeline-merge-next",
476
+ className: "inline-flex items-center gap-1 text-xs font-medium text-text-secondary hover:text-text-primary disabled:opacity-50",
477
+ children: [/* @__PURE__ */ L(j, { className: "h-3 w-3" }), "Merge with next"]
478
+ }), m && !d && /* @__PURE__ */ R("button", {
479
+ type: "button",
480
+ disabled: u.busy,
481
+ onClick: () => f(!0),
482
+ "data-testid": "timeline-split",
483
+ className: "inline-flex items-center gap-1 text-xs font-medium text-text-secondary hover:text-text-primary disabled:opacity-50",
484
+ children: [/* @__PURE__ */ L(N, { className: "h-3 w-3" }), "Split"]
485
+ })]
375
486
  })
376
487
  ]
377
488
  })
@@ -385,76 +496,144 @@ function G(e) {
385
496
  let t = e.getTimezoneOffset();
386
497
  return (/* @__PURE__ */ new Date(e.getTime() - t * 60 * 1e3)).toISOString().slice(0, 10);
387
498
  }
388
- var K = 14;
389
- function q() {
499
+ var Re = 14;
500
+ function ze() {
390
501
  let e = /* @__PURE__ */ new Date();
391
- return e.setDate(e.getDate() + K), G(e);
502
+ return e.setDate(e.getDate() + Re), G(e);
392
503
  }
393
- function xe(e) {
504
+ function Be(e) {
394
505
  let t = /* @__PURE__ */ new Date(`${e}T00:00:00`), n = /* @__PURE__ */ new Date(`${e}T23:59:59.999`);
395
506
  return {
396
507
  from: t.toISOString(),
397
508
  to: n.toISOString()
398
509
  };
399
510
  }
400
- function Se() {
401
- let { workspaceId: g = "" } = e(), { toasts: ie, addToast: _, dismissToast: ae } = h(), [v] = de(), [y, w] = x(() => {
402
- let e = ne(v.get("date"));
403
- return e !== null && e <= q() ? e : G(/* @__PURE__ */ new Date());
404
- }), [E, D] = x(null), { from: le, to: O } = b(() => xe(y), [y]), { data: k, loading: j, error: M, refetch: L } = s({
511
+ function Ve() {
512
+ let { workspaceId: _ = "" } = e(), { toasts: ie, addToast: y, dismissToast: ae } = g(), [oe] = Se(), [b, le] = w(() => {
513
+ let e = v(oe.get("date"));
514
+ return e !== null && e <= ze() ? e : G(/* @__PURE__ */ new Date());
515
+ }), [x, S] = w(null), { from: de, to: me } = C(() => Be(b), [b]), { data: he, loading: O, error: ve, refetch: k } = s({
405
516
  variables: {
406
- from: le,
407
- to: O
517
+ from: de,
518
+ to: me
408
519
  },
409
- skip: !g,
520
+ skip: !_,
410
521
  fetchPolicy: "cache-and-network"
411
- }), { data: R } = c({
522
+ }), { data: A } = c({
412
523
  variables: { pagination: { limit: 200 } },
413
- skip: !g
414
- }), [V, { loading: U }] = l(), [K, { loading: Se }] = o(), [Ce, { loading: we }] = u(), [Te, { loading: Ee }] = d(), [De, { loading: Oe }] = f(), ke = Se || we || Ee || Oe, Ae = ge(z(he, { activationConstraint: { distance: 6 } }), z(me)), J = k?.timeCampusTimeline, Y = b(() => J?.segments ?? [], [J]);
415
- ee(!j && !!J, Y.length > 0);
416
- let X = J?.summary, Z = b(() => {
524
+ skip: !_
525
+ }), [j, { loading: M }] = u(), [N, { loading: P }] = o(), [I, { loading: be }] = d(), [De, { loading: B }] = f(), [Ae, { loading: Ne }] = ee(), U = P || be || B || Ne, [Re, { loading: Ve }] = l(), [He, { loading: Ue }] = p(), [We, Ge] = w(!1), Ke = Ve || Ue || We, qe = ke(Oe(Ee, { activationConstraint: { distance: 6 } }), Oe(Te)), K = he?.timeCampusTimeline, q = C(() => K?.segments ?? [], [K]);
526
+ m(!O && !!K, q.length > 0);
527
+ let J = K?.summary, Y = C(() => {
417
528
  let e = /* @__PURE__ */ new Map();
418
- for (let t of R?.projects?.items ?? []) e.set(t.id, t.name);
529
+ for (let t of A?.projects?.items ?? []) e.set(t.id, t.name);
419
530
  return e;
420
- }, [R?.projects?.items]), je = b(() => Array.from(Z, ([e, t]) => ({
531
+ }, [A?.projects?.items]), X = C(() => Array.from(Y, ([e, t]) => ({
421
532
  id: e,
422
533
  name: t
423
- })), [Z]), Q = b(() => se(Y, Z), [Y, Z]), Me = b(() => {
534
+ })), [Y]), Z = C(() => ce(q, Y), [q, Y]), Je = C(() => {
424
535
  let e = /* @__PURE__ */ new Map();
425
- for (let t of X?.byCategory ?? []) e.set(t.category, {
536
+ for (let t of J?.byCategory ?? []) e.set(t.category, {
426
537
  totalSeconds: t.totalSeconds,
427
538
  segmentCount: t.segmentCount
428
539
  });
429
540
  return e;
430
- }, [X]), Ne = async (e, t) => {
431
- !e.isRecategorizable || e.category === t || (await V({ variables: {
432
- id: e.sourceId,
433
- category: t
434
- } }), await L());
541
+ }, [J]), Ye = async (e, t) => {
542
+ if (!(!e.isRecategorizable || e.category === t)) try {
543
+ await j({ variables: {
544
+ id: e.sourceId,
545
+ category: t
546
+ } }), await k(), y({
547
+ title: `Moved to ${V[t].label}`,
548
+ variant: "success"
549
+ });
550
+ } catch (e) {
551
+ y({
552
+ title: W(e),
553
+ variant: "error"
554
+ });
555
+ }
556
+ }, Q = C(() => ue(q), [q]), Xe = async (e) => {
557
+ let t = 0, n = null;
558
+ Ge(!0);
559
+ try {
560
+ for (let r = 0; r < e.length; r += Fe) {
561
+ let i = await Promise.allSettled(e.slice(r, r + Fe).map((e) => j({ variables: {
562
+ id: e.sourceId,
563
+ category: e.category
564
+ } })));
565
+ for (let e of i) e.status === "fulfilled" ? t++ : n ??= e.reason;
566
+ }
567
+ y(n === null ? {
568
+ title: t === 1 ? "Category approved" : `Approved ${t} categories`,
569
+ variant: "success"
570
+ } : {
571
+ title: `Approved ${t} of ${e.length}`,
572
+ description: W(n),
573
+ variant: "error"
574
+ });
575
+ } finally {
576
+ Ge(!1);
577
+ try {
578
+ await k();
579
+ } catch {}
580
+ }
581
+ }, Ze = async (e, t) => {
582
+ try {
583
+ await Re({ variables: { ids: [e.sourceId, t.sourceId] } }), await k(), y({
584
+ title: "Activities merged",
585
+ description: "Gaps between them are not counted as tracked time.",
586
+ variant: "success"
587
+ });
588
+ } catch (e) {
589
+ y({
590
+ title: W(e),
591
+ variant: "error"
592
+ });
593
+ }
594
+ }, Qe = async (e, t) => {
595
+ try {
596
+ await He({ variables: {
597
+ id: e.sourceId,
598
+ at: t.toISOString()
599
+ } }), await k(), y({
600
+ title: `Split at ${n(t.toISOString())}`,
601
+ variant: "success"
602
+ });
603
+ } catch (e) {
604
+ y({
605
+ title: W(e),
606
+ variant: "error"
607
+ });
608
+ }
609
+ }, $e = {
610
+ busy: Ke,
611
+ onMerge: (e, t) => void Ze(e, t),
612
+ onSplit: (e, t) => void Qe(e, t),
613
+ onApprove: (e) => void Xe([e])
435
614
  }, $ = async (e, t) => {
436
615
  try {
437
- await e(), await L(), _({
616
+ await e(), await k(), y({
438
617
  title: t,
439
618
  variant: "success"
440
619
  });
441
620
  } catch (e) {
442
- _({
621
+ y({
443
622
  title: W(e),
444
623
  variant: "error"
445
624
  });
446
625
  }
447
- }, Pe = (e) => $(() => K({ variables: { id: e.captureEventId } }), `Assigned to ${e.projectName}`), Fe = (e) => $(() => Ce({ variables: { id: e.captureEventId } }), "Suggestion dismissed"), Ie = (e, t) => {
626
+ }, et = (e) => $(() => N({ variables: { id: e.captureEventId } }), `Assigned to ${e.projectName}`), tt = (e) => $(() => I({ variables: { id: e.captureEventId } }), "Suggestion dismissed"), nt = (e, t) => {
448
627
  if ((e.projectId ?? null) === t) return;
449
- let n = t ? Z.get(t) : void 0;
450
- return $(() => Te({ variables: {
628
+ let n = t ? Y.get(t) : void 0;
629
+ return $(() => De({ variables: {
451
630
  id: e.sourceId,
452
631
  projectId: t
453
632
  } }), n ? `Assigned to ${n}` : "Project removed");
454
- }, Le = async (e) => {
633
+ }, rt = async (e) => {
455
634
  try {
456
- let t = (await De({ variables: { id: e.sourceId } })).data?.suggestTimeCampusCaptureEventCategory;
457
- await L(), _(t?.suggestedProjectId ? {
635
+ let t = (await Ae({ variables: { id: e.sourceId } })).data?.suggestTimeCampusCaptureEventCategory;
636
+ await k(), y(t?.suggestedProjectId ? {
458
637
  title: `Suggested ${t.suggestedProjectName ?? "a project"}`,
459
638
  description: "Accept or dismiss it on the activity.",
460
639
  variant: "info"
@@ -464,146 +643,144 @@ function Se() {
464
643
  variant: "info"
465
644
  });
466
645
  } catch (e) {
467
- _({
646
+ y({
468
647
  title: W(e),
469
648
  variant: "error"
470
649
  });
471
650
  }
472
- }, Re = async () => {
651
+ }, it = async () => {
473
652
  let e = 0;
474
653
  try {
475
- for (let t of Q) await K({ variables: { id: t.captureEventId } }), e++;
476
- _({
654
+ for (let t of Z) await N({ variables: { id: t.captureEventId } }), e++;
655
+ y({
477
656
  title: `Accepted ${e} project ${e === 1 ? "suggestion" : "suggestions"}`,
478
657
  variant: "success"
479
658
  });
480
659
  } catch (t) {
481
- _({
482
- title: `Accepted ${e} of ${Q.length}`,
660
+ y({
661
+ title: `Accepted ${e} of ${Z.length}`,
483
662
  description: W(t),
484
663
  variant: "error"
485
664
  });
486
665
  } finally {
487
- await L();
666
+ await k();
488
667
  }
489
- }, ze = {
490
- projects: je,
491
- busy: ke,
492
- onAccept: (e) => void Pe(e),
493
- onReject: (e) => void Fe(e),
494
- onSetProject: (e, t) => void Ie(e, t),
495
- onSuggest: (e) => void Le(e)
496
- }, Be = (e) => {
668
+ }, at = {
669
+ projects: X,
670
+ busy: U,
671
+ onAccept: (e) => void et(e),
672
+ onReject: (e) => void tt(e),
673
+ onSetProject: (e, t) => void nt(e, t),
674
+ onSuggest: (e) => void rt(e)
675
+ }, ot = (e) => {
497
676
  let t = e.active.data.current?.segment;
498
- D(t ?? null);
499
- }, Ve = (e) => {
677
+ S(t ?? null);
678
+ }, st = (e) => {
500
679
  let t = e.active.data.current?.segment;
501
- D(null);
502
- let n = e.over?.id;
503
- if (!t || typeof n != "string") return;
504
- let r = n.replace(/^category:/, "");
505
- H.includes(r) && Ne(t, r);
506
- }, He = X && X.focusRatio != null ? Math.round(X.focusRatio * 100) : 0, Ue = X?.firstActivityAt && X?.lastActivityAt ? `${n(X.firstActivityAt)} – ${n(X.lastActivityAt)}` : null;
507
- return /* @__PURE__ */ F(p, {
680
+ S(null);
681
+ let n = pe(e.over?.id, H);
682
+ !t || !n || (n.kind === "category" ? Ye(t, n.category) : t.source === "CAPTURE" && nt(t, n.projectId));
683
+ }, ct = q.some((e) => e.source === "CAPTURE" && e.isRecategorizable), lt = J && J.focusRatio != null ? Math.round(J.focusRatio * 100) : 0, ut = J?.firstActivityAt && J?.lastActivityAt ? `${n(J.firstActivityAt)} – ${n(J.lastActivityAt)}` : null;
684
+ return /* @__PURE__ */ R(te, {
508
685
  title: "Timeline",
509
686
  description: "Your day, assembled automatically",
510
687
  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.",
511
- actions: /* @__PURE__ */ F("div", {
688
+ actions: /* @__PURE__ */ R("div", {
512
689
  className: "flex flex-wrap items-center gap-3",
513
- children: [Ue && /* @__PURE__ */ F("span", {
690
+ children: [ut && /* @__PURE__ */ R("span", {
514
691
  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",
515
- children: [/* @__PURE__ */ P(S, { className: "h-3.5 w-3.5" }), Ue]
516
- }), /* @__PURE__ */ F("label", {
692
+ children: [/* @__PURE__ */ L(T, { className: "h-3.5 w-3.5" }), ut]
693
+ }), /* @__PURE__ */ R("label", {
517
694
  className: "flex items-center gap-2 text-sm text-text-secondary",
518
- children: [/* @__PURE__ */ P(ce, { className: "h-4 w-4" }), /* @__PURE__ */ P("input", {
695
+ children: [/* @__PURE__ */ L(ge, { className: "h-4 w-4" }), /* @__PURE__ */ L("input", {
519
696
  type: "date",
520
- value: y,
521
- max: q(),
522
- onChange: (e) => w(e.target.value),
697
+ value: b,
698
+ max: ze(),
699
+ onChange: (e) => le(e.target.value),
523
700
  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"
524
701
  })]
525
702
  })]
526
703
  }),
527
704
  children: [
528
- /* @__PURE__ */ P(te, { path: y === G(/* @__PURE__ */ new Date()) ? "/mobile/timeline" : `/mobile/timeline?date=${y}` }),
529
- j && !J ? /* @__PURE__ */ F("div", {
705
+ /* @__PURE__ */ L(ne, { path: b === G(/* @__PURE__ */ new Date()) ? "/mobile/timeline" : `/mobile/timeline?date=${b}` }),
706
+ O && !K ? /* @__PURE__ */ R("div", {
530
707
  className: "space-y-6",
531
- children: [/* @__PURE__ */ P(i, {
708
+ children: [/* @__PURE__ */ L(i, {
532
709
  variant: "card",
533
710
  count: 4
534
- }), /* @__PURE__ */ P(i, {
711
+ }), /* @__PURE__ */ L(i, {
535
712
  variant: "list",
536
713
  count: 6
537
714
  })]
538
- }) : M ? /* @__PURE__ */ P("div", {
715
+ }) : ve ? /* @__PURE__ */ L("div", {
539
716
  className: "rounded-lg border border-status-error-bg/40 bg-status-error-bg p-4 text-sm text-status-error-text",
540
717
  children: "Failed to load your timeline. Please try again later."
541
- }) : /* @__PURE__ */ F(fe, {
542
- sensors: Ae,
543
- onDragStart: Be,
544
- onDragEnd: Ve,
545
- children: [/* @__PURE__ */ F("div", {
718
+ }) : /* @__PURE__ */ R(Ce, {
719
+ sensors: qe,
720
+ onDragStart: ot,
721
+ onDragEnd: st,
722
+ children: [/* @__PURE__ */ R("div", {
546
723
  className: "space-y-6",
547
724
  children: [
548
- /* @__PURE__ */ F("div", {
725
+ /* @__PURE__ */ R("div", {
549
726
  className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",
550
727
  children: [
551
- /* @__PURE__ */ P(r, {
728
+ /* @__PURE__ */ L(r, {
552
729
  featured: !0,
553
730
  title: "Tracked time",
554
- value: t(X?.totalTrackedSeconds ?? 0),
555
- icon: /* @__PURE__ */ P(S, { className: "h-5 w-5" }),
731
+ value: t(J?.totalTrackedSeconds ?? 0),
732
+ icon: /* @__PURE__ */ L(T, { className: "h-5 w-5" }),
556
733
  description: "Total activity across the day"
557
734
  }),
558
- /* @__PURE__ */ P(r, {
735
+ /* @__PURE__ */ L(r, {
559
736
  title: "Focus ratio",
560
- value: `${He}%`,
561
- icon: /* @__PURE__ */ P(C, { className: "h-5 w-5" }),
737
+ value: `${lt}%`,
738
+ icon: /* @__PURE__ */ L(D, { className: "h-5 w-5" }),
562
739
  description: "Share of time in deep work"
563
740
  }),
564
- /* @__PURE__ */ P(r, {
741
+ /* @__PURE__ */ L(r, {
565
742
  title: "Context switches",
566
- value: X?.contextSwitches ?? 0,
567
- icon: /* @__PURE__ */ P(N, { className: "h-5 w-5" }),
743
+ value: J?.contextSwitches ?? 0,
744
+ icon: /* @__PURE__ */ L(xe, { className: "h-5 w-5" }),
568
745
  description: "Category changes through the day"
569
746
  }),
570
- /* @__PURE__ */ P(r, {
747
+ /* @__PURE__ */ L(r, {
571
748
  title: "Longest focus block",
572
- value: t(X?.longestFocusBlockSeconds ?? 0),
573
- icon: /* @__PURE__ */ P(C, { className: "h-5 w-5" }),
749
+ value: t(J?.longestFocusBlockSeconds ?? 0),
750
+ icon: /* @__PURE__ */ L(D, { className: "h-5 w-5" }),
574
751
  description: "Your deepest uninterrupted stretch"
575
752
  })
576
753
  ]
577
754
  }),
578
- Y.length > 0 && /* @__PURE__ */ F(I, {
755
+ q.length > 0 && /* @__PURE__ */ R(z, {
579
756
  treatment: "glass",
580
757
  className: "p-4 sm:p-6",
581
758
  children: [
582
- /* @__PURE__ */ P("h2", {
759
+ /* @__PURE__ */ L("h2", {
583
760
  className: "mb-1 text-sm font-semibold text-text-primary",
584
761
  children: "Where the time went"
585
762
  }),
586
- /* @__PURE__ */ P("p", {
763
+ /* @__PURE__ */ L("p", {
587
764
  className: "mb-4 text-xs text-text-secondary",
588
- children: "Drag a segment from the timeline below onto a category to recategorize it — or use its dropdown."
765
+ children: "Drag a segment from the timeline below onto a category to recategorize it, or onto a project to assign it — or use its dropdowns."
589
766
  }),
590
- re(Y) && /* @__PURE__ */ F("p", {
767
+ re(q) && /* @__PURE__ */ R("p", {
591
768
  className: "mb-4 flex items-start gap-1.5 text-xs text-text-secondary",
592
769
  "data-testid": "timeline-ai-disclaimer",
593
- children: [/* @__PURE__ */ P(A, {
770
+ children: [/* @__PURE__ */ L(F, {
594
771
  className: "mt-0.5 h-3 w-3 shrink-0",
595
772
  "aria-hidden": !0
596
- }), /* @__PURE__ */ F("span", { children: [
773
+ }), /* @__PURE__ */ R("span", { children: [
597
774
  "Some activities here were categorized by AI.",
598
775
  " ",
599
776
  "AI can get this wrong. Pick another category to correct it, and TimeCampus will use your choice for this app from now on."
600
777
  ] })]
601
778
  }),
602
- /* @__PURE__ */ P("div", {
779
+ /* @__PURE__ */ L("div", {
603
780
  className: "flex flex-wrap gap-4",
604
781
  children: H.map((e) => {
605
- let t = B[e], n = Me.get(e);
606
- return /* @__PURE__ */ P(ye, {
782
+ let t = V[e], n = Je.get(e);
783
+ return /* @__PURE__ */ L(Pe, {
607
784
  category: e,
608
785
  label: t.label,
609
786
  dotClassName: t.dot,
@@ -613,67 +790,124 @@ function Se() {
613
790
  })
614
791
  ]
615
792
  }),
616
- Q.length > 0 && /* @__PURE__ */ F("div", {
793
+ ct && X.length > 0 && /* @__PURE__ */ R(z, {
794
+ treatment: "glass",
795
+ className: "p-4 sm:p-6",
796
+ children: [
797
+ /* @__PURE__ */ L("h2", {
798
+ className: "mb-1 text-sm font-semibold text-text-primary",
799
+ children: "Assign to a project"
800
+ }),
801
+ /* @__PURE__ */ L("p", {
802
+ className: "mb-4 text-xs text-text-secondary",
803
+ children: "Drag a captured activity onto a project to assign it."
804
+ }),
805
+ /* @__PURE__ */ R("div", {
806
+ className: "flex flex-wrap gap-3",
807
+ children: [X.map((e) => /* @__PURE__ */ L(Ie, {
808
+ projectId: e.id,
809
+ label: e.name
810
+ }, e.id)), /* @__PURE__ */ L(Ie, {
811
+ projectId: null,
812
+ label: "No project"
813
+ })]
814
+ })
815
+ ]
816
+ }),
817
+ Q.length > 0 && /* @__PURE__ */ R("div", {
617
818
  className: "flex flex-wrap items-center gap-3 rounded-lg border border-border-seam bg-bg-sunken/40 px-4 py-3",
618
- "data-testid": "timeline-suggestions-banner",
819
+ "data-testid": "timeline-approval-banner",
619
820
  children: [
620
- /* @__PURE__ */ P(A, { className: "h-4 w-4 shrink-0 text-primary" }),
621
- /* @__PURE__ */ F("p", {
821
+ /* @__PURE__ */ L(F, { className: "h-4 w-4 shrink-0 text-primary" }),
822
+ /* @__PURE__ */ R("p", {
622
823
  className: "text-sm text-text-secondary",
623
824
  children: [
624
- /* @__PURE__ */ F("span", {
825
+ /* @__PURE__ */ R("span", {
625
826
  className: "font-medium text-text-primary",
626
827
  children: [
627
828
  Q.length,
829
+ " ",
830
+ Q.length === 1 ? "category was" : "categories were",
831
+ " ",
832
+ "chosen by AI."
833
+ ]
834
+ }),
835
+ " ",
836
+ "Approve them as they are, or drag one onto another category to correct it."
837
+ ]
838
+ }),
839
+ /* @__PURE__ */ R("button", {
840
+ type: "button",
841
+ disabled: Ke || M,
842
+ onClick: () => void Xe(Q),
843
+ 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",
844
+ children: [/* @__PURE__ */ L(E, { className: "h-3.5 w-3.5" }), "Approve all"]
845
+ })
846
+ ]
847
+ }),
848
+ Z.length > 0 && /* @__PURE__ */ R("div", {
849
+ className: "flex flex-wrap items-center gap-3 rounded-lg border border-border-seam bg-bg-sunken/40 px-4 py-3",
850
+ "data-testid": "timeline-suggestions-banner",
851
+ children: [
852
+ /* @__PURE__ */ L(F, { className: "h-4 w-4 shrink-0 text-primary" }),
853
+ /* @__PURE__ */ R("p", {
854
+ className: "text-sm text-text-secondary",
855
+ children: [
856
+ /* @__PURE__ */ R("span", {
857
+ className: "font-medium text-text-primary",
858
+ children: [
859
+ Z.length,
628
860
  " project",
629
861
  " ",
630
- Q.length === 1 ? "suggestion" : "suggestions"
862
+ Z.length === 1 ? "suggestion" : "suggestions"
631
863
  ]
632
864
  }),
633
865
  " ",
634
866
  "waiting for review. Nothing is assigned until you accept."
635
867
  ]
636
868
  }),
637
- /* @__PURE__ */ F("button", {
869
+ /* @__PURE__ */ R("button", {
638
870
  type: "button",
639
- disabled: ke,
640
- onClick: () => void Re(),
871
+ disabled: U,
872
+ onClick: () => void it(),
641
873
  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",
642
- children: [/* @__PURE__ */ P(T, { className: "h-3.5 w-3.5" }), "Accept all"]
874
+ children: [/* @__PURE__ */ L(_e, { className: "h-3.5 w-3.5" }), "Accept all"]
643
875
  })
644
876
  ]
645
877
  }),
646
- Y.length === 0 ? /* @__PURE__ */ P(a, {
878
+ q.length === 0 ? /* @__PURE__ */ L(a, {
647
879
  illustration: "empty-generic",
648
880
  title: "No activity captured for this day",
649
881
  description: "As you track time, hold meetings, run focus sessions, and connect shared integrations, your day assembles here automatically — categorized and in order."
650
- }) : /* @__PURE__ */ P(I, {
882
+ }) : /* @__PURE__ */ L(z, {
651
883
  treatment: "glass",
652
884
  glow: !0,
653
885
  className: "overflow-hidden",
654
- children: /* @__PURE__ */ P("ol", {
886
+ children: /* @__PURE__ */ L("ol", {
655
887
  className: "divide-y divide-border-seam",
656
- children: Y.map((e) => _e(e) ? /* @__PURE__ */ P(ve, { segment: e }, e.id) : /* @__PURE__ */ P(be, {
888
+ children: q.map((e, t) => je(e) ? /* @__PURE__ */ L(Me, { segment: e }, e.id) : /* @__PURE__ */ L(Le, {
657
889
  segment: e,
658
890
  category: e.category ?? "OTHER",
659
- projectName: e.projectId ? Z.get(e.projectId) : void 0,
660
- suggestion: oe(e, Z),
661
- recategorizing: U,
662
- onRecategorize: Ne,
663
- projectActions: ze
891
+ projectName: e.projectId ? Y.get(e.projectId) : void 0,
892
+ suggestion: se(e, Y),
893
+ recategorizing: M,
894
+ onRecategorize: Ye,
895
+ projectActions: at,
896
+ mergeTarget: fe(q, t),
897
+ editActions: $e
664
898
  }, e.id))
665
899
  })
666
900
  })
667
901
  ]
668
- }), /* @__PURE__ */ P(pe, { children: E && /* @__PURE__ */ F("div", {
902
+ }), /* @__PURE__ */ L(we, { children: x && /* @__PURE__ */ R("div", {
669
903
  className: "flex items-center gap-2 rounded-lg border border-border-seam bg-bg-surface px-3 py-2 shadow-pop",
670
- children: [/* @__PURE__ */ P(ue, { className: "h-4 w-4 text-text-tertiary" }), /* @__PURE__ */ P("span", {
904
+ children: [/* @__PURE__ */ L(ye, { className: "h-4 w-4 text-text-tertiary" }), /* @__PURE__ */ L("span", {
671
905
  className: "text-sm font-medium text-text-primary",
672
- children: E.title || B[E.category ?? "OTHER"].label
906
+ children: x.title || V[x.category ?? "OTHER"].label
673
907
  })]
674
908
  }) })]
675
909
  }),
676
- /* @__PURE__ */ P(m, {
910
+ /* @__PURE__ */ L(h, {
677
911
  toasts: ie,
678
912
  onDismiss: ae
679
913
  })
@@ -681,6 +915,6 @@ function Se() {
681
915
  });
682
916
  }
683
917
  //#endregion
684
- export { Se as TimelinePage };
918
+ export { Ve as TimelinePage };
685
919
 
686
920
  //# sourceMappingURL=TimelinePage.js.map