@burdenoff/microfe-timecampus 2026.1031.2 → 2026.1031.3

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