@burdenoff/microfe-timecampus 2026.1025.2 → 2026.1028.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.
- package/dist/generated/global-types.d.ts +363 -2
- package/dist/generated/global-types.d.ts.map +1 -1
- package/dist/generated/wspace-operations.d.ts +108 -0
- package/dist/generated/wspace-operations.d.ts.map +1 -1
- package/dist/generated/wspace-operations.js +479 -425
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.d.ts +3261 -122
- package/dist/generated/wspace-types.d.ts.map +1 -1
- package/dist/generated/wspace-types.js.map +1 -1
- package/dist/index.js +7 -7
- package/dist/timecampus/index.js +7 -7
- package/dist/timecampus/pages/focus/FocusProtectionPage.d.ts.map +1 -1
- package/dist/timecampus/pages/focus/FocusProtectionPage.js +283 -168
- package/dist/timecampus/pages/focus/FocusProtectionPage.js.map +1 -1
- package/dist/timecampus/pages/focus/focusHelpers.d.ts +28 -0
- package/dist/timecampus/pages/focus/focusHelpers.d.ts.map +1 -1
- package/dist/timecampus/pages/focus/focusHelpers.js +68 -1
- package/dist/timecampus/pages/focus/focusHelpers.js.map +1 -1
- package/dist/timecampus/pages/focus/useDesktopFocusStatus.d.ts +14 -0
- package/dist/timecampus/pages/focus/useDesktopFocusStatus.d.ts.map +1 -0
- package/dist/timecampus/pages/focus/useDesktopFocusStatus.js +26 -0
- package/dist/timecampus/pages/focus/useDesktopFocusStatus.js.map +1 -0
- package/dist/timecampus/pages/timeline/TimelinePage.d.ts.map +1 -1
- package/dist/timecampus/pages/timeline/TimelinePage.js +245 -120
- package/dist/timecampus/pages/timeline/TimelinePage.js.map +1 -1
- package/dist/timecampus/pages/timeline/timelineFocus.d.ts +33 -0
- package/dist/timecampus/pages/timeline/timelineFocus.d.ts.map +1 -0
- package/dist/timecampus/pages/timeline/timelineFocus.js +26 -0
- package/dist/timecampus/pages/timeline/timelineFocus.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,83 +1,116 @@
|
|
|
1
1
|
import { useTimeCampus as e } from "../../providers/TimeCampusProvider.js";
|
|
2
2
|
import { StatCard as t } from "../../components/StatCard.js";
|
|
3
3
|
import { LoadingSkeleton as ee } from "../../components/LoadingSkeleton.js";
|
|
4
|
-
import { useCancelFocusBlockMutation as te, useEndFocusSessionMutation as ne, useGetActiveFocusSessionQuery as re, useGetFocusBlockSuggestionsQuery as ie,
|
|
4
|
+
import { useCancelFocusBlockMutation as te, useEndFocusSessionMutation as ne, useGetActiveFocusSessionQuery as re, useGetFocusBlockSuggestionsQuery as ie, useGetFocusCalendarConnectionQuery as ae, useGetFocusPreferencesQuery as oe, useGetFocusProtectionSummaryQuery as se, useListFocusBlocksQuery as ce, useLogFocusInterruptionMutation as le, useRespondToFocusBlockSuggestionMutation as ue, useStartFocusSessionMutation as de, useUpdateFocusPreferencesMutation as fe } from "../../../generated/wspace-operations.js";
|
|
5
5
|
import { PageLayout as n } from "../../components/PageLayout.js";
|
|
6
6
|
import { StatusBadge as r } from "../../components/StatusBadge.js";
|
|
7
|
-
import { ToastContainer as
|
|
7
|
+
import { ToastContainer as pe, useToast as me } from "../../components/Toast.js";
|
|
8
8
|
import { TimeCampusFocusBlockResponse as i, TimeCampusFocusProtectionLevel as a, TimeCampusFocusSessionStatus as o } from "../../../generated/wspace-types.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
9
|
+
import { useDesktopFocusStatus as he } from "./useDesktopFocusStatus.js";
|
|
10
|
+
import { DAY_MS as s, announceFocusChange as ge, calendarHoldLabel as _e, calendarProviderLabel as ve, canStartBlock as ye, formatDuration as c, formatRange as be, localDayStart as xe, minutesLeft as Se, minutesToTime as l, parseAppList as Ce, parseSiteList as we, readStartBlockParam as Te, reasonLabel as Ee, startNudgeOptions as De, timeToMinutes as Oe, withoutStartBlockParam as ke } from "./focusHelpers.js";
|
|
11
|
+
import { useEffect as u, useMemo as d, useRef as f, useState as p } from "react";
|
|
12
|
+
import { AlarmClock as Ae, Ban as je, CalendarClock as Me, Check as Ne, Play as Pe, Shield as Fe, ShieldCheck as Ie, Square as Le, Target as Re, X as ze } from "lucide-react";
|
|
13
|
+
import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
14
|
+
import { GlassCard as Be } from "@burdenoff/fe-libs/ui";
|
|
14
15
|
//#region src/timecampus/pages/focus/FocusProtectionPage.tsx
|
|
15
|
-
var _ = "Focus Protection", v = "Adaptive focus blocks and distraction blocking during focus sessions",
|
|
16
|
+
var _ = "Focus Protection", v = "Adaptive focus blocks and distraction blocking during focus sessions", Ve = [
|
|
16
17
|
"GetActiveFocusSession",
|
|
17
18
|
"GetFocusBlockSuggestions",
|
|
18
19
|
"ListFocusBlocks",
|
|
19
20
|
"GetFocusProtectionSummary"
|
|
20
|
-
], y = "rounded-md border border-border-subtle bg-bg-surface px-3 py-1.5 text-sm text-text-primary", b = "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 hover:bg-action-primary-bg/90 disabled:opacity-50", x = "inline-flex items-center gap-1.5 rounded-md border border-border-subtle bg-bg-surface px-3 py-1.5 text-sm font-medium text-text-primary hover:bg-bg-surface-hover disabled:opacity-50"
|
|
21
|
-
|
|
21
|
+
], y = "rounded-md border border-border-subtle bg-bg-surface px-3 py-1.5 text-sm text-text-primary", b = "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 hover:bg-action-primary-bg/90 disabled:opacity-50", x = "inline-flex items-center gap-1.5 rounded-md border border-border-subtle bg-bg-surface px-3 py-1.5 text-sm font-medium text-text-primary hover:bg-bg-surface-hover disabled:opacity-50", S = {
|
|
22
|
+
on: "on",
|
|
23
|
+
off: "off",
|
|
24
|
+
running: "on",
|
|
25
|
+
stopped: "off",
|
|
26
|
+
unsupported: "not available on this system",
|
|
27
|
+
"needs-setup": "needs a one-time setup",
|
|
28
|
+
error: "not working"
|
|
29
|
+
};
|
|
30
|
+
function He(e) {
|
|
31
|
+
return S[e] ?? e;
|
|
32
|
+
}
|
|
33
|
+
function C(e) {
|
|
22
34
|
return e instanceof Error ? e.message : "Something went wrong";
|
|
23
35
|
}
|
|
24
|
-
function
|
|
25
|
-
let { workspaceId:
|
|
36
|
+
function Ue() {
|
|
37
|
+
let { workspaceId: S = "" } = e(), { toasts: Ue, addToast: w, dismissToast: We } = me(), [T, Ge] = p(0), [E, Ke] = p(() => Date.now());
|
|
26
38
|
u(() => {
|
|
27
|
-
let e = window.setInterval(() =>
|
|
39
|
+
let e = window.setInterval(() => Ke(Date.now()), 6e4);
|
|
28
40
|
return () => window.clearInterval(e);
|
|
29
41
|
}, []);
|
|
30
|
-
let D = d(() =>
|
|
42
|
+
let D = d(() => xe(/* @__PURE__ */ new Date(), T), [T]), qe = d(() => new Date(D.getTime() + s), [D]), Je = d(() => {
|
|
31
43
|
let e = /* @__PURE__ */ new Date();
|
|
32
44
|
return {
|
|
33
|
-
from: (/* @__PURE__ */ new Date(e.getTime() - 7 *
|
|
45
|
+
from: (/* @__PURE__ */ new Date(e.getTime() - 7 * s)).toISOString(),
|
|
34
46
|
to: e.toISOString()
|
|
35
47
|
};
|
|
36
|
-
}, []), O = re({ skip: !
|
|
48
|
+
}, []), O = re({ skip: !S }), k = ie({
|
|
37
49
|
variables: { dayStart: D.toISOString() },
|
|
38
|
-
skip: !
|
|
39
|
-
}),
|
|
50
|
+
skip: !S
|
|
51
|
+
}), Ye = ce({
|
|
40
52
|
variables: {
|
|
41
53
|
from: D.toISOString(),
|
|
42
|
-
to:
|
|
54
|
+
to: qe.toISOString()
|
|
43
55
|
},
|
|
44
|
-
skip: !
|
|
45
|
-
}), A = ae({ skip: !
|
|
46
|
-
variables:
|
|
47
|
-
skip: !
|
|
48
|
-
}), j = { refetchQueries:
|
|
56
|
+
skip: !S
|
|
57
|
+
}), A = oe({ skip: !S }), Xe = ae({ skip: !S }), Ze = se({
|
|
58
|
+
variables: Je,
|
|
59
|
+
skip: !S
|
|
60
|
+
}), j = { refetchQueries: Ve }, [M, { loading: N }] = de(j), [Qe, { loading: P }] = ne(j), [$e] = le(j), [et, { loading: F }] = ue(j), [tt] = te(j), [nt, { loading: I }] = fe({ refetchQueries: [
|
|
61
|
+
"GetFocusPreferences",
|
|
62
|
+
"GetFocusBlockSuggestions",
|
|
63
|
+
"GetFocusCalendarConnection"
|
|
64
|
+
] }), [L, rt] = p(50), [R, it] = p(!1), z = A.data?.timeCampusFocusPreferences, [B, V] = p("09:00"), [H, U] = p("18:00"), [W, G] = p(90), [at, ot] = p(2), [st, ct] = p(10), [lt, ut] = p(!0), [dt, ft] = p(""), [pt, mt] = p(""), [ht, gt] = p(!0), [_t, vt] = p(!0), [K, yt] = p(5), q = he();
|
|
49
65
|
u(() => {
|
|
50
|
-
|
|
51
|
-
}, [
|
|
52
|
-
let
|
|
66
|
+
z && (V(l(z.workdayStartMinute)), U(l(z.workdayEndMinute)), G(z.preferredBlockMinutes), ot(z.maxBlocksPerDay), ct(z.meetingBufferMinutes), ut(z.blockingEnabled), ft(z.blockedDomains.join("\n")), mt(z.blockedApps.join("\n")), gt(z.doNotDisturb), vt(z.calendarHoldEnabled), yt(z.startNudgeMinutes));
|
|
67
|
+
}, [z]);
|
|
68
|
+
let J = O.data?.timeCampusActiveFocusSession ?? null, bt = k.data?.timeCampusFocusBlockSuggestions ?? [], xt = Ye.data?.timeCampusFocusBlocks ?? [], Y = Ze.data?.timeCampusFocusSummary, X = Xe.data?.timeCampusFocusCalendarConnection, St = ve(X?.provider), Ct = !O.data && O.loading || !A.data && A.loading, wt = O.error ?? A.error;
|
|
53
69
|
async function Z(e, t) {
|
|
54
70
|
try {
|
|
55
|
-
await e(), w({
|
|
71
|
+
await e(), ge(), w({
|
|
56
72
|
title: t,
|
|
57
73
|
variant: "success"
|
|
58
74
|
});
|
|
59
75
|
} catch (e) {
|
|
60
76
|
w({
|
|
61
|
-
title:
|
|
77
|
+
title: C(e),
|
|
62
78
|
variant: "error"
|
|
63
79
|
});
|
|
64
80
|
}
|
|
65
81
|
}
|
|
66
|
-
let
|
|
67
|
-
plannedDurationSeconds: e ? void 0 :
|
|
68
|
-
protectionLevel:
|
|
82
|
+
let Tt = (e) => Z(() => M({ variables: {
|
|
83
|
+
plannedDurationSeconds: e ? void 0 : L * 60,
|
|
84
|
+
protectionLevel: R ? a.Strict : a.Standard,
|
|
69
85
|
focusBlockId: e
|
|
70
|
-
} }), "Focus session started"),
|
|
71
|
-
|
|
86
|
+
} }), "Focus session started"), Et = f(!1), Dt = f(() => void 0);
|
|
87
|
+
u(() => {
|
|
88
|
+
Dt.current = (e, t) => {
|
|
89
|
+
if (t) {
|
|
90
|
+
w({
|
|
91
|
+
title: "A focus session is already running",
|
|
92
|
+
variant: "info"
|
|
93
|
+
});
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
Z(() => M({ variables: { focusBlockId: e } }), "Focus block started");
|
|
97
|
+
};
|
|
98
|
+
}), u(() => {
|
|
99
|
+
if (Et.current || !S || !O.data) return;
|
|
100
|
+
let e = Te(window.location.search);
|
|
101
|
+
e && (Et.current = !0, window.history.replaceState(window.history.state, "", ke(window.location.href)), Dt.current(e, !!O.data.timeCampusActiveFocusSession));
|
|
102
|
+
}, [S, O.data]);
|
|
103
|
+
let Ot = (e) => J ? Z(() => Qe({ variables: {
|
|
104
|
+
id: J.id,
|
|
72
105
|
status: e
|
|
73
|
-
} }), e === o.Completed ? "Focus session completed" : "Focus session abandoned") : void 0, Q = (e, t) => Z(() =>
|
|
106
|
+
} }), e === o.Completed ? "Focus session completed" : "Focus session abandoned") : void 0, Q = (e, t) => Z(() => et({ variables: { input: {
|
|
74
107
|
startTime: e.startTime,
|
|
75
108
|
endTime: e.endTime,
|
|
76
109
|
response: t,
|
|
77
110
|
dayStart: D.toISOString(),
|
|
78
111
|
snoozeMinutes: t === i.Snooze ? 30 : null
|
|
79
|
-
} } }), t === i.Accept ? "Focus block scheduled" : t === i.Snooze ? "Snoozed for 30 minutes" : "Suggestion dismissed"),
|
|
80
|
-
let e =
|
|
112
|
+
} } }), t === i.Accept ? "Focus block scheduled" : t === i.Snooze ? "Snoozed for 30 minutes" : "Suggestion dismissed"), kt = () => {
|
|
113
|
+
let e = Oe(B), t = Oe(H);
|
|
81
114
|
if (e === null || t === null) {
|
|
82
115
|
w({
|
|
83
116
|
title: "Use HH:MM for the workday",
|
|
@@ -85,18 +118,22 @@ function C() {
|
|
|
85
118
|
});
|
|
86
119
|
return;
|
|
87
120
|
}
|
|
88
|
-
Z(() =>
|
|
121
|
+
Z(() => nt({ variables: { input: {
|
|
89
122
|
workdayStartMinute: e,
|
|
90
123
|
workdayEndMinute: t,
|
|
91
|
-
preferredBlockMinutes:
|
|
92
|
-
minBlockMinutes: Math.min(45,
|
|
93
|
-
maxBlocksPerDay:
|
|
94
|
-
meetingBufferMinutes:
|
|
95
|
-
blockingEnabled:
|
|
96
|
-
blockedDomains:
|
|
124
|
+
preferredBlockMinutes: W,
|
|
125
|
+
minBlockMinutes: Math.min(45, W),
|
|
126
|
+
maxBlocksPerDay: at,
|
|
127
|
+
meetingBufferMinutes: st,
|
|
128
|
+
blockingEnabled: lt,
|
|
129
|
+
blockedDomains: we(dt),
|
|
130
|
+
blockedApps: Ce(pt),
|
|
131
|
+
doNotDisturb: ht,
|
|
132
|
+
calendarHoldEnabled: _t,
|
|
133
|
+
startNudgeMinutes: K
|
|
97
134
|
} } }), "Focus settings saved");
|
|
98
135
|
};
|
|
99
|
-
if (
|
|
136
|
+
if (Ct) return /* @__PURE__ */ h(n, {
|
|
100
137
|
title: _,
|
|
101
138
|
description: v,
|
|
102
139
|
children: /* @__PURE__ */ h(ee, {
|
|
@@ -104,7 +141,7 @@ function C() {
|
|
|
104
141
|
count: 4
|
|
105
142
|
})
|
|
106
143
|
});
|
|
107
|
-
if (
|
|
144
|
+
if (wt && !O.data) return /* @__PURE__ */ h(n, {
|
|
108
145
|
title: _,
|
|
109
146
|
description: v,
|
|
110
147
|
children: /* @__PURE__ */ h("div", {
|
|
@@ -112,15 +149,15 @@ function C() {
|
|
|
112
149
|
children: "Failed to load focus protection. Please try again later."
|
|
113
150
|
})
|
|
114
151
|
});
|
|
115
|
-
let $ =
|
|
152
|
+
let $ = J ? Se(J.startTime, J.plannedDurationSeconds, E) : null, At = Y ? Math.round(Y.averageProtectionRatio * 100) : null;
|
|
116
153
|
return /* @__PURE__ */ g(n, {
|
|
117
154
|
title: _,
|
|
118
155
|
description: v,
|
|
119
|
-
purpose: "Protect the hours that matter: TimeCampus suggests focus blocks around your meetings and the times you focus best, and blocks distracting sites in your browser while a session runs.",
|
|
156
|
+
purpose: "Protect the hours that matter: TimeCampus suggests focus blocks around your meetings and the times you focus best, and blocks distracting sites in your browser, and in the desktop app turns on Do Not Disturb and hides distracting apps while a session runs.",
|
|
120
157
|
children: [
|
|
121
|
-
/* @__PURE__ */ h(
|
|
122
|
-
toasts:
|
|
123
|
-
onDismiss:
|
|
158
|
+
/* @__PURE__ */ h(pe, {
|
|
159
|
+
toasts: Ue,
|
|
160
|
+
onDismiss: We
|
|
124
161
|
}),
|
|
125
162
|
/* @__PURE__ */ g("div", {
|
|
126
163
|
className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",
|
|
@@ -128,26 +165,26 @@ function C() {
|
|
|
128
165
|
/* @__PURE__ */ h(t, {
|
|
129
166
|
featured: !0,
|
|
130
167
|
title: "Protected Time",
|
|
131
|
-
value:
|
|
132
|
-
icon: /* @__PURE__ */ h(
|
|
168
|
+
value: Y ? c(Y.totalProtectedSeconds) : "--",
|
|
169
|
+
icon: /* @__PURE__ */ h(Ie, { className: "h-5 w-5" }),
|
|
133
170
|
description: "Last 7 days"
|
|
134
171
|
}),
|
|
135
172
|
/* @__PURE__ */ h(t, {
|
|
136
173
|
title: "Protection Ratio",
|
|
137
|
-
value:
|
|
138
|
-
icon: /* @__PURE__ */ h(
|
|
174
|
+
value: At === null ? "--" : `${At}%`,
|
|
175
|
+
icon: /* @__PURE__ */ h(Fe, { className: "h-5 w-5" }),
|
|
139
176
|
description: "Protected vs interrupted"
|
|
140
177
|
}),
|
|
141
178
|
/* @__PURE__ */ h(t, {
|
|
142
179
|
title: "Sessions",
|
|
143
|
-
value:
|
|
144
|
-
icon: /* @__PURE__ */ h(
|
|
145
|
-
description:
|
|
180
|
+
value: Y ? String(Y.totalSessions) : "--",
|
|
181
|
+
icon: /* @__PURE__ */ h(Re, { className: "h-5 w-5" }),
|
|
182
|
+
description: Y ? `${Y.completedSessions} completed` : "Last 7 days"
|
|
146
183
|
}),
|
|
147
184
|
/* @__PURE__ */ h(t, {
|
|
148
185
|
title: "Interruptions",
|
|
149
|
-
value:
|
|
150
|
-
icon: /* @__PURE__ */ h(
|
|
186
|
+
value: Y ? String(Y.totalInterruptionCount) : "--",
|
|
187
|
+
icon: /* @__PURE__ */ h(je, { className: "h-5 w-5" }),
|
|
151
188
|
description: "Logged, detected or bypassed"
|
|
152
189
|
})
|
|
153
190
|
]
|
|
@@ -155,7 +192,7 @@ function C() {
|
|
|
155
192
|
/* @__PURE__ */ h("div", {
|
|
156
193
|
className: "mt-6",
|
|
157
194
|
"data-testid": "focus-session-card",
|
|
158
|
-
children: /* @__PURE__ */ g(
|
|
195
|
+
children: /* @__PURE__ */ g(Be, {
|
|
159
196
|
treatment: "glass",
|
|
160
197
|
glow: !0,
|
|
161
198
|
className: "p-6",
|
|
@@ -163,62 +200,62 @@ function C() {
|
|
|
163
200
|
className: "flex flex-wrap items-start justify-between gap-4",
|
|
164
201
|
children: [/* @__PURE__ */ g("div", { children: [/* @__PURE__ */ g("h3", {
|
|
165
202
|
className: "flex items-center gap-2 text-sm font-semibold text-text-primary",
|
|
166
|
-
children: [/* @__PURE__ */ h(
|
|
167
|
-
}),
|
|
203
|
+
children: [/* @__PURE__ */ h(Fe, { className: "h-4 w-4" }), "Focus session"]
|
|
204
|
+
}), J ? /* @__PURE__ */ g("p", {
|
|
168
205
|
className: "mt-1 text-sm text-text-secondary",
|
|
169
206
|
"data-testid": "focus-session-status",
|
|
170
207
|
children: [
|
|
171
208
|
$ === null ? "Open-ended session in progress." : $ === 0 ? "Planned time is up — finish when you're ready." : `${$} minute${$ === 1 ? "" : "s"} left.`,
|
|
172
209
|
" ",
|
|
173
|
-
|
|
210
|
+
J.interruptionCount,
|
|
174
211
|
" interruption",
|
|
175
|
-
|
|
212
|
+
J.interruptionCount === 1 ? "" : "s",
|
|
176
213
|
",",
|
|
177
214
|
" ",
|
|
178
|
-
|
|
179
|
-
"
|
|
180
|
-
|
|
215
|
+
J.blockedAttemptCount,
|
|
216
|
+
" distraction",
|
|
217
|
+
J.blockedAttemptCount === 1 ? "" : "s",
|
|
181
218
|
" blocked."
|
|
182
219
|
]
|
|
183
220
|
}) : /* @__PURE__ */ h("p", {
|
|
184
221
|
className: "mt-1 text-sm text-text-secondary",
|
|
185
|
-
children: "No session running. While one is active, the TimeCampus browser extension blocks the sites listed below."
|
|
186
|
-
})] }),
|
|
187
|
-
variant:
|
|
188
|
-
label:
|
|
222
|
+
children: "No session running. While one is active, the TimeCampus browser extension blocks the sites listed below and the TimeCampus desktop app hides or flags the apps listed below."
|
|
223
|
+
})] }), J && /* @__PURE__ */ h(r, {
|
|
224
|
+
variant: J.protectionLevel === a.Strict ? "warning" : "success",
|
|
225
|
+
label: J.protectionLevel === a.Strict ? "Strict" : "Standard"
|
|
189
226
|
})]
|
|
190
227
|
}), /* @__PURE__ */ h("div", {
|
|
191
228
|
className: "mt-4 flex flex-wrap items-center gap-3",
|
|
192
|
-
children:
|
|
229
|
+
children: J ? /* @__PURE__ */ g(m, { children: [
|
|
193
230
|
/* @__PURE__ */ g("button", {
|
|
194
231
|
type: "button",
|
|
195
232
|
className: b,
|
|
196
|
-
disabled:
|
|
197
|
-
onClick: () =>
|
|
233
|
+
disabled: P,
|
|
234
|
+
onClick: () => Ot(o.Completed),
|
|
198
235
|
"data-testid": "focus-end",
|
|
199
|
-
children: [/* @__PURE__ */ h(
|
|
236
|
+
children: [/* @__PURE__ */ h(Le, { className: "h-4 w-4" }), " End session"]
|
|
200
237
|
}),
|
|
201
238
|
/* @__PURE__ */ h("button", {
|
|
202
239
|
type: "button",
|
|
203
240
|
className: x,
|
|
204
|
-
disabled:
|
|
205
|
-
onClick: () =>
|
|
241
|
+
disabled: P,
|
|
242
|
+
onClick: () => Ot(o.Abandoned),
|
|
206
243
|
children: "Abandon"
|
|
207
244
|
}),
|
|
208
245
|
/* @__PURE__ */ h("button", {
|
|
209
246
|
type: "button",
|
|
210
247
|
className: x,
|
|
211
|
-
onClick: () => Z(() =>
|
|
248
|
+
onClick: () => Z(() => $e({ variables: { focusSessionId: J.id } }), "Interruption logged"),
|
|
212
249
|
"data-testid": "focus-log-interruption",
|
|
213
250
|
children: "Log an interruption"
|
|
214
251
|
})
|
|
215
|
-
] }) : /* @__PURE__ */ g(
|
|
252
|
+
] }) : /* @__PURE__ */ g(m, { children: [
|
|
216
253
|
/* @__PURE__ */ g("label", {
|
|
217
254
|
className: "flex items-center gap-2 text-sm text-text-secondary",
|
|
218
255
|
children: ["Length", /* @__PURE__ */ g("select", {
|
|
219
256
|
className: y,
|
|
220
|
-
value:
|
|
221
|
-
onChange: (e) =>
|
|
257
|
+
value: L,
|
|
258
|
+
onChange: (e) => rt(Number(e.target.value)),
|
|
222
259
|
"data-testid": "focus-length",
|
|
223
260
|
children: [
|
|
224
261
|
/* @__PURE__ */ h("option", {
|
|
@@ -244,18 +281,18 @@ function C() {
|
|
|
244
281
|
className: "flex items-center gap-2 text-sm text-text-secondary",
|
|
245
282
|
children: [/* @__PURE__ */ h("input", {
|
|
246
283
|
type: "checkbox",
|
|
247
|
-
checked:
|
|
248
|
-
onChange: (e) =>
|
|
284
|
+
checked: R,
|
|
285
|
+
onChange: (e) => it(e.target.checked),
|
|
249
286
|
className: "h-4 w-4 rounded border-border-subtle"
|
|
250
287
|
}), "Strict (no “continue anyway”)"]
|
|
251
288
|
}),
|
|
252
289
|
/* @__PURE__ */ g("button", {
|
|
253
290
|
type: "button",
|
|
254
291
|
className: b,
|
|
255
|
-
disabled:
|
|
256
|
-
onClick: () =>
|
|
292
|
+
disabled: N,
|
|
293
|
+
onClick: () => Tt(),
|
|
257
294
|
"data-testid": "focus-start",
|
|
258
|
-
children: [/* @__PURE__ */ h(
|
|
295
|
+
children: [/* @__PURE__ */ h(Pe, { className: "h-4 w-4" }), " Start focus session"]
|
|
259
296
|
})
|
|
260
297
|
] })
|
|
261
298
|
})]
|
|
@@ -271,7 +308,7 @@ function C() {
|
|
|
271
308
|
className: "flex flex-wrap items-center justify-between gap-2",
|
|
272
309
|
children: [/* @__PURE__ */ g("h3", {
|
|
273
310
|
className: "flex items-center gap-2 text-sm font-semibold text-text-primary",
|
|
274
|
-
children: [/* @__PURE__ */ h(
|
|
311
|
+
children: [/* @__PURE__ */ h(Me, { className: "h-4 w-4" }), "Suggested focus blocks"]
|
|
275
312
|
}), /* @__PURE__ */ h("div", {
|
|
276
313
|
className: "flex gap-1",
|
|
277
314
|
role: "group",
|
|
@@ -280,7 +317,7 @@ function C() {
|
|
|
280
317
|
type: "button",
|
|
281
318
|
"aria-pressed": T === t,
|
|
282
319
|
className: T === t ? b : x,
|
|
283
|
-
onClick: () =>
|
|
320
|
+
onClick: () => Ge(t),
|
|
284
321
|
children: e
|
|
285
322
|
}, e))
|
|
286
323
|
})]
|
|
@@ -294,9 +331,9 @@ function C() {
|
|
|
294
331
|
children: [
|
|
295
332
|
k.error && /* @__PURE__ */ h("p", {
|
|
296
333
|
className: "text-sm text-status-error-text",
|
|
297
|
-
children:
|
|
334
|
+
children: C(k.error)
|
|
298
335
|
}),
|
|
299
|
-
!k.error && k.data &&
|
|
336
|
+
!k.error && k.data && bt.length === 0 && /* @__PURE__ */ g("p", {
|
|
300
337
|
className: "text-sm text-text-secondary",
|
|
301
338
|
"data-testid": "focus-suggestions-empty",
|
|
302
339
|
children: [
|
|
@@ -306,7 +343,7 @@ function C() {
|
|
|
306
343
|
" — your day is full or you have scheduled your maximum blocks."
|
|
307
344
|
]
|
|
308
345
|
}),
|
|
309
|
-
|
|
346
|
+
bt.map((e) => /* @__PURE__ */ g("div", {
|
|
310
347
|
className: "rounded-lg border border-border-subtle p-3",
|
|
311
348
|
"data-testid": "focus-suggestion",
|
|
312
349
|
children: [
|
|
@@ -314,9 +351,9 @@ function C() {
|
|
|
314
351
|
className: "flex flex-wrap items-center justify-between gap-2",
|
|
315
352
|
children: [/* @__PURE__ */ g("span", {
|
|
316
353
|
className: "text-sm font-medium text-text-primary",
|
|
317
|
-
children: [
|
|
354
|
+
children: [be(e.startTime, e.endTime), /* @__PURE__ */ h("span", {
|
|
318
355
|
className: "ml-2 text-xs text-text-secondary",
|
|
319
|
-
children:
|
|
356
|
+
children: c(e.durationMinutes * 60)
|
|
320
357
|
})]
|
|
321
358
|
}), /* @__PURE__ */ g("span", {
|
|
322
359
|
className: "text-xs text-text-secondary",
|
|
@@ -331,7 +368,7 @@ function C() {
|
|
|
331
368
|
className: "mt-2 flex flex-wrap gap-1.5",
|
|
332
369
|
children: e.reasons.map((e) => /* @__PURE__ */ h(r, {
|
|
333
370
|
variant: "info",
|
|
334
|
-
label:
|
|
371
|
+
label: Ee(e)
|
|
335
372
|
}, e))
|
|
336
373
|
}),
|
|
337
374
|
/* @__PURE__ */ g("div", {
|
|
@@ -340,26 +377,26 @@ function C() {
|
|
|
340
377
|
/* @__PURE__ */ g("button", {
|
|
341
378
|
type: "button",
|
|
342
379
|
className: b,
|
|
343
|
-
disabled:
|
|
380
|
+
disabled: F,
|
|
344
381
|
onClick: () => Q(e, i.Accept),
|
|
345
382
|
"data-testid": "focus-suggestion-accept",
|
|
346
|
-
children: [/* @__PURE__ */ h(
|
|
383
|
+
children: [/* @__PURE__ */ h(Ne, { className: "h-4 w-4" }), " Accept"]
|
|
347
384
|
}),
|
|
348
385
|
/* @__PURE__ */ g("button", {
|
|
349
386
|
type: "button",
|
|
350
387
|
className: x,
|
|
351
|
-
disabled:
|
|
388
|
+
disabled: F,
|
|
352
389
|
onClick: () => Q(e, i.Snooze),
|
|
353
390
|
"data-testid": "focus-suggestion-snooze",
|
|
354
|
-
children: [/* @__PURE__ */ h(
|
|
391
|
+
children: [/* @__PURE__ */ h(Ae, { className: "h-4 w-4" }), " Snooze 30 min"]
|
|
355
392
|
}),
|
|
356
393
|
/* @__PURE__ */ g("button", {
|
|
357
394
|
type: "button",
|
|
358
395
|
className: x,
|
|
359
|
-
disabled:
|
|
396
|
+
disabled: F,
|
|
360
397
|
onClick: () => Q(e, i.Dismiss),
|
|
361
398
|
"data-testid": "focus-suggestion-dismiss",
|
|
362
|
-
children: [/* @__PURE__ */ h(
|
|
399
|
+
children: [/* @__PURE__ */ h(ze, { className: "h-4 w-4" }), " Dismiss"]
|
|
363
400
|
})
|
|
364
401
|
]
|
|
365
402
|
})
|
|
@@ -371,54 +408,69 @@ function C() {
|
|
|
371
408
|
}), /* @__PURE__ */ g("div", {
|
|
372
409
|
className: "rounded-xl border border-border-seam bg-bg-surface p-6 shadow-elevation-1",
|
|
373
410
|
"data-testid": "focus-scheduled",
|
|
374
|
-
children: [
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
className: "text-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
"
|
|
398
|
-
" ",
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
411
|
+
children: [
|
|
412
|
+
/* @__PURE__ */ g("h3", {
|
|
413
|
+
className: "flex items-center gap-2 text-sm font-semibold text-text-primary",
|
|
414
|
+
children: [
|
|
415
|
+
/* @__PURE__ */ h(Re, { className: "h-4 w-4" }),
|
|
416
|
+
"Scheduled (",
|
|
417
|
+
T === 0 ? "today" : "tomorrow",
|
|
418
|
+
")"
|
|
419
|
+
]
|
|
420
|
+
}),
|
|
421
|
+
X && /* @__PURE__ */ h("p", {
|
|
422
|
+
className: "mt-1 text-xs text-text-secondary",
|
|
423
|
+
"data-testid": "focus-calendar-connection",
|
|
424
|
+
children: X.holdsEnabled ? X.connected ? `Accepted blocks are held as busy "Focus" time on ${X.calendarName ?? "your calendar"}${St ? ` and sync to ${St}` : ""}.` : X.reachable ? "No personal calendar yet. Create one in Calendar to hold accepted blocks there and plan around its events." : "Your calendar could not be reached just now; blocks are still scheduled here." : "Calendar holds are off — accepted blocks stay in TimeCampus only."
|
|
425
|
+
}),
|
|
426
|
+
/* @__PURE__ */ g("div", {
|
|
427
|
+
className: "mt-4 space-y-3",
|
|
428
|
+
children: [Ye.data && xt.length === 0 && /* @__PURE__ */ h("p", {
|
|
429
|
+
className: "text-sm text-text-secondary",
|
|
430
|
+
children: "Accept a suggestion to put a focus block on your schedule."
|
|
431
|
+
}), xt.map((e) => {
|
|
432
|
+
let t = _e(e.calendarHoldStatus, e.calendarId && e.calendarId === X?.calendarId ? X?.calendarName : null);
|
|
433
|
+
return /* @__PURE__ */ g("div", {
|
|
434
|
+
className: "flex flex-wrap items-center justify-between gap-2 rounded-lg border border-border-subtle p-3",
|
|
435
|
+
"data-testid": "focus-scheduled-block",
|
|
436
|
+
children: [/* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("p", {
|
|
437
|
+
className: "text-sm font-medium text-text-primary",
|
|
438
|
+
children: be(e.startTime, e.endTime)
|
|
439
|
+
}), /* @__PURE__ */ g("p", {
|
|
440
|
+
className: "text-xs text-text-secondary",
|
|
441
|
+
children: [
|
|
442
|
+
e.source === "ADAPTIVE" ? "Suggested" : "Manual",
|
|
443
|
+
" ·",
|
|
444
|
+
" ",
|
|
445
|
+
c(e.durationMinutes * 60),
|
|
446
|
+
t && /* @__PURE__ */ g("span", {
|
|
447
|
+
"data-testid": "focus-block-calendar-hold",
|
|
448
|
+
children: [" · ", t]
|
|
449
|
+
})
|
|
450
|
+
]
|
|
451
|
+
})] }), e.status === "STARTED" ? /* @__PURE__ */ h(r, {
|
|
452
|
+
variant: "success",
|
|
453
|
+
label: "Started"
|
|
454
|
+
}) : /* @__PURE__ */ g("div", {
|
|
455
|
+
className: "flex gap-2",
|
|
456
|
+
children: [!J && ye(e.endTime, E) && /* @__PURE__ */ g("button", {
|
|
457
|
+
type: "button",
|
|
458
|
+
className: b,
|
|
459
|
+
disabled: N,
|
|
460
|
+
onClick: () => Tt(e.id),
|
|
461
|
+
children: [/* @__PURE__ */ h(Pe, { className: "h-4 w-4" }), " Start"]
|
|
462
|
+
}), /* @__PURE__ */ h("button", {
|
|
463
|
+
type: "button",
|
|
464
|
+
className: x,
|
|
465
|
+
onClick: () => Z(() => tt({ variables: { id: e.id } }), "Focus block canceled"),
|
|
466
|
+
"data-testid": "focus-block-cancel",
|
|
467
|
+
children: "Cancel"
|
|
468
|
+
})]
|
|
469
|
+
})]
|
|
470
|
+
}, e.id);
|
|
419
471
|
})]
|
|
420
|
-
}
|
|
421
|
-
|
|
472
|
+
})
|
|
473
|
+
]
|
|
422
474
|
})]
|
|
423
475
|
}),
|
|
424
476
|
/* @__PURE__ */ g("div", {
|
|
@@ -427,7 +479,7 @@ function C() {
|
|
|
427
479
|
children: [
|
|
428
480
|
/* @__PURE__ */ g("h3", {
|
|
429
481
|
className: "flex items-center gap-2 text-sm font-semibold text-text-primary",
|
|
430
|
-
children: [/* @__PURE__ */ h(
|
|
482
|
+
children: [/* @__PURE__ */ h(je, { className: "h-4 w-4" }), "Distraction blocking and planning"]
|
|
431
483
|
}),
|
|
432
484
|
/* @__PURE__ */ g("div", {
|
|
433
485
|
className: "mt-4 grid grid-cols-1 gap-6 lg:grid-cols-2",
|
|
@@ -436,10 +488,10 @@ function C() {
|
|
|
436
488
|
children: [
|
|
437
489
|
/* @__PURE__ */ g("label", {
|
|
438
490
|
className: "flex items-center justify-between gap-4 text-sm text-text-primary",
|
|
439
|
-
children: ["Block sites during focus sessions", /* @__PURE__ */ h("input", {
|
|
491
|
+
children: ["Block sites and apps during focus sessions", /* @__PURE__ */ h("input", {
|
|
440
492
|
type: "checkbox",
|
|
441
|
-
checked:
|
|
442
|
-
onChange: (e) =>
|
|
493
|
+
checked: lt,
|
|
494
|
+
onChange: (e) => ut(e.target.checked),
|
|
443
495
|
className: "h-4 w-4 rounded border-border-subtle",
|
|
444
496
|
"data-testid": "focus-blocking-enabled"
|
|
445
497
|
})]
|
|
@@ -448,8 +500,8 @@ function C() {
|
|
|
448
500
|
className: "block text-sm text-text-primary",
|
|
449
501
|
children: ["Blocked sites", /* @__PURE__ */ h("textarea", {
|
|
450
502
|
rows: 6,
|
|
451
|
-
value:
|
|
452
|
-
onChange: (e) =>
|
|
503
|
+
value: dt,
|
|
504
|
+
onChange: (e) => ft(e.target.value),
|
|
453
505
|
className: `${y} mt-1 w-full font-mono`,
|
|
454
506
|
"aria-describedby": "focus-sites-help",
|
|
455
507
|
"data-testid": "focus-blocked-sites"
|
|
@@ -459,6 +511,46 @@ function C() {
|
|
|
459
511
|
id: "focus-sites-help",
|
|
460
512
|
className: "text-xs text-text-secondary",
|
|
461
513
|
children: "One site per line (subdomains are included). Blocking is enforced by the TimeCampus browser extension while a session is active; allow-listed apps on a session are never blocked."
|
|
514
|
+
}),
|
|
515
|
+
/* @__PURE__ */ g("label", {
|
|
516
|
+
className: "block text-sm text-text-primary",
|
|
517
|
+
children: ["Blocked desktop apps", /* @__PURE__ */ h("textarea", {
|
|
518
|
+
rows: 5,
|
|
519
|
+
value: pt,
|
|
520
|
+
onChange: (e) => mt(e.target.value),
|
|
521
|
+
className: `${y} mt-1 w-full font-mono`,
|
|
522
|
+
"aria-describedby": "focus-apps-help",
|
|
523
|
+
"data-testid": "focus-blocked-apps"
|
|
524
|
+
})]
|
|
525
|
+
}),
|
|
526
|
+
/* @__PURE__ */ h("p", {
|
|
527
|
+
id: "focus-apps-help",
|
|
528
|
+
className: "text-xs text-text-secondary",
|
|
529
|
+
children: "One app per line, as your computer names it (for example Discord or Steam). In the TimeCampus desktop app, strict sessions hide these apps and standard sessions warn you and count the time as an interruption."
|
|
530
|
+
}),
|
|
531
|
+
/* @__PURE__ */ g("label", {
|
|
532
|
+
className: "flex items-center justify-between gap-4 text-sm text-text-primary",
|
|
533
|
+
children: ["Turn on Do Not Disturb during focus sessions", /* @__PURE__ */ h("input", {
|
|
534
|
+
type: "checkbox",
|
|
535
|
+
checked: ht,
|
|
536
|
+
onChange: (e) => gt(e.target.checked),
|
|
537
|
+
className: "h-4 w-4 rounded border-border-subtle",
|
|
538
|
+
"data-testid": "focus-do-not-disturb"
|
|
539
|
+
})]
|
|
540
|
+
}),
|
|
541
|
+
q && /* @__PURE__ */ g("p", {
|
|
542
|
+
className: "text-xs text-text-secondary",
|
|
543
|
+
"data-testid": "focus-desktop-status",
|
|
544
|
+
children: [
|
|
545
|
+
"This computer: Do Not Disturb",
|
|
546
|
+
" ",
|
|
547
|
+
He(q.doNotDisturb),
|
|
548
|
+
", app blocking",
|
|
549
|
+
" ",
|
|
550
|
+
He(q.appWatcher),
|
|
551
|
+
".",
|
|
552
|
+
q.detail ? ` ${q.detail}` : ""
|
|
553
|
+
]
|
|
462
554
|
})
|
|
463
555
|
]
|
|
464
556
|
}), /* @__PURE__ */ g("div", {
|
|
@@ -474,8 +566,8 @@ function C() {
|
|
|
474
566
|
children: [
|
|
475
567
|
/* @__PURE__ */ h("input", {
|
|
476
568
|
type: "time",
|
|
477
|
-
value:
|
|
478
|
-
onChange: (e) =>
|
|
569
|
+
value: B,
|
|
570
|
+
onChange: (e) => V(e.target.value),
|
|
479
571
|
className: y,
|
|
480
572
|
"aria-label": "Workday start"
|
|
481
573
|
}),
|
|
@@ -485,8 +577,8 @@ function C() {
|
|
|
485
577
|
}),
|
|
486
578
|
/* @__PURE__ */ h("input", {
|
|
487
579
|
type: "time",
|
|
488
|
-
value:
|
|
489
|
-
onChange: (e) =>
|
|
580
|
+
value: H === "24:00" ? "23:59" : H,
|
|
581
|
+
onChange: (e) => U(e.target.value),
|
|
490
582
|
className: y,
|
|
491
583
|
"aria-label": "Workday end"
|
|
492
584
|
})
|
|
@@ -500,8 +592,8 @@ function C() {
|
|
|
500
592
|
min: 15,
|
|
501
593
|
max: 240,
|
|
502
594
|
step: 15,
|
|
503
|
-
value:
|
|
504
|
-
onChange: (e) =>
|
|
595
|
+
value: W,
|
|
596
|
+
onChange: (e) => G(Number(e.target.value)),
|
|
505
597
|
className: `${y} w-24 text-right`
|
|
506
598
|
})]
|
|
507
599
|
}),
|
|
@@ -511,11 +603,34 @@ function C() {
|
|
|
511
603
|
type: "number",
|
|
512
604
|
min: 1,
|
|
513
605
|
max: 6,
|
|
514
|
-
value:
|
|
515
|
-
onChange: (e) =>
|
|
606
|
+
value: at,
|
|
607
|
+
onChange: (e) => ot(Number(e.target.value)),
|
|
516
608
|
className: `${y} w-24 text-right`
|
|
517
609
|
})]
|
|
518
610
|
}),
|
|
611
|
+
/* @__PURE__ */ g("label", {
|
|
612
|
+
className: "flex items-center justify-between gap-4 text-sm text-text-primary",
|
|
613
|
+
children: ["Hold accepted blocks on my calendar", /* @__PURE__ */ h("input", {
|
|
614
|
+
type: "checkbox",
|
|
615
|
+
checked: _t,
|
|
616
|
+
onChange: (e) => vt(e.target.checked),
|
|
617
|
+
className: "h-4 w-4 rounded border-border-subtle",
|
|
618
|
+
"data-testid": "focus-calendar-hold"
|
|
619
|
+
})]
|
|
620
|
+
}),
|
|
621
|
+
/* @__PURE__ */ g("label", {
|
|
622
|
+
className: "flex items-center justify-between gap-4 text-sm text-text-primary",
|
|
623
|
+
children: ["Remind me before a block starts", /* @__PURE__ */ h("select", {
|
|
624
|
+
value: K,
|
|
625
|
+
onChange: (e) => yt(Number(e.target.value)),
|
|
626
|
+
className: y,
|
|
627
|
+
"data-testid": "focus-start-nudge",
|
|
628
|
+
children: De(K).map((e) => /* @__PURE__ */ h("option", {
|
|
629
|
+
value: e.value,
|
|
630
|
+
children: e.label
|
|
631
|
+
}, e.value))
|
|
632
|
+
})]
|
|
633
|
+
}),
|
|
519
634
|
/* @__PURE__ */ g("label", {
|
|
520
635
|
className: "flex items-center justify-between gap-4 text-sm text-text-primary",
|
|
521
636
|
children: ["Buffer around meetings (minutes)", /* @__PURE__ */ h("input", {
|
|
@@ -523,8 +638,8 @@ function C() {
|
|
|
523
638
|
min: 0,
|
|
524
639
|
max: 60,
|
|
525
640
|
step: 5,
|
|
526
|
-
value:
|
|
527
|
-
onChange: (e) =>
|
|
641
|
+
value: st,
|
|
642
|
+
onChange: (e) => ct(Number(e.target.value)),
|
|
528
643
|
className: `${y} w-24 text-right`
|
|
529
644
|
})]
|
|
530
645
|
})
|
|
@@ -536,10 +651,10 @@ function C() {
|
|
|
536
651
|
children: /* @__PURE__ */ h("button", {
|
|
537
652
|
type: "button",
|
|
538
653
|
className: b,
|
|
539
|
-
disabled:
|
|
540
|
-
onClick:
|
|
654
|
+
disabled: I,
|
|
655
|
+
onClick: kt,
|
|
541
656
|
"data-testid": "focus-save-settings",
|
|
542
|
-
children:
|
|
657
|
+
children: I ? "Saving..." : "Save focus settings"
|
|
543
658
|
})
|
|
544
659
|
})
|
|
545
660
|
]
|
|
@@ -548,6 +663,6 @@ function C() {
|
|
|
548
663
|
});
|
|
549
664
|
}
|
|
550
665
|
//#endregion
|
|
551
|
-
export {
|
|
666
|
+
export { Ue as FocusProtectionPage };
|
|
552
667
|
|
|
553
668
|
//# sourceMappingURL=FocusProtectionPage.js.map
|