@burdenoff/microfe-timecampus 2026.1030.2 → 2026.1030.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generated/wspace-operations.d.ts +305 -0
- package/dist/generated/wspace-operations.d.ts.map +1 -1
- package/dist/generated/wspace-operations.js +1236 -1112
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.d.ts +433 -65
- package/dist/generated/wspace-types.d.ts.map +1 -1
- package/dist/generated/wspace-types.js +15 -8
- package/dist/generated/wspace-types.js.map +1 -1
- package/dist/index.js +7 -7
- package/dist/timecampus/TimeCampusRoot.d.ts.map +1 -1
- package/dist/timecampus/TimeCampusRoot.js +86 -78
- package/dist/timecampus/TimeCampusRoot.js.map +1 -1
- package/dist/timecampus/TimeCampusRoutes.d.ts.map +1 -1
- package/dist/timecampus/TimeCampusRoutes.js +15 -11
- package/dist/timecampus/TimeCampusRoutes.js.map +1 -1
- package/dist/timecampus/index.js +7 -7
- package/dist/timecampus/pages/channels/ChannelsPage.d.ts +2 -0
- package/dist/timecampus/pages/channels/ChannelsPage.d.ts.map +1 -0
- package/dist/timecampus/pages/channels/ChannelsPage.js +673 -0
- package/dist/timecampus/pages/channels/ChannelsPage.js.map +1 -0
- package/dist/timecampus/pages/channels/channelCatalog.d.ts +49 -0
- package/dist/timecampus/pages/channels/channelCatalog.d.ts.map +1 -0
- package/dist/timecampus/pages/channels/channelCatalog.js +125 -0
- package/dist/timecampus/pages/channels/channelCatalog.js.map +1 -0
- package/dist/timecampus/pages/timeline/TimelinePage.d.ts.map +1 -1
- package/dist/timecampus/pages/timeline/TimelinePage.js +173 -151
- package/dist/timecampus/pages/timeline/TimelinePage.js.map +1 -1
- package/dist/timecampus/pages/timeline/timelineProvenance.d.ts +27 -0
- package/dist/timecampus/pages/timeline/timelineProvenance.d.ts.map +1 -0
- package/dist/timecampus/pages/timeline/timelineProvenance.js +46 -0
- package/dist/timecampus/pages/timeline/timelineProvenance.js.map +1 -0
- package/dist/types/external-enums.d.ts +17 -0
- package/dist/types/external-enums.d.ts.map +1 -0
- package/dist/types/external-enums.js +4 -0
- package/dist/types/external-enums.js.map +1 -0
- package/package.json +1 -1
|
@@ -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 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 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'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/**\n * How a segment came by its category. The service writes these lowercase\n * (`timeline.service.ts` → 'auto' | 'user' | 'channel'), so normalise before\n * matching rather than trusting the string's casing.\n */\nconst CATEGORY_SOURCE_LABEL: Record<string, string> = {\n auto: \"Auto-categorized\",\n user: \"You set this\",\n channel: \"From channel rules\",\n};\n\nfunction categorySourceLabel(source: string | null | undefined): string | null {\n if (!source) return null;\n return CATEGORY_SOURCE_LABEL[source.toLowerCase()] ?? source;\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 = categorySourceLabel(segment.categorySource);\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 <span className=\"text-xs text-text-tertiary\">{provenance}</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 <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":";;;;;;;;;;;;;;;AAkDA,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;CACD,IAAM,IAAQ,EAAQ;CACtB,IAAI,CAAC,GAAO,OAAO;CACnB,IAAM,IAAU,EAAQ,WAClB,IAAO,IAAU,IAAgB,GACjC,IAAS,EAAiB,GAAS,GAAO,EAAQ,OAAO,GACzD,IAAU,IAAU,OAAO,EAAiB,CAAK,GACjD,IAAQ,IACV,OACA,EAAa,EAAQ,WAAW,EAAQ,SAAS,CAAK,GACpD,IAA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MACb,EAAe,CAAO,IACpB,kBAAC,GAAD,EAA2C,WAAU,GAA/B,EAAQ,EAAuB,IAErD,kBAAC,GAAD;QAEW;QACT,UAAW,EAAQ,YAAyB;QAC5C,aACE,EAAQ,YACJ,EAAgB,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 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'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;EAC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AAA;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"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a timeline segment came by its category (BOFF-3899). The service writes
|
|
3
|
+
* `categorySource` lowercase ('auto' | 'user' | 'channel' | 'ai'); an AI
|
|
4
|
+
* decision also carries the model's confidence (0..1) and the
|
|
5
|
+
* "provider:model" that made it. Pure so the labels are unit-tested.
|
|
6
|
+
*/
|
|
7
|
+
export interface SegmentProvenanceInput {
|
|
8
|
+
categorySource?: string | null;
|
|
9
|
+
categoryConfidence?: number | null;
|
|
10
|
+
categoryModel?: string | null;
|
|
11
|
+
}
|
|
12
|
+
export interface SegmentProvenance {
|
|
13
|
+
/** Short text shown next to the category chip. */
|
|
14
|
+
label: string;
|
|
15
|
+
/** Longer explanation for the hover title / screen readers. */
|
|
16
|
+
detail: string;
|
|
17
|
+
/** True when a model, not a rule or the user, chose the category. */
|
|
18
|
+
isAi: boolean;
|
|
19
|
+
}
|
|
20
|
+
/** The disclaimer shown with AI-decided categories (AI readiness 5.3). */
|
|
21
|
+
export declare const AI_CATEGORY_DISCLAIMER = "AI can get this wrong. Pick another category to correct it, and TimeCampus will use your choice for this app from now on.";
|
|
22
|
+
/** Whole-percent confidence, or null when the value is missing or unusable. */
|
|
23
|
+
export declare function confidencePercent(confidence: number | null | undefined): number | null;
|
|
24
|
+
export declare function segmentProvenance(segment: SegmentProvenanceInput): SegmentProvenance | null;
|
|
25
|
+
/** True when at least one segment's category was decided by a model. */
|
|
26
|
+
export declare function hasAiCategorizedSegment(segments: ReadonlyArray<SegmentProvenanceInput>): boolean;
|
|
27
|
+
//# sourceMappingURL=timelineProvenance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timelineProvenance.d.ts","sourceRoot":"","sources":["../../../../src/timecampus/pages/timeline/timelineProvenance.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,sBAAsB;IACrC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED,MAAM,WAAW,iBAAiB;IAChC,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,MAAM,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,IAAI,EAAE,OAAO,CAAC;CACf;AAkBD,0EAA0E;AAC1E,eAAO,MAAM,sBAAsB,8HAC0F,CAAC;AAE9H,+EAA+E;AAC/E,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GACpC,MAAM,GAAG,IAAI,CAKf;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,sBAAsB,GAC9B,iBAAiB,GAAG,IAAI,CA0B1B;AAED,wEAAwE;AACxE,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,aAAa,CAAC,sBAAsB,CAAC,GAC9C,OAAO,CAIT"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
//#region src/timecampus/pages/timeline/timelineProvenance.ts
|
|
2
|
+
var e = {
|
|
3
|
+
auto: {
|
|
4
|
+
label: "Auto-categorized",
|
|
5
|
+
detail: "Categorized by TimeCampus's built-in app rules."
|
|
6
|
+
},
|
|
7
|
+
user: {
|
|
8
|
+
label: "You set this",
|
|
9
|
+
detail: "You chose this category. TimeCampus applies your correction to this app from now on."
|
|
10
|
+
},
|
|
11
|
+
channel: {
|
|
12
|
+
label: "From channel rules",
|
|
13
|
+
detail: "Categorized by the capture channel that sent this activity."
|
|
14
|
+
}
|
|
15
|
+
}, t = "AI can get this wrong. Pick another category to correct it, and TimeCampus will use your choice for this app from now on.";
|
|
16
|
+
function n(e) {
|
|
17
|
+
return typeof e != "number" || !Number.isFinite(e) ? null : Math.round(Math.min(1, Math.max(0, e)) * 100);
|
|
18
|
+
}
|
|
19
|
+
function r(r) {
|
|
20
|
+
let i = r.categorySource?.trim().toLowerCase();
|
|
21
|
+
if (!i) return null;
|
|
22
|
+
if (i === "ai") {
|
|
23
|
+
let e = n(r.categoryConfidence), i = e === null ? "Categorized by AI" : `Categorized by AI · ${e}% confident`, a = r.categoryModel?.trim();
|
|
24
|
+
return {
|
|
25
|
+
label: i,
|
|
26
|
+
detail: `${a ? `Decided by ${a}.` : "Decided by a model."} ${t}`,
|
|
27
|
+
isAi: !0
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
let a = e[i];
|
|
31
|
+
return a ? {
|
|
32
|
+
...a,
|
|
33
|
+
isAi: !1
|
|
34
|
+
} : {
|
|
35
|
+
label: r.categorySource ?? i,
|
|
36
|
+
detail: `Category source: ${r.categorySource ?? i}.`,
|
|
37
|
+
isAi: !1
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function i(e) {
|
|
41
|
+
return e.some((e) => e.categorySource?.trim().toLowerCase() === "ai");
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { t as AI_CATEGORY_DISCLAIMER, n as confidencePercent, i as hasAiCategorizedSegment, r as segmentProvenance };
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=timelineProvenance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timelineProvenance.js","names":[],"sources":["../../../../src/timecampus/pages/timeline/timelineProvenance.ts"],"sourcesContent":["/**\n * How a timeline segment came by its category (BOFF-3899). The service writes\n * `categorySource` lowercase ('auto' | 'user' | 'channel' | 'ai'); an AI\n * decision also carries the model's confidence (0..1) and the\n * \"provider:model\" that made it. Pure so the labels are unit-tested.\n */\n\nexport interface SegmentProvenanceInput {\n categorySource?: string | null;\n categoryConfidence?: number | null;\n categoryModel?: string | null;\n}\n\nexport interface SegmentProvenance {\n /** Short text shown next to the category chip. */\n label: string;\n /** Longer explanation for the hover title / screen readers. */\n detail: string;\n /** True when a model, not a rule or the user, chose the category. */\n isAi: boolean;\n}\n\nconst SOURCE_PROVENANCE: Record<string, Omit<SegmentProvenance, \"isAi\">> = {\n auto: {\n label: \"Auto-categorized\",\n detail: \"Categorized by TimeCampus's built-in app rules.\",\n },\n user: {\n label: \"You set this\",\n detail:\n \"You chose this category. TimeCampus applies your correction to this app from now on.\",\n },\n channel: {\n label: \"From channel rules\",\n detail: \"Categorized by the capture channel that sent this activity.\",\n },\n};\n\n/** The disclaimer shown with AI-decided categories (AI readiness 5.3). */\nexport const AI_CATEGORY_DISCLAIMER =\n \"AI can get this wrong. Pick another category to correct it, and TimeCampus will use your choice for this app from now on.\";\n\n/** Whole-percent confidence, or null when the value is missing or unusable. */\nexport function confidencePercent(\n confidence: number | null | undefined,\n): number | null {\n if (typeof confidence !== \"number\" || !Number.isFinite(confidence)) {\n return null;\n }\n return Math.round(Math.min(1, Math.max(0, confidence)) * 100);\n}\n\nexport function segmentProvenance(\n segment: SegmentProvenanceInput,\n): SegmentProvenance | null {\n const source = segment.categorySource?.trim().toLowerCase();\n if (!source) return null;\n\n if (source === \"ai\") {\n const percent = confidencePercent(segment.categoryConfidence);\n const label =\n percent === null\n ? \"Categorized by AI\"\n : `Categorized by AI · ${percent}% confident`;\n const model = segment.categoryModel?.trim();\n const decidedBy = model ? `Decided by ${model}.` : \"Decided by a model.\";\n return {\n label,\n detail: `${decidedBy} ${AI_CATEGORY_DISCLAIMER}`,\n isAi: true,\n };\n }\n\n const known = SOURCE_PROVENANCE[source];\n if (known) return { ...known, isAi: false };\n return {\n label: segment.categorySource ?? source,\n detail: `Category source: ${segment.categorySource ?? source}.`,\n isAi: false,\n };\n}\n\n/** True when at least one segment's category was decided by a model. */\nexport function hasAiCategorizedSegment(\n segments: ReadonlyArray<SegmentProvenanceInput>,\n): boolean {\n return segments.some(\n (segment) => segment.categorySource?.trim().toLowerCase() === \"ai\",\n );\n}\n"],"mappings":";AAsBA,IAAM,IAAqE;CACzE,MAAM;EACJ,OAAO;EACP,QAAQ;CACV;CACA,MAAM;EACJ,OAAO;EACP,QACE;CACJ;CACA,SAAS;EACP,OAAO;EACP,QAAQ;CACV;AACF,GAGa,IACX;AAGF,SAAgB,EACd,GACe;CAIf,OAHI,OAAO,KAAe,YAAY,CAAC,OAAO,SAAS,CAAU,IACxD,OAEF,KAAK,MAAM,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,CAAU,CAAC,IAAI,GAAG;AAC9D;AAEA,SAAgB,EACd,GAC0B;CAC1B,IAAM,IAAS,EAAQ,gBAAgB,KAAK,CAAC,CAAC,YAAY;CAC1D,IAAI,CAAC,GAAQ,OAAO;CAEpB,IAAI,MAAW,MAAM;EACnB,IAAM,IAAU,EAAkB,EAAQ,kBAAkB,GACtD,IACJ,MAAY,OACR,sBACA,uBAAuB,EAAQ,cAC/B,IAAQ,EAAQ,eAAe,KAAK;EAE1C,OAAO;GACL;GACA,QAAQ,GAHQ,IAAQ,cAAc,EAAM,KAAK,sBAG5B,GAAG;GACxB,MAAM;EACR;CACF;CAEA,IAAM,IAAQ,EAAkB;CAEhC,OADI,IAAc;EAAE,GAAG;EAAO,MAAM;CAAM,IACnC;EACL,OAAO,EAAQ,kBAAkB;EACjC,QAAQ,oBAAoB,EAAQ,kBAAkB,EAAO;EAC7D,MAAM;CACR;AACF;AAGA,SAAgB,EACd,GACS;CACT,OAAO,EAAS,MACb,MAAY,EAAQ,gBAAgB,KAAK,CAAC,CAAC,YAAY,MAAM,IAChE;AACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enums the GraphQL codegen takes from here instead of generating
|
|
3
|
+
* (`enumValues` in .graphqlrc.yml).
|
|
4
|
+
*
|
|
5
|
+
* BigConsoleWidgetType (owned by wspace-bigconsole-svc) has two values that
|
|
6
|
+
* differ only in case, `MAP` and `map`. graphql-codegen PascalCases enum
|
|
7
|
+
* member names, so it would emit `Map` twice, which esbuild/Vite reject
|
|
8
|
+
* ("The symbol \"Map\" has already been declared") and which fails every test
|
|
9
|
+
* and build in this package. TimeCampus never reads or writes BigConsole
|
|
10
|
+
* widgets, so the enum is exposed as its raw wire value.
|
|
11
|
+
*
|
|
12
|
+
* The generated types module re-exports this name, so it needs a runtime
|
|
13
|
+
* binding as well as a type; the binding is an empty, frozen lookup.
|
|
14
|
+
*/
|
|
15
|
+
export type BigConsoleWidgetType = string;
|
|
16
|
+
export declare const BigConsoleWidgetType: Readonly<Record<string, string>>;
|
|
17
|
+
//# sourceMappingURL=external-enums.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"external-enums.d.ts","sourceRoot":"","sources":["../../src/types/external-enums.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAC1C,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAC/C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"external-enums.js","names":[],"sources":["../../src/types/external-enums.ts"],"sourcesContent":["/**\n * Enums the GraphQL codegen takes from here instead of generating\n * (`enumValues` in .graphqlrc.yml).\n *\n * BigConsoleWidgetType (owned by wspace-bigconsole-svc) has two values that\n * differ only in case, `MAP` and `map`. graphql-codegen PascalCases enum\n * member names, so it would emit `Map` twice, which esbuild/Vite reject\n * (\"The symbol \\\"Map\\\" has already been declared\") and which fails every test\n * and build in this package. TimeCampus never reads or writes BigConsole\n * widgets, so the enum is exposed as its raw wire value.\n *\n * The generated types module re-exports this name, so it needs a runtime\n * binding as well as a type; the binding is an empty, frozen lookup.\n */\nexport type BigConsoleWidgetType = string;\nexport const BigConsoleWidgetType: Readonly<Record<string, string>> =\n Object.freeze({});\n"],"mappings":"AAgBE,OAAO,OAAO,CAAC,CAAC"}
|
package/package.json
CHANGED