@burdenoff/microfe-timecampus 2026.1030.4 → 2026.1031.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"TimelinePage.js","names":[],"sources":["../../../../src/timecampus/pages/timeline/TimelinePage.tsx"],"sourcesContent":["import { useMemo, useState } from \"react\";\nimport {\n DndContext,\n DragOverlay,\n KeyboardSensor,\n PointerSensor,\n useDraggable,\n useDroppable,\n useSensor,\n useSensors,\n type DragEndEvent,\n type DragStartEvent,\n} from \"@dnd-kit/core\";\nimport {\n Activity,\n Brain,\n Calendar,\n CalendarClock,\n Coffee,\n FolderOpen,\n Github,\n GripVertical,\n MessageSquare,\n Shield,\n Sparkles,\n Users,\n Zap,\n} from \"lucide-react\";\nimport { GlassCard } from \"@burdenoff/fe-libs/ui\";\nimport { PageLayout } from \"../../components/PageLayout\";\nimport { StatCard } from \"../../components/StatCard\";\nimport { EmptyState } from \"../../components/EmptyState\";\nimport { LoadingSkeleton } from \"../../components/LoadingSkeleton\";\nimport { formatDuration, formatTime } from \"../../utils/helpers\";\nimport { calendarHoldLabel } from \"../focus/focusHelpers\";\nimport {\n AI_CATEGORY_DISCLAIMER,\n hasAiCategorizedSegment,\n segmentProvenance,\n} from \"./timelineProvenance\";\nimport {\n driftLabel,\n focusStatusLabel,\n plannedDrift,\n protectedPercent,\n} from \"./timelineFocus\";\nimport { useTimeCampus } from \"../../providers/TimeCampusProvider\";\nimport {\n useGetTimeCampusTimelineQuery,\n useListProjectsQuery,\n useRecategorizeTimeCampusCaptureEventMutation,\n type TimelineSegmentFieldsFragment,\n} from \"@/generated/wspace-operations\";\n\ntype Category = \"MEETING\" | \"DEEP_WORK\" | \"COMMUNICATION\" | \"BREAK\" | \"OTHER\";\n\nconst CATEGORY_META: Record<\n Category,\n { label: string; icon: typeof Brain; dot: string; chip: string }\n> = {\n DEEP_WORK: {\n label: \"Deep work\",\n icon: Brain,\n dot: \"bg-status-success-bg\",\n chip: \"bg-status-success-bg text-status-success-text\",\n },\n MEETING: {\n label: \"Meeting\",\n icon: Users,\n dot: \"bg-status-info-bg\",\n chip: \"bg-status-info-bg text-status-info-text\",\n },\n COMMUNICATION: {\n label: \"Communication\",\n icon: MessageSquare,\n dot: \"bg-status-warning-bg\",\n chip: \"bg-status-warning-bg text-status-warning-text\",\n },\n BREAK: {\n label: \"Break\",\n icon: Coffee,\n dot: \"bg-bg-sunken\",\n chip: \"bg-bg-sunken text-text-secondary\",\n },\n OTHER: {\n label: \"Other\",\n icon: Activity,\n dot: \"bg-bg-sunken\",\n chip: \"bg-bg-sunken text-text-secondary\",\n },\n};\n\nconst SOURCE_ICON: Record<string, typeof Brain> = {\n TIME_ENTRY: Zap,\n MEETING: Users,\n POMODORO: Brain,\n EMAIL: MessageSquare,\n CAPTURE: Github,\n FOCUS_SESSION: Shield,\n FOCUS_BLOCK: CalendarClock,\n};\n\n/** Focus sessions and planned focus blocks get their own row (BOFF-9678). */\nfunction isFocusSegment(segment: TimelineSegmentFieldsFragment): boolean {\n return segment.source === \"FOCUS_SESSION\" || segment.source === \"FOCUS_BLOCK\";\n}\n\n/**\n * A focus session (what happened) or a planned focus block: planned vs\n * actual window, and protected vs interrupted time. Planned blocks are drawn\n * dashed and are not counted in the day's totals.\n */\nfunction FocusSegmentRow({\n segment,\n}: {\n segment: TimelineSegmentFieldsFragment;\n}) {\n const focus = segment.focus;\n if (!focus) return null;\n const planned = segment.isPlanned;\n const Icon = planned ? CalendarClock : Shield;\n const status = focusStatusLabel(planned, focus, segment.endTime);\n const percent = planned ? null : protectedPercent(focus);\n const drift = planned\n ? null\n : plannedDrift(segment.startTime, segment.endTime, focus);\n const hold = calendarHoldLabel(focus.calendarHoldStatus);\n\n return (\n <li\n className={`flex items-start gap-3 p-4 ${\n planned ? \"bg-bg-sunken/30\" : \"\"\n }`}\n data-testid={planned ? \"timeline-focus-block\" : \"timeline-focus-session\"}\n >\n <div className=\"flex w-16 shrink-0 flex-col items-end pt-0.5 text-xs tabular-nums text-text-secondary\">\n <span>{formatTime(segment.startTime)}</span>\n <span className=\"text-text-tertiary\">\n {formatDuration(segment.durationSeconds)}\n </span>\n </div>\n <div\n className={`mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg ${\n planned\n ? \"border border-dashed border-status-success-text/60 text-status-success-text\"\n : \"bg-status-success-bg text-status-success-text\"\n }`}\n >\n <Icon className=\"h-4 w-4\" />\n </div>\n <div className=\"min-w-0 flex-1\">\n <p className=\"truncate text-sm font-medium text-text-primary\">\n {segment.title || (planned ? \"Planned focus block\" : \"Focus session\")}\n </p>\n <div className=\"mt-1 flex flex-wrap items-center gap-2\">\n <span\n className={`inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${\n planned\n ? \"border border-dashed border-border-seam text-text-secondary\"\n : \"bg-status-success-bg text-status-success-text\"\n }`}\n data-testid=\"timeline-focus-status\"\n >\n {status}\n </span>\n {focus.protectionLevel === \"STRICT\" && (\n <span className=\"text-xs text-text-secondary\">Strict</span>\n )}\n {focus.plannedStartTime && focus.plannedEndTime && (\n <span className=\"text-xs tabular-nums text-text-secondary\">\n Planned {formatTime(focus.plannedStartTime)} –{\" \"}\n {formatTime(focus.plannedEndTime)}\n </span>\n )}\n {!planned && segment.endTime && (\n <span className=\"text-xs tabular-nums text-text-secondary\">\n Actual {formatTime(segment.startTime)} –{\" \"}\n {formatTime(segment.endTime)}\n </span>\n )}\n {drift && (\n <span className=\"text-xs text-text-tertiary\">\n Started {driftLabel(drift.startMinutes)}\n {drift.endMinutes !== null &&\n `, ended ${driftLabel(drift.endMinutes, \"over\", \"short\")}`}\n </span>\n )}\n {hold && <span className=\"text-xs text-text-tertiary\">{hold}</span>}\n </div>\n {!planned && (\n <div className=\"mt-2\" data-testid=\"timeline-focus-protection\">\n <div\n className=\"flex h-1.5 w-full max-w-xs overflow-hidden rounded-full bg-bg-sunken\"\n role=\"img\"\n aria-label={`${percent ?? 0}% of this session stayed protected`}\n >\n <span\n className=\"h-full bg-status-success-text\"\n style={{ width: `${percent ?? 0}%` }}\n />\n <span\n className=\"h-full bg-status-warning-text\"\n style={{ width: `${percent === null ? 0 : 100 - percent}%` }}\n />\n </div>\n <p className=\"mt-1 text-xs tabular-nums text-text-secondary\">\n Protected {formatDuration(focus.protectedSeconds)} · Interrupted{\" \"}\n {formatDuration(focus.interruptedSeconds)} ·{\" \"}\n {focus.interruptionCount} interruption\n {focus.interruptionCount === 1 ? \"\" : \"s\"}\n {focus.blockedAttemptCount > 0 &&\n ` · ${focus.blockedAttemptCount} distraction${\n focus.blockedAttemptCount === 1 ? \"\" : \"s\"\n } blocked`}\n </p>\n </div>\n )}\n {planned && (\n <p className=\"mt-1 text-xs text-text-tertiary\">\n Not counted in the day&apos;s totals until you run it.\n </p>\n )}\n </div>\n </li>\n );\n}\n\nconst CATEGORY_ORDER: Category[] = [\n \"DEEP_WORK\",\n \"MEETING\",\n \"COMMUNICATION\",\n \"BREAK\",\n \"OTHER\",\n];\n\n/** Droppable target: a category chip in the \"Where the time went\" summary. */\nfunction DroppableCategoryChip({\n category,\n label,\n dotClassName,\n totalSeconds,\n}: {\n category: Category;\n label: string;\n dotClassName: string;\n totalSeconds: number;\n}) {\n const { isOver, setNodeRef } = useDroppable({ id: `category:${category}` });\n return (\n <div\n ref={setNodeRef}\n className={`flex items-center gap-2 rounded-lg border px-3 py-2 transition-colors ${\n isOver\n ? \"border-action-primary-bg bg-action-primary-bg/10\"\n : \"border-border-seam bg-bg-surface\"\n }`}\n >\n <span\n className={`inline-block h-2.5 w-2.5 rounded-full ${dotClassName}`}\n aria-hidden\n />\n <span className=\"text-sm font-medium text-text-primary\">{label}</span>\n <span className=\"text-sm tabular-nums text-text-secondary\">\n {formatDuration(totalSeconds)}\n </span>\n {isOver && (\n <span className=\"text-xs font-medium text-primary\">Drop here</span>\n )}\n </div>\n );\n}\n\n/** Draggable row for a single timeline segment, with the existing dropdown kept as an accessible fallback. */\nfunction DraggableSegmentRow({\n segment,\n category,\n projectName,\n recategorizing,\n onRecategorize,\n}: {\n segment: TimelineSegmentFieldsFragment;\n category: Category;\n /** Resolved name for `segment.projectId`; undefined when it carries none. */\n projectName: string | undefined;\n recategorizing: boolean;\n onRecategorize: (\n segment: TimelineSegmentFieldsFragment,\n category: Category,\n ) => void;\n}) {\n const meta = CATEGORY_META[category] ?? CATEGORY_META.OTHER;\n const SourceIcon = SOURCE_ICON[segment.source] ?? Activity;\n const provenance = segmentProvenance(segment);\n const { attributes, listeners, setNodeRef, isDragging } = useDraggable({\n id: segment.id,\n data: { segment },\n disabled: !segment.isRecategorizable,\n });\n\n return (\n <li\n ref={setNodeRef}\n className={`flex items-start gap-3 p-4 transition-colors hover:bg-bg-sunken/50 ${\n isDragging ? \"opacity-40\" : \"\"\n }`}\n >\n <div className=\"flex w-16 shrink-0 flex-col items-end pt-0.5 text-xs tabular-nums text-text-secondary\">\n <span>{formatTime(segment.startTime)}</span>\n <span className=\"text-text-tertiary\">\n {formatDuration(segment.durationSeconds)}\n </span>\n </div>\n {segment.isRecategorizable && (\n <button\n type=\"button\"\n aria-label={`Drag to recategorize ${segment.title || meta.label}`}\n className=\"mt-1.5 shrink-0 cursor-grab touch-none text-text-tertiary hover:text-text-secondary active:cursor-grabbing\"\n {...attributes}\n {...listeners}\n >\n <GripVertical className=\"h-4 w-4\" />\n </button>\n )}\n <div\n className={`mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg ${meta.chip}`}\n >\n <SourceIcon className=\"h-4 w-4\" />\n </div>\n <div className=\"min-w-0 flex-1\">\n <p className=\"truncate text-sm font-medium text-text-primary\">\n {segment.title || meta.label}\n </p>\n <div className=\"mt-1 flex flex-wrap items-center gap-2\">\n <span\n className={`inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${meta.chip}`}\n >\n {meta.label}\n </span>\n {projectName !== undefined && (\n <span 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\">\n <FolderOpen className=\"h-3 w-3 shrink-0\" />\n <span className=\"truncate\">{projectName}</span>\n </span>\n )}\n {segment.app && (\n <span className=\"text-xs text-text-secondary\">{segment.app}</span>\n )}\n {provenance &&\n (provenance.isAi ? (\n <span\n className=\"inline-flex items-center gap-1 rounded-full bg-bg-sunken px-2 py-0.5 text-xs font-medium text-text-secondary\"\n title={provenance.detail}\n data-testid=\"timeline-ai-provenance\"\n >\n <Sparkles className=\"h-3 w-3 shrink-0\" aria-hidden />\n {provenance.label}\n <span className=\"sr-only\">. {provenance.detail}</span>\n </span>\n ) : (\n <span\n className=\"text-xs text-text-tertiary\"\n title={provenance.detail}\n >\n {provenance.label}\n </span>\n ))}\n </div>\n </div>\n {segment.isRecategorizable && (\n <select\n aria-label=\"Recategorize activity\"\n disabled={recategorizing}\n value={category}\n onChange={(e) => onRecategorize(segment, e.target.value as Category)}\n 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\"\n >\n {CATEGORY_ORDER.map((c) => (\n <option key={c} value={c}>\n {CATEGORY_META[c].label}\n </option>\n ))}\n </select>\n )}\n </li>\n );\n}\n\nfunction toLocalDateInput(date: Date): string {\n const offset = date.getTimezoneOffset();\n const local = new Date(date.getTime() - offset * 60 * 1000);\n return local.toISOString().slice(0, 10);\n}\n\n/** Latest day the picker offers: planned focus blocks can be up to two weeks ahead. */\nconst MAX_DAYS_AHEAD = 14;\n\nfunction maxPickableDate(): string {\n const d = new Date();\n d.setDate(d.getDate() + MAX_DAYS_AHEAD);\n return toLocalDateInput(d);\n}\n\nfunction dayBounds(dateStr: string): { from: string; to: string } {\n const start = new Date(`${dateStr}T00:00:00`);\n const end = new Date(`${dateStr}T23:59:59.999`);\n return { from: start.toISOString(), to: end.toISOString() };\n}\n\nexport function TimelinePage() {\n const { workspaceId = \"\" } = useTimeCampus();\n const [dateStr, setDateStr] = useState(() => toLocalDateInput(new Date()));\n const [draggingSegment, setDraggingSegment] =\n useState<TimelineSegmentFieldsFragment | null>(null);\n\n const { from, to } = useMemo(() => dayBounds(dateStr), [dateStr]);\n\n const { data, loading, error, refetch } = useGetTimeCampusTimelineQuery({\n variables: { from, to },\n skip: !workspaceId,\n fetchPolicy: \"cache-and-network\",\n });\n\n // Segments carry a `projectId` only; the workspace's projects supply the\n // name to show next to them. A segment whose id isn't in this list simply\n // keeps no project chip — it is never labelled from a guess.\n const { data: projectsData } = useListProjectsQuery({\n variables: { pagination: { limit: 200 } },\n skip: !workspaceId,\n });\n\n const [recategorize, { loading: recategorizing }] =\n useRecategorizeTimeCampusCaptureEventMutation();\n\n const sensors = useSensors(\n useSensor(PointerSensor, { activationConstraint: { distance: 6 } }),\n useSensor(KeyboardSensor),\n );\n\n const timeline = data?.timeCampusTimeline;\n const segments = timeline?.segments ?? [];\n const summary = timeline?.summary;\n\n const projectNameById = useMemo(() => {\n const map = new Map<string, string>();\n for (const project of projectsData?.projects?.items ?? []) {\n map.set(project.id, project.name);\n }\n return map;\n }, [projectsData?.projects?.items]);\n\n const totalsByCategory = useMemo(() => {\n const map = new Map<\n string,\n { totalSeconds: number; segmentCount: number }\n >();\n for (const t of summary?.byCategory ?? []) {\n map.set(t.category, {\n totalSeconds: t.totalSeconds,\n segmentCount: t.segmentCount,\n });\n }\n return map;\n }, [summary]);\n\n const handleRecategorize = async (\n segment: TimelineSegmentFieldsFragment,\n category: Category,\n ) => {\n if (!segment.isRecategorizable || segment.category === category) return;\n await recategorize({\n variables: { id: segment.sourceId, category },\n });\n await refetch();\n };\n\n const handleDragStart = (event: DragStartEvent) => {\n const segment = event.active.data.current?.segment as\n TimelineSegmentFieldsFragment | undefined;\n setDraggingSegment(segment ?? null);\n };\n\n const handleDragEnd = (event: DragEndEvent) => {\n const segment = event.active.data.current?.segment as\n TimelineSegmentFieldsFragment | undefined;\n setDraggingSegment(null);\n const overId = event.over?.id;\n if (!segment || typeof overId !== \"string\") return;\n const category = overId.replace(/^category:/, \"\") as Category;\n if (!CATEGORY_ORDER.includes(category)) return;\n void handleRecategorize(segment, category);\n };\n\n const focusPct =\n summary && summary.focusRatio != null\n ? Math.round(summary.focusRatio * 100)\n : 0;\n\n // The real span of the day, straight off the summary — not inferred from the\n // segment list, which may be paginated or filtered differently.\n const daySpan =\n summary?.firstActivityAt && summary?.lastActivityAt\n ? `${formatTime(summary.firstActivityAt)} – ${formatTime(summary.lastActivityAt)}`\n : null;\n\n return (\n <PageLayout\n title=\"Timeline\"\n description=\"Your day, assembled automatically\"\n 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.\"\n actions={\n <div className=\"flex flex-wrap items-center gap-3\">\n {daySpan && (\n <span 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\">\n <Activity className=\"h-3.5 w-3.5\" />\n {daySpan}\n </span>\n )}\n <label className=\"flex items-center gap-2 text-sm text-text-secondary\">\n <Calendar className=\"h-4 w-4\" />\n <input\n type=\"date\"\n value={dateStr}\n max={maxPickableDate()}\n onChange={(e) => setDateStr(e.target.value)}\n 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\"\n />\n </label>\n </div>\n }\n >\n {loading && !timeline ? (\n <div className=\"space-y-6\">\n <LoadingSkeleton variant=\"card\" count={4} />\n <LoadingSkeleton variant=\"list\" count={6} />\n </div>\n ) : error ? (\n <div className=\"rounded-lg border border-status-error-bg/40 bg-status-error-bg p-4 text-sm text-status-error-text\">\n Failed to load your timeline. Please try again later.\n </div>\n ) : (\n <DndContext\n sensors={sensors}\n onDragStart={handleDragStart}\n onDragEnd={handleDragEnd}\n >\n <div className=\"space-y-6\">\n {/* Summary */}\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4\">\n <StatCard\n featured\n title=\"Tracked time\"\n value={formatDuration(summary?.totalTrackedSeconds ?? 0)}\n icon={<Activity className=\"h-5 w-5\" />}\n description=\"Total activity across the day\"\n />\n <StatCard\n title=\"Focus ratio\"\n value={`${focusPct}%`}\n icon={<Brain className=\"h-5 w-5\" />}\n description=\"Share of time in deep work\"\n />\n <StatCard\n title=\"Context switches\"\n value={summary?.contextSwitches ?? 0}\n icon={<Zap className=\"h-5 w-5\" />}\n description=\"Category changes through the day\"\n />\n <StatCard\n title=\"Longest focus block\"\n value={formatDuration(summary?.longestFocusBlockSeconds ?? 0)}\n icon={<Brain className=\"h-5 w-5\" />}\n description=\"Your deepest uninterrupted stretch\"\n />\n </div>\n\n {/* Category breakdown — also the drop targets for drag-to-recategorize */}\n {segments.length > 0 && (\n <GlassCard treatment=\"glass\" className=\"p-4 sm:p-6\">\n <h2 className=\"mb-1 text-sm font-semibold text-text-primary\">\n Where the time went\n </h2>\n <p className=\"mb-4 text-xs text-text-secondary\">\n Drag a segment from the timeline below onto a category to\n recategorize it — or use its dropdown.\n </p>\n {hasAiCategorizedSegment(segments) && (\n <p\n className=\"mb-4 flex items-start gap-1.5 text-xs text-text-secondary\"\n data-testid=\"timeline-ai-disclaimer\"\n >\n <Sparkles className=\"mt-0.5 h-3 w-3 shrink-0\" aria-hidden />\n <span>\n Some activities here were categorized by AI.{\" \"}\n {AI_CATEGORY_DISCLAIMER}\n </span>\n </p>\n )}\n <div className=\"flex flex-wrap gap-4\">\n {CATEGORY_ORDER.map((category) => {\n const meta = CATEGORY_META[category];\n const total = totalsByCategory.get(category);\n return (\n <DroppableCategoryChip\n key={category}\n category={category}\n label={meta.label}\n dotClassName={meta.dot}\n totalSeconds={total?.totalSeconds ?? 0}\n />\n );\n })}\n </div>\n </GlassCard>\n )}\n\n {/* Chronological timeline */}\n {segments.length === 0 ? (\n <EmptyState\n illustration=\"empty-generic\"\n title=\"No activity captured for this day\"\n description=\"As you track time, hold meetings, run focus sessions, and connect shared integrations, your day assembles here automatically — categorized and in order.\"\n />\n ) : (\n <GlassCard treatment=\"glass\" glow className=\"overflow-hidden\">\n <ol className=\"divide-y divide-border-seam\">\n {segments.map((segment: TimelineSegmentFieldsFragment) =>\n isFocusSegment(segment) ? (\n <FocusSegmentRow key={segment.id} segment={segment} />\n ) : (\n <DraggableSegmentRow\n key={segment.id}\n segment={segment}\n category={(segment.category as Category) ?? \"OTHER\"}\n projectName={\n segment.projectId\n ? projectNameById.get(segment.projectId)\n : undefined\n }\n recategorizing={recategorizing}\n onRecategorize={handleRecategorize}\n />\n ),\n )}\n </ol>\n </GlassCard>\n )}\n </div>\n\n <DragOverlay>\n {draggingSegment && (\n <div className=\"flex items-center gap-2 rounded-lg border border-border-seam bg-bg-surface px-3 py-2 shadow-pop\">\n <GripVertical className=\"h-4 w-4 text-text-tertiary\" />\n <span className=\"text-sm font-medium text-text-primary\">\n {draggingSegment.title ||\n CATEGORY_META[\n (draggingSegment.category as Category) ?? \"OTHER\"\n ].label}\n </span>\n </div>\n )}\n </DragOverlay>\n </DndContext>\n )}\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAwDA,IAAM,IAGF;CACF,WAAW;EACT,OAAO;EACP,MAAM;EACN,KAAK;EACL,MAAM;CACR;CACA,SAAS;EACP,OAAO;EACP,MAAM;EACN,KAAK;EACL,MAAM;CACR;CACA,eAAe;EACb,OAAO;EACP,MAAM;EACN,KAAK;EACL,MAAM;CACR;CACA,OAAO;EACL,OAAO;EACP,MAAM;EACN,KAAK;EACL,MAAM;CACR;CACA,OAAO;EACL,OAAO;EACP,MAAM;EACN,KAAK;EACL,MAAM;CACR;AACF,GAEM,IAA4C;CAChD,YAAY;CACZ,SAAS;CACT,UAAU;CACV,OAAO;CACP,SAAS;CACT,eAAe;CACf,aAAa;AACf;AAGA,SAAS,EAAe,GAAiD;CACvE,OAAO,EAAQ,WAAW,mBAAmB,EAAQ,WAAW;AAClE;AAOA,SAAS,EAAgB,EACvB,cAGC;CAC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AAC,GAAD;SAAU,WAAU;SAA0B,eAAA;QAAa,CAAA,GAC3D,kBAAC,QAAD,EAAA,UAAA;SAAM;SACyC;;QAEzC,EAAA,CAAA,CACL;;OAEL,kBAAC,OAAD;QAAK,WAAU;QACZ,UAAA,EAAe,KAAK,MAAa;SAChC,IAAM,IAAO,EAAc,IACrB,IAAQ,GAAiB,IAAI,CAAQ;SAC3C,OACE,kBAAC,GAAD;UAEY;UACV,OAAO,EAAK;UACZ,cAAc,EAAK;UACnB,cAAc,GAAO,gBAAgB;SACtC,GALM,CAKN;QAEL,CAAC;OACE,CAAA;MACI;;KAIZ,EAAS,WAAW,IACnB,kBAAC,GAAD;MACE,cAAa;MACb,OAAM;MACN,aAAY;KACb,CAAA,IAED,kBAAC,GAAD;MAAW,WAAU;MAAQ,MAAA;MAAK,WAAU;MAC1C,UAAA,kBAAC,MAAD;OAAI,WAAU;OACX,UAAA,EAAS,KAAK,MACb,EAAe,CAAO,IACpB,kBAAC,GAAD,EAA2C,WAAU,GAA/B,EAAQ,EAAuB,IAErD,kBAAC,IAAD;QAEW;QACT,UAAW,EAAQ,YAAyB;QAC5C,aACE,EAAQ,YACJ,GAAgB,IAAI,EAAQ,SAAS,IACrC,KAAA;QAEU;QAChB,gBAAgB;OACjB,GAVM,EAAQ,EAUd,CAEL;MACE,CAAA;KACK,CAAA;IAEV;GAEL,CAAA,GAAA,kBAAC,GAAD,EAAA,UACG,KACC,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,kBAAC,GAAD,EAAc,WAAU,6BAA8B,CAAA,GACtD,kBAAC,QAAD;KAAM,WAAU;KACb,UAAA,EAAgB,SACf,EACG,EAAgB,YAAyB,QAC3C,CAAC;IACA,CAAA,CACH;GAEI,CAAA,EAAA,CAAA,CACH;;CAEJ,CAAA;AAEhB"}
1
+ {"version":3,"file":"TimelinePage.js","names":[],"sources":["../../../../src/timecampus/pages/timeline/TimelinePage.tsx"],"sourcesContent":["import { useMemo, useState } from \"react\";\nimport {\n DndContext,\n DragOverlay,\n KeyboardSensor,\n PointerSensor,\n useDraggable,\n useDroppable,\n useSensor,\n useSensors,\n type DragEndEvent,\n type DragStartEvent,\n} from \"@dnd-kit/core\";\nimport {\n Activity,\n Brain,\n Calendar,\n CalendarClock,\n Check,\n Coffee,\n FolderOpen,\n Github,\n GripVertical,\n MessageSquare,\n Shield,\n Sparkles,\n Users,\n X,\n Zap,\n} from \"lucide-react\";\nimport { GlassCard } from \"@burdenoff/fe-libs/ui\";\nimport { PageLayout } from \"../../components/PageLayout\";\nimport { StatCard } from \"../../components/StatCard\";\nimport { EmptyState } from \"../../components/EmptyState\";\nimport { ToastContainer, useToast } from \"../../components/Toast\";\nimport { LoadingSkeleton } from \"../../components/LoadingSkeleton\";\nimport { formatDuration, formatTime } from \"../../utils/helpers\";\nimport { calendarHoldLabel } from \"../focus/focusHelpers\";\nimport {\n AI_CATEGORY_DISCLAIMER,\n hasAiCategorizedSegment,\n segmentProvenance,\n} from \"./timelineProvenance\";\nimport {\n driftLabel,\n focusStatusLabel,\n plannedDrift,\n protectedPercent,\n} from \"./timelineFocus\";\nimport {\n pendingSuggestion,\n pendingSuggestions,\n type PendingSuggestion,\n} from \"./timelineSuggestions\";\nimport { useTimeCampus } from \"../../providers/TimeCampusProvider\";\nimport {\n useAcceptTimeCampusCaptureEventSuggestionMutation,\n useGetTimeCampusTimelineQuery,\n useListProjectsQuery,\n useRecategorizeTimeCampusCaptureEventMutation,\n useRejectTimeCampusCaptureEventSuggestionMutation,\n useSetTimeCampusCaptureEventProjectMutation,\n useSuggestTimeCampusCaptureEventProjectMutation,\n type TimelineSegmentFieldsFragment,\n} from \"@/generated/wspace-operations\";\n\ntype Category = \"MEETING\" | \"DEEP_WORK\" | \"COMMUNICATION\" | \"BREAK\" | \"OTHER\";\n\nconst CATEGORY_META: Record<\n Category,\n { label: string; icon: typeof Brain; dot: string; chip: string }\n> = {\n DEEP_WORK: {\n label: \"Deep work\",\n icon: Brain,\n dot: \"bg-status-success-bg\",\n chip: \"bg-status-success-bg text-status-success-text\",\n },\n MEETING: {\n label: \"Meeting\",\n icon: Users,\n dot: \"bg-status-info-bg\",\n chip: \"bg-status-info-bg text-status-info-text\",\n },\n COMMUNICATION: {\n label: \"Communication\",\n icon: MessageSquare,\n dot: \"bg-status-warning-bg\",\n chip: \"bg-status-warning-bg text-status-warning-text\",\n },\n BREAK: {\n label: \"Break\",\n icon: Coffee,\n dot: \"bg-bg-sunken\",\n chip: \"bg-bg-sunken text-text-secondary\",\n },\n OTHER: {\n label: \"Other\",\n icon: Activity,\n dot: \"bg-bg-sunken\",\n chip: \"bg-bg-sunken text-text-secondary\",\n },\n};\n\nconst SOURCE_ICON: Record<string, typeof Brain> = {\n TIME_ENTRY: Zap,\n MEETING: Users,\n POMODORO: Brain,\n EMAIL: MessageSquare,\n CAPTURE: Github,\n FOCUS_SESSION: Shield,\n FOCUS_BLOCK: CalendarClock,\n};\n\n/** Focus sessions and planned focus blocks get their own row (BOFF-9678). */\nfunction isFocusSegment(segment: TimelineSegmentFieldsFragment): boolean {\n return segment.source === \"FOCUS_SESSION\" || segment.source === \"FOCUS_BLOCK\";\n}\n\n/**\n * A focus session (what happened) or a planned focus block: planned vs\n * actual window, and protected vs interrupted time. Planned blocks are drawn\n * dashed and are not counted in the day's totals.\n */\nfunction FocusSegmentRow({\n segment,\n}: {\n segment: TimelineSegmentFieldsFragment;\n}) {\n const focus = segment.focus;\n if (!focus) return null;\n const planned = segment.isPlanned;\n const Icon = planned ? CalendarClock : Shield;\n const status = focusStatusLabel(planned, focus, segment.endTime);\n const percent = planned ? null : protectedPercent(focus);\n const drift = planned\n ? null\n : plannedDrift(segment.startTime, segment.endTime, focus);\n const hold = calendarHoldLabel(focus.calendarHoldStatus);\n\n return (\n <li\n className={`flex items-start gap-3 p-4 ${\n planned ? \"bg-bg-sunken/30\" : \"\"\n }`}\n data-testid={planned ? \"timeline-focus-block\" : \"timeline-focus-session\"}\n >\n <div className=\"flex w-16 shrink-0 flex-col items-end pt-0.5 text-xs tabular-nums text-text-secondary\">\n <span>{formatTime(segment.startTime)}</span>\n <span className=\"text-text-tertiary\">\n {formatDuration(segment.durationSeconds)}\n </span>\n </div>\n <div\n className={`mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg ${\n planned\n ? \"border border-dashed border-status-success-text/60 text-status-success-text\"\n : \"bg-status-success-bg text-status-success-text\"\n }`}\n >\n <Icon className=\"h-4 w-4\" />\n </div>\n <div className=\"min-w-0 flex-1\">\n <p className=\"truncate text-sm font-medium text-text-primary\">\n {segment.title || (planned ? \"Planned focus block\" : \"Focus session\")}\n </p>\n <div className=\"mt-1 flex flex-wrap items-center gap-2\">\n <span\n className={`inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${\n planned\n ? \"border border-dashed border-border-seam text-text-secondary\"\n : \"bg-status-success-bg text-status-success-text\"\n }`}\n data-testid=\"timeline-focus-status\"\n >\n {status}\n </span>\n {focus.protectionLevel === \"STRICT\" && (\n <span className=\"text-xs text-text-secondary\">Strict</span>\n )}\n {focus.plannedStartTime && focus.plannedEndTime && (\n <span className=\"text-xs tabular-nums text-text-secondary\">\n Planned {formatTime(focus.plannedStartTime)} –{\" \"}\n {formatTime(focus.plannedEndTime)}\n </span>\n )}\n {!planned && segment.endTime && (\n <span className=\"text-xs tabular-nums text-text-secondary\">\n Actual {formatTime(segment.startTime)} –{\" \"}\n {formatTime(segment.endTime)}\n </span>\n )}\n {drift && (\n <span className=\"text-xs text-text-tertiary\">\n Started {driftLabel(drift.startMinutes)}\n {drift.endMinutes !== null &&\n `, ended ${driftLabel(drift.endMinutes, \"over\", \"short\")}`}\n </span>\n )}\n {hold && <span className=\"text-xs text-text-tertiary\">{hold}</span>}\n </div>\n {!planned && (\n <div className=\"mt-2\" data-testid=\"timeline-focus-protection\">\n <div\n className=\"flex h-1.5 w-full max-w-xs overflow-hidden rounded-full bg-bg-sunken\"\n role=\"img\"\n aria-label={`${percent ?? 0}% of this session stayed protected`}\n >\n <span\n className=\"h-full bg-status-success-text\"\n style={{ width: `${percent ?? 0}%` }}\n />\n <span\n className=\"h-full bg-status-warning-text\"\n style={{ width: `${percent === null ? 0 : 100 - percent}%` }}\n />\n </div>\n <p className=\"mt-1 text-xs tabular-nums text-text-secondary\">\n Protected {formatDuration(focus.protectedSeconds)} · Interrupted{\" \"}\n {formatDuration(focus.interruptedSeconds)} ·{\" \"}\n {focus.interruptionCount} interruption\n {focus.interruptionCount === 1 ? \"\" : \"s\"}\n {focus.blockedAttemptCount > 0 &&\n ` · ${focus.blockedAttemptCount} distraction${\n focus.blockedAttemptCount === 1 ? \"\" : \"s\"\n } blocked`}\n </p>\n </div>\n )}\n {planned && (\n <p className=\"mt-1 text-xs text-text-tertiary\">\n Not counted in the day&apos;s totals until you run it.\n </p>\n )}\n </div>\n </li>\n );\n}\n\nconst CATEGORY_ORDER: Category[] = [\n \"DEEP_WORK\",\n \"MEETING\",\n \"COMMUNICATION\",\n \"BREAK\",\n \"OTHER\",\n];\n\n/** Project actions on a captured activity (BOFF-4146). */\ninterface ProjectActions {\n /** The workspace's projects, for the project picker. */\n projects: ReadonlyArray<{ id: string; name: string }>;\n /** True while any project change is in flight. */\n busy: boolean;\n onAccept: (suggestion: PendingSuggestion) => void;\n onReject: (suggestion: PendingSuggestion) => void;\n onSetProject: (\n segment: TimelineSegmentFieldsFragment,\n projectId: string | null,\n ) => void;\n onSuggest: (segment: TimelineSegmentFieldsFragment) => void;\n}\n\n/**\n * A pending project suggestion with one-click approval. Nothing is assigned\n * until the person accepts it.\n */\nfunction ProjectSuggestionStrip({\n suggestion,\n busy,\n onAccept,\n onReject,\n}: {\n suggestion: PendingSuggestion;\n busy: boolean;\n onAccept: (suggestion: PendingSuggestion) => void;\n onReject: (suggestion: PendingSuggestion) => void;\n}) {\n return (\n <div\n 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\"\n data-testid=\"timeline-project-suggestion\"\n >\n <Sparkles className=\"h-3.5 w-3.5 shrink-0 text-primary\" aria-hidden />\n <span className=\"text-xs text-text-secondary\">\n Suggested project{\" \"}\n <span className=\"font-medium text-text-primary\">\n {suggestion.projectName}\n </span>{\" \"}\n · {suggestion.confidencePercent}% · {suggestion.reason}\n </span>\n <span className=\"ml-auto flex items-center gap-1\">\n <button\n type=\"button\"\n disabled={busy}\n onClick={() => onAccept(suggestion)}\n aria-label={`Accept project ${suggestion.projectName}`}\n 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\"\n >\n <Check className=\"h-3 w-3\" />\n Accept\n </button>\n <button\n type=\"button\"\n disabled={busy}\n onClick={() => onReject(suggestion)}\n aria-label={`Dismiss suggested project ${suggestion.projectName}`}\n 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\"\n >\n <X className=\"h-3 w-3\" />\n Dismiss\n </button>\n </span>\n </div>\n );\n}\n\n/** Droppable target: a category chip in the \"Where the time went\" summary. */\nfunction DroppableCategoryChip({\n category,\n label,\n dotClassName,\n totalSeconds,\n}: {\n category: Category;\n label: string;\n dotClassName: string;\n totalSeconds: number;\n}) {\n const { isOver, setNodeRef } = useDroppable({ id: `category:${category}` });\n return (\n <div\n ref={setNodeRef}\n className={`flex items-center gap-2 rounded-lg border px-3 py-2 transition-colors ${\n isOver\n ? \"border-action-primary-bg bg-action-primary-bg/10\"\n : \"border-border-seam bg-bg-surface\"\n }`}\n >\n <span\n className={`inline-block h-2.5 w-2.5 rounded-full ${dotClassName}`}\n aria-hidden\n />\n <span className=\"text-sm font-medium text-text-primary\">{label}</span>\n <span className=\"text-sm tabular-nums text-text-secondary\">\n {formatDuration(totalSeconds)}\n </span>\n {isOver && (\n <span className=\"text-xs font-medium text-primary\">Drop here</span>\n )}\n </div>\n );\n}\n\n/** Draggable row for a single timeline segment, with the existing dropdown kept as an accessible fallback. */\nfunction DraggableSegmentRow({\n segment,\n category,\n projectName,\n suggestion,\n recategorizing,\n onRecategorize,\n projectActions,\n}: {\n segment: TimelineSegmentFieldsFragment;\n category: Category;\n /** Resolved name for `segment.projectId`; undefined when it carries none. */\n projectName: string | undefined;\n /** Pending project suggestion to review, if any. */\n suggestion: PendingSuggestion | null;\n recategorizing: boolean;\n onRecategorize: (\n segment: TimelineSegmentFieldsFragment,\n category: Category,\n ) => void;\n projectActions: ProjectActions;\n}) {\n const meta = CATEGORY_META[category] ?? CATEGORY_META.OTHER;\n const SourceIcon = SOURCE_ICON[segment.source] ?? Activity;\n const provenance = segmentProvenance(segment);\n const isCapture = segment.source === \"CAPTURE\";\n const canSuggest =\n isCapture &&\n !segment.projectId &&\n !suggestion &&\n projectActions.projects.length > 0;\n const { attributes, listeners, setNodeRef, isDragging } = useDraggable({\n id: segment.id,\n data: { segment },\n disabled: !segment.isRecategorizable,\n });\n\n return (\n <li\n ref={setNodeRef}\n className={`flex items-start gap-3 p-4 transition-colors hover:bg-bg-sunken/50 ${\n isDragging ? \"opacity-40\" : \"\"\n }`}\n >\n <div className=\"flex w-16 shrink-0 flex-col items-end pt-0.5 text-xs tabular-nums text-text-secondary\">\n <span>{formatTime(segment.startTime)}</span>\n <span className=\"text-text-tertiary\">\n {formatDuration(segment.durationSeconds)}\n </span>\n </div>\n {segment.isRecategorizable && (\n <button\n type=\"button\"\n aria-label={`Drag to recategorize ${segment.title || meta.label}`}\n className=\"mt-1.5 shrink-0 cursor-grab touch-none text-text-tertiary hover:text-text-secondary active:cursor-grabbing\"\n {...attributes}\n {...listeners}\n >\n <GripVertical className=\"h-4 w-4\" />\n </button>\n )}\n <div\n className={`mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg ${meta.chip}`}\n >\n <SourceIcon className=\"h-4 w-4\" />\n </div>\n <div className=\"min-w-0 flex-1\">\n <p className=\"truncate text-sm font-medium text-text-primary\">\n {segment.title || meta.label}\n </p>\n <div className=\"mt-1 flex flex-wrap items-center gap-2\">\n <span\n className={`inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${meta.chip}`}\n >\n {meta.label}\n </span>\n {projectName !== undefined && (\n <span 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\">\n <FolderOpen className=\"h-3 w-3 shrink-0\" />\n <span className=\"truncate\">{projectName}</span>\n </span>\n )}\n {segment.app && (\n <span className=\"text-xs text-text-secondary\">{segment.app}</span>\n )}\n {provenance &&\n (provenance.isAi ? (\n <span\n className=\"inline-flex items-center gap-1 rounded-full bg-bg-sunken px-2 py-0.5 text-xs font-medium text-text-secondary\"\n title={provenance.detail}\n data-testid=\"timeline-ai-provenance\"\n >\n <Sparkles className=\"h-3 w-3 shrink-0\" aria-hidden />\n {provenance.label}\n <span className=\"sr-only\">. {provenance.detail}</span>\n </span>\n ) : (\n <span\n className=\"text-xs text-text-tertiary\"\n title={provenance.detail}\n >\n {provenance.label}\n </span>\n ))}\n </div>\n {suggestion && (\n <ProjectSuggestionStrip\n suggestion={suggestion}\n busy={projectActions.busy}\n onAccept={projectActions.onAccept}\n onReject={projectActions.onReject}\n />\n )}\n </div>\n <div className=\"flex shrink-0 flex-col items-end gap-1.5\">\n {segment.isRecategorizable && (\n <select\n aria-label=\"Recategorize activity\"\n disabled={recategorizing}\n value={category}\n onChange={(e) =>\n onRecategorize(segment, e.target.value as Category)\n }\n 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\"\n >\n {CATEGORY_ORDER.map((c) => (\n <option key={c} value={c}>\n {CATEGORY_META[c].label}\n </option>\n ))}\n </select>\n )}\n {isCapture && projectActions.projects.length > 0 && (\n <select\n aria-label=\"Assign project\"\n disabled={projectActions.busy}\n value={segment.projectId ?? \"\"}\n onChange={(e) =>\n projectActions.onSetProject(segment, e.target.value || null)\n }\n 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\"\n >\n <option value=\"\">No project</option>\n {projectActions.projects.map((project) => (\n <option key={project.id} value={project.id}>\n {project.name}\n </option>\n ))}\n </select>\n )}\n {canSuggest && (\n <button\n type=\"button\"\n disabled={projectActions.busy}\n onClick={() => projectActions.onSuggest(segment)}\n className=\"inline-flex items-center gap-1 text-xs font-medium text-primary hover:underline disabled:opacity-50\"\n >\n <Sparkles className=\"h-3 w-3\" />\n Suggest project\n </button>\n )}\n </div>\n </li>\n );\n}\n\nfunction errorMessage(err: unknown): string {\n return err instanceof Error ? err.message : \"Something went wrong\";\n}\n\nfunction toLocalDateInput(date: Date): string {\n const offset = date.getTimezoneOffset();\n const local = new Date(date.getTime() - offset * 60 * 1000);\n return local.toISOString().slice(0, 10);\n}\n\n/** Latest day the picker offers: planned focus blocks can be up to two weeks ahead. */\nconst MAX_DAYS_AHEAD = 14;\n\nfunction maxPickableDate(): string {\n const d = new Date();\n d.setDate(d.getDate() + MAX_DAYS_AHEAD);\n return toLocalDateInput(d);\n}\n\nfunction dayBounds(dateStr: string): { from: string; to: string } {\n const start = new Date(`${dateStr}T00:00:00`);\n const end = new Date(`${dateStr}T23:59:59.999`);\n return { from: start.toISOString(), to: end.toISOString() };\n}\n\nexport function TimelinePage() {\n const { workspaceId = \"\" } = useTimeCampus();\n const { toasts, addToast, dismissToast } = useToast();\n const [dateStr, setDateStr] = useState(() => toLocalDateInput(new Date()));\n const [draggingSegment, setDraggingSegment] =\n useState<TimelineSegmentFieldsFragment | null>(null);\n\n const { from, to } = useMemo(() => dayBounds(dateStr), [dateStr]);\n\n const { data, loading, error, refetch } = useGetTimeCampusTimelineQuery({\n variables: { from, to },\n skip: !workspaceId,\n fetchPolicy: \"cache-and-network\",\n });\n\n // Segments carry a `projectId` only; the workspace's projects supply the\n // name to show next to them. A segment whose id isn't in this list simply\n // keeps no project chip — it is never labelled from a guess.\n const { data: projectsData } = useListProjectsQuery({\n variables: { pagination: { limit: 200 } },\n skip: !workspaceId,\n });\n\n const [recategorize, { loading: recategorizing }] =\n useRecategorizeTimeCampusCaptureEventMutation();\n const [acceptSuggestion, { loading: accepting }] =\n useAcceptTimeCampusCaptureEventSuggestionMutation();\n const [rejectSuggestion, { loading: rejecting }] =\n useRejectTimeCampusCaptureEventSuggestionMutation();\n const [setEventProject, { loading: settingProject }] =\n useSetTimeCampusCaptureEventProjectMutation();\n const [suggestProject, { loading: suggesting }] =\n useSuggestTimeCampusCaptureEventProjectMutation();\n const projectBusy = accepting || rejecting || settingProject || suggesting;\n\n const sensors = useSensors(\n useSensor(PointerSensor, { activationConstraint: { distance: 6 } }),\n useSensor(KeyboardSensor),\n );\n\n const timeline = data?.timeCampusTimeline;\n const segments = useMemo(() => timeline?.segments ?? [], [timeline]);\n const summary = timeline?.summary;\n\n const projectNameById = useMemo(() => {\n const map = new Map<string, string>();\n for (const project of projectsData?.projects?.items ?? []) {\n map.set(project.id, project.name);\n }\n return map;\n }, [projectsData?.projects?.items]);\n\n const projects = useMemo(\n () => Array.from(projectNameById, ([id, name]) => ({ id, name })),\n [projectNameById],\n );\n\n // Suggestions waiting for review across the day, for \"Accept all\".\n const pending = useMemo(\n () => pendingSuggestions(segments, projectNameById),\n [segments, projectNameById],\n );\n\n const totalsByCategory = useMemo(() => {\n const map = new Map<\n string,\n { totalSeconds: number; segmentCount: number }\n >();\n for (const t of summary?.byCategory ?? []) {\n map.set(t.category, {\n totalSeconds: t.totalSeconds,\n segmentCount: t.segmentCount,\n });\n }\n return map;\n }, [summary]);\n\n const handleRecategorize = async (\n segment: TimelineSegmentFieldsFragment,\n category: Category,\n ) => {\n if (!segment.isRecategorizable || segment.category === category) return;\n await recategorize({\n variables: { id: segment.sourceId, category },\n });\n await refetch();\n };\n\n /** Run a project change, then refresh the day and report the outcome. */\n const runProjectChange = async (\n change: () => Promise<unknown>,\n success: string,\n ) => {\n try {\n await change();\n await refetch();\n addToast({ title: success, variant: \"success\" });\n } catch (err) {\n addToast({ title: errorMessage(err), variant: \"error\" });\n }\n };\n\n const handleAccept = (suggestion: PendingSuggestion) =>\n runProjectChange(\n () => acceptSuggestion({ variables: { id: suggestion.captureEventId } }),\n `Assigned to ${suggestion.projectName}`,\n );\n\n const handleReject = (suggestion: PendingSuggestion) =>\n runProjectChange(\n () => rejectSuggestion({ variables: { id: suggestion.captureEventId } }),\n \"Suggestion dismissed\",\n );\n\n const handleSetProject = (\n segment: TimelineSegmentFieldsFragment,\n projectId: string | null,\n ) => {\n if ((segment.projectId ?? null) === projectId) return;\n const name = projectId ? projectNameById.get(projectId) : undefined;\n return runProjectChange(\n () => setEventProject({ variables: { id: segment.sourceId, projectId } }),\n name ? `Assigned to ${name}` : \"Project removed\",\n );\n };\n\n const handleSuggest = async (segment: TimelineSegmentFieldsFragment) => {\n try {\n const result = await suggestProject({\n variables: { id: segment.sourceId },\n });\n const suggestion = result.data?.suggestTimeCampusCaptureEventCategory;\n await refetch();\n addToast(\n suggestion?.suggestedProjectId\n ? {\n title: `Suggested ${suggestion.suggestedProjectName ?? \"a project\"}`,\n description: \"Accept or dismiss it on the activity.\",\n variant: \"info\",\n }\n : {\n title: \"No confident project match\",\n description: \"Pick a project from the list instead.\",\n variant: \"info\",\n },\n );\n } catch (err) {\n addToast({ title: errorMessage(err), variant: \"error\" });\n }\n };\n\n const handleAcceptAll = async () => {\n let accepted = 0;\n try {\n for (const suggestion of pending) {\n await acceptSuggestion({\n variables: { id: suggestion.captureEventId },\n });\n accepted++;\n }\n addToast({\n title: `Accepted ${accepted} project ${accepted === 1 ? \"suggestion\" : \"suggestions\"}`,\n variant: \"success\",\n });\n } catch (err) {\n addToast({\n title: `Accepted ${accepted} of ${pending.length}`,\n description: errorMessage(err),\n variant: \"error\",\n });\n } finally {\n await refetch();\n }\n };\n\n const projectActions: ProjectActions = {\n projects,\n busy: projectBusy,\n onAccept: (suggestion) => void handleAccept(suggestion),\n onReject: (suggestion) => void handleReject(suggestion),\n onSetProject: (segment, projectId) =>\n void handleSetProject(segment, projectId),\n onSuggest: (segment) => void handleSuggest(segment),\n };\n\n const handleDragStart = (event: DragStartEvent) => {\n const segment = event.active.data.current?.segment as\n TimelineSegmentFieldsFragment | undefined;\n setDraggingSegment(segment ?? null);\n };\n\n const handleDragEnd = (event: DragEndEvent) => {\n const segment = event.active.data.current?.segment as\n TimelineSegmentFieldsFragment | undefined;\n setDraggingSegment(null);\n const overId = event.over?.id;\n if (!segment || typeof overId !== \"string\") return;\n const category = overId.replace(/^category:/, \"\") as Category;\n if (!CATEGORY_ORDER.includes(category)) return;\n void handleRecategorize(segment, category);\n };\n\n const focusPct =\n summary && summary.focusRatio != null\n ? Math.round(summary.focusRatio * 100)\n : 0;\n\n // The real span of the day, straight off the summary — not inferred from the\n // segment list, which may be paginated or filtered differently.\n const daySpan =\n summary?.firstActivityAt && summary?.lastActivityAt\n ? `${formatTime(summary.firstActivityAt)} – ${formatTime(summary.lastActivityAt)}`\n : null;\n\n return (\n <PageLayout\n title=\"Timeline\"\n description=\"Your day, assembled automatically\"\n 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.\"\n actions={\n <div className=\"flex flex-wrap items-center gap-3\">\n {daySpan && (\n <span 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\">\n <Activity className=\"h-3.5 w-3.5\" />\n {daySpan}\n </span>\n )}\n <label className=\"flex items-center gap-2 text-sm text-text-secondary\">\n <Calendar className=\"h-4 w-4\" />\n <input\n type=\"date\"\n value={dateStr}\n max={maxPickableDate()}\n onChange={(e) => setDateStr(e.target.value)}\n 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\"\n />\n </label>\n </div>\n }\n >\n {loading && !timeline ? (\n <div className=\"space-y-6\">\n <LoadingSkeleton variant=\"card\" count={4} />\n <LoadingSkeleton variant=\"list\" count={6} />\n </div>\n ) : error ? (\n <div className=\"rounded-lg border border-status-error-bg/40 bg-status-error-bg p-4 text-sm text-status-error-text\">\n Failed to load your timeline. Please try again later.\n </div>\n ) : (\n <DndContext\n sensors={sensors}\n onDragStart={handleDragStart}\n onDragEnd={handleDragEnd}\n >\n <div className=\"space-y-6\">\n {/* Summary */}\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4\">\n <StatCard\n featured\n title=\"Tracked time\"\n value={formatDuration(summary?.totalTrackedSeconds ?? 0)}\n icon={<Activity className=\"h-5 w-5\" />}\n description=\"Total activity across the day\"\n />\n <StatCard\n title=\"Focus ratio\"\n value={`${focusPct}%`}\n icon={<Brain className=\"h-5 w-5\" />}\n description=\"Share of time in deep work\"\n />\n <StatCard\n title=\"Context switches\"\n value={summary?.contextSwitches ?? 0}\n icon={<Zap className=\"h-5 w-5\" />}\n description=\"Category changes through the day\"\n />\n <StatCard\n title=\"Longest focus block\"\n value={formatDuration(summary?.longestFocusBlockSeconds ?? 0)}\n icon={<Brain className=\"h-5 w-5\" />}\n description=\"Your deepest uninterrupted stretch\"\n />\n </div>\n\n {/* Category breakdown — also the drop targets for drag-to-recategorize */}\n {segments.length > 0 && (\n <GlassCard treatment=\"glass\" className=\"p-4 sm:p-6\">\n <h2 className=\"mb-1 text-sm font-semibold text-text-primary\">\n Where the time went\n </h2>\n <p className=\"mb-4 text-xs text-text-secondary\">\n Drag a segment from the timeline below onto a category to\n recategorize it — or use its dropdown.\n </p>\n {hasAiCategorizedSegment(segments) && (\n <p\n className=\"mb-4 flex items-start gap-1.5 text-xs text-text-secondary\"\n data-testid=\"timeline-ai-disclaimer\"\n >\n <Sparkles className=\"mt-0.5 h-3 w-3 shrink-0\" aria-hidden />\n <span>\n Some activities here were categorized by AI.{\" \"}\n {AI_CATEGORY_DISCLAIMER}\n </span>\n </p>\n )}\n <div className=\"flex flex-wrap gap-4\">\n {CATEGORY_ORDER.map((category) => {\n const meta = CATEGORY_META[category];\n const total = totalsByCategory.get(category);\n return (\n <DroppableCategoryChip\n key={category}\n category={category}\n label={meta.label}\n dotClassName={meta.dot}\n totalSeconds={total?.totalSeconds ?? 0}\n />\n );\n })}\n </div>\n </GlassCard>\n )}\n\n {/* Project suggestions waiting for review (BOFF-4146) */}\n {pending.length > 0 && (\n <div\n className=\"flex flex-wrap items-center gap-3 rounded-lg border border-border-seam bg-bg-sunken/40 px-4 py-3\"\n data-testid=\"timeline-suggestions-banner\"\n >\n <Sparkles className=\"h-4 w-4 shrink-0 text-primary\" />\n <p className=\"text-sm text-text-secondary\">\n <span className=\"font-medium text-text-primary\">\n {pending.length} project{\" \"}\n {pending.length === 1 ? \"suggestion\" : \"suggestions\"}\n </span>{\" \"}\n waiting for review. Nothing is assigned until you accept.\n </p>\n <button\n type=\"button\"\n disabled={projectBusy}\n onClick={() => void handleAcceptAll()}\n 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\"\n >\n <Check className=\"h-3.5 w-3.5\" />\n Accept all\n </button>\n </div>\n )}\n\n {/* Chronological timeline */}\n {segments.length === 0 ? (\n <EmptyState\n illustration=\"empty-generic\"\n title=\"No activity captured for this day\"\n description=\"As you track time, hold meetings, run focus sessions, and connect shared integrations, your day assembles here automatically — categorized and in order.\"\n />\n ) : (\n <GlassCard treatment=\"glass\" glow className=\"overflow-hidden\">\n <ol className=\"divide-y divide-border-seam\">\n {segments.map((segment: TimelineSegmentFieldsFragment) =>\n isFocusSegment(segment) ? (\n <FocusSegmentRow key={segment.id} segment={segment} />\n ) : (\n <DraggableSegmentRow\n key={segment.id}\n segment={segment}\n category={(segment.category as Category) ?? \"OTHER\"}\n projectName={\n segment.projectId\n ? projectNameById.get(segment.projectId)\n : undefined\n }\n suggestion={pendingSuggestion(segment, projectNameById)}\n recategorizing={recategorizing}\n onRecategorize={handleRecategorize}\n projectActions={projectActions}\n />\n ),\n )}\n </ol>\n </GlassCard>\n )}\n </div>\n\n <DragOverlay>\n {draggingSegment && (\n <div className=\"flex items-center gap-2 rounded-lg border border-border-seam bg-bg-surface px-3 py-2 shadow-pop\">\n <GripVertical className=\"h-4 w-4 text-text-tertiary\" />\n <span className=\"text-sm font-medium text-text-primary\">\n {draggingSegment.title ||\n CATEGORY_META[\n (draggingSegment.category as Category) ?? \"OTHER\"\n ].label}\n </span>\n </div>\n )}\n </DragOverlay>\n </DndContext>\n )}\n <ToastContainer toasts={toasts} onDismiss={dismissToast} />\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAoEA,IAAM,IAGF;CACF,WAAW;EACT,OAAO;EACP,MAAM;EACN,KAAK;EACL,MAAM;CACR;CACA,SAAS;EACP,OAAO;EACP,MAAM;EACN,KAAK;EACL,MAAM;CACR;CACA,eAAe;EACb,OAAO;EACP,MAAM;EACN,KAAK;EACL,MAAM;CACR;CACA,OAAO;EACL,OAAO;EACP,MAAM;EACN,KAAK;EACL,MAAM;CACR;CACA,OAAO;EACL,OAAO;EACP,MAAM;EACN,KAAK;EACL,MAAM;CACR;AACF,GAEM,IAA4C;CAChD,YAAY;CACZ,SAAS;CACT,UAAU;CACV,OAAO;CACP,SAAS;CACT,eAAe;CACf,aAAa;AACf;AAGA,SAAS,GAAe,GAAiD;CACvE,OAAO,EAAQ,WAAW,mBAAmB,EAAQ,WAAW;AAClE;AAOA,SAAS,GAAgB,EACvB,cAGC;CACD,IAAM,IAAQ,EAAQ;CACtB,IAAI,CAAC,GAAO,OAAO;CACnB,IAAM,IAAU,EAAQ,WAClB,IAAO,IAAU,IAAgB,GACjC,IAAS,GAAiB,GAAS,GAAO,EAAQ,OAAO,GACzD,IAAU,IAAU,OAAO,GAAiB,CAAK,GACjD,IAAQ,IACV,OACA,EAAa,EAA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AAA,EAAgB,SACf,EACG,EAAgB,YAAyB,QAC3C,CAAC;IACA,CAAA,CACH;GAEI,CAAA,EAAA,CAAA,CACH;EAEd,CAAA,GAAA,kBAAC,IAAD;GAAwB;GAAQ,WAAW;EAAe,CAAA,CAChD;;AAEhB"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Project suggestions on the timeline (BOFF-4146).
3
+ *
4
+ * The service stores a pending project suggestion on each captured activity
5
+ * (learned from the person's earlier choices, matched against project names,
6
+ * or refined by a model when one is configured). Nothing is assigned until
7
+ * the person accepts it; these helpers decide what the timeline shows.
8
+ */
9
+ /** The fields of a timeline segment the suggestion UI reads. */
10
+ export interface SuggestionSegment {
11
+ source: string;
12
+ sourceId: string;
13
+ projectId?: string | null;
14
+ suggestedProjectId?: string | null;
15
+ categorySuggestionConfidence?: number | null;
16
+ categorizationMethod?: string | null;
17
+ categorySource?: string | null;
18
+ categoryConfidence?: number | null;
19
+ }
20
+ /** A suggestion ready to show: the project exists and the segment has no project yet. */
21
+ export interface PendingSuggestion {
22
+ captureEventId: string;
23
+ projectId: string;
24
+ projectName: string;
25
+ /** Whole percent, 0..100. */
26
+ confidencePercent: number;
27
+ /** Plain-language explanation of where the suggestion came from. */
28
+ reason: string;
29
+ }
30
+ /** Plain-language reason for a suggestion method; generic for unknown methods. */
31
+ export declare function suggestionReason(method: string | null | undefined): string;
32
+ /**
33
+ * The suggestion to show for a segment, or null. Only captured activity can
34
+ * carry one; a segment that already has a project, or whose suggested
35
+ * project is not in the workspace's project list (deleted, or not loaded),
36
+ * shows nothing rather than a label built from a guess.
37
+ */
38
+ export declare function pendingSuggestion(segment: SuggestionSegment, projectNameById: ReadonlyMap<string, string>): PendingSuggestion | null;
39
+ /** Every suggestion on the day that is waiting for review, in timeline order. */
40
+ export declare function pendingSuggestions(segments: ReadonlyArray<SuggestionSegment>, projectNameById: ReadonlyMap<string, string>): PendingSuggestion[];
41
+ //# sourceMappingURL=timelineSuggestions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timelineSuggestions.d.ts","sourceRoot":"","sources":["../../../../src/timecampus/pages/timeline/timelineSuggestions.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,gEAAgE;AAChE,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,4BAA4B,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7C,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC;AAED,yFAAyF;AACzF,MAAM,WAAW,iBAAiB;IAChC,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,6BAA6B;IAC7B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oEAAoE;IACpE,MAAM,EAAE,MAAM,CAAC;CAChB;AAQD,kFAAkF;AAClF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAE1E;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,iBAAiB,EAC1B,eAAe,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAC3C,iBAAiB,GAAG,IAAI,CAa1B;AAED,iFAAiF;AACjF,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,aAAa,CAAC,iBAAiB,CAAC,EAC1C,eAAe,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAC3C,iBAAiB,EAAE,CAOrB"}
@@ -0,0 +1,33 @@
1
+ import { confidencePercent as e } from "./timelineProvenance.js";
2
+ //#region src/timecampus/pages/timeline/timelineSuggestions.ts
3
+ var t = {
4
+ HISTORY: "Learned from projects you chose before",
5
+ RULE_BASED: "Matches the project name",
6
+ LLM: "Suggested by AI"
7
+ };
8
+ function n(e) {
9
+ return e && t[e] || "Suggested";
10
+ }
11
+ function r(t, r) {
12
+ if (t.source !== "CAPTURE" || t.projectId || !t.suggestedProjectId) return null;
13
+ let i = r.get(t.suggestedProjectId);
14
+ return i === void 0 ? null : {
15
+ captureEventId: t.sourceId,
16
+ projectId: t.suggestedProjectId,
17
+ projectName: i,
18
+ confidencePercent: e(t.categorySuggestionConfidence) ?? 0,
19
+ reason: n(t.categorizationMethod)
20
+ };
21
+ }
22
+ function i(e, t) {
23
+ let n = [];
24
+ for (let i of e) {
25
+ let e = r(i, t);
26
+ e && n.push(e);
27
+ }
28
+ return n;
29
+ }
30
+ //#endregion
31
+ export { r as pendingSuggestion, i as pendingSuggestions, n as suggestionReason };
32
+
33
+ //# sourceMappingURL=timelineSuggestions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timelineSuggestions.js","names":[],"sources":["../../../../src/timecampus/pages/timeline/timelineSuggestions.ts"],"sourcesContent":["/**\n * Project suggestions on the timeline (BOFF-4146).\n *\n * The service stores a pending project suggestion on each captured activity\n * (learned from the person's earlier choices, matched against project names,\n * or refined by a model when one is configured). Nothing is assigned until\n * the person accepts it; these helpers decide what the timeline shows.\n */\n\nimport { confidencePercent } from \"./timelineProvenance\";\n\n/** The fields of a timeline segment the suggestion UI reads. */\nexport interface SuggestionSegment {\n source: string;\n sourceId: string;\n projectId?: string | null;\n suggestedProjectId?: string | null;\n categorySuggestionConfidence?: number | null;\n categorizationMethod?: string | null;\n categorySource?: string | null;\n categoryConfidence?: number | null;\n}\n\n/** A suggestion ready to show: the project exists and the segment has no project yet. */\nexport interface PendingSuggestion {\n captureEventId: string;\n projectId: string;\n projectName: string;\n /** Whole percent, 0..100. */\n confidencePercent: number;\n /** Plain-language explanation of where the suggestion came from. */\n reason: string;\n}\n\nconst METHOD_REASON: Record<string, string> = {\n HISTORY: \"Learned from projects you chose before\",\n RULE_BASED: \"Matches the project name\",\n LLM: \"Suggested by AI\",\n};\n\n/** Plain-language reason for a suggestion method; generic for unknown methods. */\nexport function suggestionReason(method: string | null | undefined): string {\n return (method && METHOD_REASON[method]) || \"Suggested\";\n}\n\n/**\n * The suggestion to show for a segment, or null. Only captured activity can\n * carry one; a segment that already has a project, or whose suggested\n * project is not in the workspace's project list (deleted, or not loaded),\n * shows nothing rather than a label built from a guess.\n */\nexport function pendingSuggestion(\n segment: SuggestionSegment,\n projectNameById: ReadonlyMap<string, string>,\n): PendingSuggestion | null {\n if (segment.source !== \"CAPTURE\") return null;\n if (segment.projectId || !segment.suggestedProjectId) return null;\n const projectName = projectNameById.get(segment.suggestedProjectId);\n if (projectName === undefined) return null;\n return {\n captureEventId: segment.sourceId,\n projectId: segment.suggestedProjectId,\n projectName,\n confidencePercent:\n confidencePercent(segment.categorySuggestionConfidence) ?? 0,\n reason: suggestionReason(segment.categorizationMethod),\n };\n}\n\n/** Every suggestion on the day that is waiting for review, in timeline order. */\nexport function pendingSuggestions(\n segments: ReadonlyArray<SuggestionSegment>,\n projectNameById: ReadonlyMap<string, string>,\n): PendingSuggestion[] {\n const pending: PendingSuggestion[] = [];\n for (const segment of segments) {\n const suggestion = pendingSuggestion(segment, projectNameById);\n if (suggestion) pending.push(suggestion);\n }\n return pending;\n}\n"],"mappings":";;AAkCA,IAAM,IAAwC;CAC5C,SAAS;CACT,YAAY;CACZ,KAAK;AACP;AAGA,SAAgB,EAAiB,GAA2C;CAC1E,OAAQ,KAAU,EAAc,MAAY;AAC9C;AAQA,SAAgB,EACd,GACA,GAC0B;CAE1B,IADI,EAAQ,WAAW,aACnB,EAAQ,aAAa,CAAC,EAAQ,oBAAoB,OAAO;CAC7D,IAAM,IAAc,EAAgB,IAAI,EAAQ,kBAAkB;CAElE,OADI,MAAgB,KAAA,IAAkB,OAC/B;EACL,gBAAgB,EAAQ;EACxB,WAAW,EAAQ;EACnB;EACA,mBACE,EAAkB,EAAQ,4BAA4B,KAAK;EAC7D,QAAQ,EAAiB,EAAQ,oBAAoB;CACvD;AACF;AAGA,SAAgB,EACd,GACA,GACqB;CACrB,IAAM,IAA+B,CAAC;CACtC,KAAK,IAAM,KAAW,GAAU;EAC9B,IAAM,IAAa,EAAkB,GAAS,CAAe;EAC7D,AAAI,KAAY,EAAQ,KAAK,CAAU;CACzC;CACA,OAAO;AACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-timecampus",
3
- "version": "2026.1030.4",
3
+ "version": "2026.1031.1",
4
4
  "description": "Burdenoff TimeCampus Microfrontend - AI-powered time management and productivity platform",
5
5
  "type": "module",
6
6
  "files": [