@burdenoff/microfe-timecampus 2026.1205.1 → 2026.1206.2

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 (125) hide show
  1. package/dist/timecampus/components/DateFields.d.ts +53 -0
  2. package/dist/timecampus/components/DateFields.js +87 -0
  3. package/dist/timecampus/components/DateFields.js.map +1 -0
  4. package/dist/timecampus/components/ErrorBoundary.js +1 -1
  5. package/dist/timecampus/components/ErrorBoundary.js.map +1 -1
  6. package/dist/timecampus/components/StatusBadge.js +4 -4
  7. package/dist/timecampus/components/StatusBadge.js.map +1 -1
  8. package/dist/timecampus/components/Toast.js +4 -4
  9. package/dist/timecampus/components/Toast.js.map +1 -1
  10. package/dist/timecampus/components/dateFieldValues.d.ts +39 -0
  11. package/dist/timecampus/components/dateFieldValues.js +49 -0
  12. package/dist/timecampus/components/dateFieldValues.js.map +1 -0
  13. package/dist/timecampus/components/maps/LocationGeofenceMap.js +2 -2
  14. package/dist/timecampus/components/maps/LocationGeofenceMap.js.map +1 -1
  15. package/dist/timecampus/pages/HomePage.js +1 -1
  16. package/dist/timecampus/pages/HomePage.js.map +1 -1
  17. package/dist/timecampus/pages/admin/AdminPage.js +6 -6
  18. package/dist/timecampus/pages/admin/AdminPage.js.map +1 -1
  19. package/dist/timecampus/pages/application-usage/ApplicationUsagePage.js +5 -5
  20. package/dist/timecampus/pages/application-usage/ApplicationUsagePage.js.map +1 -1
  21. package/dist/timecampus/pages/channels/ChannelsPage.js +1 -1
  22. package/dist/timecampus/pages/channels/ChannelsPage.js.map +1 -1
  23. package/dist/timecampus/pages/client-portal/ClientPortalPage.js +4 -4
  24. package/dist/timecampus/pages/client-portal/ClientPortalPage.js.map +1 -1
  25. package/dist/timecampus/pages/dashboard/AnalyticsPage.js +3 -3
  26. package/dist/timecampus/pages/dashboard/AnalyticsPage.js.map +1 -1
  27. package/dist/timecampus/pages/dashboard/ReportsPage.js +4 -4
  28. package/dist/timecampus/pages/dashboard/ReportsPage.js.map +1 -1
  29. package/dist/timecampus/pages/dashboard/ServerReportExports.js +1 -1
  30. package/dist/timecampus/pages/dashboard/ServerReportExports.js.map +1 -1
  31. package/dist/timecampus/pages/email-tracking/EmailTrackingPage.js +121 -120
  32. package/dist/timecampus/pages/email-tracking/EmailTrackingPage.js.map +1 -1
  33. package/dist/timecampus/pages/expense-tracking/ExpenseTrackingPage.js +71 -71
  34. package/dist/timecampus/pages/expense-tracking/ExpenseTrackingPage.js.map +1 -1
  35. package/dist/timecampus/pages/extend/AppletDeveloperPage.js +1 -1
  36. package/dist/timecampus/pages/extend/AppletDeveloperPage.js.map +1 -1
  37. package/dist/timecampus/pages/extend/ThirdPartyAppletsSection.js +1 -1
  38. package/dist/timecampus/pages/extend/ThirdPartyAppletsSection.js.map +1 -1
  39. package/dist/timecampus/pages/extend/TimeTriggersPage.js +1 -1
  40. package/dist/timecampus/pages/extend/TimeTriggersPage.js.map +1 -1
  41. package/dist/timecampus/pages/focus/FocusProtectionPage.js +250 -253
  42. package/dist/timecampus/pages/focus/FocusProtectionPage.js.map +1 -1
  43. package/dist/timecampus/pages/focus-score/FocusScorePage.js +1 -1
  44. package/dist/timecampus/pages/focus-score/FocusScorePage.js.map +1 -1
  45. package/dist/timecampus/pages/geofencing/GeofencingPage.js +5 -5
  46. package/dist/timecampus/pages/geofencing/GeofencingPage.js.map +1 -1
  47. package/dist/timecampus/pages/invoicing/InvoicingPage.js +264 -263
  48. package/dist/timecampus/pages/invoicing/InvoicingPage.js.map +1 -1
  49. package/dist/timecampus/pages/lifetime/DeadTimeRadarPage.js +1 -1
  50. package/dist/timecampus/pages/lifetime/DeadTimeRadarPage.js.map +1 -1
  51. package/dist/timecampus/pages/lifetime/FiniteLifePage.js +103 -103
  52. package/dist/timecampus/pages/lifetime/FiniteLifePage.js.map +1 -1
  53. package/dist/timecampus/pages/lifetime/LifeBalancePage.js +1 -1
  54. package/dist/timecampus/pages/lifetime/LifeBalancePage.js.map +1 -1
  55. package/dist/timecampus/pages/lifetime/LifeTimelinePage.js +43 -43
  56. package/dist/timecampus/pages/lifetime/LifeTimelinePage.js.map +1 -1
  57. package/dist/timecampus/pages/lifetime/PersonalCorporatePage.js +3 -3
  58. package/dist/timecampus/pages/lifetime/PersonalCorporatePage.js.map +1 -1
  59. package/dist/timecampus/pages/lifetime/RecommendationsPage.js +1 -1
  60. package/dist/timecampus/pages/lifetime/RecommendationsPage.js.map +1 -1
  61. package/dist/timecampus/pages/lifetime/TimeWellSpentPage.js +2 -2
  62. package/dist/timecampus/pages/lifetime/TimeWellSpentPage.js.map +1 -1
  63. package/dist/timecampus/pages/lifetime/ValuesGoalsPage.js +5 -5
  64. package/dist/timecampus/pages/lifetime/ValuesGoalsPage.js.map +1 -1
  65. package/dist/timecampus/pages/location-tracking/LocationTrackingPage.js +223 -221
  66. package/dist/timecampus/pages/location-tracking/LocationTrackingPage.js.map +1 -1
  67. package/dist/timecampus/pages/meetings/ActionItemFormModal.js +65 -64
  68. package/dist/timecampus/pages/meetings/ActionItemFormModal.js.map +1 -1
  69. package/dist/timecampus/pages/meetings/MeetingAnalyticsPage.js +1 -1
  70. package/dist/timecampus/pages/meetings/MeetingAnalyticsPage.js.map +1 -1
  71. package/dist/timecampus/pages/meetings/MeetingCreatePage.js +55 -55
  72. package/dist/timecampus/pages/meetings/MeetingCreatePage.js.map +1 -1
  73. package/dist/timecampus/pages/meetings/MeetingDetailPage.js +8 -8
  74. package/dist/timecampus/pages/meetings/MeetingDetailPage.js.map +1 -1
  75. package/dist/timecampus/pages/meetings/MeetingFormModal.js +99 -97
  76. package/dist/timecampus/pages/meetings/MeetingFormModal.js.map +1 -1
  77. package/dist/timecampus/pages/meetings/MeetingsPage.js +3 -3
  78. package/dist/timecampus/pages/meetings/MeetingsPage.js.map +1 -1
  79. package/dist/timecampus/pages/meetings/ParticipantFormModal.js +1 -1
  80. package/dist/timecampus/pages/meetings/ParticipantFormModal.js.map +1 -1
  81. package/dist/timecampus/pages/mobile/MobileLifeBalancePage.js +1 -1
  82. package/dist/timecampus/pages/mobile/MobileLifeBalancePage.js.map +1 -1
  83. package/dist/timecampus/pages/mobile/MobileTimelinePage.js +4 -4
  84. package/dist/timecampus/pages/mobile/MobileTimelinePage.js.map +1 -1
  85. package/dist/timecampus/pages/mobile/MobileTimerPage.js +1 -1
  86. package/dist/timecampus/pages/mobile/MobileTimerPage.js.map +1 -1
  87. package/dist/timecampus/pages/pomodoro/PomodoroAnalyticsPage.js +2 -2
  88. package/dist/timecampus/pages/pomodoro/PomodoroAnalyticsPage.js.map +1 -1
  89. package/dist/timecampus/pages/pomodoro/PomodoroPage.js +155 -154
  90. package/dist/timecampus/pages/pomodoro/PomodoroPage.js.map +1 -1
  91. package/dist/timecampus/pages/pomodoro/PomodoroSettingsPage.js +1 -1
  92. package/dist/timecampus/pages/pomodoro/PomodoroSettingsPage.js.map +1 -1
  93. package/dist/timecampus/pages/projects/ProjectCreatePage.js +1 -1
  94. package/dist/timecampus/pages/projects/ProjectCreatePage.js.map +1 -1
  95. package/dist/timecampus/pages/projects/ProjectDetailPage.js +5 -5
  96. package/dist/timecampus/pages/projects/ProjectDetailPage.js.map +1 -1
  97. package/dist/timecampus/pages/projects/ProjectsPage.js +6 -6
  98. package/dist/timecampus/pages/projects/ProjectsPage.js.map +1 -1
  99. package/dist/timecampus/pages/projects/TasksPage.js +189 -188
  100. package/dist/timecampus/pages/projects/TasksPage.js.map +1 -1
  101. package/dist/timecampus/pages/resource-planning/ResourcePlanningPage.js +356 -361
  102. package/dist/timecampus/pages/resource-planning/ResourcePlanningPage.js.map +1 -1
  103. package/dist/timecampus/pages/team/TeamAnalyticsPage.js +2 -2
  104. package/dist/timecampus/pages/team/TeamAnalyticsPage.js.map +1 -1
  105. package/dist/timecampus/pages/team/TeamMembersPage.js +3 -3
  106. package/dist/timecampus/pages/team/TeamMembersPage.js.map +1 -1
  107. package/dist/timecampus/pages/team/TeamPage.js +2 -2
  108. package/dist/timecampus/pages/team/TeamPage.js.map +1 -1
  109. package/dist/timecampus/pages/team-activity/TeamActivityPage.js +2 -2
  110. package/dist/timecampus/pages/team-activity/TeamActivityPage.js.map +1 -1
  111. package/dist/timecampus/pages/time/TimeEntriesPage.js +133 -131
  112. package/dist/timecampus/pages/time/TimeEntriesPage.js.map +1 -1
  113. package/dist/timecampus/pages/time/TimeTrackingPage.js +1 -1
  114. package/dist/timecampus/pages/time/TimeTrackingPage.js.map +1 -1
  115. package/dist/timecampus/pages/time/TimerPage.js +1 -1
  116. package/dist/timecampus/pages/time/TimerPage.js.map +1 -1
  117. package/dist/timecampus/pages/time-approval/SubmitTimesheetModal.js +47 -48
  118. package/dist/timecampus/pages/time-approval/SubmitTimesheetModal.js.map +1 -1
  119. package/dist/timecampus/pages/time-approval/TimeApprovalPage.js +8 -8
  120. package/dist/timecampus/pages/time-approval/TimeApprovalPage.js.map +1 -1
  121. package/dist/timecampus/pages/timeline/TimelinePage.js +237 -237
  122. package/dist/timecampus/pages/timeline/TimelinePage.js.map +1 -1
  123. package/dist/timecampus/pages/work-patterns/SustainedLoadCard.js +3 -3
  124. package/dist/timecampus/pages/work-patterns/SustainedLoadCard.js.map +1 -1
  125. package/package.json +1 -1
@@ -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;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,K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H,kBAAC,KAAD;aAAG,WAAU;aAAb,UAAA;cACGzE,EAASyE,EAAE,WAAW;cAAE;cACxBX,IACG,MAAM9D,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"}
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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D,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"}
@@ -13,10 +13,11 @@ import { DonutChart as ae } from "../../components/charts/DonutChart.js";
13
13
  import { PERSONAL_LIFE_DOMAINS as s, formatSecondsHuman as c, isoDaysAgo as l, isoNow as u, lifeDomainLabel as d } from "./domains.js";
14
14
  import { TimeCampusLifeDomain as f, TimeCampusOwnershipContext as oe } from "../../../generated/wspace-types.js";
15
15
  import { useLifeTimelineQuery as se, useLogLifeTimeEntryMutation as ce } from "../../../generated/wspace-operations.js";
16
+ import { DateField as le, DateTimeField as ue } from "../../components/DateFields.js";
16
17
  import { useMemo as p, useState as m } from "react";
17
- import { Activity as le, BookOpen as h, Briefcase as g, Car as _, CircleDashed as v, Clapperboard as y, Dumbbell as b, Heart as x, Hourglass as S, House as C, MessageCircle as w, Moon as T, NotebookPen as E, Plus as ue, Sparkles as D, Wallet as O } from "lucide-react";
18
+ import { Activity as de, BookOpen as h, Briefcase as g, Car as _, CircleDashed as v, Clapperboard as y, Dumbbell as b, Heart as x, Hourglass as S, House as C, MessageCircle as w, Moon as T, NotebookPen as E, Plus as fe, Sparkles as D, Wallet as O } from "lucide-react";
18
19
  import { Fragment as k, jsx as A, jsxs as j } from "react/jsx-runtime";
19
- import { GlassCard as de, ThemedSelect as fe } from "@burdenoff/fe-libs/ui";
20
+ import { GlassCard as pe, ThemedSelect as me } from "@burdenoff/fe-libs/ui";
20
21
  // src/timecampus/pages/lifetime/LifeTimelinePage.tsx
21
22
  var M = {
22
23
  [f.Work]: {
@@ -75,25 +76,25 @@ var M = {
75
76
  icon: v,
76
77
  variant: "muted"
77
78
  }
78
- }, pe = {
79
+ }, he = {
79
80
  success: "bg-status-success-text",
80
81
  warning: "bg-status-warning-text",
81
82
  error: "bg-status-error-text",
82
83
  info: "bg-status-info-text",
83
84
  default: "bg-action-primary-bg",
84
85
  muted: "bg-muted-foreground"
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
+ }, ge = {
87
+ success: "bg-status-success-bgSubtle text-status-success-text",
88
+ warning: "bg-status-warning-bgSubtle text-status-warning-text",
89
+ error: "bg-status-error-bgSubtle text-status-error-text",
90
+ info: "bg-status-info-bgSubtle text-status-info-text",
90
91
  default: "bg-action-primary-bg/10 text-primary",
91
92
  muted: "bg-bg-sunken text-text-secondary"
92
93
  };
93
- function he(e) {
94
+ function _e(e) {
94
95
  return M[e] ?? M[f.Other];
95
96
  }
96
- var ge = [
97
+ var ve = [
97
98
  {
98
99
  key: "day",
99
100
  label: "Day"
@@ -113,38 +114,38 @@ function N(e) {
113
114
  function P(e) {
114
115
  return (/* @__PURE__ */ new Date(e.getTime() - e.getTimezoneOffset() * 6e4)).toISOString().slice(0, 16);
115
116
  }
116
- function _e(e) {
117
+ function ye(e) {
117
118
  let t = /* @__PURE__ */ new Date(`${e}T00:00:00`), n = /* @__PURE__ */ new Date(`${e}T23:59:59.999`);
118
119
  return {
119
120
  from: t.toISOString(),
120
121
  to: n.toISOString()
121
122
  };
122
123
  }
123
- function ve(e) {
124
+ function be(e) {
124
125
  if (e.endTime) return e.endTime;
125
126
  let t = new Date(e.startTime).getTime() + e.durationSeconds * 1e3;
126
127
  return new Date(t).toISOString();
127
128
  }
128
129
  function F() {
129
- let { workspaceId: h = "" } = e(), { toasts: _, addToast: y, dismissToast: b } = ie(), [S, C] = m("day"), [w, T] = m(() => N(/* @__PURE__ */ new Date())), { from: E, to: D } = p(() => S === "day" ? _e(w) : S === "7d" ? {
130
+ let { workspaceId: h = "" } = e(), { toasts: _, addToast: y, dismissToast: b } = ie(), [S, C] = m("day"), [w, T] = m(() => N(/* @__PURE__ */ new Date())), { from: E, to: D } = p(() => S === "day" ? ye(w) : S === "7d" ? {
130
131
  from: l(7),
131
132
  to: u()
132
133
  } : {
133
134
  from: l(30),
134
135
  to: u()
135
- }, [S, w]), { data: O, loading: M, error: F, refetch: ye } = se({
136
+ }, [S, w]), { data: O, loading: M, error: F, refetch: xe } = se({
136
137
  variables: {
137
138
  from: E,
138
139
  to: D
139
140
  },
140
141
  skip: !h,
141
142
  fetchPolicy: "cache-and-network"
142
- }), [be, { loading: I }] = ce(), L = O?.lifeTimeline, R = L?.summary, z = p(() => [...L?.segments ?? []].sort((e, t) => new Date(e.startTime).getTime() - new Date(t.startTime).getTime()), [L]), B = p(() => R?.byDomain ?? [], [R]), V = R?.totalCoveredSeconds ?? 0, H = R?.unaccountedSeconds ?? 0, xe = B.filter((e) => e.domain === f.Work).reduce((e, t) => e + t.totalSeconds, 0), Se = B.filter((e) => e.domain !== f.Work).reduce((e, t) => e + t.totalSeconds, 0), U = p(() => B.filter((e) => e.totalSeconds > 0).map((e) => ({
143
+ }), [Se, { loading: I }] = ce(), L = O?.lifeTimeline, R = L?.summary, z = p(() => [...L?.segments ?? []].sort((e, t) => new Date(e.startTime).getTime() - new Date(t.startTime).getTime()), [L]), B = p(() => R?.byDomain ?? [], [R]), V = R?.totalCoveredSeconds ?? 0, H = R?.unaccountedSeconds ?? 0, Ce = B.filter((e) => e.domain === f.Work).reduce((e, t) => e + t.totalSeconds, 0), we = B.filter((e) => e.domain !== f.Work).reduce((e, t) => e + t.totalSeconds, 0), U = p(() => B.filter((e) => e.totalSeconds > 0).map((e) => ({
143
144
  name: d(e.domain),
144
145
  value: e.totalSeconds
145
- })), [B]), [Ce, W] = m(!1), [G, K] = m(s[0]), [q, J] = m(""), [Y, X] = m("30"), [Z, Q] = m(""), we = () => {
146
+ })), [B]), [Te, W] = m(!1), [G, K] = m(s[0]), [q, J] = m(""), [Y, X] = m("30"), [Z, Q] = m(""), Ee = () => {
146
147
  K(s[0]), J(P(/* @__PURE__ */ new Date())), X("30"), Q(""), W(!0);
147
- }, Te = async (e) => {
148
+ }, De = async (e) => {
148
149
  e.preventDefault();
149
150
  let t = Number(Y);
150
151
  if (!q || !Number.isFinite(t) || t <= 0) y({
@@ -152,7 +153,7 @@ function F() {
152
153
  title: "Add a start time and a positive duration"
153
154
  });
154
155
  else try {
155
- let e = await be({ variables: {
156
+ let e = await Se({ variables: {
156
157
  domain: G,
157
158
  startTime: new Date(q).toISOString(),
158
159
  duration: Math.round(t * 60),
@@ -163,7 +164,7 @@ function F() {
163
164
  variant: "success",
164
165
  title: "Life time logged",
165
166
  description: `${d(G)} · ${c(Math.round(t * 60))}`
166
- }), W(!1), await ye();
167
+ }), W(!1), await xe();
167
168
  } catch (e) {
168
169
  y({
169
170
  variant: "error",
@@ -173,9 +174,9 @@ function F() {
173
174
  }
174
175
  }, $ = /* @__PURE__ */ j("button", {
175
176
  type: "button",
176
- onClick: we,
177
+ onClick: Ee,
177
178
  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",
178
- children: [/* @__PURE__ */ A(ue, { className: "h-4 w-4" }), "Log life time"]
179
+ children: [/* @__PURE__ */ A(fe, { className: "h-4 w-4" }), "Log life time"]
179
180
  });
180
181
  return /* @__PURE__ */ j(ee, {
181
182
  title: "Life timeline",
@@ -184,20 +185,19 @@ function F() {
184
185
  actions: /* @__PURE__ */ j(k, { children: [
185
186
  /* @__PURE__ */ A("div", {
186
187
  className: "flex items-center rounded-lg border border-border-subtle bg-bg-sunken/50 p-0.5",
187
- children: ge.map((e) => /* @__PURE__ */ A("button", {
188
+ children: ve.map((e) => /* @__PURE__ */ A("button", {
188
189
  type: "button",
189
190
  onClick: () => C(e.key),
190
191
  className: i("rounded-md px-2.5 py-1 text-xs font-medium transition-colors", S === e.key ? "bg-bg-surface text-text-primary shadow-sm" : "text-text-secondary hover:text-text-primary"),
191
192
  children: e.label
192
193
  }, e.key))
193
194
  }),
194
- S === "day" && /* @__PURE__ */ A("input", {
195
- type: "date",
196
- "aria-label": "Pick a day",
195
+ S === "day" && /* @__PURE__ */ A(le, {
197
196
  value: w,
198
197
  max: N(/* @__PURE__ */ new Date()),
199
- onChange: (e) => T(e.target.value),
200
- 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"
198
+ onChange: T,
199
+ label: "Pick a day",
200
+ inline: !0
201
201
  }),
202
202
  $
203
203
  ] }),
@@ -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",
@@ -224,18 +224,18 @@ function F() {
224
224
  featured: !0,
225
225
  title: "Time covered",
226
226
  value: c(V),
227
- icon: /* @__PURE__ */ A(le, { className: "h-5 w-5" }),
227
+ icon: /* @__PURE__ */ A(de, { className: "h-5 w-5" }),
228
228
  description: "Accounted-for time in this range"
229
229
  }),
230
230
  /* @__PURE__ */ A(t, {
231
231
  title: "Work",
232
- value: c(xe),
232
+ value: c(Ce),
233
233
  icon: /* @__PURE__ */ A(g, { className: "h-5 w-5" }),
234
234
  description: "Captured work time"
235
235
  }),
236
236
  /* @__PURE__ */ A(t, {
237
237
  title: "Personal",
238
- value: c(Se),
238
+ value: c(we),
239
239
  icon: /* @__PURE__ */ A(x, { className: "h-5 w-5" }),
240
240
  description: "Everything beyond work"
241
241
  }),
@@ -274,14 +274,14 @@ function F() {
274
274
  title: "No life yet in this range",
275
275
  description: "Work sessions land here automatically. Add the rest of your day — sleep, family, health, commute, downtime — and your real timeline assembles in order.",
276
276
  action: $
277
- }) : /* @__PURE__ */ A(de, {
277
+ }) : /* @__PURE__ */ A(pe, {
278
278
  treatment: "glass",
279
279
  glow: !0,
280
280
  className: "overflow-hidden",
281
281
  children: /* @__PURE__ */ A("ol", {
282
282
  className: "divide-y divide-border-seam",
283
283
  children: z.map((e) => {
284
- let t = he(e.lifeDomain), n = t.icon, r = e.ownershipContext === oe.Personal;
284
+ let t = _e(e.lifeDomain), n = t.icon, r = e.ownershipContext === oe.Personal;
285
285
  return /* @__PURE__ */ j("li", {
286
286
  className: "flex items-stretch gap-3 p-4 transition-colors hover:bg-bg-sunken/50",
287
287
  children: [
@@ -291,7 +291,7 @@ function F() {
291
291
  a(e.startTime),
292
292
  " –",
293
293
  " ",
294
- a(ve(e))
294
+ a(be(e))
295
295
  ] }), /* @__PURE__ */ A("span", {
296
296
  className: "text-text-tertiary",
297
297
  children: c(e.durationSeconds)
@@ -299,10 +299,10 @@ function F() {
299
299
  }),
300
300
  /* @__PURE__ */ A("span", {
301
301
  "aria-hidden": !0,
302
- className: i("w-1 shrink-0 rounded-full", pe[t.variant])
302
+ className: i("w-1 shrink-0 rounded-full", he[t.variant])
303
303
  }),
304
304
  /* @__PURE__ */ A("div", {
305
- className: i("mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg", me[t.variant]),
305
+ className: i("mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg", ge[t.variant]),
306
306
  children: /* @__PURE__ */ A(n, { className: "h-4 w-4" })
307
307
  }),
308
308
  /* @__PURE__ */ j("div", {
@@ -337,7 +337,7 @@ function F() {
337
337
  ]
338
338
  }),
339
339
  /* @__PURE__ */ A(te, {
340
- open: Ce,
340
+ open: Te,
341
341
  onClose: () => W(!1),
342
342
  title: "Log life time",
343
343
  description: "Add a slice of life — sleep, family, health, downtime — to your timeline.",
@@ -355,7 +355,7 @@ function F() {
355
355
  })] }),
356
356
  children: /* @__PURE__ */ j("form", {
357
357
  id: "log-life-form",
358
- onSubmit: Te,
358
+ onSubmit: De,
359
359
  className: "space-y-4",
360
360
  children: [
361
361
  /* @__PURE__ */ j("label", {
@@ -363,7 +363,7 @@ function F() {
363
363
  children: [/* @__PURE__ */ A("span", {
364
364
  className: "mb-1 block text-sm font-medium text-text-primary",
365
365
  children: "Life domain"
366
- }), /* @__PURE__ */ A(fe, {
366
+ }), /* @__PURE__ */ A(me, {
367
367
  value: G,
368
368
  onChange: (e) => K(e.target.value),
369
369
  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",
@@ -378,12 +378,12 @@ function F() {
378
378
  children: [/* @__PURE__ */ A("span", {
379
379
  className: "mb-1 block text-sm font-medium text-text-primary",
380
380
  children: "Starts"
381
- }), /* @__PURE__ */ A("input", {
382
- type: "datetime-local",
381
+ }), /* @__PURE__ */ A(ue, {
383
382
  value: q,
384
383
  max: P(/* @__PURE__ */ new Date()),
385
- onChange: (e) => J(e.target.value),
386
- 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"
384
+ onChange: J,
385
+ label: "Starts",
386
+ step: 5
387
387
  })]
388
388
  }),
389
389
  /* @__PURE__ */ j("label", {
@@ -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>\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;EA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,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","DateField","loading","LoadingSkeleton","error","StatCard","Activity","ChartCard","DonutChart","v","EmptyState","GlassCard","meta","Icon","isPersonal","TimeCampusOwnershipContext","formatTime","StatusBadge","Modal","ThemedSelect","DateTimeField","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\";\nimport { DateField, DateTimeField } from \"../../components/DateFields\";\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 <DateField\n value={dateStr}\n max={toLocalDateInput(new Date())}\n onChange={setDateStr}\n label=\"Pick a day\"\n inline\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 <DateTimeField\n value={logStart}\n max={toLocalDateTimeInput(new Date())}\n onChange={setLogStart}\n label=\"Starts\"\n step={5}\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":";;;;;;;;;;;;;;;;;;;;;AA2DA,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;EACr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,MAAM;QACN,aAAY;QACZ,WAAU;OACX,CAAA,CACI;;KACH;;GACD,CAAA;GAEP,kBAACmC,IAAD;IAAwB;IAAQ,WAAWC;GAAe,CAAA;EAChD;;AAEhB"}
@@ -246,7 +246,7 @@ function T() {
246
246
  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, {