@burdenoff/microfe-timecampus 2026.1206.1 → 2026.1206.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/generated/global-types.d.ts +7409 -959
  2. package/dist/generated/wspace-operations.d.ts +46 -12
  3. package/dist/generated/wspace-operations.js.map +1 -1
  4. package/dist/generated/wspace-types.d.ts +107058 -11342
  5. package/dist/generated/wspace-types.js +1 -1
  6. package/dist/generated/wspace-types.js.map +1 -1
  7. package/dist/timecampus/components/DateFields.d.ts +53 -0
  8. package/dist/timecampus/components/DateFields.js +87 -0
  9. package/dist/timecampus/components/DateFields.js.map +1 -0
  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/pages/channels/channelCatalog.js +2 -1
  14. package/dist/timecampus/pages/channels/channelCatalog.js.map +1 -1
  15. package/dist/timecampus/pages/email-tracking/EmailTrackingPage.js +112 -111
  16. package/dist/timecampus/pages/email-tracking/EmailTrackingPage.js.map +1 -1
  17. package/dist/timecampus/pages/expense-tracking/ExpenseTrackingPage.js +65 -65
  18. package/dist/timecampus/pages/expense-tracking/ExpenseTrackingPage.js.map +1 -1
  19. package/dist/timecampus/pages/focus/FocusProtectionPage.js +250 -253
  20. package/dist/timecampus/pages/focus/FocusProtectionPage.js.map +1 -1
  21. package/dist/timecampus/pages/invoicing/InvoicingPage.js +259 -258
  22. package/dist/timecampus/pages/invoicing/InvoicingPage.js.map +1 -1
  23. package/dist/timecampus/pages/lifetime/FiniteLifePage.js +103 -103
  24. package/dist/timecampus/pages/lifetime/FiniteLifePage.js.map +1 -1
  25. package/dist/timecampus/pages/lifetime/LifeTimelinePage.js +38 -38
  26. package/dist/timecampus/pages/lifetime/LifeTimelinePage.js.map +1 -1
  27. package/dist/timecampus/pages/location-tracking/LocationTrackingPage.js +218 -216
  28. package/dist/timecampus/pages/location-tracking/LocationTrackingPage.js.map +1 -1
  29. package/dist/timecampus/pages/meetings/ActionItemFormModal.js +64 -63
  30. package/dist/timecampus/pages/meetings/ActionItemFormModal.js.map +1 -1
  31. package/dist/timecampus/pages/meetings/MeetingCreatePage.js +54 -54
  32. package/dist/timecampus/pages/meetings/MeetingCreatePage.js.map +1 -1
  33. package/dist/timecampus/pages/meetings/MeetingFormModal.js +98 -96
  34. package/dist/timecampus/pages/meetings/MeetingFormModal.js.map +1 -1
  35. package/dist/timecampus/pages/pomodoro/PomodoroPage.js +150 -149
  36. package/dist/timecampus/pages/pomodoro/PomodoroPage.js.map +1 -1
  37. package/dist/timecampus/pages/projects/TasksPage.js +183 -182
  38. package/dist/timecampus/pages/projects/TasksPage.js.map +1 -1
  39. package/dist/timecampus/pages/resource-planning/ResourcePlanningPage.js +346 -351
  40. package/dist/timecampus/pages/resource-planning/ResourcePlanningPage.js.map +1 -1
  41. package/dist/timecampus/pages/time/TimeEntriesPage.js +129 -127
  42. package/dist/timecampus/pages/time/TimeEntriesPage.js.map +1 -1
  43. package/dist/timecampus/pages/time-approval/SubmitTimesheetModal.js +46 -47
  44. package/dist/timecampus/pages/time-approval/SubmitTimesheetModal.js.map +1 -1
  45. package/dist/timecampus/pages/timeline/TimelinePage.js +231 -231
  46. package/dist/timecampus/pages/timeline/TimelinePage.js.map +1 -1
  47. package/package.json +4 -2
@@ -1,39 +1,40 @@
1
1
  import "../../components/index.js";
2
2
  import { LoadingSkeleton as e } from "../../components/LoadingSkeleton.js";
3
3
  import { EmptyState as t } from "../../components/EmptyState.js";
4
- import { useTimeCampus as n } from "../../providers/TimeCampusProvider.js";
5
- import { PageLayout as r } from "../../components/PageLayout.js";
6
- import { Modal as i } from "../../components/Modal.js";
7
- import { ChartCard as a } from "../../components/ChartCard.js";
8
- import { ToastContainer as ee, useToast as te } from "../../components/Toast.js";
9
- import { DonutChart as ne } from "../../components/charts/DonutChart.js";
10
- import { WeeksGrid as re } from "../../components/charts/WeeksGrid.js";
11
- import { useMyLifeInWeeksQuery as ie, useMyLifeProfileQuery as ae, useUpdateMyLifeProfileMutation as o } from "../../../generated/wspace-operations.js";
12
- import { formatSecondsHuman as s, lifeDomainLabel as c } from "./domains.js";
4
+ import { useTimeCampus as ee } from "../../providers/TimeCampusProvider.js";
5
+ import { PageLayout as n } from "../../components/PageLayout.js";
6
+ import { Modal as r } from "../../components/Modal.js";
7
+ import { ChartCard as i } from "../../components/ChartCard.js";
8
+ import { ToastContainer as te, useToast as ne } from "../../components/Toast.js";
9
+ import { DonutChart as re } from "../../components/charts/DonutChart.js";
10
+ import { WeeksGrid as ie } from "../../components/charts/WeeksGrid.js";
11
+ import { useMyLifeInWeeksQuery as ae, useMyLifeProfileQuery as oe, useUpdateMyLifeProfileMutation as a } from "../../../generated/wspace-operations.js";
12
+ import { formatSecondsHuman as o, lifeDomainLabel as s } from "./domains.js";
13
+ import { DateField as c } from "../../components/DateFields.js";
13
14
  import { useMemo as l, useState as u } from "react";
14
- import { ArrowRight as d, CalendarDays as oe, Hourglass as f, Lock as p, SlidersHorizontal as m, Sparkles as h } from "lucide-react";
15
- import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
16
- import { GlassCard as se } from "@burdenoff/fe-libs/ui";
15
+ import { ArrowRight as d, CalendarDays as f, Hourglass as p, Lock as m, SlidersHorizontal as h, Sparkles as se } from "lucide-react";
16
+ import { Fragment as ce, jsx as g, jsxs as _ } from "react/jsx-runtime";
17
+ import { GlassCard as le } from "@burdenoff/fe-libs/ui";
17
18
  // src/timecampus/pages/lifetime/FiniteLifePage.tsx
18
- function y(e) {
19
+ function v(e) {
19
20
  return Math.max(0, Math.round(e)).toLocaleString();
20
21
  }
21
- function b(e) {
22
+ function y(e) {
22
23
  return (Math.round(e / 52 * 10) / 10).toFixed(1);
23
24
  }
24
- function ce(e) {
25
+ function ue(e) {
25
26
  return e ? e.slice(0, 10) : "";
26
27
  }
27
- var x = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
28
- function S() {
29
- let { workspaceId: S = "" } = n(), { toasts: le, addToast: C, dismissToast: w } = te(), { data: T, loading: E, error: D, refetch: O } = ie({ skip: !S }), { data: k, loading: A, error: j, refetch: M } = ae({ skip: !S }), [N, { loading: P }] = o(), F = T?.myLifeInWeeks, I = k?.myLifeProfile, [L, R] = u(!1), [z, B] = u(""), [V, H] = u(""), [U, W] = u(!1), [G, K] = u(null), q = () => {
30
- B(ce(I?.birthDate ?? F?.birthDate)), H(I?.lifeExpectancyYears == null ? F?.lifeExpectancyYears == null ? "" : String(F.lifeExpectancyYears) : String(I.lifeExpectancyYears)), W(I?.hideRemainingWeeks ?? F?.hideRemainingWeeks ?? !1), K(null), R(!0);
31
- }, ue = async (e) => {
28
+ var b = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
29
+ function x() {
30
+ let { workspaceId: x = "" } = ee(), { toasts: S, addToast: C, dismissToast: w } = ne(), { data: T, loading: E, error: D, refetch: O } = ae({ skip: !x }), { data: k, loading: A, error: j, refetch: M } = oe({ skip: !x }), [N, { loading: P }] = a(), F = T?.myLifeInWeeks, I = k?.myLifeProfile, [L, R] = u(!1), [z, B] = u(""), [V, H] = u(""), [U, W] = u(!1), [G, K] = u(null), q = () => {
31
+ B(ue(I?.birthDate ?? F?.birthDate)), H(I?.lifeExpectancyYears == null ? F?.lifeExpectancyYears == null ? "" : String(F.lifeExpectancyYears) : String(I.lifeExpectancyYears)), W(I?.hideRemainingWeeks ?? F?.hideRemainingWeeks ?? !1), K(null), R(!0);
32
+ }, de = async (e) => {
32
33
  if (e?.preventDefault(), K(null), !z) {
33
34
  K("Please add your birth date to continue.");
34
35
  return;
35
36
  }
36
- if (z > x) {
37
+ if (z > b) {
37
38
  K("Your birth date can't be in the future.");
38
39
  return;
39
40
  }
@@ -64,88 +65,88 @@ function S() {
64
65
  description: "Please try again in a moment."
65
66
  });
66
67
  }
67
- }, J = !!F?.birthDate, Y = F?.hideRemainingWeeks ?? I?.hideRemainingWeeks ?? !1, X = F?.weeksLived ?? null, Z = F?.lifeExpectancyYears ?? null, de = Y ? null : F?.expectedTotalWeeks ?? null, Q = Y || F?.weeksRemaining == null ? null : F.weeksRemaining, $ = l(() => (F?.domainRollups ?? []).filter((e) => e.totalSeconds > 0).map((e) => ({
68
- name: c(e.domain),
68
+ }, J = !!F?.birthDate, Y = F?.hideRemainingWeeks ?? I?.hideRemainingWeeks ?? !1, X = F?.weeksLived ?? null, Z = F?.lifeExpectancyYears ?? null, fe = Y ? null : F?.expectedTotalWeeks ?? null, Q = Y || F?.weeksRemaining == null ? null : F.weeksRemaining, $ = l(() => (F?.domainRollups ?? []).filter((e) => e.totalSeconds > 0).map((e) => ({
69
+ name: s(e.domain),
69
70
  value: e.totalSeconds
70
- })), [F?.domainRollups]), fe = $.reduce((e, t) => e + t.value, 0);
71
- return (E || A) && !F && !I ? /* @__PURE__ */ _(r, {
71
+ })), [F?.domainRollups]), pe = $.reduce((e, t) => e + t.value, 0);
72
+ return (E || A) && !F && !I ? /* @__PURE__ */ g(n, {
72
73
  title: "Your Life in Weeks",
73
74
  description: "A calm, private view of the weeks you've lived — and the ones still ahead.",
74
- children: /* @__PURE__ */ _(e, { variant: "detail" })
75
- }) : /* @__PURE__ */ v(r, {
75
+ children: /* @__PURE__ */ g(e, { variant: "detail" })
76
+ }) : /* @__PURE__ */ _(n, {
76
77
  title: "Your Life in Weeks",
77
78
  description: "A calm, private view of the weeks you've lived — and the ones still ahead.",
78
79
  purpose: "Each square is a single week of your life. It's a gentle memento — not a countdown — meant only for you, to help this week feel a little more intentional.",
79
- actions: /* @__PURE__ */ v("button", {
80
+ actions: /* @__PURE__ */ _("button", {
80
81
  type: "button",
81
82
  onClick: q,
82
83
  className: "inline-flex items-center gap-1.5 rounded-md border border-border-subtle bg-bg-surface px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken",
83
- children: [/* @__PURE__ */ _(m, { className: "h-4 w-4" }), "Life settings"]
84
+ children: [/* @__PURE__ */ g(h, { className: "h-4 w-4" }), "Life settings"]
84
85
  }),
85
86
  children: [
86
- (D || j) && !F && !I ? /* @__PURE__ */ _("div", {
87
+ (D || j) && !F && !I ? /* @__PURE__ */ g("div", {
87
88
  className: "rounded-xl border border-status-error-border/50 bg-status-error-bg/10 p-4 text-sm text-status-error-text",
88
89
  children: "We couldn't load your life view right now. Please try again in a moment."
89
- }) : /* @__PURE__ */ v("div", {
90
+ }) : /* @__PURE__ */ _("div", {
90
91
  className: "space-y-6",
91
92
  children: [
92
- /* @__PURE__ */ v("div", {
93
+ /* @__PURE__ */ _("div", {
93
94
  className: "grid grid-cols-1 gap-6 lg:grid-cols-3",
94
- children: [/* @__PURE__ */ _("div", {
95
+ children: [/* @__PURE__ */ g("div", {
95
96
  className: "lg:col-span-2",
96
- children: /* @__PURE__ */ v(a, {
97
+ children: /* @__PURE__ */ _(i, {
97
98
  title: "Your life in weeks",
98
99
  description: J ? "Each row is a year; each square, a week you have lived or have yet to live." : "Add your birth date to fill in the weeks you've already lived.",
99
- children: [/* @__PURE__ */ _(re, {
100
+ children: [/* @__PURE__ */ g(ie, {
100
101
  weeksLived: X,
101
- totalWeeks: de,
102
- ariaLabel: J ? `Your life in weeks: ${y(X ?? 0)} weeks lived so far` : "Your life in weeks — birth date not set yet"
103
- }), /* @__PURE__ */ v("div", {
102
+ totalWeeks: fe,
103
+ ariaLabel: J ? `Your life in weeks: ${v(X ?? 0)} weeks lived so far` : "Your life in weeks — birth date not set yet"
104
+ }), /* @__PURE__ */ _("div", {
104
105
  className: "mt-4 flex flex-wrap items-center gap-x-5 gap-y-2 text-xs text-text-secondary",
105
106
  children: [
106
- /* @__PURE__ */ v("span", {
107
+ /* @__PURE__ */ _("span", {
107
108
  className: "flex items-center gap-1.5",
108
- children: [/* @__PURE__ */ _("span", { className: "h-3 w-3 rounded-[3px] bg-action-primary-bg" }), "Weeks lived"]
109
+ children: [/* @__PURE__ */ g("span", { className: "h-3 w-3 rounded-[3px] bg-action-primary-bg" }), "Weeks lived"]
109
110
  }),
110
- /* @__PURE__ */ v("span", {
111
+ /* @__PURE__ */ _("span", {
111
112
  className: "flex items-center gap-1.5",
112
- children: [/* @__PURE__ */ _("span", { className: "h-3 w-3 rounded-[3px] border-2 border-action-primary-bg bg-bg-surface" }), "This week"]
113
+ children: [/* @__PURE__ */ g("span", { className: "h-3 w-3 rounded-[3px] border-2 border-action-primary-bg bg-bg-surface" }), "This week"]
113
114
  }),
114
- /* @__PURE__ */ v("span", {
115
+ /* @__PURE__ */ _("span", {
115
116
  className: "flex items-center gap-1.5",
116
- children: [/* @__PURE__ */ _("span", { className: "h-3 w-3 rounded-[3px] border border-border-seam" }), "Ahead"]
117
+ children: [/* @__PURE__ */ g("span", { className: "h-3 w-3 rounded-[3px] border border-border-seam" }), "Ahead"]
117
118
  })
118
119
  ]
119
120
  })]
120
121
  })
121
- }), /* @__PURE__ */ v(se, {
122
+ }), /* @__PURE__ */ _(le, {
122
123
  treatment: "glass",
123
124
  glow: !0,
124
125
  className: "flex flex-col p-5 sm:p-6",
125
126
  children: [
126
- /* @__PURE__ */ _("div", {
127
+ /* @__PURE__ */ g("div", {
127
128
  className: "flex h-10 w-10 items-center justify-center rounded-xl bg-action-primary-bg/10 text-primary",
128
- children: /* @__PURE__ */ _(f, { className: "h-5 w-5" })
129
+ children: /* @__PURE__ */ g(p, { className: "h-5 w-5" })
129
130
  }),
130
- J ? /* @__PURE__ */ v("div", {
131
+ J ? /* @__PURE__ */ _("div", {
131
132
  className: "mt-4 space-y-5",
132
133
  children: [
133
- /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("p", {
134
+ /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("p", {
134
135
  className: "text-sm text-text-secondary",
135
136
  children: "You have lived"
136
- }), /* @__PURE__ */ v("p", {
137
+ }), /* @__PURE__ */ _("p", {
137
138
  className: "mt-0.5 text-3xl font-bold tabular-nums text-text-primary",
138
139
  children: [
139
- y(X ?? 0),
140
+ v(X ?? 0),
140
141
  " ",
141
- /* @__PURE__ */ _("span", {
142
+ /* @__PURE__ */ g("span", {
142
143
  className: "text-xl font-semibold text-text-secondary",
143
144
  children: "weeks"
144
145
  })
145
146
  ]
146
147
  })] }),
147
- Z != null && Q != null ? /* @__PURE__ */ v("div", { children: [
148
- /* @__PURE__ */ v("p", {
148
+ Z != null && Q != null ? /* @__PURE__ */ _("div", { children: [
149
+ /* @__PURE__ */ _("p", {
149
150
  className: "text-sm text-text-secondary",
150
151
  children: [
151
152
  "If you live to ",
@@ -153,134 +154,133 @@ function S() {
153
154
  ", about"
154
155
  ]
155
156
  }),
156
- /* @__PURE__ */ v("p", {
157
+ /* @__PURE__ */ _("p", {
157
158
  className: "mt-0.5 text-2xl font-bold tabular-nums text-text-primary",
158
159
  children: [
159
- y(Q),
160
+ v(Q),
160
161
  " ",
161
- /* @__PURE__ */ _("span", {
162
+ /* @__PURE__ */ g("span", {
162
163
  className: "text-lg font-semibold text-text-secondary",
163
164
  children: "remain"
164
165
  })
165
166
  ]
166
167
  }),
167
- /* @__PURE__ */ v("p", {
168
+ /* @__PURE__ */ _("p", {
168
169
  className: "mt-1 text-xs text-text-secondary",
169
170
  children: [
170
- b(X ?? 0),
171
+ y(X ?? 0),
171
172
  " years lived ·",
172
173
  " ",
173
- b(Q),
174
+ y(Q),
174
175
  " years ahead"
175
176
  ]
176
177
  })
177
- ] }) : /* @__PURE__ */ _("p", {
178
+ ] }) : /* @__PURE__ */ g("p", {
178
179
  className: "text-xs text-text-secondary",
179
180
  children: Y ? "You've chosen to see only the weeks you've lived." : "Add a life expectancy in settings to gently sketch the weeks ahead."
180
181
  }),
181
- /* @__PURE__ */ _("div", {
182
+ /* @__PURE__ */ g("div", {
182
183
  className: "rounded-lg border border-border-seam bg-bg-surface/40 p-3",
183
- children: /* @__PURE__ */ v("p", {
184
+ children: /* @__PURE__ */ _("p", {
184
185
  className: "flex items-start gap-2 text-sm text-text-primary",
185
- children: [/* @__PURE__ */ _(h, { className: "mt-0.5 h-4 w-4 shrink-0 text-primary" }), /* @__PURE__ */ _("span", { children: "What if today was your last? Make this week count." })]
186
+ children: [/* @__PURE__ */ g(se, { className: "mt-0.5 h-4 w-4 shrink-0 text-primary" }), /* @__PURE__ */ g("span", { children: "What if today was your last? Make this week count." })]
186
187
  })
187
188
  })
188
189
  ]
189
- }) : /* @__PURE__ */ v("div", {
190
+ }) : /* @__PURE__ */ _("div", {
190
191
  className: "mt-4 space-y-4",
191
- children: [/* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("h3", {
192
+ children: [/* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("h3", {
192
193
  className: "text-base font-semibold text-text-primary",
193
194
  children: "See your life in weeks"
194
- }), /* @__PURE__ */ _("p", {
195
+ }), /* @__PURE__ */ g("p", {
195
196
  className: "mt-1 text-sm text-text-secondary",
196
197
  children: "Add your birth date and we'll gently fill in the weeks you've lived so far — a quiet reminder that time is finite, and this week is yours to spend."
197
- })] }), /* @__PURE__ */ v("button", {
198
+ })] }), /* @__PURE__ */ _("button", {
198
199
  type: "button",
199
200
  onClick: q,
200
201
  className: "inline-flex items-center gap-1.5 rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90",
201
- children: ["Add your birth date", /* @__PURE__ */ _(d, { className: "h-4 w-4" })]
202
+ children: ["Add your birth date", /* @__PURE__ */ g(d, { className: "h-4 w-4" })]
202
203
  })]
203
204
  }),
204
- /* @__PURE__ */ v("p", {
205
+ /* @__PURE__ */ _("p", {
205
206
  className: "mt-6 flex items-start gap-1.5 text-xs text-text-secondary",
206
- children: [/* @__PURE__ */ _(p, { className: "mt-0.5 h-3.5 w-3.5 shrink-0" }), /* @__PURE__ */ _("span", { children: "Only you can see this. Your birth date is never shared, and you can turn this off anytime." })]
207
+ children: [/* @__PURE__ */ g(m, { className: "mt-0.5 h-3.5 w-3.5 shrink-0" }), /* @__PURE__ */ g("span", { children: "Only you can see this. Your birth date is never shared, and you can turn this off anytime." })]
207
208
  })
208
209
  ]
209
210
  })]
210
211
  }),
211
- $.length > 0 && /* @__PURE__ */ _(a, {
212
+ $.length > 0 && /* @__PURE__ */ g(i, {
212
213
  title: "Where your recent weeks went",
213
214
  description: "How your logged time settled across life's domains lately — a mirror, not a scorecard.",
214
- children: /* @__PURE__ */ _(ne, {
215
+ children: /* @__PURE__ */ g(re, {
215
216
  data: $,
216
217
  centerLabel: "logged lately",
217
- centerValue: s(fe),
218
- valueFormat: (e) => s(e),
218
+ centerValue: o(pe),
219
+ valueFormat: (e) => o(e),
219
220
  emptyLabel: "Nothing logged in this window yet.",
220
221
  ariaLabel: "Recent time by life domain"
221
222
  })
222
223
  }),
223
- J && $.length === 0 && /* @__PURE__ */ _(t, {
224
+ J && $.length === 0 && /* @__PURE__ */ g(t, {
224
225
  title: "Your weeks are yours to shape",
225
226
  description: "As you capture how you spend your time, a quiet reflection of your recent weeks will appear here — only for you."
226
227
  })
227
228
  ]
228
229
  }),
229
- /* @__PURE__ */ _(i, {
230
+ /* @__PURE__ */ g(r, {
230
231
  open: L,
231
232
  onClose: () => R(!1),
232
233
  title: "Your life in weeks",
233
234
  description: "This is private and entirely optional. Add only what feels comfortable.",
234
- footer: /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("button", {
235
+ footer: /* @__PURE__ */ _(ce, { children: [/* @__PURE__ */ g("button", {
235
236
  type: "button",
236
237
  onClick: () => R(!1),
237
238
  className: "rounded-md border border-border-subtle px-4 py-2 text-sm text-text-secondary hover:bg-bg-sunken hover:text-text-primary",
238
239
  children: "Cancel"
239
- }), /* @__PURE__ */ _("button", {
240
+ }), /* @__PURE__ */ g("button", {
240
241
  type: "submit",
241
242
  form: "finite-life-setup",
242
243
  disabled: P,
243
244
  className: "inline-flex items-center gap-1.5 rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90 disabled:opacity-50",
244
245
  children: P ? "Saving…" : "Save"
245
246
  })] }),
246
- children: /* @__PURE__ */ v("form", {
247
+ children: /* @__PURE__ */ _("form", {
247
248
  id: "finite-life-setup",
248
- onSubmit: ue,
249
+ onSubmit: de,
249
250
  className: "space-y-5",
250
251
  children: [
251
- /* @__PURE__ */ v("div", { children: [
252
- /* @__PURE__ */ v("label", {
252
+ /* @__PURE__ */ _("div", { children: [
253
+ /* @__PURE__ */ _("label", {
253
254
  htmlFor: "finite-life-birthdate",
254
255
  className: "flex items-center gap-1.5 text-sm font-medium text-text-primary",
255
- children: [/* @__PURE__ */ _(oe, { className: "h-4 w-4 text-text-secondary" }), "Your birth date"]
256
+ children: [/* @__PURE__ */ g(f, { className: "h-4 w-4 text-text-secondary" }), "Your birth date"]
256
257
  }),
257
- /* @__PURE__ */ _("input", {
258
+ /* @__PURE__ */ g(c, {
258
259
  id: "finite-life-birthdate",
259
- type: "date",
260
260
  value: z,
261
- max: x,
262
- onChange: (e) => B(e.target.value),
263
- className: "mt-2 w-full rounded-lg border border-border-subtle bg-bg-sunken px-3 py-2 text-sm text-text-primary"
261
+ max: b,
262
+ onChange: B,
263
+ label: "Your birth date"
264
264
  }),
265
- /* @__PURE__ */ _("p", {
265
+ /* @__PURE__ */ g("p", {
266
266
  className: "mt-1.5 text-xs text-text-secondary",
267
267
  children: "Used only to count the weeks you've lived. It stays with you."
268
268
  })
269
269
  ] }),
270
- /* @__PURE__ */ v("div", { children: [
271
- /* @__PURE__ */ v("label", {
270
+ /* @__PURE__ */ _("div", { children: [
271
+ /* @__PURE__ */ _("label", {
272
272
  htmlFor: "finite-life-expectancy",
273
273
  className: "text-sm font-medium text-text-primary",
274
274
  children: [
275
275
  "Life expectancy",
276
276
  " ",
277
- /* @__PURE__ */ _("span", {
277
+ /* @__PURE__ */ g("span", {
278
278
  className: "font-normal text-text-secondary",
279
279
  children: "(optional)"
280
280
  })
281
281
  ]
282
282
  }),
283
- /* @__PURE__ */ _("input", {
283
+ /* @__PURE__ */ g("input", {
284
284
  id: "finite-life-expectancy",
285
285
  type: "number",
286
286
  inputMode: "numeric",
@@ -292,40 +292,40 @@ function S() {
292
292
  onChange: (e) => H(e.target.value),
293
293
  className: "mt-2 w-full rounded-lg border border-border-subtle bg-bg-sunken px-3 py-2 text-sm text-text-primary"
294
294
  }),
295
- /* @__PURE__ */ _("p", {
295
+ /* @__PURE__ */ g("p", {
296
296
  className: "mt-1.5 text-xs text-text-secondary",
297
297
  children: "A gentle horizon for the weeks ahead — never a deadline. Leave it blank to simply see the weeks you've lived."
298
298
  })
299
299
  ] }),
300
- /* @__PURE__ */ v("label", {
300
+ /* @__PURE__ */ _("label", {
301
301
  className: "flex items-start gap-2.5 rounded-lg border border-border-subtle bg-bg-surface/40 p-3",
302
- children: [/* @__PURE__ */ _("input", {
302
+ children: [/* @__PURE__ */ g("input", {
303
303
  type: "checkbox",
304
304
  checked: U,
305
305
  onChange: (e) => W(e.target.checked),
306
306
  className: "mt-0.5 h-4 w-4 shrink-0 rounded border-border-subtle"
307
- }), /* @__PURE__ */ v("span", {
307
+ }), /* @__PURE__ */ _("span", {
308
308
  className: "text-sm text-text-primary",
309
- children: ["Hide the weeks ahead", /* @__PURE__ */ _("span", {
309
+ children: ["Hide the weeks ahead", /* @__PURE__ */ g("span", {
310
310
  className: "mt-0.5 block text-xs text-text-secondary",
311
311
  children: "Show only the weeks you've lived — no horizon, no countdown."
312
312
  })]
313
313
  })]
314
314
  }),
315
- G && /* @__PURE__ */ _("p", {
315
+ G && /* @__PURE__ */ g("p", {
316
316
  className: "rounded-lg border border-status-error-border/50 bg-status-error-bg/10 px-3 py-2 text-sm text-status-error-text",
317
317
  children: G
318
318
  })
319
319
  ]
320
320
  })
321
321
  }),
322
- /* @__PURE__ */ _(ee, {
323
- toasts: le,
322
+ /* @__PURE__ */ g(te, {
323
+ toasts: S,
324
324
  onDismiss: w
325
325
  })
326
326
  ]
327
327
  });
328
328
  }
329
- export { S as FiniteLifePage };
329
+ export { x as FiniteLifePage };
330
330
 
331
331
  //# sourceMappingURL=FiniteLifePage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FiniteLifePage.js","names":["_Fragment","nf","n","weeksToYears","weeks","isoToDateInput","iso","TODAY_DATE_INPUT","FiniteLifePage","useTimeCampus","useToast","weeksData","weeksLoading","weeksError","refetchWeeks","useMyLifeInWeeksQuery","workspaceId","profileData","profileLoading","profileError","refetchProfile","useMyLifeProfileQuery","updateProfile","saving","useUpdateMyLifeProfileMutation","profile","setupOpen","setSetupOpen","useState","birthDateInput","setBirthDateInput","expectancyInput","setExpectancyInput","hideRemainingInput","setHideRemainingInput","formError","setFormError","openSetup","handleSave","expectancy","parsed","addToast","hasBirthDate","hideRemaining","weeksLived","expectancyYears","gridTotalWeeks","weeksRemaining","domainSlices","useMemo","r","lifeDomainLabel","rollupTotalSeconds","sum","s","PageLayout","LoadingSkeleton","jsxs","SlidersHorizontal","ChartCard","WeeksGrid","GlassCard","Hourglass","Sparkles","ArrowRight","Lock","DonutChart","formatSecondsHuman","v","EmptyState","Modal","Fragment","CalendarDays","ToastContainer","dismissToast"],"sources":["../../../../src/timecampus/pages/lifetime/FiniteLifePage.tsx"],"sourcesContent":["import { useMemo, useState, type FormEvent } from \"react\";\nimport {\n Hourglass,\n Sparkles,\n SlidersHorizontal,\n CalendarDays,\n Lock,\n ArrowRight,\n} from \"lucide-react\";\nimport { GlassCard } from \"@burdenoff/fe-libs/ui\";\nimport {\n PageLayout,\n ChartCard,\n EmptyState,\n Modal,\n DonutChart,\n WeeksGrid,\n LoadingSkeleton,\n ToastContainer,\n useToast,\n type DonutSlice,\n} from \"../../components\";\nimport { useTimeCampus } from \"../../providers/TimeCampusProvider\";\nimport {\n useMyLifeInWeeksQuery,\n useMyLifeProfileQuery,\n useUpdateMyLifeProfileMutation,\n type MyLifeInWeeksQuery,\n} from \"@/generated/wspace-operations\";\nimport { lifeDomainLabel, formatSecondsHuman } from \"./domains\";\n\n/** One life-domain roll-up row, typed from the generated query result. */\ntype LifeDomainRollup =\n MyLifeInWeeksQuery[\"myLifeInWeeks\"][\"domainRollups\"][number];\n\n/** Grouped integer (e.g. 1,742). */\nfunction nf(n: number): string {\n return Math.max(0, Math.round(n)).toLocaleString();\n}\n\n/** Whole-week count → years with one decimal (e.g. 33.5). */\nfunction weeksToYears(weeks: number): string {\n return (Math.round((weeks / 52) * 10) / 10).toFixed(1);\n}\n\n/** ISO datetime → the `YYYY-MM-DD` a native date input expects. */\nfunction isoToDateInput(iso: string | null | undefined): string {\n if (!iso) return \"\";\n return iso.slice(0, 10);\n}\n\nconst TODAY_DATE_INPUT = new Date().toISOString().slice(0, 10);\n\n/**\n * FiniteLifePage — the finite-life \"your life in weeks\" memento.\n *\n * A calm, opt-in, entirely private reflection: each cell is one week of a life,\n * anchored to the gentle north star \"What if today was your last?\". Everything\n * it draws comes from the viewer's own (optional) birth date and life\n * expectancy — never a guessed age or an invented mortality date. It is\n * self-scoped (identity travels in the gateway headers, so the queries take no\n * user argument) and honest by construction: with no birth date it still\n * renders an open horizon and simply invites you to add one. It respects the\n * `hideRemainingWeeks` choice so no one is forced to stare down a countdown.\n */\nexport function FiniteLifePage() {\n const { workspaceId = \"\" } = useTimeCampus();\n const { toasts, addToast, dismissToast } = useToast();\n\n const {\n data: weeksData,\n loading: weeksLoading,\n error: weeksError,\n refetch: refetchWeeks,\n } = useMyLifeInWeeksQuery({ skip: !workspaceId });\n\n const {\n data: profileData,\n loading: profileLoading,\n error: profileError,\n refetch: refetchProfile,\n } = useMyLifeProfileQuery({ skip: !workspaceId });\n\n const [updateProfile, { loading: saving }] = useUpdateMyLifeProfileMutation();\n\n const weeks = weeksData?.myLifeInWeeks;\n const profile = profileData?.myLifeProfile;\n\n // ---- Setup modal (opt-in, dismissible) -----------------------------------\n const [setupOpen, setSetupOpen] = useState(false);\n const [birthDateInput, setBirthDateInput] = useState(\"\");\n const [expectancyInput, setExpectancyInput] = useState(\"\");\n const [hideRemainingInput, setHideRemainingInput] = useState(false);\n const [formError, setFormError] = useState<string | null>(null);\n\n const openSetup = () => {\n setBirthDateInput(isoToDateInput(profile?.birthDate ?? weeks?.birthDate));\n setExpectancyInput(\n profile?.lifeExpectancyYears != null\n ? String(profile.lifeExpectancyYears)\n : weeks?.lifeExpectancyYears != null\n ? String(weeks.lifeExpectancyYears)\n : \"\",\n );\n setHideRemainingInput(\n profile?.hideRemainingWeeks ?? weeks?.hideRemainingWeeks ?? false,\n );\n setFormError(null);\n setSetupOpen(true);\n };\n\n const handleSave = async (e?: FormEvent) => {\n e?.preventDefault();\n setFormError(null);\n\n if (!birthDateInput) {\n setFormError(\"Please add your birth date to continue.\");\n return;\n }\n if (birthDateInput > TODAY_DATE_INPUT) {\n setFormError(\"Your birth date can't be in the future.\");\n return;\n }\n\n let expectancy: number | null = null;\n if (expectancyInput.trim() !== \"\") {\n const parsed = Number(expectancyInput);\n if (!Number.isInteger(parsed) || parsed < 1 || parsed > 130) {\n setFormError(\n \"Life expectancy should be a whole number of years (1–130).\",\n );\n return;\n }\n expectancy = parsed;\n }\n\n try {\n await updateProfile({\n variables: {\n input: {\n birthDate: new Date(\n `${birthDateInput}T00:00:00.000Z`,\n ).toISOString(),\n lifeExpectancyYears: expectancy,\n hideRemainingWeeks: hideRemainingInput,\n finiteLifeOptIn: true,\n },\n },\n });\n await Promise.all([refetchWeeks(), refetchProfile()]);\n setSetupOpen(false);\n addToast({\n variant: \"success\",\n title: \"Saved — this is just for you\",\n description: \"You can change or turn this off anytime.\",\n });\n } catch {\n addToast({\n variant: \"error\",\n title: \"Couldn't save your settings\",\n description: \"Please try again in a moment.\",\n });\n }\n };\n\n // ---- Derived, honest values ----------------------------------------------\n const hasBirthDate = !!weeks?.birthDate;\n const hideRemaining =\n weeks?.hideRemainingWeeks ?? profile?.hideRemainingWeeks ?? false;\n\n const weeksLived = weeks?.weeksLived ?? null;\n const expectancyYears = weeks?.lifeExpectancyYears ?? null;\n // Only reveal the full mortal horizon when the user hasn't asked to hide it.\n const gridTotalWeeks = hideRemaining\n ? null\n : (weeks?.expectedTotalWeeks ?? null);\n const weeksRemaining =\n hideRemaining || weeks?.weeksRemaining == null\n ? null\n : weeks.weeksRemaining;\n\n // Reflection: where the recent (backend-defined) window actually went.\n const domainSlices: DonutSlice[] = useMemo(() => {\n const rollups: LifeDomainRollup[] = weeks?.domainRollups ?? [];\n return rollups\n .filter((r) => r.totalSeconds > 0)\n .map((r) => ({\n name: lifeDomainLabel(r.domain),\n value: r.totalSeconds,\n }));\n }, [weeks?.domainRollups]);\n const rollupTotalSeconds = domainSlices.reduce((sum, s) => sum + s.value, 0);\n\n const loading = weeksLoading || profileLoading;\n const hardError = (weeksError || profileError) && !weeks && !profile;\n\n const setupAction = (\n <button\n type=\"button\"\n onClick={openSetup}\n className=\"inline-flex items-center gap-1.5 rounded-md border border-border-subtle bg-bg-surface px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken\"\n >\n <SlidersHorizontal className=\"h-4 w-4\" />\n Life settings\n </button>\n );\n\n if (loading && !weeks && !profile) {\n return (\n <PageLayout\n title=\"Your Life in Weeks\"\n description=\"A calm, private view of the weeks you've lived — and the ones still ahead.\"\n >\n <LoadingSkeleton variant=\"detail\" />\n </PageLayout>\n );\n }\n\n return (\n <PageLayout\n title=\"Your Life in Weeks\"\n description=\"A calm, private view of the weeks you've lived — and the ones still ahead.\"\n purpose=\"Each square is a single week of your life. It's a gentle memento — not a countdown — meant only for you, to help this week feel a little more intentional.\"\n actions={setupAction}\n >\n {hardError ? (\n <div className=\"rounded-xl border border-status-error-border/50 bg-status-error-bg/10 p-4 text-sm text-status-error-text\">\n We couldn't load your life view right now. Please try again in a\n moment.\n </div>\n ) : (\n <div className=\"space-y-6\">\n <div className=\"grid grid-cols-1 gap-6 lg:grid-cols-3\">\n {/* The grid — the memento itself */}\n <div className=\"lg:col-span-2\">\n <ChartCard\n title=\"Your life in weeks\"\n description={\n hasBirthDate\n ? \"Each row is a year; each square, a week you have lived or have yet to live.\"\n : \"Add your birth date to fill in the weeks you've already lived.\"\n }\n >\n <WeeksGrid\n weeksLived={weeksLived}\n totalWeeks={gridTotalWeeks}\n ariaLabel={\n hasBirthDate\n ? `Your life in weeks: ${nf(weeksLived ?? 0)} weeks lived so far`\n : \"Your life in weeks — birth date not set yet\"\n }\n />\n <div className=\"mt-4 flex flex-wrap items-center gap-x-5 gap-y-2 text-xs text-text-secondary\">\n <span className=\"flex items-center gap-1.5\">\n <span className=\"h-3 w-3 rounded-[3px] bg-action-primary-bg\" />\n Weeks lived\n </span>\n <span className=\"flex items-center gap-1.5\">\n <span className=\"h-3 w-3 rounded-[3px] border-2 border-action-primary-bg bg-bg-surface\" />\n This week\n </span>\n <span className=\"flex items-center gap-1.5\">\n <span className=\"h-3 w-3 rounded-[3px] border border-border-seam\" />\n Ahead\n </span>\n </div>\n </ChartCard>\n </div>\n\n {/* The calm side card */}\n <GlassCard\n treatment=\"glass\"\n glow\n className=\"flex flex-col p-5 sm:p-6\"\n >\n <div className=\"flex h-10 w-10 items-center justify-center rounded-xl bg-action-primary-bg/10 text-primary\">\n <Hourglass className=\"h-5 w-5\" />\n </div>\n\n {hasBirthDate ? (\n <div className=\"mt-4 space-y-5\">\n <div>\n <p className=\"text-sm text-text-secondary\">\n You have lived\n </p>\n <p className=\"mt-0.5 text-3xl font-bold tabular-nums text-text-primary\">\n {nf(weeksLived ?? 0)}{\" \"}\n <span className=\"text-xl font-semibold text-text-secondary\">\n weeks\n </span>\n </p>\n </div>\n\n {expectancyYears != null && weeksRemaining != null ? (\n <div>\n <p className=\"text-sm text-text-secondary\">\n If you live to {expectancyYears}, about\n </p>\n <p className=\"mt-0.5 text-2xl font-bold tabular-nums text-text-primary\">\n {nf(weeksRemaining)}{\" \"}\n <span className=\"text-lg font-semibold text-text-secondary\">\n remain\n </span>\n </p>\n <p className=\"mt-1 text-xs text-text-secondary\">\n {weeksToYears(weeksLived ?? 0)} years lived ·{\" \"}\n {weeksToYears(weeksRemaining)} years ahead\n </p>\n </div>\n ) : (\n <p className=\"text-xs text-text-secondary\">\n {hideRemaining\n ? \"You've chosen to see only the weeks you've lived.\"\n : \"Add a life expectancy in settings to gently sketch the weeks ahead.\"}\n </p>\n )}\n\n <div className=\"rounded-lg border border-border-seam bg-bg-surface/40 p-3\">\n <p className=\"flex items-start gap-2 text-sm text-text-primary\">\n <Sparkles className=\"mt-0.5 h-4 w-4 shrink-0 text-primary\" />\n <span>\n What if today was your last? Make this week count.\n </span>\n </p>\n </div>\n </div>\n ) : (\n <div className=\"mt-4 space-y-4\">\n <div>\n <h3 className=\"text-base font-semibold text-text-primary\">\n See your life in weeks\n </h3>\n <p className=\"mt-1 text-sm text-text-secondary\">\n Add your birth date and we'll gently fill in the weeks\n you've lived so far — a quiet reminder that time is\n finite, and this week is yours to spend.\n </p>\n </div>\n <button\n type=\"button\"\n onClick={openSetup}\n className=\"inline-flex items-center gap-1.5 rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90\"\n >\n Add your birth date\n <ArrowRight className=\"h-4 w-4\" />\n </button>\n </div>\n )}\n\n <p className=\"mt-6 flex items-start gap-1.5 text-xs text-text-secondary\">\n <Lock className=\"mt-0.5 h-3.5 w-3.5 shrink-0\" />\n <span>\n Only you can see this. Your birth date is never shared, and\n you can turn this off anytime.\n </span>\n </p>\n </GlassCard>\n </div>\n\n {/* Gentle reflection — only when there's real recent data to show */}\n {domainSlices.length > 0 && (\n <ChartCard\n title=\"Where your recent weeks went\"\n description=\"How your logged time settled across life's domains lately — a mirror, not a scorecard.\"\n >\n <DonutChart\n data={domainSlices}\n centerLabel=\"logged lately\"\n centerValue={formatSecondsHuman(rollupTotalSeconds)}\n valueFormat={(v) => formatSecondsHuman(v)}\n emptyLabel=\"Nothing logged in this window yet.\"\n ariaLabel=\"Recent time by life domain\"\n />\n </ChartCard>\n )}\n\n {/* Honest first-run nudge when nothing has been logged either */}\n {hasBirthDate && domainSlices.length === 0 && (\n <EmptyState\n title=\"Your weeks are yours to shape\"\n description=\"As you capture how you spend your time, a quiet reflection of your recent weeks will appear here — only for you.\"\n />\n )}\n </div>\n )}\n\n {/* Opt-in setup */}\n <Modal\n open={setupOpen}\n onClose={() => setSetupOpen(false)}\n title=\"Your life in weeks\"\n description=\"This is private and entirely optional. Add only what feels comfortable.\"\n footer={\n <>\n <button\n type=\"button\"\n onClick={() => setSetupOpen(false)}\n className=\"rounded-md border border-border-subtle px-4 py-2 text-sm text-text-secondary hover:bg-bg-sunken hover:text-text-primary\"\n >\n Cancel\n </button>\n <button\n type=\"submit\"\n form=\"finite-life-setup\"\n disabled={saving}\n className=\"inline-flex items-center gap-1.5 rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90 disabled:opacity-50\"\n >\n {saving ? \"Saving…\" : \"Save\"}\n </button>\n </>\n }\n >\n <form\n id=\"finite-life-setup\"\n onSubmit={handleSave}\n className=\"space-y-5\"\n >\n <div>\n <label\n htmlFor=\"finite-life-birthdate\"\n className=\"flex items-center gap-1.5 text-sm font-medium text-text-primary\"\n >\n <CalendarDays className=\"h-4 w-4 text-text-secondary\" />\n Your birth date\n </label>\n <input\n id=\"finite-life-birthdate\"\n type=\"date\"\n value={birthDateInput}\n max={TODAY_DATE_INPUT}\n onChange={(e) => setBirthDateInput(e.target.value)}\n className=\"mt-2 w-full rounded-lg border border-border-subtle bg-bg-sunken px-3 py-2 text-sm text-text-primary\"\n />\n <p className=\"mt-1.5 text-xs text-text-secondary\">\n Used only to count the weeks you've lived. It stays with you.\n </p>\n </div>\n\n <div>\n <label\n htmlFor=\"finite-life-expectancy\"\n className=\"text-sm font-medium text-text-primary\"\n >\n Life expectancy{\" \"}\n <span className=\"font-normal text-text-secondary\">\n (optional)\n </span>\n </label>\n <input\n id=\"finite-life-expectancy\"\n type=\"number\"\n inputMode=\"numeric\"\n min={1}\n max={130}\n step={1}\n placeholder=\"e.g. 90\"\n value={expectancyInput}\n onChange={(e) => setExpectancyInput(e.target.value)}\n className=\"mt-2 w-full rounded-lg border border-border-subtle bg-bg-sunken px-3 py-2 text-sm text-text-primary\"\n />\n <p className=\"mt-1.5 text-xs text-text-secondary\">\n A gentle horizon for the weeks ahead — never a deadline. Leave it\n blank to simply see the weeks you've lived.\n </p>\n </div>\n\n <label className=\"flex items-start gap-2.5 rounded-lg border border-border-subtle bg-bg-surface/40 p-3\">\n <input\n type=\"checkbox\"\n checked={hideRemainingInput}\n onChange={(e) => setHideRemainingInput(e.target.checked)}\n className=\"mt-0.5 h-4 w-4 shrink-0 rounded border-border-subtle\"\n />\n <span className=\"text-sm text-text-primary\">\n Hide the weeks ahead\n <span className=\"mt-0.5 block text-xs text-text-secondary\">\n Show only the weeks you've lived — no horizon, no countdown.\n </span>\n </span>\n </label>\n\n {formError && (\n <p className=\"rounded-lg border border-status-error-border/50 bg-status-error-bg/10 px-3 py-2 text-sm text-status-error-text\">\n {formError}\n </p>\n )}\n </form>\n </Modal>\n\n <ToastContainer toasts={toasts} onDismiss={dismissToast} />\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAoCA,SAASC,EAAG,GAAmB;CAC7B,OAAO,KAAK,IAAI,GAAG,KAAK,MAAMC,CAAC,CAAC,CAAC,CAAC,eAAe;AACnD;AAGA,SAASC,EAAa,GAAuB;CAC3C,QAAQ,KAAK,MAAOC,IAAQ,KAAM,EAAE,IAAI,GAAA,CAAI,QAAQ,CAAC;AACvD;AAGA,SAASC,GAAe,GAAwC;CAE9D,OADKC,IACEA,EAAI,MAAM,GAAG,EAAE,IADL;AAEnB;AAEA,IAAMC,qBAAmB,IAAI,KAAK,EAAA,CAAE,YAAY,CAAC,CAAC,MAAM,GAAG,EAAE;AAc7D,SAAgBC,IAAiB;CAC/B,IAAM,EAAE,iBAAc,OAAOC,EAAc,GACrC,EAAE,YAAQ,aAAU,oBAAiBC,GAAS,GAE9C,EACJ,MAAMC,GACN,SAASC,GACT,OAAOC,GACP,SAASC,MACPC,GAAsB,EAAE,MAAM,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,OAAOC;QACP,WAAW,MAAMC,EAAmB,EAAE,OAAO,KAAK;QAClD,WAAU;OACX,CAAA;OACD,kBAAC,KAAD;QAAG,WAAU;QAAqC,UAAA;OAG/C,CAAA;MACA,EAAA,CAAA;MAEL,kBAAC,SAAD;OAAO,WAAU;OAAjB,UAAA,CACE,kBAAC,SAAD;QACE,MAAK;QACL,SAASC;QACT,WAAW,MAAMC,EAAsB,EAAE,OAAO,OAAO;QACvD,WAAU;OACX,CAAA,GACD,kBAAC,QAAD;QAAM,WAAU;QAAhB,UAAA,CAA4C,wBAE1C,kBAAC,QAAD;SAAM,WAAU;SAA2C,UAAA;QAErD,CAAA,CACF;OACD,CAAA,CAAA;;MAENC,KACC,kBAAC,KAAD;OAAG,WAAU;OACV,UAAAA;MACA,CAAA;KAED;;GACD,CAAA;GAEP,kBAACsC,IAAD;IAAwB;IAAQ,WAAWC;GAAe,CAAA;EAChD;;AAEhB"}
1
+ {"version":3,"file":"FiniteLifePage.js","names":["_Fragment","nf","n","weeksToYears","weeks","isoToDateInput","iso","TODAY_DATE_INPUT","FiniteLifePage","useTimeCampus","useToast","weeksData","weeksLoading","weeksError","refetchWeeks","useMyLifeInWeeksQuery","workspaceId","profileData","profileLoading","profileError","refetchProfile","useMyLifeProfileQuery","updateProfile","saving","useUpdateMyLifeProfileMutation","profile","setupOpen","setSetupOpen","useState","birthDateInput","setBirthDateInput","expectancyInput","setExpectancyInput","hideRemainingInput","setHideRemainingInput","formError","setFormError","openSetup","handleSave","expectancy","parsed","addToast","hasBirthDate","hideRemaining","weeksLived","expectancyYears","gridTotalWeeks","weeksRemaining","domainSlices","useMemo","r","lifeDomainLabel","rollupTotalSeconds","sum","s","PageLayout","LoadingSkeleton","jsxs","SlidersHorizontal","ChartCard","WeeksGrid","GlassCard","Hourglass","Sparkles","ArrowRight","Lock","DonutChart","formatSecondsHuman","v","EmptyState","Modal","Fragment","CalendarDays","DateField","ToastContainer","dismissToast"],"sources":["../../../../src/timecampus/pages/lifetime/FiniteLifePage.tsx"],"sourcesContent":["import { useMemo, useState, type FormEvent } from \"react\";\nimport {\n Hourglass,\n Sparkles,\n SlidersHorizontal,\n CalendarDays,\n Lock,\n ArrowRight,\n} from \"lucide-react\";\nimport { GlassCard } from \"@burdenoff/fe-libs/ui\";\nimport {\n PageLayout,\n ChartCard,\n EmptyState,\n Modal,\n DonutChart,\n WeeksGrid,\n LoadingSkeleton,\n ToastContainer,\n useToast,\n type DonutSlice,\n} from \"../../components\";\nimport { useTimeCampus } from \"../../providers/TimeCampusProvider\";\nimport {\n useMyLifeInWeeksQuery,\n useMyLifeProfileQuery,\n useUpdateMyLifeProfileMutation,\n type MyLifeInWeeksQuery,\n} from \"@/generated/wspace-operations\";\nimport { lifeDomainLabel, formatSecondsHuman } from \"./domains\";\nimport { DateField } from \"../../components/DateFields\";\n\n/** One life-domain roll-up row, typed from the generated query result. */\ntype LifeDomainRollup =\n MyLifeInWeeksQuery[\"myLifeInWeeks\"][\"domainRollups\"][number];\n\n/** Grouped integer (e.g. 1,742). */\nfunction nf(n: number): string {\n return Math.max(0, Math.round(n)).toLocaleString();\n}\n\n/** Whole-week count → years with one decimal (e.g. 33.5). */\nfunction weeksToYears(weeks: number): string {\n return (Math.round((weeks / 52) * 10) / 10).toFixed(1);\n}\n\n/** ISO datetime → the `YYYY-MM-DD` a native date input expects. */\nfunction isoToDateInput(iso: string | null | undefined): string {\n if (!iso) return \"\";\n return iso.slice(0, 10);\n}\n\nconst TODAY_DATE_INPUT = new Date().toISOString().slice(0, 10);\n\n/**\n * FiniteLifePage — the finite-life \"your life in weeks\" memento.\n *\n * A calm, opt-in, entirely private reflection: each cell is one week of a life,\n * anchored to the gentle north star \"What if today was your last?\". Everything\n * it draws comes from the viewer's own (optional) birth date and life\n * expectancy — never a guessed age or an invented mortality date. It is\n * self-scoped (identity travels in the gateway headers, so the queries take no\n * user argument) and honest by construction: with no birth date it still\n * renders an open horizon and simply invites you to add one. It respects the\n * `hideRemainingWeeks` choice so no one is forced to stare down a countdown.\n */\nexport function FiniteLifePage() {\n const { workspaceId = \"\" } = useTimeCampus();\n const { toasts, addToast, dismissToast } = useToast();\n\n const {\n data: weeksData,\n loading: weeksLoading,\n error: weeksError,\n refetch: refetchWeeks,\n } = useMyLifeInWeeksQuery({ skip: !workspaceId });\n\n const {\n data: profileData,\n loading: profileLoading,\n error: profileError,\n refetch: refetchProfile,\n } = useMyLifeProfileQuery({ skip: !workspaceId });\n\n const [updateProfile, { loading: saving }] = useUpdateMyLifeProfileMutation();\n\n const weeks = weeksData?.myLifeInWeeks;\n const profile = profileData?.myLifeProfile;\n\n // ---- Setup modal (opt-in, dismissible) -----------------------------------\n const [setupOpen, setSetupOpen] = useState(false);\n const [birthDateInput, setBirthDateInput] = useState(\"\");\n const [expectancyInput, setExpectancyInput] = useState(\"\");\n const [hideRemainingInput, setHideRemainingInput] = useState(false);\n const [formError, setFormError] = useState<string | null>(null);\n\n const openSetup = () => {\n setBirthDateInput(isoToDateInput(profile?.birthDate ?? weeks?.birthDate));\n setExpectancyInput(\n profile?.lifeExpectancyYears != null\n ? String(profile.lifeExpectancyYears)\n : weeks?.lifeExpectancyYears != null\n ? String(weeks.lifeExpectancyYears)\n : \"\",\n );\n setHideRemainingInput(\n profile?.hideRemainingWeeks ?? weeks?.hideRemainingWeeks ?? false,\n );\n setFormError(null);\n setSetupOpen(true);\n };\n\n const handleSave = async (e?: FormEvent) => {\n e?.preventDefault();\n setFormError(null);\n\n if (!birthDateInput) {\n setFormError(\"Please add your birth date to continue.\");\n return;\n }\n if (birthDateInput > TODAY_DATE_INPUT) {\n setFormError(\"Your birth date can't be in the future.\");\n return;\n }\n\n let expectancy: number | null = null;\n if (expectancyInput.trim() !== \"\") {\n const parsed = Number(expectancyInput);\n if (!Number.isInteger(parsed) || parsed < 1 || parsed > 130) {\n setFormError(\n \"Life expectancy should be a whole number of years (1–130).\",\n );\n return;\n }\n expectancy = parsed;\n }\n\n try {\n await updateProfile({\n variables: {\n input: {\n birthDate: new Date(\n `${birthDateInput}T00:00:00.000Z`,\n ).toISOString(),\n lifeExpectancyYears: expectancy,\n hideRemainingWeeks: hideRemainingInput,\n finiteLifeOptIn: true,\n },\n },\n });\n await Promise.all([refetchWeeks(), refetchProfile()]);\n setSetupOpen(false);\n addToast({\n variant: \"success\",\n title: \"Saved — this is just for you\",\n description: \"You can change or turn this off anytime.\",\n });\n } catch {\n addToast({\n variant: \"error\",\n title: \"Couldn't save your settings\",\n description: \"Please try again in a moment.\",\n });\n }\n };\n\n // ---- Derived, honest values ----------------------------------------------\n const hasBirthDate = !!weeks?.birthDate;\n const hideRemaining =\n weeks?.hideRemainingWeeks ?? profile?.hideRemainingWeeks ?? false;\n\n const weeksLived = weeks?.weeksLived ?? null;\n const expectancyYears = weeks?.lifeExpectancyYears ?? null;\n // Only reveal the full mortal horizon when the user hasn't asked to hide it.\n const gridTotalWeeks = hideRemaining\n ? null\n : (weeks?.expectedTotalWeeks ?? null);\n const weeksRemaining =\n hideRemaining || weeks?.weeksRemaining == null\n ? null\n : weeks.weeksRemaining;\n\n // Reflection: where the recent (backend-defined) window actually went.\n const domainSlices: DonutSlice[] = useMemo(() => {\n const rollups: LifeDomainRollup[] = weeks?.domainRollups ?? [];\n return rollups\n .filter((r) => r.totalSeconds > 0)\n .map((r) => ({\n name: lifeDomainLabel(r.domain),\n value: r.totalSeconds,\n }));\n }, [weeks?.domainRollups]);\n const rollupTotalSeconds = domainSlices.reduce((sum, s) => sum + s.value, 0);\n\n const loading = weeksLoading || profileLoading;\n const hardError = (weeksError || profileError) && !weeks && !profile;\n\n const setupAction = (\n <button\n type=\"button\"\n onClick={openSetup}\n className=\"inline-flex items-center gap-1.5 rounded-md border border-border-subtle bg-bg-surface px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken\"\n >\n <SlidersHorizontal className=\"h-4 w-4\" />\n Life settings\n </button>\n );\n\n if (loading && !weeks && !profile) {\n return (\n <PageLayout\n title=\"Your Life in Weeks\"\n description=\"A calm, private view of the weeks you've lived — and the ones still ahead.\"\n >\n <LoadingSkeleton variant=\"detail\" />\n </PageLayout>\n );\n }\n\n return (\n <PageLayout\n title=\"Your Life in Weeks\"\n description=\"A calm, private view of the weeks you've lived — and the ones still ahead.\"\n purpose=\"Each square is a single week of your life. It's a gentle memento — not a countdown — meant only for you, to help this week feel a little more intentional.\"\n actions={setupAction}\n >\n {hardError ? (\n <div className=\"rounded-xl border border-status-error-border/50 bg-status-error-bg/10 p-4 text-sm text-status-error-text\">\n We couldn't load your life view right now. Please try again in a\n moment.\n </div>\n ) : (\n <div className=\"space-y-6\">\n <div className=\"grid grid-cols-1 gap-6 lg:grid-cols-3\">\n {/* The grid — the memento itself */}\n <div className=\"lg:col-span-2\">\n <ChartCard\n title=\"Your life in weeks\"\n description={\n hasBirthDate\n ? \"Each row is a year; each square, a week you have lived or have yet to live.\"\n : \"Add your birth date to fill in the weeks you've already lived.\"\n }\n >\n <WeeksGrid\n weeksLived={weeksLived}\n totalWeeks={gridTotalWeeks}\n ariaLabel={\n hasBirthDate\n ? `Your life in weeks: ${nf(weeksLived ?? 0)} weeks lived so far`\n : \"Your life in weeks — birth date not set yet\"\n }\n />\n <div className=\"mt-4 flex flex-wrap items-center gap-x-5 gap-y-2 text-xs text-text-secondary\">\n <span className=\"flex items-center gap-1.5\">\n <span className=\"h-3 w-3 rounded-[3px] bg-action-primary-bg\" />\n Weeks lived\n </span>\n <span className=\"flex items-center gap-1.5\">\n <span className=\"h-3 w-3 rounded-[3px] border-2 border-action-primary-bg bg-bg-surface\" />\n This week\n </span>\n <span className=\"flex items-center gap-1.5\">\n <span className=\"h-3 w-3 rounded-[3px] border border-border-seam\" />\n Ahead\n </span>\n </div>\n </ChartCard>\n </div>\n\n {/* The calm side card */}\n <GlassCard\n treatment=\"glass\"\n glow\n className=\"flex flex-col p-5 sm:p-6\"\n >\n <div className=\"flex h-10 w-10 items-center justify-center rounded-xl bg-action-primary-bg/10 text-primary\">\n <Hourglass className=\"h-5 w-5\" />\n </div>\n\n {hasBirthDate ? (\n <div className=\"mt-4 space-y-5\">\n <div>\n <p className=\"text-sm text-text-secondary\">\n You have lived\n </p>\n <p className=\"mt-0.5 text-3xl font-bold tabular-nums text-text-primary\">\n {nf(weeksLived ?? 0)}{\" \"}\n <span className=\"text-xl font-semibold text-text-secondary\">\n weeks\n </span>\n </p>\n </div>\n\n {expectancyYears != null && weeksRemaining != null ? (\n <div>\n <p className=\"text-sm text-text-secondary\">\n If you live to {expectancyYears}, about\n </p>\n <p className=\"mt-0.5 text-2xl font-bold tabular-nums text-text-primary\">\n {nf(weeksRemaining)}{\" \"}\n <span className=\"text-lg font-semibold text-text-secondary\">\n remain\n </span>\n </p>\n <p className=\"mt-1 text-xs text-text-secondary\">\n {weeksToYears(weeksLived ?? 0)} years lived ·{\" \"}\n {weeksToYears(weeksRemaining)} years ahead\n </p>\n </div>\n ) : (\n <p className=\"text-xs text-text-secondary\">\n {hideRemaining\n ? \"You've chosen to see only the weeks you've lived.\"\n : \"Add a life expectancy in settings to gently sketch the weeks ahead.\"}\n </p>\n )}\n\n <div className=\"rounded-lg border border-border-seam bg-bg-surface/40 p-3\">\n <p className=\"flex items-start gap-2 text-sm text-text-primary\">\n <Sparkles className=\"mt-0.5 h-4 w-4 shrink-0 text-primary\" />\n <span>\n What if today was your last? Make this week count.\n </span>\n </p>\n </div>\n </div>\n ) : (\n <div className=\"mt-4 space-y-4\">\n <div>\n <h3 className=\"text-base font-semibold text-text-primary\">\n See your life in weeks\n </h3>\n <p className=\"mt-1 text-sm text-text-secondary\">\n Add your birth date and we'll gently fill in the weeks\n you've lived so far — a quiet reminder that time is\n finite, and this week is yours to spend.\n </p>\n </div>\n <button\n type=\"button\"\n onClick={openSetup}\n className=\"inline-flex items-center gap-1.5 rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90\"\n >\n Add your birth date\n <ArrowRight className=\"h-4 w-4\" />\n </button>\n </div>\n )}\n\n <p className=\"mt-6 flex items-start gap-1.5 text-xs text-text-secondary\">\n <Lock className=\"mt-0.5 h-3.5 w-3.5 shrink-0\" />\n <span>\n Only you can see this. Your birth date is never shared, and\n you can turn this off anytime.\n </span>\n </p>\n </GlassCard>\n </div>\n\n {/* Gentle reflection — only when there's real recent data to show */}\n {domainSlices.length > 0 && (\n <ChartCard\n title=\"Where your recent weeks went\"\n description=\"How your logged time settled across life's domains lately — a mirror, not a scorecard.\"\n >\n <DonutChart\n data={domainSlices}\n centerLabel=\"logged lately\"\n centerValue={formatSecondsHuman(rollupTotalSeconds)}\n valueFormat={(v) => formatSecondsHuman(v)}\n emptyLabel=\"Nothing logged in this window yet.\"\n ariaLabel=\"Recent time by life domain\"\n />\n </ChartCard>\n )}\n\n {/* Honest first-run nudge when nothing has been logged either */}\n {hasBirthDate && domainSlices.length === 0 && (\n <EmptyState\n title=\"Your weeks are yours to shape\"\n description=\"As you capture how you spend your time, a quiet reflection of your recent weeks will appear here — only for you.\"\n />\n )}\n </div>\n )}\n\n {/* Opt-in setup */}\n <Modal\n open={setupOpen}\n onClose={() => setSetupOpen(false)}\n title=\"Your life in weeks\"\n description=\"This is private and entirely optional. Add only what feels comfortable.\"\n footer={\n <>\n <button\n type=\"button\"\n onClick={() => setSetupOpen(false)}\n className=\"rounded-md border border-border-subtle px-4 py-2 text-sm text-text-secondary hover:bg-bg-sunken hover:text-text-primary\"\n >\n Cancel\n </button>\n <button\n type=\"submit\"\n form=\"finite-life-setup\"\n disabled={saving}\n className=\"inline-flex items-center gap-1.5 rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90 disabled:opacity-50\"\n >\n {saving ? \"Saving…\" : \"Save\"}\n </button>\n </>\n }\n >\n <form\n id=\"finite-life-setup\"\n onSubmit={handleSave}\n className=\"space-y-5\"\n >\n <div>\n <label\n htmlFor=\"finite-life-birthdate\"\n className=\"flex items-center gap-1.5 text-sm font-medium text-text-primary\"\n >\n <CalendarDays className=\"h-4 w-4 text-text-secondary\" />\n Your birth date\n </label>\n <DateField\n id=\"finite-life-birthdate\"\n value={birthDateInput}\n max={TODAY_DATE_INPUT}\n onChange={setBirthDateInput}\n label=\"Your birth date\"\n />\n <p className=\"mt-1.5 text-xs text-text-secondary\">\n Used only to count the weeks you've lived. It stays with you.\n </p>\n </div>\n\n <div>\n <label\n htmlFor=\"finite-life-expectancy\"\n className=\"text-sm font-medium text-text-primary\"\n >\n Life expectancy{\" \"}\n <span className=\"font-normal text-text-secondary\">\n (optional)\n </span>\n </label>\n <input\n id=\"finite-life-expectancy\"\n type=\"number\"\n inputMode=\"numeric\"\n min={1}\n max={130}\n step={1}\n placeholder=\"e.g. 90\"\n value={expectancyInput}\n onChange={(e) => setExpectancyInput(e.target.value)}\n className=\"mt-2 w-full rounded-lg border border-border-subtle bg-bg-sunken px-3 py-2 text-sm text-text-primary\"\n />\n <p className=\"mt-1.5 text-xs text-text-secondary\">\n A gentle horizon for the weeks ahead — never a deadline. Leave it\n blank to simply see the weeks you've lived.\n </p>\n </div>\n\n <label className=\"flex items-start gap-2.5 rounded-lg border border-border-subtle bg-bg-surface/40 p-3\">\n <input\n type=\"checkbox\"\n checked={hideRemainingInput}\n onChange={(e) => setHideRemainingInput(e.target.checked)}\n className=\"mt-0.5 h-4 w-4 shrink-0 rounded border-border-subtle\"\n />\n <span className=\"text-sm text-text-primary\">\n Hide the weeks ahead\n <span className=\"mt-0.5 block text-xs text-text-secondary\">\n Show only the weeks you've lived — no horizon, no countdown.\n </span>\n </span>\n </label>\n\n {formError && (\n <p className=\"rounded-lg border border-status-error-border/50 bg-status-error-bg/10 px-3 py-2 text-sm text-status-error-text\">\n {formError}\n </p>\n )}\n </form>\n </Modal>\n\n <ToastContainer toasts={toasts} onDismiss={dismissToast} />\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAqCA,SAASC,EAAG,GAAmB;CAC7B,OAAO,KAAK,IAAI,GAAG,KAAK,MAAMC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