@burdenoff/microfe-timecampus 2026.1205.1 → 2026.1206.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.
Files changed (115) hide show
  1. package/dist/timecampus/components/ErrorBoundary.js +1 -1
  2. package/dist/timecampus/components/ErrorBoundary.js.map +1 -1
  3. package/dist/timecampus/components/StatusBadge.js +4 -4
  4. package/dist/timecampus/components/StatusBadge.js.map +1 -1
  5. package/dist/timecampus/components/Toast.js +4 -4
  6. package/dist/timecampus/components/Toast.js.map +1 -1
  7. package/dist/timecampus/components/maps/LocationGeofenceMap.js +2 -2
  8. package/dist/timecampus/components/maps/LocationGeofenceMap.js.map +1 -1
  9. package/dist/timecampus/pages/HomePage.js +1 -1
  10. package/dist/timecampus/pages/HomePage.js.map +1 -1
  11. package/dist/timecampus/pages/admin/AdminPage.js +6 -6
  12. package/dist/timecampus/pages/admin/AdminPage.js.map +1 -1
  13. package/dist/timecampus/pages/application-usage/ApplicationUsagePage.js +5 -5
  14. package/dist/timecampus/pages/application-usage/ApplicationUsagePage.js.map +1 -1
  15. package/dist/timecampus/pages/channels/ChannelsPage.js +1 -1
  16. package/dist/timecampus/pages/channels/ChannelsPage.js.map +1 -1
  17. package/dist/timecampus/pages/client-portal/ClientPortalPage.js +4 -4
  18. package/dist/timecampus/pages/client-portal/ClientPortalPage.js.map +1 -1
  19. package/dist/timecampus/pages/dashboard/AnalyticsPage.js +3 -3
  20. package/dist/timecampus/pages/dashboard/AnalyticsPage.js.map +1 -1
  21. package/dist/timecampus/pages/dashboard/ReportsPage.js +4 -4
  22. package/dist/timecampus/pages/dashboard/ReportsPage.js.map +1 -1
  23. package/dist/timecampus/pages/dashboard/ServerReportExports.js +1 -1
  24. package/dist/timecampus/pages/dashboard/ServerReportExports.js.map +1 -1
  25. package/dist/timecampus/pages/email-tracking/EmailTrackingPage.js +9 -9
  26. package/dist/timecampus/pages/email-tracking/EmailTrackingPage.js.map +1 -1
  27. package/dist/timecampus/pages/expense-tracking/ExpenseTrackingPage.js +6 -6
  28. package/dist/timecampus/pages/expense-tracking/ExpenseTrackingPage.js.map +1 -1
  29. package/dist/timecampus/pages/extend/AppletDeveloperPage.js +1 -1
  30. package/dist/timecampus/pages/extend/AppletDeveloperPage.js.map +1 -1
  31. package/dist/timecampus/pages/extend/ThirdPartyAppletsSection.js +1 -1
  32. package/dist/timecampus/pages/extend/ThirdPartyAppletsSection.js.map +1 -1
  33. package/dist/timecampus/pages/extend/TimeTriggersPage.js +1 -1
  34. package/dist/timecampus/pages/extend/TimeTriggersPage.js.map +1 -1
  35. package/dist/timecampus/pages/focus-score/FocusScorePage.js +1 -1
  36. package/dist/timecampus/pages/focus-score/FocusScorePage.js.map +1 -1
  37. package/dist/timecampus/pages/geofencing/GeofencingPage.js +5 -5
  38. package/dist/timecampus/pages/geofencing/GeofencingPage.js.map +1 -1
  39. package/dist/timecampus/pages/invoicing/InvoicingPage.js +5 -5
  40. package/dist/timecampus/pages/invoicing/InvoicingPage.js.map +1 -1
  41. package/dist/timecampus/pages/lifetime/DeadTimeRadarPage.js +1 -1
  42. package/dist/timecampus/pages/lifetime/DeadTimeRadarPage.js.map +1 -1
  43. package/dist/timecampus/pages/lifetime/LifeBalancePage.js +1 -1
  44. package/dist/timecampus/pages/lifetime/LifeBalancePage.js.map +1 -1
  45. package/dist/timecampus/pages/lifetime/LifeTimelinePage.js +5 -5
  46. package/dist/timecampus/pages/lifetime/LifeTimelinePage.js.map +1 -1
  47. package/dist/timecampus/pages/lifetime/PersonalCorporatePage.js +3 -3
  48. package/dist/timecampus/pages/lifetime/PersonalCorporatePage.js.map +1 -1
  49. package/dist/timecampus/pages/lifetime/RecommendationsPage.js +1 -1
  50. package/dist/timecampus/pages/lifetime/RecommendationsPage.js.map +1 -1
  51. package/dist/timecampus/pages/lifetime/TimeWellSpentPage.js +2 -2
  52. package/dist/timecampus/pages/lifetime/TimeWellSpentPage.js.map +1 -1
  53. package/dist/timecampus/pages/lifetime/ValuesGoalsPage.js +5 -5
  54. package/dist/timecampus/pages/lifetime/ValuesGoalsPage.js.map +1 -1
  55. package/dist/timecampus/pages/location-tracking/LocationTrackingPage.js +5 -5
  56. package/dist/timecampus/pages/location-tracking/LocationTrackingPage.js.map +1 -1
  57. package/dist/timecampus/pages/meetings/ActionItemFormModal.js +1 -1
  58. package/dist/timecampus/pages/meetings/ActionItemFormModal.js.map +1 -1
  59. package/dist/timecampus/pages/meetings/MeetingAnalyticsPage.js +1 -1
  60. package/dist/timecampus/pages/meetings/MeetingAnalyticsPage.js.map +1 -1
  61. package/dist/timecampus/pages/meetings/MeetingCreatePage.js +1 -1
  62. package/dist/timecampus/pages/meetings/MeetingCreatePage.js.map +1 -1
  63. package/dist/timecampus/pages/meetings/MeetingDetailPage.js +8 -8
  64. package/dist/timecampus/pages/meetings/MeetingDetailPage.js.map +1 -1
  65. package/dist/timecampus/pages/meetings/MeetingFormModal.js +1 -1
  66. package/dist/timecampus/pages/meetings/MeetingFormModal.js.map +1 -1
  67. package/dist/timecampus/pages/meetings/MeetingsPage.js +3 -3
  68. package/dist/timecampus/pages/meetings/MeetingsPage.js.map +1 -1
  69. package/dist/timecampus/pages/meetings/ParticipantFormModal.js +1 -1
  70. package/dist/timecampus/pages/meetings/ParticipantFormModal.js.map +1 -1
  71. package/dist/timecampus/pages/mobile/MobileLifeBalancePage.js +1 -1
  72. package/dist/timecampus/pages/mobile/MobileLifeBalancePage.js.map +1 -1
  73. package/dist/timecampus/pages/mobile/MobileTimelinePage.js +4 -4
  74. package/dist/timecampus/pages/mobile/MobileTimelinePage.js.map +1 -1
  75. package/dist/timecampus/pages/mobile/MobileTimerPage.js +1 -1
  76. package/dist/timecampus/pages/mobile/MobileTimerPage.js.map +1 -1
  77. package/dist/timecampus/pages/pomodoro/PomodoroAnalyticsPage.js +2 -2
  78. package/dist/timecampus/pages/pomodoro/PomodoroAnalyticsPage.js.map +1 -1
  79. package/dist/timecampus/pages/pomodoro/PomodoroPage.js +5 -5
  80. package/dist/timecampus/pages/pomodoro/PomodoroPage.js.map +1 -1
  81. package/dist/timecampus/pages/pomodoro/PomodoroSettingsPage.js +1 -1
  82. package/dist/timecampus/pages/pomodoro/PomodoroSettingsPage.js.map +1 -1
  83. package/dist/timecampus/pages/projects/ProjectCreatePage.js +1 -1
  84. package/dist/timecampus/pages/projects/ProjectCreatePage.js.map +1 -1
  85. package/dist/timecampus/pages/projects/ProjectDetailPage.js +5 -5
  86. package/dist/timecampus/pages/projects/ProjectDetailPage.js.map +1 -1
  87. package/dist/timecampus/pages/projects/ProjectsPage.js +6 -6
  88. package/dist/timecampus/pages/projects/ProjectsPage.js.map +1 -1
  89. package/dist/timecampus/pages/projects/TasksPage.js +6 -6
  90. package/dist/timecampus/pages/projects/TasksPage.js.map +1 -1
  91. package/dist/timecampus/pages/resource-planning/ResourcePlanningPage.js +10 -10
  92. package/dist/timecampus/pages/resource-planning/ResourcePlanningPage.js.map +1 -1
  93. package/dist/timecampus/pages/team/TeamAnalyticsPage.js +2 -2
  94. package/dist/timecampus/pages/team/TeamAnalyticsPage.js.map +1 -1
  95. package/dist/timecampus/pages/team/TeamMembersPage.js +3 -3
  96. package/dist/timecampus/pages/team/TeamMembersPage.js.map +1 -1
  97. package/dist/timecampus/pages/team/TeamPage.js +2 -2
  98. package/dist/timecampus/pages/team/TeamPage.js.map +1 -1
  99. package/dist/timecampus/pages/team-activity/TeamActivityPage.js +2 -2
  100. package/dist/timecampus/pages/team-activity/TeamActivityPage.js.map +1 -1
  101. package/dist/timecampus/pages/time/TimeEntriesPage.js +4 -4
  102. package/dist/timecampus/pages/time/TimeEntriesPage.js.map +1 -1
  103. package/dist/timecampus/pages/time/TimeTrackingPage.js +1 -1
  104. package/dist/timecampus/pages/time/TimeTrackingPage.js.map +1 -1
  105. package/dist/timecampus/pages/time/TimerPage.js +1 -1
  106. package/dist/timecampus/pages/time/TimerPage.js.map +1 -1
  107. package/dist/timecampus/pages/time-approval/SubmitTimesheetModal.js +1 -1
  108. package/dist/timecampus/pages/time-approval/SubmitTimesheetModal.js.map +1 -1
  109. package/dist/timecampus/pages/time-approval/TimeApprovalPage.js +8 -8
  110. package/dist/timecampus/pages/time-approval/TimeApprovalPage.js.map +1 -1
  111. package/dist/timecampus/pages/timeline/TimelinePage.js +6 -6
  112. package/dist/timecampus/pages/timeline/TimelinePage.js.map +1 -1
  113. package/dist/timecampus/pages/work-patterns/SustainedLoadCard.js +3 -3
  114. package/dist/timecampus/pages/work-patterns/SustainedLoadCard.js.map +1 -1
  115. package/package.json +1 -1
@@ -154,7 +154,7 @@ function N() {
154
154
  children: /* @__PURE__ */ E("div", {
155
155
  className: "flex gap-3",
156
156
  children: [/* @__PURE__ */ T("span", {
157
- className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-status-info-bg text-status-info-text",
157
+ className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-status-info-bgSubtle text-status-info-text",
158
158
  children: /* @__PURE__ */ T(y, { className: "h-5 w-5" })
159
159
  }), /* @__PURE__ */ E("div", {
160
160
  className: "min-w-0",
@@ -1 +1 @@
1
- {"version":3,"file":"DeadTimeRadarPage.js","names":["_Fragment","RANGE_OPTIONS","KIND_META","Hourglass","Bus","CircleHelp","TimerOff","humaniseKind","kind","word","kindLabel","kindIcon","CircleDashed","DeadTimeRadarPage","useTimeCampus","rangeDays","setRangeDays","useState","useMemo","isoDaysAgo","isoNow","useMyDeadTimeRadarQuery","workspaceId","radar","data","rangeSelector","active","option","purpose","loading","PageLayout","LoadingSkeleton","error","buckets","totalSeconds","reclaimableSeconds","reclaimablePct","sortedBuckets","b","a","chartData","bucket","noBuckets","StatCard","formatSecondsHuman","Sparkles","Clock","Percent","GlassCard","Info","EmptyState","Radar","Fragment","BucketIcon","ProgressMeter","v","ChartCard","BarsChart"],"sources":["../../../../src/timecampus/pages/lifetime/DeadTimeRadarPage.tsx"],"sourcesContent":["import { useMemo, useState, type ComponentType } from \"react\";\nimport {\n Radar,\n Sparkles,\n Clock,\n Percent,\n Info,\n Hourglass,\n Bus,\n CircleHelp,\n TimerOff,\n CircleDashed,\n} from \"lucide-react\";\nimport { GlassCard } from \"@burdenoff/fe-libs/ui\";\nimport {\n PageLayout,\n StatCard,\n ChartCard,\n BarsChart,\n ProgressMeter,\n EmptyState,\n LoadingSkeleton,\n type ChartDatum,\n} from \"../../components\";\nimport { useTimeCampus } from \"../../providers/TimeCampusProvider\";\nimport { useMyDeadTimeRadarQuery } from \"@/generated/wspace-operations\";\nimport { formatSecondsHuman, isoDaysAgo, isoNow } from \"./domains\";\n\n/** Range presets that drive the self-scoped query's `from`/`to` window. */\nconst RANGE_OPTIONS = [\n { label: \"7 days\", value: 7 },\n { label: \"30 days\", value: 30 },\n { label: \"90 days\", value: 90 },\n] as const;\n\n/**\n * Friendly labels + an icon for the friction \"kinds\" the backend emits. The raw\n * kind string is the source of truth; unknown kinds fall back to a humanised\n * version of the string so a new backend category never renders as a raw enum.\n */\nconst KIND_META: Record<\n string,\n { label: string; Icon: ComponentType<{ className?: string }> }\n> = {\n WAITING: { label: \"Queues & waiting\", Icon: Hourglass },\n COMMUTE: { label: \"Commute (dead transit)\", Icon: Bus },\n UNCATEGORISED: { label: \"Uncategorised time\", Icon: CircleHelp },\n UNCATEGORIZED: { label: \"Uncategorised time\", Icon: CircleHelp },\n IDLE_GAP: { label: \"Idle gaps\", Icon: TimerOff },\n IDLE: { label: \"Idle gaps\", Icon: TimerOff },\n GAP: { label: \"Untracked gaps\", Icon: TimerOff },\n};\n\nfunction humaniseKind(kind: string): string {\n return kind\n .toLowerCase()\n .split(/[_\\s]+/)\n .filter(Boolean)\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(\" \");\n}\n\nfunction kindLabel(kind: string): string {\n return KIND_META[kind]?.label ?? humaniseKind(kind);\n}\n\nfunction kindIcon(kind: string): ComponentType<{ className?: string }> {\n return KIND_META[kind]?.Icon ?? CircleDashed;\n}\n\nexport function DeadTimeRadarPage() {\n const { workspaceId } = useTimeCampus();\n const [rangeDays, setRangeDays] = useState<number>(30);\n\n // Memoise the window so `from`/`to` are stable across renders (isoNow() would\n // otherwise produce a fresh string every render and refetch in a loop).\n const { from, to } = useMemo(\n () => ({ from: isoDaysAgo(rangeDays), to: isoNow() }),\n [rangeDays],\n );\n\n const { data, loading, error } = useMyDeadTimeRadarQuery({\n variables: { from, to },\n skip: !workspaceId,\n });\n\n const radar = data?.myDeadTimeRadar;\n\n const rangeSelector = (\n <div\n className=\"flex items-center rounded-lg border border-border-subtle bg-bg-sunken/50 p-0.5\"\n role=\"group\"\n aria-label=\"Time range\"\n >\n {RANGE_OPTIONS.map((option) => {\n const active = option.value === rangeDays;\n return (\n <button\n key={option.value}\n type=\"button\"\n aria-pressed={active}\n onClick={() => setRangeDays(option.value)}\n className={\n active\n ? \"rounded-md bg-bg-surface px-2.5 py-1 text-xs font-medium text-text-primary shadow-sm\"\n : \"rounded-md px-2.5 py-1 text-xs font-medium text-text-secondary transition-colors hover:text-text-primary\"\n }\n >\n {option.label}\n </button>\n );\n })}\n </div>\n );\n\n const purpose =\n \"Dead-Time Radar surfaces the friction hidden in your day — the queues, \" +\n \"commutes and untracked gaps that quietly eat your hours — and quantifies \" +\n \"how much of it you could realistically reclaim.\";\n\n if (!workspaceId || loading) {\n return (\n <PageLayout\n title=\"Dead-Time Radar\"\n description=\"Quantified reclaimable hours from friction and untracked gaps\"\n purpose={purpose}\n actions={rangeSelector}\n >\n <LoadingSkeleton variant=\"card\" count={4} />\n </PageLayout>\n );\n }\n\n if (error) {\n return (\n <PageLayout\n title=\"Dead-Time Radar\"\n description=\"Quantified reclaimable hours from friction and untracked gaps\"\n purpose={purpose}\n actions={rangeSelector}\n >\n <div className=\"rounded-xl border border-status-error-border/50 bg-status-error-bg/10 p-4 text-sm text-status-error-text\">\n Couldn&apos;t load your dead-time radar right now. Please try again in\n a moment.\n </div>\n </PageLayout>\n );\n }\n\n const buckets = radar?.buckets ?? [];\n const totalSeconds = radar?.totalSeconds ?? 0;\n const reclaimableSeconds = radar?.reclaimableSeconds ?? 0;\n const reclaimablePct =\n totalSeconds > 0\n ? Math.round((reclaimableSeconds / totalSeconds) * 100)\n : 0;\n\n // Largest friction first so the biggest opportunities read at the top.\n const sortedBuckets = [...buckets].sort(\n (a, b) => b.totalSeconds - a.totalSeconds,\n );\n\n const chartData: ChartDatum[] = sortedBuckets.map((bucket) => ({\n kind: kindLabel(bucket.kind),\n total: bucket.totalSeconds,\n reclaimable: bucket.reclaimableSeconds,\n }));\n\n const noBuckets = buckets.length === 0;\n\n return (\n <PageLayout\n title=\"Dead-Time Radar\"\n description=\"Quantified reclaimable hours from friction and untracked gaps\"\n purpose={purpose}\n actions={rangeSelector}\n >\n <div className=\"space-y-6\">\n {/* Hero metrics — all derived from the query result. */}\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3\">\n <StatCard\n featured\n title=\"Reclaimable time\"\n value={formatSecondsHuman(reclaimableSeconds)}\n icon={<Sparkles className=\"h-5 w-5\" />}\n description={`Estimated from your last ${rangeDays} days`}\n />\n <StatCard\n title=\"Total dead-time\"\n value={formatSecondsHuman(totalSeconds)}\n icon={<Clock className=\"h-5 w-5\" />}\n description=\"Friction + untracked gaps logged\"\n />\n <StatCard\n title=\"Reclaimable share\"\n value={`${reclaimablePct}%`}\n icon={<Percent className=\"h-5 w-5\" />}\n description=\"Of total dead-time you could recover\"\n />\n </div>\n\n {/* Honest measurement note — shown prominently, never overstated. */}\n {radar?.note && (\n <GlassCard treatment=\"insight\" className=\"p-4 sm:p-5\">\n <div className=\"flex gap-3\">\n <span className=\"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-status-info-bg text-status-info-text\">\n <Info className=\"h-5 w-5\" />\n </span>\n <div className=\"min-w-0\">\n <h3 className=\"text-sm font-semibold text-text-primary\">\n How this is measured\n </h3>\n <p className=\"mt-1 text-sm text-text-secondary\">{radar.note}</p>\n </div>\n </div>\n </GlassCard>\n )}\n\n {noBuckets ? (\n <EmptyState\n title=\"No dead-time detected yet\"\n description=\"Once you log friction moments — time spent waiting, commuting, or on-hold — and leave gaps in your tracked day, your reclaimable hours will show up here.\"\n action={\n <span className=\"inline-flex items-center gap-2 rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text\">\n <Radar className=\"h-4 w-4\" />\n Log your first friction moment\n </span>\n }\n />\n ) : (\n <>\n {/* Per-bucket breakdown cards. */}\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3\">\n {sortedBuckets.map((bucket) => {\n const BucketIcon = kindIcon(bucket.kind);\n return (\n <GlassCard\n key={bucket.kind}\n treatment=\"glass\"\n className=\"p-4 sm:p-5\"\n >\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"min-w-0\">\n <p className=\"truncate text-sm font-medium text-text-secondary\">\n {kindLabel(bucket.kind)}\n </p>\n <p className=\"mt-1.5 text-2xl font-bold tabular-nums text-text-primary\">\n {formatSecondsHuman(bucket.totalSeconds)}\n </p>\n </div>\n <span className=\"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-action-primary-bg/10 text-primary\">\n <BucketIcon className=\"h-5 w-5\" />\n </span>\n </div>\n <div className=\"mt-4\">\n <ProgressMeter\n value={bucket.reclaimableSeconds}\n max={bucket.totalSeconds || 1}\n label=\"Reclaimable\"\n tone=\"warning\"\n size=\"sm\"\n format={(v) => formatSecondsHuman(v)}\n />\n </div>\n </GlassCard>\n );\n })}\n </div>\n\n {/* Total vs reclaimable per friction source. */}\n <ChartCard\n title=\"Friction by source\"\n description=\"Total dead-time against the portion you could reclaim, per source\"\n >\n <BarsChart\n data={chartData}\n xKey=\"kind\"\n orientation=\"horizontal\"\n categoryWidth={140}\n series={[\n { key: \"total\", label: \"Total dead-time\" },\n { key: \"reclaimable\", label: \"Reclaimable\" },\n ]}\n valueFormat={(v) => formatSecondsHuman(v)}\n height={Math.max(220, sortedBuckets.length * 56)}\n emptyLabel=\"No friction s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A,CACE,kBAAC,OAAD;SAAK,WAAU;SAAf,UAAA,CACE,kBAAC,KAAD;UAAG,WAAU;UACV,UAAAtC,EAAU+B,EAAO,IAAI;SACrB,CAAA,GACH,kBAAC,KAAD;UAAG,WAAU;UACV,UAAAG,EAAmBH,EAAO,YAAY;SACtC,CAAA,CACA;QACL,CAAA,GAAA,kBAAC,QAAD;SAAM,WAAU;SACd,UAAA,kBAACY,GAAD,EAAY,WAAU,UAAW,CAAA;QAC7B,CAAA,CACH;OACL,CAAA,GAAA,kBAAC,OAAD;QAAK,WAAU;QACb,UAAA,kBAACC,GAAD;SACE,OAAOb,EAAO;SACd,KAAKA,EAAO,gBAAgB;SAC5B,OAAM;SACN,MAAK;SACL,MAAK;SACL,SAAS,MAAMG,EAAmBW,CAAC;QACpC,CAAA;OACE,CAAA,CACI;MA3BJ,GAAAd,EAAO,IA2BH;KAEf,CAAC;IACE,CAAA,GAGL,kBAACe,GAAD;KACE,OAAM;KACN,aAAY;KAEZ,UAAA,kBAACC,GAAD;MACE,MAAMjB;MACN,MAAK;MACL,aAAY;MACZ,eAAe;MACf,QAAQ,CACN;OAAE,KAAK;OAAS,OAAO;MAAkB,GACzC;OAAE,KAAK;OAAe,OAAO;MAAc,CAC7C;MACA,cAAc,MAAMI,EAAmBW,CAAC;MACxC,QAAQ,KAAK,IAAI,KAAKlB,EAAc,SAAS,EAAE;MAC/C,YAAW;MACX,WAAU;KACX,CAAA;IACQ,CAAA,CACX,EAAA,CAAA;GAED;;CACK,CAAA;AAEhB"}
1
+ {"version":3,"file":"DeadTimeRadarPage.js","names":["_Fragment","RANGE_OPTIONS","KIND_META","Hourglass","Bus","CircleHelp","TimerOff","humaniseKind","kind","word","kindLabel","kindIcon","CircleDashed","DeadTimeRadarPage","useTimeCampus","rangeDays","setRangeDays","useState","useMemo","isoDaysAgo","isoNow","useMyDeadTimeRadarQuery","workspaceId","radar","data","rangeSelector","active","option","purpose","loading","PageLayout","LoadingSkeleton","error","buckets","totalSeconds","reclaimableSeconds","reclaimablePct","sortedBuckets","b","a","chartData","bucket","noBuckets","StatCard","formatSecondsHuman","Sparkles","Clock","Percent","GlassCard","Info","EmptyState","Radar","Fragment","BucketIcon","ProgressMeter","v","ChartCard","BarsChart"],"sources":["../../../../src/timecampus/pages/lifetime/DeadTimeRadarPage.tsx"],"sourcesContent":["import { useMemo, useState, type ComponentType } from \"react\";\nimport {\n Radar,\n Sparkles,\n Clock,\n Percent,\n Info,\n Hourglass,\n Bus,\n CircleHelp,\n TimerOff,\n CircleDashed,\n} from \"lucide-react\";\nimport { GlassCard } from \"@burdenoff/fe-libs/ui\";\nimport {\n PageLayout,\n StatCard,\n ChartCard,\n BarsChart,\n ProgressMeter,\n EmptyState,\n LoadingSkeleton,\n type ChartDatum,\n} from \"../../components\";\nimport { useTimeCampus } from \"../../providers/TimeCampusProvider\";\nimport { useMyDeadTimeRadarQuery } from \"@/generated/wspace-operations\";\nimport { formatSecondsHuman, isoDaysAgo, isoNow } from \"./domains\";\n\n/** Range presets that drive the self-scoped query's `from`/`to` window. */\nconst RANGE_OPTIONS = [\n { label: \"7 days\", value: 7 },\n { label: \"30 days\", value: 30 },\n { label: \"90 days\", value: 90 },\n] as const;\n\n/**\n * Friendly labels + an icon for the friction \"kinds\" the backend emits. The raw\n * kind string is the source of truth; unknown kinds fall back to a humanised\n * version of the string so a new backend category never renders as a raw enum.\n */\nconst KIND_META: Record<\n string,\n { label: string; Icon: ComponentType<{ className?: string }> }\n> = {\n WAITING: { label: \"Queues & waiting\", Icon: Hourglass },\n COMMUTE: { label: \"Commute (dead transit)\", Icon: Bus },\n UNCATEGORISED: { label: \"Uncategorised time\", Icon: CircleHelp },\n UNCATEGORIZED: { label: \"Uncategorised time\", Icon: CircleHelp },\n IDLE_GAP: { label: \"Idle gaps\", Icon: TimerOff },\n IDLE: { label: \"Idle gaps\", Icon: TimerOff },\n GAP: { label: \"Untracked gaps\", Icon: TimerOff },\n};\n\nfunction humaniseKind(kind: string): string {\n return kind\n .toLowerCase()\n .split(/[_\\s]+/)\n .filter(Boolean)\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(\" \");\n}\n\nfunction kindLabel(kind: string): string {\n return KIND_META[kind]?.label ?? humaniseKind(kind);\n}\n\nfunction kindIcon(kind: string): ComponentType<{ className?: string }> {\n return KIND_META[kind]?.Icon ?? CircleDashed;\n}\n\nexport function DeadTimeRadarPage() {\n const { workspaceId } = useTimeCampus();\n const [rangeDays, setRangeDays] = useState<number>(30);\n\n // Memoise the window so `from`/`to` are stable across renders (isoNow() would\n // otherwise produce a fresh string every render and refetch in a loop).\n const { from, to } = useMemo(\n () => ({ from: isoDaysAgo(rangeDays), to: isoNow() }),\n [rangeDays],\n );\n\n const { data, loading, error } = useMyDeadTimeRadarQuery({\n variables: { from, to },\n skip: !workspaceId,\n });\n\n const radar = data?.myDeadTimeRadar;\n\n const rangeSelector = (\n <div\n className=\"flex items-center rounded-lg border border-border-subtle bg-bg-sunken/50 p-0.5\"\n role=\"group\"\n aria-label=\"Time range\"\n >\n {RANGE_OPTIONS.map((option) => {\n const active = option.value === rangeDays;\n return (\n <button\n key={option.value}\n type=\"button\"\n aria-pressed={active}\n onClick={() => setRangeDays(option.value)}\n className={\n active\n ? \"rounded-md bg-bg-surface px-2.5 py-1 text-xs font-medium text-text-primary shadow-sm\"\n : \"rounded-md px-2.5 py-1 text-xs font-medium text-text-secondary transition-colors hover:text-text-primary\"\n }\n >\n {option.label}\n </button>\n );\n })}\n </div>\n );\n\n const purpose =\n \"Dead-Time Radar surfaces the friction hidden in your day — the queues, \" +\n \"commutes and untracked gaps that quietly eat your hours — and quantifies \" +\n \"how much of it you could realistically reclaim.\";\n\n if (!workspaceId || loading) {\n return (\n <PageLayout\n title=\"Dead-Time Radar\"\n description=\"Quantified reclaimable hours from friction and untracked gaps\"\n purpose={purpose}\n actions={rangeSelector}\n >\n <LoadingSkeleton variant=\"card\" count={4} />\n </PageLayout>\n );\n }\n\n if (error) {\n return (\n <PageLayout\n title=\"Dead-Time Radar\"\n description=\"Quantified reclaimable hours from friction and untracked gaps\"\n purpose={purpose}\n actions={rangeSelector}\n >\n <div className=\"rounded-xl border border-status-error-border/50 bg-status-error-bg/10 p-4 text-sm text-status-error-text\">\n Couldn&apos;t load your dead-time radar right now. Please try again in\n a moment.\n </div>\n </PageLayout>\n );\n }\n\n const buckets = radar?.buckets ?? [];\n const totalSeconds = radar?.totalSeconds ?? 0;\n const reclaimableSeconds = radar?.reclaimableSeconds ?? 0;\n const reclaimablePct =\n totalSeconds > 0\n ? Math.round((reclaimableSeconds / totalSeconds) * 100)\n : 0;\n\n // Largest friction first so the biggest opportunities read at the top.\n const sortedBuckets = [...buckets].sort(\n (a, b) => b.totalSeconds - a.totalSeconds,\n );\n\n const chartData: ChartDatum[] = sortedBuckets.map((bucket) => ({\n kind: kindLabel(bucket.kind),\n total: bucket.totalSeconds,\n reclaimable: bucket.reclaimableSeconds,\n }));\n\n const noBuckets = buckets.length === 0;\n\n return (\n <PageLayout\n title=\"Dead-Time Radar\"\n description=\"Quantified reclaimable hours from friction and untracked gaps\"\n purpose={purpose}\n actions={rangeSelector}\n >\n <div className=\"space-y-6\">\n {/* Hero metrics — all derived from the query result. */}\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3\">\n <StatCard\n featured\n title=\"Reclaimable time\"\n value={formatSecondsHuman(reclaimableSeconds)}\n icon={<Sparkles className=\"h-5 w-5\" />}\n description={`Estimated from your last ${rangeDays} days`}\n />\n <StatCard\n title=\"Total dead-time\"\n value={formatSecondsHuman(totalSeconds)}\n icon={<Clock className=\"h-5 w-5\" />}\n description=\"Friction + untracked gaps logged\"\n />\n <StatCard\n title=\"Reclaimable share\"\n value={`${reclaimablePct}%`}\n icon={<Percent className=\"h-5 w-5\" />}\n description=\"Of total dead-time you could recover\"\n />\n </div>\n\n {/* Honest measurement note — shown prominently, never overstated. */}\n {radar?.note && (\n <GlassCard treatment=\"insight\" className=\"p-4 sm:p-5\">\n <div className=\"flex gap-3\">\n <span className=\"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-status-info-bgSubtle text-status-info-text\">\n <Info className=\"h-5 w-5\" />\n </span>\n <div className=\"min-w-0\">\n <h3 className=\"text-sm font-semibold text-text-primary\">\n How this is measured\n </h3>\n <p className=\"mt-1 text-sm text-text-secondary\">{radar.note}</p>\n </div>\n </div>\n </GlassCard>\n )}\n\n {noBuckets ? (\n <EmptyState\n title=\"No dead-time detected yet\"\n description=\"Once you log friction moments — time spent waiting, commuting, or on-hold — and leave gaps in your tracked day, your reclaimable hours will show up here.\"\n action={\n <span className=\"inline-flex items-center gap-2 rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text\">\n <Radar className=\"h-4 w-4\" />\n Log your first friction moment\n </span>\n }\n />\n ) : (\n <>\n {/* Per-bucket breakdown cards. */}\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3\">\n {sortedBuckets.map((bucket) => {\n const BucketIcon = kindIcon(bucket.kind);\n return (\n <GlassCard\n key={bucket.kind}\n treatment=\"glass\"\n className=\"p-4 sm:p-5\"\n >\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"min-w-0\">\n <p className=\"truncate text-sm font-medium text-text-secondary\">\n {kindLabel(bucket.kind)}\n </p>\n <p className=\"mt-1.5 text-2xl font-bold tabular-nums text-text-primary\">\n {formatSecondsHuman(bucket.totalSeconds)}\n </p>\n </div>\n <span className=\"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-action-primary-bg/10 text-primary\">\n <BucketIcon className=\"h-5 w-5\" />\n </span>\n </div>\n <div className=\"mt-4\">\n <ProgressMeter\n value={bucket.reclaimableSeconds}\n max={bucket.totalSeconds || 1}\n label=\"Reclaimable\"\n tone=\"warning\"\n size=\"sm\"\n format={(v) => formatSecondsHuman(v)}\n />\n </div>\n </GlassCard>\n );\n })}\n </div>\n\n {/* Total vs reclaimable per friction source. */}\n <ChartCard\n title=\"Friction by source\"\n description=\"Total dead-time against the portion you could reclaim, per source\"\n >\n <BarsChart\n data={chartData}\n xKey=\"kind\"\n orientation=\"horizontal\"\n categoryWidth={140}\n series={[\n { key: \"total\", label: \"Total dead-time\" },\n { key: \"reclaimable\", label: \"Reclaimable\" },\n ]}\n valueFormat={(v) => formatSecondsHuman(v)}\n height={Math.max(220, sortedBuckets.length * 56)}\n emptyLabel=\"No friction sources in this range.\"\n ariaLabel=\"Total and reclaimable dead-time by source\"\n />\n </ChartCard>\n </>\n )}\n </div>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA6BA,IAAMC,IAAgB;CACpB;EAAE,OAAO;EAAU,OAAO;CAAE;CAC5B;EAAE,OAAO;EAAW,OAAO;CAAG;CAC9B;EAAE,OAAO;EAAW,OAAO;CAAG;AAChC,GAOMC,IAGF;CACF,SAAS;EAAE,OAAO;EAAoB,MAAMC;CAAU;CACtD,SAAS;EAAE,OAAO;EAA0B,MAAMC;CAAI;CACtD,eAAe;EAAE,OAAO;EAAsB,MAAMC;CAAW;CAC/D,eAAe;EAAE,OAAO;EAAsB,MAAMA;CAAW;CAC/D,UAAU;EAAE,OAAO;EAAa,MAAMC;CAAS;CAC/C,MAAM;EAAE,OAAO;EAAa,MAAMA;CAAS;CAC3C,KAAK;EAAE,OAAO;EAAkB,MAAMA;CAAS;AACjD;AAEA,SAASC,EAAa,GAAsB;CAC1C,OAAOC,EACJ,YAAY,CAAC,CACb,MAAM,QAAQ,CAAC,CACf,OAAO,OAAO,CAAC,CACf,KAAK,MAASC,EAAK,OAAO,CAAC,CAAC,CAAC,YAAY,IAAIA,EAAK,MAAM,CAAC,CAAC,CAAC,CAC3D,KAAK,GAAG;AACb;AAEA,SAASC,EAAU,GAAsB;CACvC,OAAOR,EAAUM,EAAK,EAAE,SAASD,EAAaC,CAAI;AACpD;AAEA,SAASG,EAAS,GAAqD;CACrE,OAAOT,EAAUM,EAAK,EAAE,QAAQI;AAClC;AAEA,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{
213
213
  }) : z ? /* @__PURE__ */ D(a, {
214
214
  ...$,
215
215
  children: [/* @__PURE__ */ E("div", {
216
- className: "rounded-lg border border-status-error-bg/40 bg-status-error-bg p-4 text-sm text-status-error-text",
216
+ className: "rounded-lg border border-status-error-border bg-status-error-bgSubtle p-4 text-sm text-status-error-text",
217
217
  children: "We couldn't load your life balance right now. Please try again in a moment."
218
218
  }), /* @__PURE__ */ E(l, {
219
219
  toasts: s,
@@ -1 +1 @@
1
- {"version":3,"file":"LifeBalancePage.js","names":["_Fragment","_jsxs","RANGE_OPTIONS","sharePct","share","hoursLabel","secondsToHours","seconds","HOURS_IN_WEEK","SetTargetsModal","setBalanceTarget","saving","useSetBalanceTargetMutation","draft","setDraft","useState","open","next","domain","ALL_LIFE_DOMAINS","value","currentTargets","allocated","useMemo","sum","raw","overAllocated","Modal","Fragment","onClose","pending","original","notify","onSaved","Check","lifeDomainLabel","prev","e","cn","GapBadge","pp","gap","StatusBadge","LifeBalancePage","useTimeCampus","useToast","addToast","rangeDays","setRangeDays","targetsOpen","setTargetsOpen","range","isoDaysAgo","isoNow","balanceData","balanceLoading","balanceError","refetchBalance","useMyLifeBalanceQuery","workspaceId","targetsData","refetchTargets","useMyBalanceTargetsQuery","balance","byDomain","hasTargets","targetHoursByDomain","map","targets","target","targetsCount","orderIndex","i","wheelData","a","b","d","listRows","coveredSeconds","unaccountedSeconds","totalSeconds","coveragePct","activeDomains","hasData","rangeLabel","o","refetchAll","pageProps","option","Target","PageLayout","LoadingSkeleton","ToastContainer","dismissToast","PhoneViewLink","StatCard","formatSecondsHuman","Clock","Gauge","Scale","ChartCard","BalanceWheel","ProgressMeter","GlassCard","Sparkles","EmptyState"],"sources":["../../../../src/timecampus/pages/lifetime/LifeBalancePage.tsx"],"sourcesContent":["import { useEffect, useMemo, useState } from \"react\";\nimport { PhoneViewLink } from \"../mobile/MobileScreen\";\nimport { Scale, Target, Clock, Gauge, Sparkles, Check } from \"lucide-react\";\nimport { GlassCard } from \"@burdenoff/fe-libs/ui\";\nimport {\n PageLayout,\n StatCard,\n ChartCard,\n EmptyState,\n StatusBadge,\n Modal,\n LoadingSkeleton,\n BalanceWheel,\n ProgressMeter,\n ToastContainer,\n useToast,\n type BalanceWheelDatum,\n type ToastVariant,\n} from \"../../components\";\nimport { useTimeCampus } from \"../../providers/TimeCampusProvider\";\nimport { cn } from \"../../utils/helpers\";\nimport {\n useMyLifeBalanceQuery,\n useMyBalanceTargetsQuery,\n useSetBalanceTargetMutation,\n type MyLifeBalanceQuery,\n type BalanceTargetFieldsFragment,\n} from \"@/generated/wspace-operations\";\nimport { TimeCampusLifeDomain } from \"@/generated/wspace-types\";\nimport {\n ALL_LIFE_DOMAINS,\n lifeDomainLabel,\n secondsToHours,\n formatSecondsHuman,\n isoDaysAgo,\n isoNow,\n} from \"./domains\";\n\ntype DomainBalance = MyLifeBalanceQuery[\"myLifeBalance\"][\"byDomain\"][number];\n\ninterface RangeOption {\n label: string;\n days: number;\n}\n\nconst RANGE_OPTIONS: RangeOption[] = [\n { label: \"7 days\", days: 7 },\n { label: \"30 days\", days: 30 },\n];\n\n/** Percentage points of a 0..1 share, rounded to a whole number. */\nfunction sharePct(share: number): number {\n return Math.round(share * 100);\n}\n\n/** Fixed one-decimal hours from seconds, e.g. \"40.0\". */\nfunction hoursLabel(seconds: number): string {\n return secondsToHours(seconds).toFixed(1);\n}\n\n// ---------------------------------------------------------------------------\n// Set-targets modal — declares desired hours/week per life domain.\n// ---------------------------------------------------------------------------\ninterface SetTargetsModalProps {\n open: boolean;\n onClose: () => void;\n /** Current desired hours/week keyed by domain (from myBalanceTargets). */\n currentTargets: Partial<Record<TimeCampusLifeDomain, number>>;\n /** Refetch the balance + targets queries after a successful save. */\n onSaved: () => void;\n notify: (variant: ToastVariant, title: string, description?: string) => void;\n}\n\nconst HOURS_IN_WEEK = 168;\n\nfunction SetTargetsModal({\n open,\n onClose,\n currentTargets,\n onSaved,\n notify,\n}: SetTargetsModalProps) {\n const [setBalanceTarget, { loading: saving }] = useSetBalanceTargetMutation();\n const [draft, setDraft] = useState<Record<string, string>>({});\n\n // Seed the draft from the live targets each time the modal opens.\n useEffect(() => {\n if (!open) return;\n const next: Record<string, string> = {};\n for (const domain of ALL_LIFE_DOMAINS) {\n const value = currentTargets[domain];\n next[domain] = typeof value === \"number\" ? String(value) : \"\";\n }\n setDraft(next);\n }, [open, currentTargets]);\n\n const allocated = useMemo(() => {\n let sum = 0;\n for (const domain of ALL_LIFE_DOMAINS) {\n const raw = draft[domain];\n const value = raw ? Number(raw) : NaN;\n if (Number.isFinite(value) && value > 0) sum += value;\n }\n return Math.round(sum * 10) / 10;\n }, [draft]);\n\n const overAllocated = allocated > HOURS_IN_WEEK;\n\n const handleSave = async () => {\n const pending: Promise<unknown>[] = [];\n for (const domain of ALL_LIFE_DOMAINS) {\n const raw = draft[domain];\n if (raw === undefined || raw.trim() === \"\") continue;\n const value = Number(raw);\n if (!Number.isFinite(value) || value < 0) continue;\n const original = currentTargets[domain];\n if (original !== undefined && Math.abs(original - value) < 1e-9) continue;\n pending.push(\n setBalanceTarget({\n variables: { domain, desiredHoursPerWeek: value },\n }),\n );\n }\n\n if (pending.length === 0) {\n onClose();\n return;\n }\n\n try {\n await Promise.all(pending);\n notify(\n \"success\",\n \"Targets saved\",\n `Updated ${pending.length} ${pending.length === 1 ? \"domain\" : \"domains\"}.`,\n );\n onSaved();\n onClose();\n } catch {\n notify(\n \"error\",\n \"Couldn't save targets\",\n \"Something went wrong. Please try again.\",\n );\n }\n };\n\n return (\n <Modal\n open={open}\n onClose={onClose}\n title=\"Set your desired balance\"\n description=\"Declare the hours per week you want to spend in each life domain. The wheel compares this to where your time actually goes.\"\n size=\"xl\"\n footer={\n <>\n <button\n onClick={onClose}\n disabled={saving}\n className=\"rounded-lg border border-border-subtle px-3 py-1.5 text-sm font-medium text-text-secondary transition-colors hover:text-text-primary disabled:opacity-60\"\n >\n Cancel\n </button>\n <button\n onClick={handleSave}\n disabled={saving}\n className=\"inline-flex items-center gap-1.5 rounded-lg bg-action-primary-bg px-3 py-1.5 text-sm font-medium text-action-primary-text transition-colors hover:opacity-90 disabled:opacity-60\"\n >\n <Check className=\"h-4 w-4\" />\n {saving ? \"Saving…\" : \"Save targets\"}\n </button>\n </>\n }\n >\n <div className=\"space-y-2\">\n {ALL_LIFE_DOMAINS.map((domain) => (\n <div\n key={domain}\n className=\"flex items-center justify-between gap-3 rounded-lg border border-border-subtle bg-bg-sunken/40 px-3 py-2\"\n >\n <label\n htmlFor={`target-${domain}`}\n className=\"min-w-0 flex-1 truncate text-sm text-text-primary\"\n >\n {lifeDomainLabel(domain)}\n </label>\n <div className=\"flex shrink-0 items-center gap-2\">\n <input\n id={`target-${domain}`}\n type=\"number\"\n min={0}\n step={0.5}\n inputMode=\"decimal\"\n value={draft[domain] ?? \"\"}\n onChange={(e) =>\n setDraft((prev) => ({ ...prev, [domain]: e.target.value }))\n }\n placeholder=\"0\"\n className=\"w-24 rounded-md border border-border-subtle bg-bg-surface px-2 py-1 text-end text-sm tabular-nums text-text-primary outline-none transition-colors focus:border-action-primary-bg\"\n />\n <span className=\"w-12 text-xs text-text-secondary\">h / wk</span>\n </div>\n </div>\n ))}\n </div>\n\n <p\n className={cn(\n \"mt-4 text-xs tabular-nums\",\n overAllocated ? \"text-status-warning-text\" : \"text-text-secondary\",\n )}\n >\n {allocated.toFixed(1)} of {HOURS_IN_WEEK} hours a week allocated\n {overAllocated\n ? \" — that's more than a week holds; consider trimming.\"\n : \".\"}\n </p>\n </Modal>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Per-domain gap badge (over / under / on-target vs desired share).\n// ---------------------------------------------------------------------------\nfunction GapBadge({ gap }: { gap: number }) {\n const pp = Math.round(Math.abs(gap) * 100);\n if (pp < 2) {\n return <StatusBadge variant=\"success\" label=\"On target\" />;\n }\n if (gap > 0) {\n return <StatusBadge variant=\"warning\" label={`+${pp}pp over`} />;\n }\n return <StatusBadge variant=\"info\" label={`${pp}pp under`} />;\n}\n\n// ---------------------------------------------------------------------------\n// Page\n// ---------------------------------------------------------------------------\nexport function LifeBalancePage() {\n const { workspaceId = \"\" } = useTimeCampus();\n const { toasts, addToast, dismissToast } = useToast();\n const notify = (variant: ToastVariant, title: string, description?: string) =>\n addToast({ variant, title, description });\n\n const [rangeDays, setRangeDays] = useState<number>(30);\n const [targetsOpen, setTargetsOpen] = useState(false);\n\n const range = useMemo(\n () => ({ from: isoDaysAgo(rangeDays), to: isoNow() }),\n [rangeDays],\n );\n\n const {\n data: balanceData,\n loading: balanceLoading,\n error: balanceError,\n refetch: refetchBalance,\n } = useMyLifeBalanceQuery({\n variables: { from: range.from, to: range.to },\n skip: !workspaceId,\n });\n\n const { data: targetsData, refetch: refetchTargets } =\n useMyBalanceTargetsQuery({ skip: !workspaceId });\n\n const balance = balanceData?.myLifeBalance;\n const byDomain = useMemo<DomainBalance[]>(\n () => balance?.byDomain ?? [],\n [balance],\n );\n const hasTargets = balance?.hasTargets ?? false;\n\n // Map current targets (desired hours/week) by domain for the modal + list.\n const targetHoursByDomain = useMemo<\n Partial<Record<TimeCampusLifeDomain, number>>\n >(() => {\n const map: Partial<Record<TimeCampusLifeDomain, number>> = {};\n const targets: BalanceTargetFieldsFragment[] =\n targetsData?.myBalanceTargets ?? [];\n for (const target of targets) {\n map[target.domain] = target.desiredHoursPerWeek;\n }\n return map;\n }, [targetsData]);\n const targetsCount = targetsData?.myBalanceTargets.length ?? 0;\n\n // Canonical display order for the wheel.\n const orderIndex = useMemo(() => {\n const map = new Map<TimeCampusLifeDomain, number>();\n ALL_LIFE_DOMAINS.forEach((domain, i) => map.set(domain, i));\n return map;\n }, []);\n\n const wheelData = useMemo<BalanceWheelDatum[]>(() => {\n return [...byDomain]\n .sort(\n (a, b) =>\n (orderIndex.get(a.domain) ?? 99) - (orderIndex.get(b.domain) ?? 99),\n )\n .map((d) => ({\n domain: d.domain,\n label: lifeDomainLabel(d.domain),\n actualShare: d.actualShare,\n desiredShare: hasTargets ? d.desiredShare : undefined,\n }));\n }, [byDomain, hasTargets, orderIndex]);\n\n // Ranked list (most-spent domains first) — only domains with real signal.\n const listRows = useMemo<DomainBalance[]>(() => {\n return [...byDomain]\n .filter(\n (d) =>\n d.actualSeconds > 0 ||\n (hasTargets && d.desiredShare > 0) ||\n targetHoursByDomain[d.domain] !== undefined,\n )\n .sort((a, b) => b.actualSeconds - a.actualSeconds);\n }, [byDomain, hasTargets, targetHoursByDomain]);\n\n const coveredSeconds = balance?.coveredSeconds ?? 0;\n const unaccountedSeconds = balance?.unaccountedSeconds ?? 0;\n const totalSeconds = coveredSeconds + unaccountedSeconds;\n const coveragePct =\n totalSeconds > 0 ? Math.round((coveredSeconds / totalSeconds) * 100) : 0;\n const activeDomains = byDomain.filter((d) => d.actualSeconds > 0).length;\n const hasData = coveredSeconds > 0 && byDomain.length > 0;\n\n const rangeLabel =\n RANGE_OPTIONS.find((o) => o.days === rangeDays)?.label ??\n `${rangeDays} days`;\n\n const refetchAll = () => {\n void refetchBalance();\n void refetchTargets();\n };\n\n // -- Header actions (range selector + set-targets) -------------------------\n const actions = (\n <>\n <div className=\"flex items-center rounded-lg border border-border-subtle bg-bg-sunken/50 p-0.5\">\n {RANGE_OPTIONS.map((option) => (\n <button\n key={option.days}\n onClick={() => setRangeDays(option.days)}\n className={cn(\n \"rounded-md px-2.5 py-1 text-xs font-medium transition-colors\",\n rangeDays === option.days\n ? \"bg-bg-surface text-text-primary shadow-sm\"\n : \"text-text-secondary hover:text-text-primary\",\n )}\n >\n {option.label}\n </button>\n ))}\n </div>\n <button\n onClick={() => setTargetsOpen(true)}\n className=\"inline-flex items-center gap-1.5 rounded-lg bg-action-primary-bg px-3 py-1.5 text-sm font-medium text-action-primary-text transition-colors hover:opacity-90\"\n >\n <Target className=\"h-4 w-4\" />\n Set targets\n </button>\n </>\n );\n\n const pageProps = {\n title: \"Life Balance\",\n description: \"How your finite time actually splits across life\",\n purpose:\n \"Your week is a fixed budget of hours. This wheel shows how that budget actually splits across the domains of your life, overlaid with the balance you said you want — so the gap between the two is impossible to ignore.\",\n actions,\n } as const;\n\n // -- Loading --------------------------------------------------------------\n if (balanceLoading && !balance) {\n return (\n <PageLayout {...pageProps}>\n <div className=\"space-y-6\">\n <LoadingSkeleton variant=\"card\" count={4} />\n <LoadingSkeleton variant=\"card\" count={2} />\n </div>\n <ToastContainer toasts={toasts} onDismiss={dismissToast} />\n </PageLayout>\n );\n }\n\n // -- Error ----------------------------------------------------------------\n if (balanceError) {\n return (\n <PageLayout {...pageProps}>\n <div className=\"rounded-lg border border-status-error-bg/40 bg-status-error-bg p-4 text-sm text-status-error-text\">\n We couldn't load your life balance right now. Please try again in a\n moment.\n </div>\n <ToastContainer toasts={toasts} onDismiss={dismissToast} />\n </PageLayout>\n );\n }\n\n // -- Empty (no tracked time yet) ------------------------------------------\n if (!hasData) {\n return (\n <PageLayout {...pageProps}>\n <PhoneViewLink path=\"/mobile/life-balance\" />\n <EmptyState\n title=\"No life data yet\"\n description=\"Once you start tracking time across your day, your balance wheel will show how your hours split across each life domain. In the meantime, you can declare the balance you're aiming for.\"\n action={\n <button\n onClick={() => setTargetsOpen(true)}\n className=\"inline-flex items-center gap-1.5 rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text transition-colors hover:opacity-90\"\n >\n <Target className=\"h-4 w-4\" />\n Declare what you value\n </button>\n }\n />\n <SetTargetsModal\n open={targetsOpen}\n onClose={() => setTargetsOpen(false)}\n currentTargets={targetHoursByDomain}\n onSaved={refetchAll}\n notify={notify}\n />\n <ToastContainer toasts={toasts} onDismiss={dismissToast} />\n </PageLayout>\n );\n }\n\n // -- Main -----------------------------------------------------------------\n return (\n <PageLayout {...pageProps}>\n <PhoneViewLink path=\"/mobile/life-balance\" />\n <div className=\"space-y-6\">\n {/* Stat row */}\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={formatSecondsHuman(coveredSeconds)}\n icon={<Clock className=\"h-5 w-5\" />}\n description={`Last ${rangeLabel}`}\n />\n <StatCard\n title=\"Unaccounted\"\n value={formatSecondsHuman(unaccountedSeconds)}\n icon={<Gauge className=\"h-5 w-5\" />}\n description={`${coveragePct}% of time is tracked`}\n />\n <StatCard\n title=\"Active domains\"\n value={String(activeDomains)}\n icon={<Scale className=\"h-5 w-5\" />}\n description={`of ${ALL_LIFE_DOMAINS.length} life domains`}\n />\n <StatCard\n title=\"Targets set\"\n value={`${targetsCount} / ${ALL_LIFE_DOMAINS.length}`}\n icon={<Target className=\"h-5 w-5\" />}\n description={\n hasTargets ? \"Desired balance declared\" : \"Not set yet\"\n }\n />\n </div>\n\n <div className=\"grid grid-cols-1 gap-6 lg:grid-cols-3\">\n {/* The wheel */}\n <ChartCard\n className=\"lg:col-span-2\"\n title=\"Life Balance Wheel\"\n description={\n hasTargets\n ? \"Solid = where your time actually goes · dashed = the balance you want\"\n : \"Where your time actually goes across life domains\"\n }\n >\n <BalanceWheel\n data={wheelData}\n height={360}\n emptyLabel=\"No tracked time in this range yet.\"\n ariaLabel=\"Life balance wheel: actual versus desired share of time by domain\"\n />\n <div className=\"mt-4 border-t border-border-seam pt-4\">\n <div className=\"flex items-center justify-between text-xs text-text-secondary\">\n <span>Time tracked</span>\n <span className=\"tabular-nums text-text-primary\">\n {formatSecondsHuman(coveredSeconds)} of{\" \"}\n {formatSecondsHuman(totalSeconds)} ({coveragePct}%)\n </span>\n </div>\n <ProgressMeter\n className=\"mt-2\"\n value={coveragePct}\n max={100}\n higherIsWorse={false}\n showValue={false}\n label=\"Coverage\"\n />\n </div>\n </ChartCard>\n\n {/* Headline + per-domain list */}\n <GlassCard treatment=\"glass\" className=\"p-5 sm:p-6\">\n <h2 className=\"text-xl font-bold leading-tight text-text-primary\">\n Your week vs the life you want\n </h2>\n <p className=\"mt-1 text-xs text-text-secondary\">\n Per-domain — hours tracked vs your desired share\n </p>\n\n {!hasTargets && (\n <div className=\"mt-3 flex items-start gap-2 rounded-lg border border-border-subtle bg-action-primary-bg/10 p-3 text-xs text-text-secondary\">\n <Sparkles className=\"mt-0.5 h-4 w-4 shrink-0 text-primary\" />\n <span>\n You haven't declared a desired balance yet, so the wheel is\n descriptive only.{\" \"}\n <button\n onClick={() => setTargetsOpen(true)}\n className=\"font-medium text-primary underline-offset-2 hover:underline\"\n >\n Set your targets\n </button>{\" \"}\n to see the gap.\n </span>\n </div>\n )}\n\n <ul className=\"mt-4 max-h-[30rem] space-y-2 overflow-y-auto pe-1\">\n {listRows.map((d) => {\n const target = targetHoursByDomain[d.domain];\n return (\n <li\n key={d.domain}\n className=\"flex items-center gap-3 rounded-lg border border-border-subtle bg-bg-surface/40 px-3 py-2.5\"\n >\n <div className=\"min-w-0 flex-1\">\n <p className=\"truncate text-sm font-medium text-text-primary\">\n {lifeDomainLabel(d.domain)}\n </p>\n <p className=\"mt-0.5 text-xs text-text-secondary\">\n {sharePct(d.actualShare)}% of tracked\n {hasTargets\n ? ` · ${sharePct(d.desiredShare)}% desired`\n : \"\"}\n {typeof target === \"number\"\n ? ` · ${target}h/wk target`\n : \"\"}\n </p>\n </div>\n <div className=\"shrink-0 text-end\">\n <p className=\"text-sm font-semibold tabular-nums text-text-primary\">\n {hoursLabel(d.actualSeconds)}h\n </p>\n </div>\n {hasTargets && (\n <div className=\"shrink-0\">\n <GapBadge gap={d.gap} />\n </div>\n )}\n </li>\n );\n })}\n </ul>\n </GlassCard>\n </div>\n </div>\n\n <SetTargetsModal\n open={targetsOpen}\n onClose={() => setTargetsOpen(false)}\n currentTargets={targetHoursByDomain}\n onSaved={refetchAll}\n notify={notify}\n />\n <ToastContainer toasts={toasts} onDismiss={dismissToast} />\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA6CA,IAAME,IAA+B,CACnC;CAAE,OAAO;CAAU,MAAM;AAAE,GAC3B;CAAE,OAAO;CAAW,MAAM;AAAG,CAC/B;AAGA,SAASC,EAAS,GAAuB;C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,CAAC;OACC,CAAA;MACK;KACR,CAAA,CAAA;IACF,CAAA,CAAA;;GAEL,kBAACnE,GAAD;IACE,MAAMwC;IACN,eAAeC,EAAe,EAAK;IACnC,gBAAgBgB;IAChB,SAASoB;IACD;GACT,CAAA;GACD,kBAACM,GAAD;IAAwB;IAAQ,WAAWC;GAAe,CAAA;EAChD;C,KA7KV,kBAACH,GAAD;EAAY,GAAIH;EAAhB,UAAA;GACE,kBAACO,GAAD,EAAe,MAAK,uBAAwB,CAAA;GAC5C,kBAACW,GAAD;IACE,OAAM;IACN,aAAY;IACZ,QACE,kBAAC,UAAD;KACE,eAAevD,EAAe,EAAI;KAClC,WAAU;KAFZ,UAAA,CAIE,kBAACuC,GAAD,EAAQ,WAAU,UAAW,CAAA,GAAC,wBAExB;;GAEX,CAAA;GACD,kBAAChF,GAAD;IACE,MAAMwC;IACN,eAAeC,EAAe,EAAK;IACnC,gBAAgBgB;IAChB,SAASoB;IACD;GACT,CAAA;GACD,kBAACM,GAAD;IAAwB;IAAQ,WAAWC;GAAe,CAAA;EAChD;;AAwJlB"}
1
+ {"version":3,"file":"LifeBalancePage.js","names":["_Fragment","_jsxs","RANGE_OPTIONS","sharePct","share","hoursLabel","secondsToHours","seconds","HOURS_IN_WEEK","SetTargetsModal","setBalanceTarget","saving","useSetBalanceTargetMutation","draft","setDraft","useState","open","next","domain","ALL_LIFE_DOMAINS","value","currentTargets","allocated","useMemo","sum","raw","overAllocated","Modal","Fragment","onClose","pending","original","notify","onSaved","Check","lifeDomainLabel","prev","e","cn","GapBadge","pp","gap","StatusBadge","LifeBalancePage","useTimeCampus","useToast","addToast","rangeDays","setRangeDays","targetsOpen","setTargetsOpen","range","isoDaysAgo","isoNow","balanceData","balanceLoading","balanceError","refetchBalance","useMyLifeBalanceQuery","workspaceId","targetsData","refetchTargets","useMyBalanceTargetsQuery","balance","byDomain","hasTargets","targetHoursByDomain","map","targets","target","targetsCount","orderIndex","i","wheelData","a","b","d","listRows","coveredSeconds","unaccountedSeconds","totalSeconds","coveragePct","activeDomains","hasData","rangeLabel","o","refetchAll","pageProps","option","Target","PageLayout","LoadingSkeleton","ToastContainer","dismissToast","PhoneViewLink","StatCard","formatSecondsHuman","Clock","Gauge","Scale","ChartCard","BalanceWheel","ProgressMeter","GlassCard","Sparkles","EmptyState"],"sources":["../../../../src/timecampus/pages/lifetime/LifeBalancePage.tsx"],"sourcesContent":["import { useEffect, useMemo, useState } from \"react\";\nimport { PhoneViewLink } from \"../mobile/MobileScreen\";\nimport { Scale, Target, Clock, Gauge, Sparkles, Check } from \"lucide-react\";\nimport { GlassCard } from \"@burdenoff/fe-libs/ui\";\nimport {\n PageLayout,\n StatCard,\n ChartCard,\n EmptyState,\n StatusBadge,\n Modal,\n LoadingSkeleton,\n BalanceWheel,\n ProgressMeter,\n ToastContainer,\n useToast,\n type BalanceWheelDatum,\n type ToastVariant,\n} from \"../../components\";\nimport { useTimeCampus } from \"../../providers/TimeCampusProvider\";\nimport { cn } from \"../../utils/helpers\";\nimport {\n useMyLifeBalanceQuery,\n useMyBalanceTargetsQuery,\n useSetBalanceTargetMutation,\n type MyLifeBalanceQuery,\n type BalanceTargetFieldsFragment,\n} from \"@/generated/wspace-operations\";\nimport { TimeCampusLifeDomain } from \"@/generated/wspace-types\";\nimport {\n ALL_LIFE_DOMAINS,\n lifeDomainLabel,\n secondsToHours,\n formatSecondsHuman,\n isoDaysAgo,\n isoNow,\n} from \"./domains\";\n\ntype DomainBalance = MyLifeBalanceQuery[\"myLifeBalance\"][\"byDomain\"][number];\n\ninterface RangeOption {\n label: string;\n days: number;\n}\n\nconst RANGE_OPTIONS: RangeOption[] = [\n { label: \"7 days\", days: 7 },\n { label: \"30 days\", days: 30 },\n];\n\n/** Percentage points of a 0..1 share, rounded to a whole number. */\nfunction sharePct(share: number): number {\n return Math.round(share * 100);\n}\n\n/** Fixed one-decimal hours from seconds, e.g. \"40.0\". */\nfunction hoursLabel(seconds: number): string {\n return secondsToHours(seconds).toFixed(1);\n}\n\n// ---------------------------------------------------------------------------\n// Set-targets modal — declares desired hours/week per life domain.\n// ---------------------------------------------------------------------------\ninterface SetTargetsModalProps {\n open: boolean;\n onClose: () => void;\n /** Current desired hours/week keyed by domain (from myBalanceTargets). */\n currentTargets: Partial<Record<TimeCampusLifeDomain, number>>;\n /** Refetch the balance + targets queries after a successful save. */\n onSaved: () => void;\n notify: (variant: ToastVariant, title: string, description?: string) => void;\n}\n\nconst HOURS_IN_WEEK = 168;\n\nfunction SetTargetsModal({\n open,\n onClose,\n currentTargets,\n onSaved,\n notify,\n}: SetTargetsModalProps) {\n const [setBalanceTarget, { loading: saving }] = useSetBalanceTargetMutation();\n const [draft, setDraft] = useState<Record<string, string>>({});\n\n // Seed the draft from the live targets each time the modal opens.\n useEffect(() => {\n if (!open) return;\n const next: Record<string, string> = {};\n for (const domain of ALL_LIFE_DOMAINS) {\n const value = currentTargets[domain];\n next[domain] = typeof value === \"number\" ? String(value) : \"\";\n }\n setDraft(next);\n }, [open, currentTargets]);\n\n const allocated = useMemo(() => {\n let sum = 0;\n for (const domain of ALL_LIFE_DOMAINS) {\n const raw = draft[domain];\n const value = raw ? Number(raw) : NaN;\n if (Number.isFinite(value) && value > 0) sum += value;\n }\n return Math.round(sum * 10) / 10;\n }, [draft]);\n\n const overAllocated = allocated > HOURS_IN_WEEK;\n\n const handleSave = async () => {\n const pending: Promise<unknown>[] = [];\n for (const domain of ALL_LIFE_DOMAINS) {\n const raw = draft[domain];\n if (raw === undefined || raw.trim() === \"\") continue;\n const value = Number(raw);\n if (!Number.isFinite(value) || value < 0) continue;\n const original = currentTargets[domain];\n if (original !== undefined && Math.abs(original - value) < 1e-9) continue;\n pending.push(\n setBalanceTarget({\n variables: { domain, desiredHoursPerWeek: value },\n }),\n );\n }\n\n if (pending.length === 0) {\n onClose();\n return;\n }\n\n try {\n await Promise.all(pending);\n notify(\n \"success\",\n \"Targets saved\",\n `Updated ${pending.length} ${pending.length === 1 ? \"domain\" : \"domains\"}.`,\n );\n onSaved();\n onClose();\n } catch {\n notify(\n \"error\",\n \"Couldn't save targets\",\n \"Something went wrong. Please try again.\",\n );\n }\n };\n\n return (\n <Modal\n open={open}\n onClose={onClose}\n title=\"Set your desired balance\"\n description=\"Declare the hours per week you want to spend in each life domain. The wheel compares this to where your time actually goes.\"\n size=\"xl\"\n footer={\n <>\n <button\n onClick={onClose}\n disabled={saving}\n className=\"rounded-lg border border-border-subtle px-3 py-1.5 text-sm font-medium text-text-secondary transition-colors hover:text-text-primary disabled:opacity-60\"\n >\n Cancel\n </button>\n <button\n onClick={handleSave}\n disabled={saving}\n className=\"inline-flex items-center gap-1.5 rounded-lg bg-action-primary-bg px-3 py-1.5 text-sm font-medium text-action-primary-text transition-colors hover:opacity-90 disabled:opacity-60\"\n >\n <Check className=\"h-4 w-4\" />\n {saving ? \"Saving…\" : \"Save targets\"}\n </button>\n </>\n }\n >\n <div className=\"space-y-2\">\n {ALL_LIFE_DOMAINS.map((domain) => (\n <div\n key={domain}\n className=\"flex items-center justify-between gap-3 rounded-lg border border-border-subtle bg-bg-sunken/40 px-3 py-2\"\n >\n <label\n htmlFor={`target-${domain}`}\n className=\"min-w-0 flex-1 truncate text-sm text-text-primary\"\n >\n {lifeDomainLabel(domain)}\n </label>\n <div className=\"flex shrink-0 items-center gap-2\">\n <input\n id={`target-${domain}`}\n type=\"number\"\n min={0}\n step={0.5}\n inputMode=\"decimal\"\n value={draft[domain] ?? \"\"}\n onChange={(e) =>\n setDraft((prev) => ({ ...prev, [domain]: e.target.value }))\n }\n placeholder=\"0\"\n className=\"w-24 rounded-md border border-border-subtle bg-bg-surface px-2 py-1 text-end text-sm tabular-nums text-text-primary outline-none transition-colors focus:border-action-primary-bg\"\n />\n <span className=\"w-12 text-xs text-text-secondary\">h / wk</span>\n </div>\n </div>\n ))}\n </div>\n\n <p\n className={cn(\n \"mt-4 text-xs tabular-nums\",\n overAllocated ? \"text-status-warning-text\" : \"text-text-secondary\",\n )}\n >\n {allocated.toFixed(1)} of {HOURS_IN_WEEK} hours a week allocated\n {overAllocated\n ? \" — that's more than a week holds; consider trimming.\"\n : \".\"}\n </p>\n </Modal>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Per-domain gap badge (over / under / on-target vs desired share).\n// ---------------------------------------------------------------------------\nfunction GapBadge({ gap }: { gap: number }) {\n const pp = Math.round(Math.abs(gap) * 100);\n if (pp < 2) {\n return <StatusBadge variant=\"success\" label=\"On target\" />;\n }\n if (gap > 0) {\n return <StatusBadge variant=\"warning\" label={`+${pp}pp over`} />;\n }\n return <StatusBadge variant=\"info\" label={`${pp}pp under`} />;\n}\n\n// ---------------------------------------------------------------------------\n// Page\n// ---------------------------------------------------------------------------\nexport function LifeBalancePage() {\n const { workspaceId = \"\" } = useTimeCampus();\n const { toasts, addToast, dismissToast } = useToast();\n const notify = (variant: ToastVariant, title: string, description?: string) =>\n addToast({ variant, title, description });\n\n const [rangeDays, setRangeDays] = useState<number>(30);\n const [targetsOpen, setTargetsOpen] = useState(false);\n\n const range = useMemo(\n () => ({ from: isoDaysAgo(rangeDays), to: isoNow() }),\n [rangeDays],\n );\n\n const {\n data: balanceData,\n loading: balanceLoading,\n error: balanceError,\n refetch: refetchBalance,\n } = useMyLifeBalanceQuery({\n variables: { from: range.from, to: range.to },\n skip: !workspaceId,\n });\n\n const { data: targetsData, refetch: refetchTargets } =\n useMyBalanceTargetsQuery({ skip: !workspaceId });\n\n const balance = balanceData?.myLifeBalance;\n const byDomain = useMemo<DomainBalance[]>(\n () => balance?.byDomain ?? [],\n [balance],\n );\n const hasTargets = balance?.hasTargets ?? false;\n\n // Map current targets (desired hours/week) by domain for the modal + list.\n const targetHoursByDomain = useMemo<\n Partial<Record<TimeCampusLifeDomain, number>>\n >(() => {\n const map: Partial<Record<TimeCampusLifeDomain, number>> = {};\n const targets: BalanceTargetFieldsFragment[] =\n targetsData?.myBalanceTargets ?? [];\n for (const target of targets) {\n map[target.domain] = target.desiredHoursPerWeek;\n }\n return map;\n }, [targetsData]);\n const targetsCount = targetsData?.myBalanceTargets.length ?? 0;\n\n // Canonical display order for the wheel.\n const orderIndex = useMemo(() => {\n const map = new Map<TimeCampusLifeDomain, number>();\n ALL_LIFE_DOMAINS.forEach((domain, i) => map.set(domain, i));\n return map;\n }, []);\n\n const wheelData = useMemo<BalanceWheelDatum[]>(() => {\n return [...byDomain]\n .sort(\n (a, b) =>\n (orderIndex.get(a.domain) ?? 99) - (orderIndex.get(b.domain) ?? 99),\n )\n .map((d) => ({\n domain: d.domain,\n label: lifeDomainLabel(d.domain),\n actualShare: d.actualShare,\n desiredShare: hasTargets ? d.desiredShare : undefined,\n }));\n }, [byDomain, hasTargets, orderIndex]);\n\n // Ranked list (most-spent domains first) — only domains with real signal.\n const listRows = useMemo<DomainBalance[]>(() => {\n return [...byDomain]\n .filter(\n (d) =>\n d.actualSeconds > 0 ||\n (hasTargets && d.desiredShare > 0) ||\n targetHoursByDomain[d.domain] !== undefined,\n )\n .sort((a, b) => b.actualSeconds - a.actualSeconds);\n }, [byDomain, hasTargets, targetHoursByDomain]);\n\n const coveredSeconds = balance?.coveredSeconds ?? 0;\n const unaccountedSeconds = balance?.unaccountedSeconds ?? 0;\n const totalSeconds = coveredSeconds + unaccountedSeconds;\n const coveragePct =\n totalSeconds > 0 ? Math.round((coveredSeconds / totalSeconds) * 100) : 0;\n const activeDomains = byDomain.filter((d) => d.actualSeconds > 0).length;\n const hasData = coveredSeconds > 0 && byDomain.length > 0;\n\n const rangeLabel =\n RANGE_OPTIONS.find((o) => o.days === rangeDays)?.label ??\n `${rangeDays} days`;\n\n const refetchAll = () => {\n void refetchBalance();\n void refetchTargets();\n };\n\n // -- Header actions (range selector + set-targets) -------------------------\n const actions = (\n <>\n <div className=\"flex items-center rounded-lg border border-border-subtle bg-bg-sunken/50 p-0.5\">\n {RANGE_OPTIONS.map((option) => (\n <button\n key={option.days}\n onClick={() => setRangeDays(option.days)}\n className={cn(\n \"rounded-md px-2.5 py-1 text-xs font-medium transition-colors\",\n rangeDays === option.days\n ? \"bg-bg-surface text-text-primary shadow-sm\"\n : \"text-text-secondary hover:text-text-primary\",\n )}\n >\n {option.label}\n </button>\n ))}\n </div>\n <button\n onClick={() => setTargetsOpen(true)}\n className=\"inline-flex items-center gap-1.5 rounded-lg bg-action-primary-bg px-3 py-1.5 text-sm font-medium text-action-primary-text transition-colors hover:opacity-90\"\n >\n <Target className=\"h-4 w-4\" />\n Set targets\n </button>\n </>\n );\n\n const pageProps = {\n title: \"Life Balance\",\n description: \"How your finite time actually splits across life\",\n purpose:\n \"Your week is a fixed budget of hours. This wheel shows how that budget actually splits across the domains of your life, overlaid with the balance you said you want — so the gap between the two is impossible to ignore.\",\n actions,\n } as const;\n\n // -- Loading --------------------------------------------------------------\n if (balanceLoading && !balance) {\n return (\n <PageLayout {...pageProps}>\n <div className=\"space-y-6\">\n <LoadingSkeleton variant=\"card\" count={4} />\n <LoadingSkeleton variant=\"card\" count={2} />\n </div>\n <ToastContainer toasts={toasts} onDismiss={dismissToast} />\n </PageLayout>\n );\n }\n\n // -- Error ----------------------------------------------------------------\n if (balanceError) {\n return (\n <PageLayout {...pageProps}>\n <div className=\"rounded-lg border border-status-error-border bg-status-error-bgSubtle p-4 text-sm text-status-error-text\">\n We couldn't load your life balance right now. Please try again in a\n moment.\n </div>\n <ToastContainer toasts={toasts} onDismiss={dismissToast} />\n </PageLayout>\n );\n }\n\n // -- Empty (no tracked time yet) ------------------------------------------\n if (!hasData) {\n return (\n <PageLayout {...pageProps}>\n <PhoneViewLink path=\"/mobile/life-balance\" />\n <EmptyState\n title=\"No life data yet\"\n description=\"Once you start tracking time across your day, your balance wheel will show how your hours split across each life domain. In the meantime, you can declare the balance you're aiming for.\"\n action={\n <button\n onClick={() => setTargetsOpen(true)}\n className=\"inline-flex items-center gap-1.5 rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text transition-colors hover:opacity-90\"\n >\n <Target className=\"h-4 w-4\" />\n Declare what you value\n </button>\n }\n />\n <SetTargetsModal\n open={targetsOpen}\n onClose={() => setTargetsOpen(false)}\n currentTargets={targetHoursByDomain}\n onSaved={refetchAll}\n notify={notify}\n />\n <ToastContainer toasts={toasts} onDismiss={dismissToast} />\n </PageLayout>\n );\n }\n\n // -- Main -----------------------------------------------------------------\n return (\n <PageLayout {...pageProps}>\n <PhoneViewLink path=\"/mobile/life-balance\" />\n <div className=\"space-y-6\">\n {/* Stat row */}\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={formatSecondsHuman(coveredSeconds)}\n icon={<Clock className=\"h-5 w-5\" />}\n description={`Last ${rangeLabel}`}\n />\n <StatCard\n title=\"Unaccounted\"\n value={formatSecondsHuman(unaccountedSeconds)}\n icon={<Gauge className=\"h-5 w-5\" />}\n description={`${coveragePct}% of time is tracked`}\n />\n <StatCard\n title=\"Active domains\"\n value={String(activeDomains)}\n icon={<Scale className=\"h-5 w-5\" />}\n description={`of ${ALL_LIFE_DOMAINS.length} life domains`}\n />\n <StatCard\n title=\"Targets set\"\n value={`${targetsCount} / ${ALL_LIFE_DOMAINS.length}`}\n icon={<Target className=\"h-5 w-5\" />}\n description={\n hasTargets ? \"Desired balance declared\" : \"Not set yet\"\n }\n />\n </div>\n\n <div className=\"grid grid-cols-1 gap-6 lg:grid-cols-3\">\n {/* The wheel */}\n <ChartCard\n className=\"lg:col-span-2\"\n title=\"Life Balance Wheel\"\n description={\n hasTargets\n ? \"Solid = where your time actually goes · dashed = the balance you want\"\n : \"Where your time actually goes across life domains\"\n }\n >\n <BalanceWheel\n data={wheelData}\n height={360}\n emptyLabel=\"No tracked time in this range yet.\"\n ariaLabel=\"Life balance wheel: actual versus desired share of time by domain\"\n />\n <div className=\"mt-4 border-t border-border-seam pt-4\">\n <div className=\"flex items-center justify-between text-xs text-text-secondary\">\n <span>Time tracked</span>\n <span className=\"tabular-nums text-text-primary\">\n {formatSecondsHuman(coveredSeconds)} of{\" \"}\n {formatSecondsHuman(totalSeconds)} ({coveragePct}%)\n </span>\n </div>\n <ProgressMeter\n className=\"mt-2\"\n value={coveragePct}\n max={100}\n higherIsWorse={false}\n showValue={false}\n label=\"Coverage\"\n />\n </div>\n </ChartCard>\n\n {/* Headline + per-domain list */}\n <GlassCard treatment=\"glass\" className=\"p-5 sm:p-6\">\n <h2 className=\"text-xl font-bold leading-tight text-text-primary\">\n Your week vs the life you want\n </h2>\n <p className=\"mt-1 text-xs text-text-secondary\">\n Per-domain — hours tracked vs your desired share\n </p>\n\n {!hasTargets && (\n <div className=\"mt-3 flex items-start gap-2 rounded-lg border border-border-subtle bg-action-primary-bg/10 p-3 text-xs text-text-secondary\">\n <Sparkles className=\"mt-0.5 h-4 w-4 shrink-0 text-primary\" />\n <span>\n You haven't declared a desired balance yet, so the wheel is\n descriptive only.{\" \"}\n <button\n onClick={() => setTargetsOpen(true)}\n className=\"font-medium text-primary underline-offset-2 hover:underline\"\n >\n Set your targets\n </button>{\" \"}\n to see the gap.\n </span>\n </div>\n )}\n\n <ul className=\"mt-4 max-h-[30rem] space-y-2 overflow-y-auto pe-1\">\n {listRows.map((d) => {\n const target = targetHoursByDomain[d.domain];\n return (\n <li\n key={d.domain}\n className=\"flex items-center gap-3 rounded-lg border border-border-subtle bg-bg-surface/40 px-3 py-2.5\"\n >\n <div className=\"min-w-0 flex-1\">\n <p className=\"truncate text-sm font-medium text-text-primary\">\n {lifeDomainLabel(d.domain)}\n </p>\n <p className=\"mt-0.5 text-xs text-text-secondary\">\n {sharePct(d.actualShare)}% of tracked\n {hasTargets\n ? ` · ${sharePct(d.desiredShare)}% desired`\n : \"\"}\n {typeof target === \"number\"\n ? ` · ${target}h/wk target`\n : \"\"}\n </p>\n </div>\n <div className=\"shrink-0 text-end\">\n <p className=\"text-sm font-semibold tabular-nums text-text-primary\">\n {hoursLabel(d.actualSeconds)}h\n </p>\n </div>\n {hasTargets && (\n <div className=\"shrink-0\">\n <GapBadge gap={d.gap} />\n </div>\n )}\n </li>\n );\n })}\n </ul>\n </GlassCard>\n </div>\n </div>\n\n <SetTargetsModal\n open={targetsOpen}\n onClose={() => setTargetsOpen(false)}\n currentTargets={targetHoursByDomain}\n onSaved={refetchAll}\n notify={notify}\n />\n <ToastContainer toasts={toasts} onDismiss={dismissToast} />\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA6CA,IAAME,IAA+B,CACnC;CAAE,OAAO;CAAU,MAAM;AAAE,GAC3B;CAAE,OAAO;CAAW,MAAM;AAAG,CAC/B;AAGA,SAASC,EAAS,GAAuB;CACvC,OAAO,KAAK,MAAMC,IAAQ,GAAG;AAC/B;AAGA,SAASC,EAAW,GAAyB;CAC3C,OAAOC,EAAeC,CAAO,CAAC,CAAC,QAAQ,CAAC;AAC1C;AAeA,IAAMC,IAAgB;AAEtB,SAASC,EAAgB,EACvB,SACA,YACA,mBACA,YACA,aACuB;CACvB,IAAM,CAACC,GAAkB,EAAE,SAASC,OAAYC,EAA4B,GACtE,CAACC,GAAOC,KAAYC,EAAiC,CAAC,CAAC;CAG7D,QAAgB;EACd,IAAI,CAACC,GAAM;EACX,IAAMC,IAA+B,CAAC;EACtC,KAAK,IAAMC,KAAUC,GAAkB;GACrC,IAAMC,IAAQC,EAAeH;GAC7B,EAAKA,KAAU,OAAOE,KAAU,WAAW,OAAOA,CAAK,IAAI;EAC7D;EACA,EAASH,CAAI;CACf,GAAG,CAACD,GAAMK,CAAc,CAAC;CAEzB,IAAMC,IAAYC,QAAc;EAC9B,IAAIC,IAAM;EACV,KAAK,IAAMN,KAAUC,GAAkB;GACrC,IAAMM,IAAMZ,EAAMK,IACZE,IAAQK,IAAM,OAAOA,CAAG,IAAI;GAClC,AAAI,OAAO,SAASL,CAAK,KAAKA,IAAQ,MAAG,KAAOA;EAClD;EACA,OAAO,KAAK,MAAMI,IAAM,EAAE,IAAI;CAChC,GAAG,CAACX,CAAK,CAAC,GAEJa,IAAgBJ,IAAYd;C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AAM9D,EAASyE,EAAE,YAAY,EAAE,aAC/B;cACH,OAAOP,KAAW,WACf,MAAMA,EAAO,eACb;aACH;YACA,CAAA,CAAA;;WACL,kBAAC,OAAD;YAAK,WAAU;YACb,UAAA,kBAAC,KAAD;aAAG,WAAU;aAAb,UAAA,CACGhE,EAAWuE,EAAE,aAAa,GAAE,GAC5B;;WACA,CAAA;WACJX,KACC,kBAAC,OAAD;YAAK,WAAU;YACb,UAAA,kBAAC1B,GAAD,EAAU,KAAKqC,EAAE,IAAM,CAAA;WACpB,CAAA;UAEL;SA3BG,GAAAA,EAAE,MA2BL;QAER,CAAC;OACC,CAAA;MACK;KACR,CAAA,CAAA;IACF,CAAA,CAAA;;GAEL,kBAACnE,GAAD;IACE,MAAMwC;IACN,eAAeC,EAAe,EAAK;IACnC,gBAAgBgB;IAChB,SAASoB;IACD;GACT,CAAA;GACD,kBAACM,GAAD;IAAwB;IAAQ,WAAWC;GAAe,CAAA;EAChD;C,KA7KV,kBAACH,GAAD;EAAY,GAAIH;EAAhB,UAAA;GACE,kBAACO,GAAD,EAAe,MAAK,uBAAwB,CAAA;GAC5C,kBAACW,GAAD;IACE,OAAM;IACN,aAAY;IACZ,QACE,kBAAC,UAAD;KACE,eAAevD,EAAe,EAAI;KAClC,WAAU;KAFZ,UAAA,CAIE,kBAACuC,GAAD,EAAQ,WAAU,UAAW,CAAA,GAAC,wBAExB;;GAEX,CAAA;GACD,kBAAChF,GAAD;IACE,MAAMwC;IACN,eAAeC,EAAe,EAAK;IACnC,gBAAgBgB;IAChB,SAASoB;IACD;GACT,CAAA;GACD,kBAACM,GAAD;IAAwB;IAAQ,WAAWC;GAAe,CAAA;EAChD;;AAwJlB"}
@@ -83,10 +83,10 @@ var M = {
83
83
  default: "bg-action-primary-bg",
84
84
  muted: "bg-muted-foreground"
85
85
  }, me = {
86
- success: "bg-status-success-bg text-status-success-text",
87
- warning: "bg-status-warning-bg text-status-warning-text",
88
- error: "bg-status-error-bg text-status-error-text",
89
- info: "bg-status-info-bg text-status-info-text",
86
+ success: "bg-status-success-bgSubtle text-status-success-text",
87
+ warning: "bg-status-warning-bgSubtle text-status-warning-text",
88
+ error: "bg-status-error-bgSubtle text-status-error-text",
89
+ info: "bg-status-info-bgSubtle text-status-info-text",
90
90
  default: "bg-action-primary-bg/10 text-primary",
91
91
  muted: "bg-bg-sunken text-text-secondary"
92
92
  };
@@ -212,7 +212,7 @@ function F() {
212
212
  count: 6
213
213
  })]
214
214
  }) : F ? /* @__PURE__ */ A("div", {
215
- className: "rounded-lg border border-status-error-bg/40 bg-status-error-bg p-4 text-sm text-status-error-text",
215
+ className: "rounded-lg border border-status-error-border bg-status-error-bgSubtle p-4 text-sm text-status-error-text",
216
216
  children: "Failed to load your life timeline. Please try again later."
217
217
  }) : /* @__PURE__ */ j("div", {
218
218
  className: "space-y-6",
@@ -1 +1 @@
1
- {"version":3,"file":"LifeTimelinePage.js","names":["_Fragment","DOMAIN_META","TimeCampusLifeDomain","Briefcase","Moon","Dumbbell","Heart","BookOpen","Clapperboard","Car","Hourglass","House","Sparkles","MessageCircle","Wallet","NotebookPen","CircleDashed","DOT_BY_VARIANT","CHIP_BY_VARIANT","domainMeta","domain","RANGE_OPTIONS","toLocalDateInput","date","toLocalDateTimeInput","dayBounds","start","dateStr","end","segmentEndTime","segment","endMs","LifeTimelinePage","useTimeCampus","useToast","range","setRange","useState","setDateStr","useMemo","isoDaysAgo","isoNow","useLifeTimelineQuery","workspaceId","logLifeTime","logging","useLogLifeTimeEntryMutation","timeline","data","summary","segments","a","b","byDomain","totalCovered","unaccounted","workSeconds","d","s","personalSeconds","donutData","lifeDomainLabel","logOpen","setLogOpen","logDomain","setLogDomain","PERSONAL_LIFE_DOMAINS","logStart","setLogStart","logMinutes","setLogMinutes","logNote","setLogNote","openLog","handleLog","minutes","result","addToast","formatSecondsHuman","refetch","err","logButton","Plus","PageLayout","Fragment","opt","cn","loading","LoadingSkeleton","error","StatCard","Activity","ChartCard","DonutChart","v","EmptyState","GlassCard","meta","Icon","isPersonal","TimeCampusOwnershipContext","formatTime","StatusBadge","Modal","ThemedSelect","ToastContainer","dismissToast"],"sources":["../../../../src/timecampus/pages/lifetime/LifeTimelinePage.tsx"],"sourcesContent":["import { useMemo, useState, type FormEvent } from \"react\";\nimport {\n Activity,\n BookOpen,\n Briefcase,\n Car,\n CircleDashed,\n Clapperboard,\n Dumbbell,\n Heart,\n Hourglass,\n House,\n MessageCircle,\n Moon,\n NotebookPen,\n Plus,\n Sparkles,\n Wallet,\n} from \"lucide-react\";\nimport { GlassCard, ThemedSelect } from \"@burdenoff/fe-libs/ui\";\nimport {\n PageLayout,\n StatCard,\n StatusBadge,\n ChartCard,\n DonutChart,\n EmptyState,\n LoadingSkeleton,\n Modal,\n useToast,\n ToastContainer,\n} from \"../../components\";\nimport { useTimeCampus } from \"../../providers/TimeCampusProvider\";\nimport { cn, formatTime, type BadgeVariant } from \"../../utils/helpers\";\nimport {\n PERSONAL_LIFE_DOMAINS,\n formatSecondsHuman,\n isoDaysAgo,\n isoNow,\n lifeDomainLabel,\n} from \"./domains\";\nimport {\n TimeCampusLifeDomain,\n TimeCampusOwnershipContext,\n} from \"@/generated/wspace-types\";\nimport {\n useLifeTimelineQuery,\n useLogLifeTimeEntryMutation,\n type LifeTimelineQuery,\n} from \"@/generated/wspace-operations\";\n\ntype LifeSegment = LifeTimelineQuery[\"lifeTimeline\"][\"segments\"][number];\ntype DomainTotal =\n LifeTimelineQuery[\"lifeTimeline\"][\"summary\"][\"byDomain\"][number];\n\n/** Per-domain presentation: an icon + a semantic colour family. Identity is\n * always carried by the label — colour is only a supporting cue, so reusing a\n * family across domains is honest. Every class here is a registered token. */\nconst DOMAIN_META: Record<\n TimeCampusLifeDomain,\n { icon: typeof Briefcase; variant: BadgeVariant }\n> = {\n [TimeCampusLifeDomain.Work]: { icon: Briefcase, variant: \"info\" },\n [TimeCampusLifeDomain.Sleep]: { icon: Moon, variant: \"muted\" },\n [TimeCampusLifeDomain.Health]: { icon: Dumbbell, variant: \"success\" },\n [TimeCampusLifeDomain.Family]: { icon: Heart, variant: \"error\" },\n [TimeCampusLifeDomain.Learning]: { icon: BookOpen, variant: \"info\" },\n [TimeCampusLifeDomain.Leisure]: { icon: Clapperboard, variant: \"default\" },\n [TimeCampusLifeDomain.Commute]: { icon: Car, variant: \"warning\" },\n [TimeCampusLifeDomain.Waiting]: { icon: Hourglass, variant: \"muted\" },\n [TimeCampusLifeDomain.Chores]: { icon: House, variant: \"warning\" },\n [TimeCampusLifeDomain.SelfCare]: { icon: Sparkles, variant: \"success\" },\n [TimeCampusLifeDomain.Social]: { icon: MessageCircle, variant: \"info\" },\n [TimeCampusLifeDomain.FinanceAdmin]: { icon: Wallet, variant: \"default\" },\n [TimeCampusLifeDomain.Reflection]: { icon: NotebookPen, variant: \"default\" },\n [TimeCampusLifeDomain.Other]: { icon: CircleDashed, variant: \"muted\" },\n};\n\n/** Colour-family → dot/edge background token (mirrors StatusBadge dotStyles). */\nconst DOT_BY_VARIANT: Record<BadgeVariant, string> = {\n success: \"bg-status-success-text\",\n warning: \"bg-status-warning-text\",\n error: \"bg-status-error-text\",\n info: \"bg-status-info-text\",\n default: \"bg-action-primary-bg\",\n muted: \"bg-muted-foreground\",\n};\n\n/** Colour-family → icon-chip background+text tokens (mirrors StatusBadge). */\nconst CHIP_BY_VARIANT: Record<BadgeVariant, string> = {\n success: \"bg-status-success-bg text-status-success-text\",\n warning: \"bg-status-warning-bg text-status-warning-text\",\n error: \"bg-status-error-bg text-status-error-text\",\n info: \"bg-status-info-bg text-status-info-text\",\n default: \"bg-action-primary-bg/10 text-primary\",\n muted: \"bg-bg-sunken text-text-secondary\",\n};\n\nfunction domainMeta(domain: TimeCampusLifeDomain) {\n return DOMAIN_META[domain] ?? DOMAIN_META[TimeCampusLifeDomain.Other];\n}\n\ntype RangeKey = \"day\" | \"7d\" | \"30d\";\n\nconst RANGE_OPTIONS: { key: RangeKey; label: string }[] = [\n { key: \"day\", label: \"Day\" },\n { key: \"7d\", label: \"7 days\" },\n { key: \"30d\", label: \"30 days\" },\n];\n\nfunction toLocalDateInput(date: Date): string {\n const local = new Date(date.getTime() - date.getTimezoneOffset() * 60_000);\n return local.toISOString().slice(0, 10);\n}\n\nfunction toLocalDateTimeInput(date: Date): string {\n const local = new Date(date.getTime() - date.getTimezoneOffset() * 60_000);\n return local.toISOString().slice(0, 16);\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\n/** End of a segment: explicit endTime, else start + duration. */\nfunction segmentEndTime(segment: LifeSegment): string {\n if (segment.endTime) return segment.endTime;\n const endMs =\n new Date(segment.startTime).getTime() + segment.durationSeconds * 1000;\n return new Date(endMs).toISOString();\n}\n\nexport function LifeTimelinePage() {\n const { workspaceId = \"\" } = useTimeCampus();\n const { toasts, addToast, dismissToast } = useToast();\n\n const [range, setRange] = useState<RangeKey>(\"day\");\n const [dateStr, setDateStr] = useState(() => toLocalDateInput(new Date()));\n\n const { from, to } = useMemo(() => {\n if (range === \"day\") return dayBounds(dateStr);\n if (range === \"7d\") return { from: isoDaysAgo(7), to: isoNow() };\n return { from: isoDaysAgo(30), to: isoNow() };\n }, [range, dateStr]);\n\n const { data, loading, error, refetch } = useLifeTimelineQuery({\n variables: { from, to },\n skip: !workspaceId,\n fetchPolicy: \"cache-and-network\",\n });\n\n const [logLifeTime, { loading: logging }] = useLogLifeTimeEntryMutation();\n\n const timeline = data?.lifeTimeline;\n const summary = timeline?.summary;\n\n const segments = useMemo(\n () =>\n [...(timeline?.segments ?? [])].sort(\n (a, b) =>\n new Date(a.startTime).getTime() - new Date(b.startTime).getTime(),\n ),\n [timeline],\n );\n\n const byDomain: DomainTotal[] = useMemo(\n () => summary?.byDomain ?? [],\n [summary],\n );\n const totalCovered = summary?.totalCoveredSeconds ?? 0;\n const unaccounted = summary?.unaccountedSeconds ?? 0;\n const workSeconds = byDomain\n .filter((d) => d.domain === TimeCampusLifeDomain.Work)\n .reduce((s, d) => s + d.totalSeconds, 0);\n const personalSeconds = byDomain\n .filter((d) => d.domain !== TimeCampusLifeDomain.Work)\n .reduce((s, d) => s + d.totalSeconds, 0);\n\n const donutData = useMemo(\n () =>\n byDomain\n .filter((d) => d.totalSeconds > 0)\n .map((d) => ({\n name: lifeDomainLabel(d.domain),\n value: d.totalSeconds,\n })),\n [byDomain],\n );\n\n // ---- Log life time modal ----\n const [logOpen, setLogOpen] = useState(false);\n const [logDomain, setLogDomain] = useState<TimeCampusLifeDomain>(\n PERSONAL_LIFE_DOMAINS[0],\n );\n const [logStart, setLogStart] = useState(\"\");\n const [logMinutes, setLogMinutes] = useState(\"30\");\n const [logNote, setLogNote] = useState(\"\");\n\n const openLog = () => {\n setLogDomain(PERSONAL_LIFE_DOMAINS[0]);\n setLogStart(toLocalDateTimeInput(new Date()));\n setLogMinutes(\"30\");\n setLogNote(\"\");\n setLogOpen(true);\n };\n\n const handleLog = async (e: FormEvent<HTMLFormElement>) => {\n e.preventDefault();\n const minutes = Number(logMinutes);\n if (!logStart || !Number.isFinite(minutes) || minutes <= 0) {\n addToast({\n variant: \"error\",\n title: \"Add a start time and a positive duration\",\n });\n return;\n }\n try {\n const result = await logLifeTime({\n variables: {\n domain: logDomain,\n startTime: new Date(logStart).toISOString(),\n duration: Math.round(minutes * 60),\n note: logNote.trim() ? logNote.trim() : undefined,\n },\n });\n if (result.error) {\n throw result.error;\n }\n addToast({\n variant: \"success\",\n title: \"Life time logged\",\n description: `${lifeDomainLabel(logDomain)} · ${formatSecondsHuman(\n Math.round(minutes * 60),\n )}`,\n });\n setLogOpen(false);\n await refetch();\n } catch (err) {\n addToast({\n variant: \"error\",\n title: \"Could not log life time\",\n description: err instanceof Error ? err.message : \"Please try again.\",\n });\n }\n };\n\n const logButton = (\n <button\n type=\"button\"\n onClick={openLog}\n className=\"inline-flex items-center gap-1.5 rounded-md bg-action-primary-bg px-3 py-1.5 text-sm font-medium text-action-primary-text transition-colors hover:opacity-90 focus:outline-none focus:ring-2 focus:ring-action-primary-bg/40\"\n >\n <Plus className=\"h-4 w-4\" />\n Log life time\n </button>\n );\n\n return (\n <PageLayout\n title=\"Life timeline\"\n description=\"Your whole day — work and life — in one honest thread\"\n purpose=\"This is your life, not just your job. Work sessions captured by TimeCampus sit alongside the sleep, family, health, commute and downtime you log — assembled in order so you can see the real shape of a day and where the hours actually go.\"\n actions={\n <>\n <div className=\"flex items-center rounded-lg border border-border-subtle bg-bg-sunken/50 p-0.5\">\n {RANGE_OPTIONS.map((opt) => (\n <button\n key={opt.key}\n type=\"button\"\n onClick={() => setRange(opt.key)}\n className={cn(\n \"rounded-md px-2.5 py-1 text-xs font-medium transition-colors\",\n range === opt.key\n ? \"bg-bg-surface text-text-primary shadow-sm\"\n : \"text-text-secondary hover:text-text-primary\",\n )}\n >\n {opt.label}\n </button>\n ))}\n </div>\n {range === \"day\" && (\n <input\n type=\"date\"\n aria-label=\"Pick a day\"\n value={dateStr}\n max={toLocalDateInput(new Date())}\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 )}\n {logButton}\n </>\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 life timeline. Please try again later.\n </div>\n ) : (\n <div className=\"space-y-6\">\n {/* Work vs Personal vs total */}\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4\">\n <StatCard\n featured\n title=\"Time covered\"\n value={formatSecondsHuman(totalCovered)}\n icon={<Activity className=\"h-5 w-5\" />}\n description=\"Accounted-for time in this range\"\n />\n <StatCard\n title=\"Work\"\n value={formatSecondsHuman(workSeconds)}\n icon={<Briefcase className=\"h-5 w-5\" />}\n description=\"Captured work time\"\n />\n <StatCard\n title=\"Personal\"\n value={formatSecondsHuman(personalSeconds)}\n icon={<Heart className=\"h-5 w-5\" />}\n description=\"Everything beyond work\"\n />\n <StatCard\n title=\"Unaccounted\"\n value={formatSecondsHuman(unaccounted)}\n icon={<CircleDashed className=\"h-5 w-5\" />}\n description=\"Not logged yet\"\n />\n </div>\n\n {/* Where life divided (real byDomain distribution) */}\n {donutData.length > 0 && (\n <ChartCard\n title=\"How your life divided\"\n description=\"Share of accounted-for time across life domains\"\n >\n <DonutChart\n data={donutData}\n centerLabel=\"Time covered\"\n centerValue={formatSecondsHuman(totalCovered)}\n valueFormat={(v) => formatSecondsHuman(v)}\n ariaLabel=\"Time by life domain\"\n />\n </ChartCard>\n )}\n\n {/* Honest unaccounted note */}\n {unaccounted > 0 && segments.length > 0 && (\n <div className=\"flex items-start gap-2 rounded-lg border border-border-seam bg-bg-surface px-4 py-3 text-sm text-text-secondary\">\n <CircleDashed className=\"mt-0.5 h-4 w-4 shrink-0 text-text-tertiary\" />\n <span>\n <span className=\"font-medium text-text-primary tabular-nums\">\n {formatSecondsHuman(unaccounted)}\n </span>{\" \"}\n of this range isn&rsquo;t accounted for yet. Log life time to\n fill the gaps and see the true shape of your day.\n </span>\n </div>\n )}\n\n {/* Chronological life timeline */}\n {segments.length === 0 ? (\n <EmptyState\n illustration=\"empty-generic\"\n title=\"No life yet in this range\"\n description=\"Work sessions land here automatically. Add the rest of your day — sleep, family, health, commute, downtime — and your real timeline assembles in order.\"\n action={logButton}\n />\n ) : (\n <GlassCard treatment=\"glass\" glow className=\"overflow-hidden\">\n <ol className=\"divide-y divide-border-seam\">\n {segments.map((segment) => {\n const meta = domainMeta(segment.lifeDomain);\n const Icon = meta.icon;\n const isPersonal =\n segment.ownershipContext ===\n TimeCampusOwnershipContext.Personal;\n return (\n <li\n key={segment.id}\n className=\"flex items-stretch gap-3 p-4 transition-colors hover:bg-bg-sunken/50\"\n >\n <div className=\"flex w-24 shrink-0 flex-col items-end pt-0.5 text-xs tabular-nums text-text-secondary\">\n <span>\n {formatTime(segment.startTime)} –{\" \"}\n {formatTime(segmentEndTime(segment))}\n </span>\n <span className=\"text-text-tertiary\">\n {formatSecondsHuman(segment.durationSeconds)}\n </span>\n </div>\n <span\n aria-hidden\n className={cn(\n \"w-1 shrink-0 rounded-full\",\n DOT_BY_VARIANT[meta.variant],\n )}\n />\n <div\n className={cn(\n \"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg\",\n CHIP_BY_VARIANT[meta.variant],\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 || lifeDomainLabel(segment.lifeDomain)}\n </p>\n <div className=\"mt-1 flex flex-wrap items-center gap-2\">\n <StatusBadge\n label={lifeDomainLabel(segment.lifeDomain)}\n variant={meta.variant}\n dot\n />\n <StatusBadge\n label={isPersonal ? \"Personal\" : \"Work\"}\n variant=\"muted\"\n />\n {segment.app && (\n <span className=\"text-xs text-text-secondary\">\n {segment.app}\n </span>\n )}\n </div>\n </div>\n </li>\n );\n })}\n </ol>\n </GlassCard>\n )}\n </div>\n )}\n\n {/* Log life time modal */}\n <Modal\n open={logOpen}\n onClose={() => setLogOpen(false)}\n title=\"Log life time\"\n description=\"Add a slice of life — sleep, family, health, downtime — to your timeline.\"\n footer={\n <>\n <button\n type=\"button\"\n onClick={() => setLogOpen(false)}\n className=\"rounded-md border border-border-seam bg-bg-surface px-3 py-1.5 text-sm text-text-secondary transition-colors hover:text-text-primary\"\n >\n Cancel\n </button>\n <button\n type=\"submit\"\n form=\"log-life-form\"\n disabled={logging}\n className=\"inline-flex items-center gap-1.5 rounded-md bg-action-primary-bg px-3 py-1.5 text-sm font-medium text-action-primary-text transition-colors hover:opacity-90 disabled:opacity-60\"\n >\n {logging ? \"Logging…\" : \"Log life time\"}\n </button>\n </>\n }\n >\n <form id=\"log-life-form\" onSubmit={handleLog} className=\"space-y-4\">\n <label className=\"block\">\n <span className=\"mb-1 block text-sm font-medium text-text-primary\">\n Life domain\n </span>\n <ThemedSelect\n value={logDomain}\n onChange={(e) =>\n setLogDomain(e.target.value as TimeCampusLifeDomain)\n }\n className=\"w-full rounded-md border border-border-seam bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-action-primary-bg/40\"\n >\n {PERSONAL_LIFE_DOMAINS.map((d) => (\n <option key={d} value={d}>\n {lifeDomainLabel(d)}\n </option>\n ))}\n </ThemedSelect>\n </label>\n\n <label className=\"block\">\n <span className=\"mb-1 block text-sm font-medium text-text-primary\">\n Starts\n </span>\n <input\n type=\"datetime-local\"\n value={logStart}\n max={toLocalDateTimeInput(new Date())}\n onChange={(e) => setLogStart(e.target.value)}\n className=\"w-full rounded-md border border-border-seam bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-action-primary-bg/40\"\n />\n </label>\n\n <label className=\"block\">\n <span className=\"mb-1 block text-sm font-medium text-text-primary\">\n Duration (minutes)\n </span>\n <input\n type=\"number\"\n min={1}\n step={1}\n value={logMinutes}\n onChange={(e) => setLogMinutes(e.target.value)}\n className=\"w-full rounded-md border border-border-seam bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-action-primary-bg/40\"\n />\n </label>\n\n <label className=\"block\">\n <span className=\"mb-1 block text-sm font-medium text-text-primary\">\n Note{\" \"}\n <span className=\"font-normal text-text-tertiary\">(optional)</span>\n </span>\n <textarea\n value={logNote}\n onChange={(e) => setLogNote(e.target.value)}\n rows={2}\n placeholder=\"What was this time about?\"\n className=\"w-full resize-none rounded-md border border-border-seam bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-tertiary focus:outline-none focus:ring-2 focus:ring-action-primary-bg/40\"\n />\n </label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O,WAAU;OAAjB,UAAA,CACE,kBAAC,QAAD;QAAM,WAAU;QAAmD,UAAA;OAE7D,CAAA,GACN,kBAAC,SAAD;QACE,MAAK;QACL,OAAOU;QACP,KAAK3C,kBAAqB,IAAI,KAAK,CAAC;QACpC,WAAW,MAAM4C,EAAY,EAAE,OAAO,KAAK;QAC3C,WAAU;OACX,CAAA,CACI;;MAEP,kBAAC,SAAD;OAAO,WAAU;OAAjB,UAAA,CACE,kBAAC,QAAD;QAAM,WAAU;QAAmD,UAAA;OAE7D,CAAA,GACN,kBAAC,SAAD;QACE,MAAK;QACL,KAAK;QACL,MAAM;QACN,OAAOC;QACP,WAAW,MAAMC,EAAc,EAAE,OAAO,KAAK;QAC7C,WAAU;OACX,CAAA,CACI;;MAEP,kBAAC,SAAD;OAAO,WAAU;OAAjB,UAAA,CACE,kBAAC,QAAD;QAAM,WAAU;QAAhB,UAAA;SAAmE;SAC5D;SACL,kBAAC,QAAD;UAAM,WAAU;UAAiC,UAAA;SAAgB,CAAA;QAC7D;OACN,CAAA,GAAA,kBAAC,YAAD;QACE,OAAOC;QACP,WAAW,MAAMC,EAAW,EAAE,OAAO,KAAK;QAC1C,MAAM;QACN,aAAY;QACZ,WAAU;OACX,CAAA,CACI;;KACH;;GACD,CAAA;GAEP,kBAACiC,IAAD;IAAwB;IAAQ,WAAWC;GAAe,CAAA;EAChD;;AAEhB"}
1
+ {"version":3,"file":"LifeTimelinePage.js","names":["_Fragment","DOMAIN_META","TimeCampusLifeDomain","Briefcase","Moon","Dumbbell","Heart","BookOpen","Clapperboard","Car","Hourglass","House","Sparkles","MessageCircle","Wallet","NotebookPen","CircleDashed","DOT_BY_VARIANT","CHIP_BY_VARIANT","domainMeta","domain","RANGE_OPTIONS","toLocalDateInput","date","toLocalDateTimeInput","dayBounds","start","dateStr","end","segmentEndTime","segment","endMs","LifeTimelinePage","useTimeCampus","useToast","range","setRange","useState","setDateStr","useMemo","isoDaysAgo","isoNow","useLifeTimelineQuery","workspaceId","logLifeTime","logging","useLogLifeTimeEntryMutation","timeline","data","summary","segments","a","b","byDomain","totalCovered","unaccounted","workSeconds","d","s","personalSeconds","donutData","lifeDomainLabel","logOpen","setLogOpen","logDomain","setLogDomain","PERSONAL_LIFE_DOMAINS","logStart","setLogStart","logMinutes","setLogMinutes","logNote","setLogNote","openLog","handleLog","minutes","result","addToast","formatSecondsHuman","refetch","err","logButton","Plus","PageLayout","Fragment","opt","cn","loading","LoadingSkeleton","error","StatCard","Activity","ChartCard","DonutChart","v","EmptyState","GlassCard","meta","Icon","isPersonal","TimeCampusOwnershipContext","formatTime","StatusBadge","Modal","ThemedSelect","ToastContainer","dismissToast"],"sources":["../../../../src/timecampus/pages/lifetime/LifeTimelinePage.tsx"],"sourcesContent":["import { useMemo, useState, type FormEvent } from \"react\";\nimport {\n Activity,\n BookOpen,\n Briefcase,\n Car,\n CircleDashed,\n Clapperboard,\n Dumbbell,\n Heart,\n Hourglass,\n House,\n MessageCircle,\n Moon,\n NotebookPen,\n Plus,\n Sparkles,\n Wallet,\n} from \"lucide-react\";\nimport { GlassCard, ThemedSelect } from \"@burdenoff/fe-libs/ui\";\nimport {\n PageLayout,\n StatCard,\n StatusBadge,\n ChartCard,\n DonutChart,\n EmptyState,\n LoadingSkeleton,\n Modal,\n useToast,\n ToastContainer,\n} from \"../../components\";\nimport { useTimeCampus } from \"../../providers/TimeCampusProvider\";\nimport { cn, formatTime, type BadgeVariant } from \"../../utils/helpers\";\nimport {\n PERSONAL_LIFE_DOMAINS,\n formatSecondsHuman,\n isoDaysAgo,\n isoNow,\n lifeDomainLabel,\n} from \"./domains\";\nimport {\n TimeCampusLifeDomain,\n TimeCampusOwnershipContext,\n} from \"@/generated/wspace-types\";\nimport {\n useLifeTimelineQuery,\n useLogLifeTimeEntryMutation,\n type LifeTimelineQuery,\n} from \"@/generated/wspace-operations\";\n\ntype LifeSegment = LifeTimelineQuery[\"lifeTimeline\"][\"segments\"][number];\ntype DomainTotal =\n LifeTimelineQuery[\"lifeTimeline\"][\"summary\"][\"byDomain\"][number];\n\n/** Per-domain presentation: an icon + a semantic colour family. Identity is\n * always carried by the label — colour is only a supporting cue, so reusing a\n * family across domains is honest. Every class here is a registered token. */\nconst DOMAIN_META: Record<\n TimeCampusLifeDomain,\n { icon: typeof Briefcase; variant: BadgeVariant }\n> = {\n [TimeCampusLifeDomain.Work]: { icon: Briefcase, variant: \"info\" },\n [TimeCampusLifeDomain.Sleep]: { icon: Moon, variant: \"muted\" },\n [TimeCampusLifeDomain.Health]: { icon: Dumbbell, variant: \"success\" },\n [TimeCampusLifeDomain.Family]: { icon: Heart, variant: \"error\" },\n [TimeCampusLifeDomain.Learning]: { icon: BookOpen, variant: \"info\" },\n [TimeCampusLifeDomain.Leisure]: { icon: Clapperboard, variant: \"default\" },\n [TimeCampusLifeDomain.Commute]: { icon: Car, variant: \"warning\" },\n [TimeCampusLifeDomain.Waiting]: { icon: Hourglass, variant: \"muted\" },\n [TimeCampusLifeDomain.Chores]: { icon: House, variant: \"warning\" },\n [TimeCampusLifeDomain.SelfCare]: { icon: Sparkles, variant: \"success\" },\n [TimeCampusLifeDomain.Social]: { icon: MessageCircle, variant: \"info\" },\n [TimeCampusLifeDomain.FinanceAdmin]: { icon: Wallet, variant: \"default\" },\n [TimeCampusLifeDomain.Reflection]: { icon: NotebookPen, variant: \"default\" },\n [TimeCampusLifeDomain.Other]: { icon: CircleDashed, variant: \"muted\" },\n};\n\n/** Colour-family → dot/edge background token (mirrors StatusBadge dotStyles). */\nconst DOT_BY_VARIANT: Record<BadgeVariant, string> = {\n success: \"bg-status-success-text\",\n warning: \"bg-status-warning-text\",\n error: \"bg-status-error-text\",\n info: \"bg-status-info-text\",\n default: \"bg-action-primary-bg\",\n muted: \"bg-muted-foreground\",\n};\n\n/** Colour-family → icon-chip background+text tokens (mirrors StatusBadge). */\nconst CHIP_BY_VARIANT: Record<BadgeVariant, string> = {\n success: \"bg-status-success-bgSubtle text-status-success-text\",\n warning: \"bg-status-warning-bgSubtle text-status-warning-text\",\n error: \"bg-status-error-bgSubtle text-status-error-text\",\n info: \"bg-status-info-bgSubtle text-status-info-text\",\n default: \"bg-action-primary-bg/10 text-primary\",\n muted: \"bg-bg-sunken text-text-secondary\",\n};\n\nfunction domainMeta(domain: TimeCampusLifeDomain) {\n return DOMAIN_META[domain] ?? DOMAIN_META[TimeCampusLifeDomain.Other];\n}\n\ntype RangeKey = \"day\" | \"7d\" | \"30d\";\n\nconst RANGE_OPTIONS: { key: RangeKey; label: string }[] = [\n { key: \"day\", label: \"Day\" },\n { key: \"7d\", label: \"7 days\" },\n { key: \"30d\", label: \"30 days\" },\n];\n\nfunction toLocalDateInput(date: Date): string {\n const local = new Date(date.getTime() - date.getTimezoneOffset() * 60_000);\n return local.toISOString().slice(0, 10);\n}\n\nfunction toLocalDateTimeInput(date: Date): string {\n const local = new Date(date.getTime() - date.getTimezoneOffset() * 60_000);\n return local.toISOString().slice(0, 16);\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\n/** End of a segment: explicit endTime, else start + duration. */\nfunction segmentEndTime(segment: LifeSegment): string {\n if (segment.endTime) return segment.endTime;\n const endMs =\n new Date(segment.startTime).getTime() + segment.durationSeconds * 1000;\n return new Date(endMs).toISOString();\n}\n\nexport function LifeTimelinePage() {\n const { workspaceId = \"\" } = useTimeCampus();\n const { toasts, addToast, dismissToast } = useToast();\n\n const [range, setRange] = useState<RangeKey>(\"day\");\n const [dateStr, setDateStr] = useState(() => toLocalDateInput(new Date()));\n\n const { from, to } = useMemo(() => {\n if (range === \"day\") return dayBounds(dateStr);\n if (range === \"7d\") return { from: isoDaysAgo(7), to: isoNow() };\n return { from: isoDaysAgo(30), to: isoNow() };\n }, [range, dateStr]);\n\n const { data, loading, error, refetch } = useLifeTimelineQuery({\n variables: { from, to },\n skip: !workspaceId,\n fetchPolicy: \"cache-and-network\",\n });\n\n const [logLifeTime, { loading: logging }] = useLogLifeTimeEntryMutation();\n\n const timeline = data?.lifeTimeline;\n const summary = timeline?.summary;\n\n const segments = useMemo(\n () =>\n [...(timeline?.segments ?? [])].sort(\n (a, b) =>\n new Date(a.startTime).getTime() - new Date(b.startTime).getTime(),\n ),\n [timeline],\n );\n\n const byDomain: DomainTotal[] = useMemo(\n () => summary?.byDomain ?? [],\n [summary],\n );\n const totalCovered = summary?.totalCoveredSeconds ?? 0;\n const unaccounted = summary?.unaccountedSeconds ?? 0;\n const workSeconds = byDomain\n .filter((d) => d.domain === TimeCampusLifeDomain.Work)\n .reduce((s, d) => s + d.totalSeconds, 0);\n const personalSeconds = byDomain\n .filter((d) => d.domain !== TimeCampusLifeDomain.Work)\n .reduce((s, d) => s + d.totalSeconds, 0);\n\n const donutData = useMemo(\n () =>\n byDomain\n .filter((d) => d.totalSeconds > 0)\n .map((d) => ({\n name: lifeDomainLabel(d.domain),\n value: d.totalSeconds,\n })),\n [byDomain],\n );\n\n // ---- Log life time modal ----\n const [logOpen, setLogOpen] = useState(false);\n const [logDomain, setLogDomain] = useState<TimeCampusLifeDomain>(\n PERSONAL_LIFE_DOMAINS[0],\n );\n const [logStart, setLogStart] = useState(\"\");\n const [logMinutes, setLogMinutes] = useState(\"30\");\n const [logNote, setLogNote] = useState(\"\");\n\n const openLog = () => {\n setLogDomain(PERSONAL_LIFE_DOMAINS[0]);\n setLogStart(toLocalDateTimeInput(new Date()));\n setLogMinutes(\"30\");\n setLogNote(\"\");\n setLogOpen(true);\n };\n\n const handleLog = async (e: FormEvent<HTMLFormElement>) => {\n e.preventDefault();\n const minutes = Number(logMinutes);\n if (!logStart || !Number.isFinite(minutes) || minutes <= 0) {\n addToast({\n variant: \"error\",\n title: \"Add a start time and a positive duration\",\n });\n return;\n }\n try {\n const result = await logLifeTime({\n variables: {\n domain: logDomain,\n startTime: new Date(logStart).toISOString(),\n duration: Math.round(minutes * 60),\n note: logNote.trim() ? logNote.trim() : undefined,\n },\n });\n if (result.error) {\n throw result.error;\n }\n addToast({\n variant: \"success\",\n title: \"Life time logged\",\n description: `${lifeDomainLabel(logDomain)} · ${formatSecondsHuman(\n Math.round(minutes * 60),\n )}`,\n });\n setLogOpen(false);\n await refetch();\n } catch (err) {\n addToast({\n variant: \"error\",\n title: \"Could not log life time\",\n description: err instanceof Error ? err.message : \"Please try again.\",\n });\n }\n };\n\n const logButton = (\n <button\n type=\"button\"\n onClick={openLog}\n className=\"inline-flex items-center gap-1.5 rounded-md bg-action-primary-bg px-3 py-1.5 text-sm font-medium text-action-primary-text transition-colors hover:opacity-90 focus:outline-none focus:ring-2 focus:ring-action-primary-bg/40\"\n >\n <Plus className=\"h-4 w-4\" />\n Log life time\n </button>\n );\n\n return (\n <PageLayout\n title=\"Life timeline\"\n description=\"Your whole day — work and life — in one honest thread\"\n purpose=\"This is your life, not just your job. Work sessions captured by TimeCampus sit alongside the sleep, family, health, commute and downtime you log — assembled in order so you can see the real shape of a day and where the hours actually go.\"\n actions={\n <>\n <div className=\"flex items-center rounded-lg border border-border-subtle bg-bg-sunken/50 p-0.5\">\n {RANGE_OPTIONS.map((opt) => (\n <button\n key={opt.key}\n type=\"button\"\n onClick={() => setRange(opt.key)}\n className={cn(\n \"rounded-md px-2.5 py-1 text-xs font-medium transition-colors\",\n range === opt.key\n ? \"bg-bg-surface text-text-primary shadow-sm\"\n : \"text-text-secondary hover:text-text-primary\",\n )}\n >\n {opt.label}\n </button>\n ))}\n </div>\n {range === \"day\" && (\n <input\n type=\"date\"\n aria-label=\"Pick a day\"\n value={dateStr}\n max={toLocalDateInput(new Date())}\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 )}\n {logButton}\n </>\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-border bg-status-error-bgSubtle p-4 text-sm text-status-error-text\">\n Failed to load your life timeline. Please try again later.\n </div>\n ) : (\n <div className=\"space-y-6\">\n {/* Work vs Personal vs total */}\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4\">\n <StatCard\n featured\n title=\"Time covered\"\n value={formatSecondsHuman(totalCovered)}\n icon={<Activity className=\"h-5 w-5\" />}\n description=\"Accounted-for time in this range\"\n />\n <StatCard\n title=\"Work\"\n value={formatSecondsHuman(workSeconds)}\n icon={<Briefcase className=\"h-5 w-5\" />}\n description=\"Captured work time\"\n />\n <StatCard\n title=\"Personal\"\n value={formatSecondsHuman(personalSeconds)}\n icon={<Heart className=\"h-5 w-5\" />}\n description=\"Everything beyond work\"\n />\n <StatCard\n title=\"Unaccounted\"\n value={formatSecondsHuman(unaccounted)}\n icon={<CircleDashed className=\"h-5 w-5\" />}\n description=\"Not logged yet\"\n />\n </div>\n\n {/* Where life divided (real byDomain distribution) */}\n {donutData.length > 0 && (\n <ChartCard\n title=\"How your life divided\"\n description=\"Share of accounted-for time across life domains\"\n >\n <DonutChart\n data={donutData}\n centerLabel=\"Time covered\"\n centerValue={formatSecondsHuman(totalCovered)}\n valueFormat={(v) => formatSecondsHuman(v)}\n ariaLabel=\"Time by life domain\"\n />\n </ChartCard>\n )}\n\n {/* Honest unaccounted note */}\n {unaccounted > 0 && segments.length > 0 && (\n <div className=\"flex items-start gap-2 rounded-lg border border-border-seam bg-bg-surface px-4 py-3 text-sm text-text-secondary\">\n <CircleDashed className=\"mt-0.5 h-4 w-4 shrink-0 text-text-tertiary\" />\n <span>\n <span className=\"font-medium text-text-primary tabular-nums\">\n {formatSecondsHuman(unaccounted)}\n </span>{\" \"}\n of this range isn&rsquo;t accounted for yet. Log life time to\n fill the gaps and see the true shape of your day.\n </span>\n </div>\n )}\n\n {/* Chronological life timeline */}\n {segments.length === 0 ? (\n <EmptyState\n illustration=\"empty-generic\"\n title=\"No life yet in this range\"\n description=\"Work sessions land here automatically. Add the rest of your day — sleep, family, health, commute, downtime — and your real timeline assembles in order.\"\n action={logButton}\n />\n ) : (\n <GlassCard treatment=\"glass\" glow className=\"overflow-hidden\">\n <ol className=\"divide-y divide-border-seam\">\n {segments.map((segment) => {\n const meta = domainMeta(segment.lifeDomain);\n const Icon = meta.icon;\n const isPersonal =\n segment.ownershipContext ===\n TimeCampusOwnershipContext.Personal;\n return (\n <li\n key={segment.id}\n className=\"flex items-stretch gap-3 p-4 transition-colors hover:bg-bg-sunken/50\"\n >\n <div className=\"flex w-24 shrink-0 flex-col items-end pt-0.5 text-xs tabular-nums text-text-secondary\">\n <span>\n {formatTime(segment.startTime)} –{\" \"}\n {formatTime(segmentEndTime(segment))}\n </span>\n <span className=\"text-text-tertiary\">\n {formatSecondsHuman(segment.durationSeconds)}\n </span>\n </div>\n <span\n aria-hidden\n className={cn(\n \"w-1 shrink-0 rounded-full\",\n DOT_BY_VARIANT[meta.variant],\n )}\n />\n <div\n className={cn(\n \"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg\",\n CHIP_BY_VARIANT[meta.variant],\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 || lifeDomainLabel(segment.lifeDomain)}\n </p>\n <div className=\"mt-1 flex flex-wrap items-center gap-2\">\n <StatusBadge\n label={lifeDomainLabel(segment.lifeDomain)}\n variant={meta.variant}\n dot\n />\n <StatusBadge\n label={isPersonal ? \"Personal\" : \"Work\"}\n variant=\"muted\"\n />\n {segment.app && (\n <span className=\"text-xs text-text-secondary\">\n {segment.app}\n </span>\n )}\n </div>\n </div>\n </li>\n );\n })}\n </ol>\n </GlassCard>\n )}\n </div>\n )}\n\n {/* Log life time modal */}\n <Modal\n open={logOpen}\n onClose={() => setLogOpen(false)}\n title=\"Log life time\"\n description=\"Add a slice of life — sleep, family, health, downtime — to your timeline.\"\n footer={\n <>\n <button\n type=\"button\"\n onClick={() => setLogOpen(false)}\n className=\"rounded-md border border-border-seam bg-bg-surface px-3 py-1.5 text-sm text-text-secondary transition-colors hover:text-text-primary\"\n >\n Cancel\n </button>\n <button\n type=\"submit\"\n form=\"log-life-form\"\n disabled={logging}\n className=\"inline-flex items-center gap-1.5 rounded-md bg-action-primary-bg px-3 py-1.5 text-sm font-medium text-action-primary-text transition-colors hover:opacity-90 disabled:opacity-60\"\n >\n {logging ? \"Logging…\" : \"Log life time\"}\n </button>\n </>\n }\n >\n <form id=\"log-life-form\" onSubmit={handleLog} className=\"space-y-4\">\n <label className=\"block\">\n <span className=\"mb-1 block text-sm font-medium text-text-primary\">\n Life domain\n </span>\n <ThemedSelect\n value={logDomain}\n onChange={(e) =>\n setLogDomain(e.target.value as TimeCampusLifeDomain)\n }\n className=\"w-full rounded-md border border-border-seam bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-action-primary-bg/40\"\n >\n {PERSONAL_LIFE_DOMAINS.map((d) => (\n <option key={d} value={d}>\n {lifeDomainLabel(d)}\n </option>\n ))}\n </ThemedSelect>\n </label>\n\n <label className=\"block\">\n <span className=\"mb-1 block text-sm font-medium text-text-primary\">\n Starts\n </span>\n <input\n type=\"datetime-local\"\n value={logStart}\n max={toLocalDateTimeInput(new Date())}\n onChange={(e) => setLogStart(e.target.value)}\n className=\"w-full rounded-md border border-border-seam bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-action-primary-bg/40\"\n />\n </label>\n\n <label className=\"block\">\n <span className=\"mb-1 block text-sm font-medium text-text-primary\">\n Duration (minutes)\n </span>\n <input\n type=\"number\"\n min={1}\n step={1}\n value={logMinutes}\n onChange={(e) => setLogMinutes(e.target.value)}\n className=\"w-full rounded-md border border-border-seam bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-action-primary-bg/40\"\n />\n </label>\n\n <label className=\"block\">\n <span className=\"mb-1 block text-sm font-medium text-text-primary\">\n Note{\" \"}\n <span className=\"font-normal text-text-tertiary\">(optional)</span>\n </span>\n <textarea\n value={logNote}\n onChange={(e) => setLogNote(e.target.value)}\n rows={2}\n placeholder=\"What was this time about?\"\n className=\"w-full resize-none rounded-md border border-border-seam bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-tertiary focus:outline-none focus:ring-2 focus:ring-action-primary-bg/40\"\n />\n </label>\n </form>\n </Modal>\n\n <ToastContainer toasts={toasts} onDismiss={dismissToast} />\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA0DA,IAAMC,IAGF;EACDC,EAAqB,OAAO;EAAE,MAAMC;EAAW,SAAS;CAAO;EAC/DD,EAAqB,QAAQ;EAAE,MAAME;EAAM,SAAS;CAAQ;EAC5DF,EAAqB,SAAS;EAAE,MAAMG;EAAU,SAAS;CAAU;EACnEH,EAAqB,SAAS;EAAE,MAAMI;EAAO,SAAS;CAAQ;EAC9DJ,EAAqB,WAAW;EAAE,MAAMK;EAAU,SAAS;CAAO;EAClEL,EAAqB,UAAU;EAAE,MAAMM;EAAc,SAAS;CAAU;EACxEN,EAAqB,UAAU;EAAE,MAAMO;EAAK,SAAS;CAAU;EAC/DP,EAAqB,UAAU;EAAE,MAAMQ;EAAW,SAAS;CAAQ;EACnER,EAAqB,SAAS;EAAE,MAAMS;EAAO,SAAS;CAAU;EAChET,EAAqB,WAAW;EAAE,MAAMU;EAAU,SAAS;CAAU;EACrEV,EAAqB,SAAS;EAAE,MAAMW;EAAe,SAAS;CAAO;EACrEX,EAAqB,eAAe;EAAE,MAAMY;EAAQ,SAAS;CAAU;EACvEZ,EAAqB,aAAa;EAAE,MAAMa;EAAa,SAAS;CAAU;EAC1Eb,EAAqB,QAAQ;EAAE,MAAMc;EAAc,SAAS;CAAQ;AACvE,GAGMC,KAA+C;CAC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  children: [/* @__PURE__ */ S("div", {
247
247
  className: "mb-4 flex items-start gap-3",
248
248
  children: [/* @__PURE__ */ x("div", {
249
- className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-status-info-bg/40 text-status-info-text",
249
+ className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-status-info-bgSubtle text-status-info-text",
250
250
  children: /* @__PURE__ */ x(y, { className: "h-5 w-5" })
251
251
  }), /* @__PURE__ */ S("div", {
252
252
  className: "min-w-0",
@@ -300,7 +300,7 @@ function T() {
300
300
  children: /* @__PURE__ */ S("div", {
301
301
  className: "flex items-center gap-3",
302
302
  children: [/* @__PURE__ */ x("div", {
303
- className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-status-success-bg/40 text-status-success-text",
303
+ className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-status-success-bgSubtle text-status-success-text",
304
304
  children: /* @__PURE__ */ x(b, { className: "h-5 w-5" })
305
305
  }), /* @__PURE__ */ x("p", {
306
306
  className: "text-sm font-semibold text-text-primary",
@@ -434,7 +434,7 @@ function T() {
434
434
  "aria-checked": n.onDeviceOnly,
435
435
  disabled: G === n.source,
436
436
  onClick: () => pe(n, !n.onDeviceOnly),
437
- className: e("rounded-full border px-2 py-0.5 text-[0.65rem] font-medium uppercase tracking-wide transition-colors", "focus:outline-none focus-visible:ring-2 focus-visible:ring-action-primary-bg/50", n.onDeviceOnly ? "border-status-info-border/60 bg-status-info-bg/40 text-status-info-text" : "border-border-subtle bg-bg-sunken/40 text-text-muted hover:text-text-secondary", G === n.source && "cursor-not-allowed opacity-50"),
437
+ className: e("rounded-full border px-2 py-0.5 text-[0.65rem] font-medium uppercase tracking-wide transition-colors", "focus:outline-none focus-visible:ring-2 focus-visible:ring-action-primary-bg/50", n.onDeviceOnly ? "border-status-info-border/60 bg-status-info-bgSubtle text-status-info-text" : "border-border-subtle bg-bg-sunken/40 text-text-muted hover:text-text-secondary", G === n.source && "cursor-not-allowed opacity-50"),
438
438
  children: G === n.source ? "Saving…" : n.onDeviceOnly ? "On-device only" : "Turn on on-device only"
439
439
  }),
440
440
  n.retentionDays != null && /* @__PURE__ */ x(s, {