@activecollab/components 2.0.576 → 2.0.578

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 (156) hide show
  1. package/dist/cjs/presentation/myWork/MyWorkTasks.js +83 -30
  2. package/dist/cjs/presentation/myWork/MyWorkTasks.js.map +1 -1
  3. package/dist/cjs/presentation/myWork/agendaGrid.js +1095 -0
  4. package/dist/cjs/presentation/myWork/agendaGrid.js.map +1 -0
  5. package/dist/cjs/presentation/reports/allReports.js +6 -0
  6. package/dist/cjs/presentation/reports/allReports.js.map +1 -1
  7. package/dist/cjs/presentation/reports/controls.js +6 -3
  8. package/dist/cjs/presentation/reports/controls.js.map +1 -1
  9. package/dist/cjs/presentation/reports/expenses.js +946 -0
  10. package/dist/cjs/presentation/reports/expenses.js.map +1 -0
  11. package/dist/cjs/presentation/shared/settings.js +6 -2
  12. package/dist/cjs/presentation/shared/settings.js.map +1 -1
  13. package/dist/cjs/presentation/shared/tokens.js +8 -1
  14. package/dist/cjs/presentation/shared/tokens.js.map +1 -1
  15. package/dist/cjs/presentation/timeboxes/AdjustmentList.js +31 -0
  16. package/dist/cjs/presentation/timeboxes/AdjustmentList.js.map +1 -0
  17. package/dist/cjs/presentation/timeboxes/AgendaDayView.js +1722 -0
  18. package/dist/cjs/presentation/timeboxes/AgendaDayView.js.map +1 -0
  19. package/dist/cjs/presentation/timeboxes/CapacityBar.js +54 -0
  20. package/dist/cjs/presentation/timeboxes/CapacityBar.js.map +1 -0
  21. package/dist/cjs/presentation/timeboxes/SimulationCard.js +47 -0
  22. package/dist/cjs/presentation/timeboxes/SimulationCard.js.map +1 -0
  23. package/dist/cjs/presentation/timeboxes/SimulationPanel.js +319 -0
  24. package/dist/cjs/presentation/timeboxes/SimulationPanel.js.map +1 -0
  25. package/dist/cjs/presentation/timeboxes/TimeRecordsSection.js +206 -0
  26. package/dist/cjs/presentation/timeboxes/TimeRecordsSection.js.map +1 -0
  27. package/dist/cjs/presentation/timeboxes/WorkloadView.js +887 -0
  28. package/dist/cjs/presentation/timeboxes/WorkloadView.js.map +1 -0
  29. package/dist/cjs/presentation/timeboxes/__tests__/timeboxes.test.js +699 -0
  30. package/dist/cjs/presentation/timeboxes/__tests__/timeboxes.test.js.map +1 -0
  31. package/dist/cjs/presentation/timeboxes/changes.js +293 -0
  32. package/dist/cjs/presentation/timeboxes/changes.js.map +1 -0
  33. package/dist/cjs/presentation/timeboxes/mockData.js +320 -0
  34. package/dist/cjs/presentation/timeboxes/mockData.js.map +1 -0
  35. package/dist/cjs/presentation/timeboxes/model.js +186 -0
  36. package/dist/cjs/presentation/timeboxes/model.js.map +1 -0
  37. package/dist/cjs/presentation/timeboxes/pillLook.js +72 -0
  38. package/dist/cjs/presentation/timeboxes/pillLook.js.map +1 -0
  39. package/dist/cjs/presentation/timeboxes/plan.js +181 -0
  40. package/dist/cjs/presentation/timeboxes/plan.js.map +1 -0
  41. package/dist/cjs/presentation/timeboxes/reducer.js +763 -0
  42. package/dist/cjs/presentation/timeboxes/reducer.js.map +1 -0
  43. package/dist/cjs/presentation/timeboxes/scheduler.js +147 -0
  44. package/dist/cjs/presentation/timeboxes/scheduler.js.map +1 -0
  45. package/dist/cjs/presentation/timeboxes/store.js +65 -0
  46. package/dist/cjs/presentation/timeboxes/store.js.map +1 -0
  47. package/dist/cjs/presentation/timeboxes/timeBlocks.js +1931 -0
  48. package/dist/cjs/presentation/timeboxes/timeBlocks.js.map +1 -0
  49. package/dist/cjs/presentation/timeboxes/timeboxSettings.js +369 -0
  50. package/dist/cjs/presentation/timeboxes/timeboxSettings.js.map +1 -0
  51. package/dist/cjs/presentation/timeboxes/tracked.js +189 -0
  52. package/dist/cjs/presentation/timeboxes/tracked.js.map +1 -0
  53. package/dist/esm/presentation/myWork/MyWorkTasks.d.ts +81 -1
  54. package/dist/esm/presentation/myWork/MyWorkTasks.d.ts.map +1 -1
  55. package/dist/esm/presentation/myWork/MyWorkTasks.js +76 -23
  56. package/dist/esm/presentation/myWork/MyWorkTasks.js.map +1 -1
  57. package/dist/esm/presentation/myWork/agendaGrid.d.ts +341 -0
  58. package/dist/esm/presentation/myWork/agendaGrid.d.ts.map +1 -0
  59. package/dist/esm/presentation/myWork/agendaGrid.js +1001 -0
  60. package/dist/esm/presentation/myWork/agendaGrid.js.map +1 -0
  61. package/dist/esm/presentation/reports/allReports.d.ts.map +1 -1
  62. package/dist/esm/presentation/reports/allReports.js +6 -0
  63. package/dist/esm/presentation/reports/allReports.js.map +1 -1
  64. package/dist/esm/presentation/reports/controls.d.ts +3 -1
  65. package/dist/esm/presentation/reports/controls.d.ts.map +1 -1
  66. package/dist/esm/presentation/reports/controls.js +6 -3
  67. package/dist/esm/presentation/reports/controls.js.map +1 -1
  68. package/dist/esm/presentation/reports/expenses.d.ts +62 -0
  69. package/dist/esm/presentation/reports/expenses.d.ts.map +1 -0
  70. package/dist/esm/presentation/reports/expenses.js +849 -0
  71. package/dist/esm/presentation/reports/expenses.js.map +1 -0
  72. package/dist/esm/presentation/shared/settings.d.ts +2 -0
  73. package/dist/esm/presentation/shared/settings.d.ts.map +1 -1
  74. package/dist/esm/presentation/shared/settings.js +5 -1
  75. package/dist/esm/presentation/shared/settings.js.map +1 -1
  76. package/dist/esm/presentation/shared/tokens.d.ts +6 -0
  77. package/dist/esm/presentation/shared/tokens.d.ts.map +1 -1
  78. package/dist/esm/presentation/shared/tokens.js +7 -0
  79. package/dist/esm/presentation/shared/tokens.js.map +1 -1
  80. package/dist/esm/presentation/timeboxes/AdjustmentList.d.ts +11 -0
  81. package/dist/esm/presentation/timeboxes/AdjustmentList.d.ts.map +1 -0
  82. package/dist/esm/presentation/timeboxes/AdjustmentList.js +22 -0
  83. package/dist/esm/presentation/timeboxes/AdjustmentList.js.map +1 -0
  84. package/dist/esm/presentation/timeboxes/AgendaDayView.d.ts +15 -0
  85. package/dist/esm/presentation/timeboxes/AgendaDayView.d.ts.map +1 -0
  86. package/dist/esm/presentation/timeboxes/AgendaDayView.js +1524 -0
  87. package/dist/esm/presentation/timeboxes/AgendaDayView.js.map +1 -0
  88. package/dist/esm/presentation/timeboxes/CapacityBar.d.ts +15 -0
  89. package/dist/esm/presentation/timeboxes/CapacityBar.d.ts.map +1 -0
  90. package/dist/esm/presentation/timeboxes/CapacityBar.js +48 -0
  91. package/dist/esm/presentation/timeboxes/CapacityBar.js.map +1 -0
  92. package/dist/esm/presentation/timeboxes/SimulationCard.d.ts +13 -0
  93. package/dist/esm/presentation/timeboxes/SimulationCard.d.ts.map +1 -0
  94. package/dist/esm/presentation/timeboxes/SimulationCard.js +41 -0
  95. package/dist/esm/presentation/timeboxes/SimulationCard.js.map +1 -0
  96. package/dist/esm/presentation/timeboxes/SimulationPanel.d.ts +18 -0
  97. package/dist/esm/presentation/timeboxes/SimulationPanel.d.ts.map +1 -0
  98. package/dist/esm/presentation/timeboxes/SimulationPanel.js +267 -0
  99. package/dist/esm/presentation/timeboxes/SimulationPanel.js.map +1 -0
  100. package/dist/esm/presentation/timeboxes/TimeRecordsSection.d.ts +14 -0
  101. package/dist/esm/presentation/timeboxes/TimeRecordsSection.d.ts.map +1 -0
  102. package/dist/esm/presentation/timeboxes/TimeRecordsSection.js +159 -0
  103. package/dist/esm/presentation/timeboxes/TimeRecordsSection.js.map +1 -0
  104. package/dist/esm/presentation/timeboxes/WorkloadView.d.ts +9 -0
  105. package/dist/esm/presentation/timeboxes/WorkloadView.d.ts.map +1 -0
  106. package/dist/esm/presentation/timeboxes/WorkloadView.js +761 -0
  107. package/dist/esm/presentation/timeboxes/WorkloadView.js.map +1 -0
  108. package/dist/esm/presentation/timeboxes/__tests__/timeboxes.test.d.ts +2 -0
  109. package/dist/esm/presentation/timeboxes/__tests__/timeboxes.test.d.ts.map +1 -0
  110. package/dist/esm/presentation/timeboxes/__tests__/timeboxes.test.js +640 -0
  111. package/dist/esm/presentation/timeboxes/__tests__/timeboxes.test.js.map +1 -0
  112. package/dist/esm/presentation/timeboxes/changes.d.ts +72 -0
  113. package/dist/esm/presentation/timeboxes/changes.d.ts.map +1 -0
  114. package/dist/esm/presentation/timeboxes/changes.js +224 -0
  115. package/dist/esm/presentation/timeboxes/changes.js.map +1 -0
  116. package/dist/esm/presentation/timeboxes/mockData.d.ts +16 -0
  117. package/dist/esm/presentation/timeboxes/mockData.d.ts.map +1 -0
  118. package/dist/esm/presentation/timeboxes/mockData.js +297 -0
  119. package/dist/esm/presentation/timeboxes/mockData.js.map +1 -0
  120. package/dist/esm/presentation/timeboxes/model.d.ts +136 -0
  121. package/dist/esm/presentation/timeboxes/model.d.ts.map +1 -0
  122. package/dist/esm/presentation/timeboxes/model.js +129 -0
  123. package/dist/esm/presentation/timeboxes/model.js.map +1 -0
  124. package/dist/esm/presentation/timeboxes/pillLook.d.ts +40 -0
  125. package/dist/esm/presentation/timeboxes/pillLook.d.ts.map +1 -0
  126. package/dist/esm/presentation/timeboxes/pillLook.js +65 -0
  127. package/dist/esm/presentation/timeboxes/pillLook.js.map +1 -0
  128. package/dist/esm/presentation/timeboxes/plan.d.ts +62 -0
  129. package/dist/esm/presentation/timeboxes/plan.d.ts.map +1 -0
  130. package/dist/esm/presentation/timeboxes/plan.js +116 -0
  131. package/dist/esm/presentation/timeboxes/plan.js.map +1 -0
  132. package/dist/esm/presentation/timeboxes/reducer.d.ts +203 -0
  133. package/dist/esm/presentation/timeboxes/reducer.d.ts.map +1 -0
  134. package/dist/esm/presentation/timeboxes/reducer.js +616 -0
  135. package/dist/esm/presentation/timeboxes/reducer.js.map +1 -0
  136. package/dist/esm/presentation/timeboxes/scheduler.d.ts +63 -0
  137. package/dist/esm/presentation/timeboxes/scheduler.d.ts.map +1 -0
  138. package/dist/esm/presentation/timeboxes/scheduler.js +120 -0
  139. package/dist/esm/presentation/timeboxes/scheduler.js.map +1 -0
  140. package/dist/esm/presentation/timeboxes/store.d.ts +23 -0
  141. package/dist/esm/presentation/timeboxes/store.d.ts.map +1 -0
  142. package/dist/esm/presentation/timeboxes/store.js +46 -0
  143. package/dist/esm/presentation/timeboxes/store.js.map +1 -0
  144. package/dist/esm/presentation/timeboxes/timeBlocks.d.ts +10 -0
  145. package/dist/esm/presentation/timeboxes/timeBlocks.d.ts.map +1 -0
  146. package/dist/esm/presentation/timeboxes/timeBlocks.js +1767 -0
  147. package/dist/esm/presentation/timeboxes/timeBlocks.js.map +1 -0
  148. package/dist/esm/presentation/timeboxes/timeboxSettings.d.ts +71 -0
  149. package/dist/esm/presentation/timeboxes/timeboxSettings.d.ts.map +1 -0
  150. package/dist/esm/presentation/timeboxes/timeboxSettings.js +302 -0
  151. package/dist/esm/presentation/timeboxes/timeboxSettings.js.map +1 -0
  152. package/dist/esm/presentation/timeboxes/tracked.d.ts +51 -0
  153. package/dist/esm/presentation/timeboxes/tracked.d.ts.map +1 -0
  154. package/dist/esm/presentation/timeboxes/tracked.js +136 -0
  155. package/dist/esm/presentation/timeboxes/tracked.js.map +1 -0
  156. package/package.json +1 -1
@@ -0,0 +1,1931 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.WeekView = exports.TimezoneChanged = exports.SuggestedBlockMenu = exports.SomeoneElsesScheduleInMyTime = exports.SomeoneElsesSchedule = exports.ResizingPinnedBlock = exports.PinnedBlockMenu = exports.DayView = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
9
+ var _agendaGrid = require("../myWork/agendaGrid");
10
+ var _MyWorkTasks = require("../myWork/MyWorkTasks");
11
+ var _shared = require("../shared");
12
+ var _CapacityBar = require("./CapacityBar");
13
+ var _pillLook = require("./pillLook");
14
+ var _Button = require("../../components/Button");
15
+ var _IconButton = require("../../components/IconButton");
16
+ var _Icons = require("../../components/Icons");
17
+ var _InfoBox = require("../../components/InfoBox");
18
+ var _Label = require("../../components/Label");
19
+ var _List = require("../../components/List");
20
+ var _Menu = require("../../components/Menu");
21
+ var _Toggle = require("../../components/Toggle");
22
+ var _Tooltip = require("../../components/Tooltip");
23
+ var _Typography = require("../../components/Typography");
24
+ var _Typography2 = require("../../components/Typography/Typography");
25
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
26
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
27
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
28
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
29
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
30
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
31
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
32
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
33
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
34
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
35
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
36
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
37
+ /**
38
+ * Time blocks — a concept for the My Work Agenda's week and day
39
+ * views: tasks with an estimate leave the All Day row and take time in the
40
+ * hour grid as time blocks.
41
+ *
42
+ * Three layers: the estimate (hours for the assignee), the daily allocation
43
+ * (the estimate split, or the estimate over the task's days), and the time
44
+ * blocks that say when on the day the work happens — pinned by the user, or
45
+ * suggested by the scheduler into free time (work window − timed events −
46
+ * pinned blocks), important first, then earlier due date, then My Work order.
47
+ *
48
+ * The scheduler's output is mock payload (`TIME_BLOCKS`, `DAY_SCHEDULES`);
49
+ * the story only draws it. Everything around the grid is the Agenda as
50
+ * `My work calendar` draws it (../myWork/agendaGrid).
51
+ *
52
+ * The pages below are stories of "Presentation/Timeboxes"
53
+ * (Timeboxes.stories.tsx), next to the simulation.
54
+ */
55
+
56
+ /* ================================================================== */
57
+ /* Mock data */
58
+ /* ================================================================== */
59
+
60
+ /** Thu 29 Oct 2026, 11:45 in the owner's timezone — below the pinned
61
+ block's text, so the now-line does not strike its name. */
62
+ var TODAY_DAY = (0, _agendaGrid.isoToDayNumber)("2026-10-29");
63
+ var NOW_MINUTES = 11 * 60 + 45;
64
+ var WEEK_DAYS = Array.from({
65
+ length: 7
66
+ }, function (_, offset) {
67
+ return (0, _agendaGrid.mondayOf)(TODAY_DAY) + offset;
68
+ });
69
+ /** In the user's My Work project order. */
70
+ var PROJECTS = [{
71
+ id: 101,
72
+ name: "Website Redesign",
73
+ company: "ActiveCollab Inc.",
74
+ color: "#4C8CF5"
75
+ }, {
76
+ id: 102,
77
+ name: "Mobile App",
78
+ company: "ActiveCollab Inc.",
79
+ color: "#F28B30"
80
+ }, {
81
+ id: 103,
82
+ name: "Marketing Q4",
83
+ company: "Northwind Traders",
84
+ color: "#9D6BD8"
85
+ }, {
86
+ id: 104,
87
+ name: "Customer Onboarding",
88
+ company: "ActiveCollab Inc.",
89
+ color: "#2FB67C"
90
+ }];
91
+ /* The tasks of the brief keep their letter in a comment: A–D are Thursday's
92
+ reference example, F is Friday's unscheduled remainder. */
93
+ var TASKS = [/* A */{
94
+ id: 412,
95
+ project_id: 101,
96
+ name: "Review homepage wireframes",
97
+ is_important: false,
98
+ is_completed: false,
99
+ start_on: "2026-10-29",
100
+ due_on: "2026-10-29",
101
+ estimate: 1
102
+ }, /* B */{
103
+ id: 418,
104
+ project_id: 102,
105
+ name: "Write API pagination spec",
106
+ is_important: false,
107
+ is_completed: false,
108
+ start_on: "2026-10-29",
109
+ due_on: "2026-10-29",
110
+ estimate: 1.5
111
+ }, /* C */{
112
+ id: 431,
113
+ project_id: 103,
114
+ name: "Prepare Q4 campaign brief",
115
+ is_important: false,
116
+ is_completed: false,
117
+ start_on: "2026-10-29",
118
+ due_on: "2026-10-29",
119
+ estimate: 2
120
+ }, /* D — split 1.5h Wed, 1.5h Thu, 1h Fri */{
121
+ id: 437,
122
+ project_id: 104,
123
+ name: "Migrate onboarding emails",
124
+ is_important: false,
125
+ is_completed: false,
126
+ start_on: "2026-10-28",
127
+ due_on: "2026-10-30",
128
+ estimate: 4
129
+ }, {
130
+ id: 402,
131
+ project_id: 102,
132
+ name: "Fix login redirect loop",
133
+ is_important: false,
134
+ is_completed: false,
135
+ start_on: "2026-10-26",
136
+ due_on: "2026-10-26",
137
+ estimate: 1
138
+ }, {
139
+ id: 404,
140
+ project_id: 103,
141
+ name: "Update pricing page copy",
142
+ is_important: false,
143
+ is_completed: false,
144
+ start_on: "2026-10-26",
145
+ due_on: "2026-10-26",
146
+ estimate: 3
147
+ }, {
148
+ id: 425,
149
+ project_id: 101,
150
+ name: "QA checkout flow",
151
+ is_important: false,
152
+ is_completed: false,
153
+ start_on: "2026-10-27",
154
+ due_on: "2026-10-27",
155
+ estimate: 2
156
+ }, {
157
+ id: 428,
158
+ project_id: 102,
159
+ name: "Draft release notes",
160
+ is_important: false,
161
+ is_completed: false,
162
+ start_on: "2026-10-27",
163
+ due_on: "2026-10-27",
164
+ estimate: 2
165
+ }, {
166
+ id: 409,
167
+ project_id: 103,
168
+ name: "Export Q3 analytics",
169
+ is_important: false,
170
+ is_completed: true,
171
+ start_on: "2026-10-28",
172
+ due_on: "2026-10-28",
173
+ estimate: 1
174
+ }, {
175
+ id: 441,
176
+ project_id: 104,
177
+ name: "Review support macros",
178
+ is_important: false,
179
+ is_completed: false,
180
+ start_on: "2026-10-28",
181
+ due_on: "2026-10-28",
182
+ estimate: 2
183
+ }, {
184
+ id: 445,
185
+ project_id: 101,
186
+ name: "Review open pull requests",
187
+ is_important: false,
188
+ is_completed: false,
189
+ start_on: "2026-10-30",
190
+ due_on: "2026-10-30",
191
+ estimate: 1
192
+ }, {
193
+ id: 450,
194
+ project_id: 103,
195
+ name: "Prepare board deck",
196
+ is_important: true,
197
+ is_completed: false,
198
+ start_on: "2026-10-30",
199
+ due_on: "2026-10-30",
200
+ estimate: 4.5
201
+ }, /* F */{
202
+ id: 433,
203
+ project_id: 102,
204
+ name: "Localize settings screens",
205
+ is_important: false,
206
+ is_completed: false,
207
+ start_on: "2026-10-30",
208
+ due_on: "2026-10-30",
209
+ estimate: 2
210
+ }, /* No estimate: stays an all-day pill. */
211
+ {
212
+ id: 436,
213
+ project_id: 103,
214
+ name: "Collect customer testimonials",
215
+ is_important: false,
216
+ is_completed: false,
217
+ start_on: "2026-10-28",
218
+ due_on: "2026-10-30",
219
+ estimate: null
220
+ }];
221
+ var SUBTASKS = [{
222
+ id: 9120,
223
+ task_id: 412,
224
+ name: "Export icon set",
225
+ due_on: "2026-10-29",
226
+ is_completed: false
227
+ }];
228
+ var EVENTS = [{
229
+ id: 1401,
230
+ class: "CalendarEvent",
231
+ name: "Weekly kickoff",
232
+ calendar_id: 5,
233
+ calendar_name: "Team",
234
+ color: "#63A7DE",
235
+ starts_on: "2026-10-26",
236
+ ends_on: "2026-10-26",
237
+ starts_on_time: "09:00:00",
238
+ ends_on_time: "09:50:00",
239
+ repeat_event: "weekly",
240
+ is_participant: true,
241
+ meeting_url: "https://meet.google.com/kxp-wqbt-rjd"
242
+ }, {
243
+ id: 1402,
244
+ class: "CalendarEvent",
245
+ name: "Client call — Northwind",
246
+ calendar_id: 9,
247
+ calendar_name: "Work (Google)",
248
+ color: "#F56F72",
249
+ starts_on: "2026-10-27",
250
+ ends_on: "2026-10-27",
251
+ starts_on_time: "14:00:00",
252
+ ends_on_time: "14:30:00",
253
+ repeat_event: "dont",
254
+ is_participant: true,
255
+ meeting_url: "https://teams.microsoft.com/l/meetup-join/19%3ameeting_NWQ4"
256
+ }, {
257
+ id: 1403,
258
+ class: "CalendarEvent",
259
+ name: "Lunch & learn",
260
+ calendar_id: 5,
261
+ calendar_name: "Team",
262
+ color: "#63A7DE",
263
+ starts_on: "2026-10-28",
264
+ ends_on: "2026-10-28",
265
+ starts_on_time: "12:00:00",
266
+ ends_on_time: "13:00:00",
267
+ repeat_event: "dont",
268
+ is_participant: true,
269
+ meeting_url: null
270
+ }, {
271
+ id: 1404,
272
+ class: "CalendarEvent",
273
+ name: "Sprint planning",
274
+ calendar_id: 5,
275
+ calendar_name: "Team",
276
+ color: "#63A7DE",
277
+ starts_on: "2026-10-29",
278
+ ends_on: "2026-10-29",
279
+ starts_on_time: "14:00:00",
280
+ ends_on_time: "15:00:00",
281
+ repeat_event: "dont",
282
+ is_participant: true,
283
+ meeting_url: "https://zoom.us/j/84213377610"
284
+ }, {
285
+ id: 1405,
286
+ class: "CalendarEvent",
287
+ name: "Retro",
288
+ calendar_id: 5,
289
+ calendar_name: "Team",
290
+ color: "#63A7DE",
291
+ starts_on: "2026-10-30",
292
+ ends_on: "2026-10-30",
293
+ starts_on_time: "14:00:00",
294
+ ends_on_time: "15:00:00",
295
+ repeat_event: "dont",
296
+ is_participant: true,
297
+ meeting_url: "https://meet.google.com/vbn-ksoe-ytu"
298
+ }];
299
+ var SETTINGS = {
300
+ workday_starts_at: "09:00",
301
+ daily_capacity: 8,
302
+ working_days: [1, 2, 3, 4, 5],
303
+ suggestion_min_gap: 15,
304
+ pause_starts_at: null,
305
+ pause_length: 0,
306
+ timezone: "Europe/Belgrade"
307
+ };
308
+ var TIME_BLOCKS = [
309
+ /* Monday: the 09:50–10:00 gap is under the 15-min minimum, so the
310
+ suggestion starts after the pinned block, at 11:00. */
311
+ {
312
+ id: 1,
313
+ task_id: 402,
314
+ type: "pinned",
315
+ day: "2026-10-26",
316
+ starts_at: "10:00",
317
+ ends_at: "11:00",
318
+ fragment: null,
319
+ fragments: null,
320
+ overlapping_event_ids: []
321
+ }, {
322
+ id: 2,
323
+ task_id: 404,
324
+ type: "suggested",
325
+ day: "2026-10-26",
326
+ starts_at: "11:00",
327
+ ends_at: "14:00",
328
+ fragment: 1,
329
+ fragments: 1,
330
+ overlapping_event_ids: []
331
+ }, /* Tuesday: the client call was added after the block was pinned. */
332
+ {
333
+ id: 3,
334
+ task_id: 428,
335
+ type: "suggested",
336
+ day: "2026-10-27",
337
+ starts_at: "09:00",
338
+ ends_at: "11:00",
339
+ fragment: 1,
340
+ fragments: 1,
341
+ overlapping_event_ids: []
342
+ }, {
343
+ id: 4,
344
+ task_id: 425,
345
+ type: "pinned",
346
+ day: "2026-10-27",
347
+ starts_at: "13:00",
348
+ ends_at: "15:00",
349
+ fragment: null,
350
+ fragments: null,
351
+ overlapping_event_ids: [1402]
352
+ }, /* Wednesday: a completed task's pinned block stays, faded. */
353
+ {
354
+ id: 5,
355
+ task_id: 409,
356
+ type: "pinned",
357
+ day: "2026-10-28",
358
+ starts_at: "09:00",
359
+ ends_at: "10:00",
360
+ fragment: null,
361
+ fragments: null,
362
+ overlapping_event_ids: []
363
+ }, {
364
+ id: 6,
365
+ task_id: 437,
366
+ type: "suggested",
367
+ day: "2026-10-28",
368
+ starts_at: "10:00",
369
+ ends_at: "11:30",
370
+ fragment: 1,
371
+ fragments: 1,
372
+ overlapping_event_ids: []
373
+ }, {
374
+ id: 7,
375
+ task_id: 441,
376
+ type: "suggested",
377
+ day: "2026-10-28",
378
+ starts_at: "11:30",
379
+ ends_at: "12:00",
380
+ fragment: 1,
381
+ fragments: 2,
382
+ overlapping_event_ids: []
383
+ }, {
384
+ id: 8,
385
+ task_id: 441,
386
+ type: "suggested",
387
+ day: "2026-10-28",
388
+ starts_at: "13:00",
389
+ ends_at: "14:30",
390
+ fragment: 2,
391
+ fragments: 2,
392
+ overlapping_event_ids: []
393
+ }, /* Thursday: the reference example. */
394
+ {
395
+ id: 9,
396
+ task_id: 431,
397
+ type: "suggested",
398
+ day: "2026-10-29",
399
+ starts_at: "09:00",
400
+ ends_at: "09:30",
401
+ fragment: 1,
402
+ fragments: 3,
403
+ overlapping_event_ids: []
404
+ }, {
405
+ id: 10,
406
+ task_id: 412,
407
+ type: "pinned",
408
+ day: "2026-10-29",
409
+ starts_at: "09:30",
410
+ ends_at: "10:30",
411
+ fragment: null,
412
+ fragments: null,
413
+ overlapping_event_ids: []
414
+ }, {
415
+ id: 11,
416
+ task_id: 431,
417
+ type: "suggested",
418
+ day: "2026-10-29",
419
+ starts_at: "10:30",
420
+ ends_at: "11:00",
421
+ fragment: 2,
422
+ fragments: 3,
423
+ overlapping_event_ids: []
424
+ }, {
425
+ id: 12,
426
+ task_id: 418,
427
+ type: "pinned",
428
+ day: "2026-10-29",
429
+ starts_at: "11:00",
430
+ ends_at: "12:30",
431
+ fragment: null,
432
+ fragments: null,
433
+ overlapping_event_ids: []
434
+ }, {
435
+ id: 13,
436
+ task_id: 431,
437
+ type: "suggested",
438
+ day: "2026-10-29",
439
+ starts_at: "12:30",
440
+ ends_at: "13:30",
441
+ fragment: 3,
442
+ fragments: 3,
443
+ overlapping_event_ids: []
444
+ }, {
445
+ id: 14,
446
+ task_id: 437,
447
+ type: "suggested",
448
+ day: "2026-10-29",
449
+ starts_at: "13:30",
450
+ ends_at: "14:00",
451
+ fragment: 1,
452
+ fragments: 2,
453
+ overlapping_event_ids: []
454
+ }, {
455
+ id: 15,
456
+ task_id: 437,
457
+ type: "suggested",
458
+ day: "2026-10-29",
459
+ starts_at: "15:00",
460
+ ends_at: "16:00",
461
+ fragment: 2,
462
+ fragments: 2,
463
+ overlapping_event_ids: []
464
+ },
465
+ /* Friday: overbooked — the important deck first, then by due date, then
466
+ My Work order; 1.5h of the localization does not fit. */
467
+ {
468
+ id: 16,
469
+ task_id: 445,
470
+ type: "pinned",
471
+ day: "2026-10-30",
472
+ starts_at: "09:00",
473
+ ends_at: "10:00",
474
+ fragment: null,
475
+ fragments: null,
476
+ overlapping_event_ids: []
477
+ }, {
478
+ id: 17,
479
+ task_id: 450,
480
+ type: "suggested",
481
+ day: "2026-10-30",
482
+ starts_at: "10:00",
483
+ ends_at: "14:00",
484
+ fragment: 1,
485
+ fragments: 2,
486
+ overlapping_event_ids: []
487
+ }, {
488
+ id: 18,
489
+ task_id: 450,
490
+ type: "suggested",
491
+ day: "2026-10-30",
492
+ starts_at: "15:00",
493
+ ends_at: "15:30",
494
+ fragment: 2,
495
+ fragments: 2,
496
+ overlapping_event_ids: []
497
+ }, {
498
+ id: 19,
499
+ task_id: 437,
500
+ type: "suggested",
501
+ day: "2026-10-30",
502
+ starts_at: "15:30",
503
+ ends_at: "16:30",
504
+ fragment: 1,
505
+ fragments: 1,
506
+ overlapping_event_ids: []
507
+ }, {
508
+ id: 20,
509
+ task_id: 433,
510
+ type: "suggested",
511
+ day: "2026-10-30",
512
+ starts_at: "16:30",
513
+ ends_at: "17:00",
514
+ fragment: 1,
515
+ fragments: 1,
516
+ overlapping_event_ids: []
517
+ }];
518
+ var DAY_SCHEDULES = [{
519
+ day: "2026-10-26",
520
+ capacity: 480,
521
+ allocated: 240,
522
+ scheduled: 240,
523
+ unscheduled: []
524
+ }, {
525
+ day: "2026-10-27",
526
+ capacity: 480,
527
+ allocated: 240,
528
+ scheduled: 240,
529
+ unscheduled: []
530
+ }, {
531
+ day: "2026-10-28",
532
+ capacity: 480,
533
+ allocated: 270,
534
+ scheduled: 270,
535
+ unscheduled: []
536
+ }, {
537
+ day: "2026-10-29",
538
+ capacity: 480,
539
+ allocated: 360,
540
+ scheduled: 360,
541
+ unscheduled: [],
542
+ free_slots: [{
543
+ starts_at: "16:00",
544
+ ends_at: "17:00"
545
+ }]
546
+ }, {
547
+ day: "2026-10-30",
548
+ capacity: 480,
549
+ allocated: 510,
550
+ scheduled: 420,
551
+ unscheduled: [{
552
+ task_id: 433,
553
+ minutes: 90
554
+ }]
555
+ }, {
556
+ day: "2026-10-31",
557
+ capacity: 0,
558
+ allocated: 0,
559
+ scheduled: 0,
560
+ unscheduled: []
561
+ }, {
562
+ day: "2026-11-01",
563
+ capacity: 0,
564
+ allocated: 0,
565
+ scheduled: 0,
566
+ unscheduled: []
567
+ }];
568
+ /* Thursday's allocations: the Day view story's day. */
569
+ var ALLOCATIONS = [{
570
+ task_id: 412,
571
+ day: "2026-10-29",
572
+ minutes: 60,
573
+ left_after_day: 0
574
+ }, {
575
+ task_id: 418,
576
+ day: "2026-10-29",
577
+ minutes: 90,
578
+ left_after_day: 0
579
+ }, {
580
+ task_id: 431,
581
+ day: "2026-10-29",
582
+ minutes: 120,
583
+ left_after_day: 0
584
+ }, {
585
+ task_id: 437,
586
+ day: "2026-10-29",
587
+ minutes: 90,
588
+ left_after_day: 60
589
+ }];
590
+ /** Whose schedule it is. */
591
+ var OWNER = {
592
+ id: 7,
593
+ first_name: "Marko",
594
+ timezone: "Europe/Belgrade",
595
+ timezone_abbr: "CET",
596
+ utc_offset: 60
597
+ };
598
+
599
+ /** A teammate looking at the owner's schedule, eleven hours behind. */
600
+ var VIEWER = {
601
+ id: 12,
602
+ first_name: "Ana",
603
+ timezone: "Pacific/Honolulu",
604
+ timezone_abbr: "HST",
605
+ utc_offset: -600
606
+ };
607
+ var TIMEZONE_CHANGE = {
608
+ previous_timezone_abbr: "CET",
609
+ current_timezone: "Europe/London",
610
+ current_timezone_abbr: "GMT",
611
+ pinned_blocks_in_previous_timezone: 3
612
+ };
613
+
614
+ /* ================================================================== */
615
+ /* Render-time lookups */
616
+ /* ================================================================== */
617
+
618
+ var projectOf = function projectOf(projectId) {
619
+ return PROJECTS.find(function (project) {
620
+ return project.id === projectId;
621
+ });
622
+ };
623
+ var taskOf = function taskOf(taskId) {
624
+ return TASKS.find(function (task) {
625
+ return task.id === taskId;
626
+ });
627
+ };
628
+ var scheduleOf = function scheduleOf(day) {
629
+ return DAY_SCHEDULES.find(function (schedule) {
630
+ return (0, _agendaGrid.isoToDayNumber)(schedule.day) === day;
631
+ });
632
+ };
633
+
634
+ /** "6h", "1.5h" — the estimate's own unit. */
635
+ var formatHours = function formatHours(minutes) {
636
+ return "".concat(Math.round(minutes / 60 * 100) / 100, "h");
637
+ };
638
+ var isWorkingDay = function isWorkingDay(day) {
639
+ return SETTINGS.working_days.includes(((0, _agendaGrid.toDate)(day).getUTCDay() + 6) % 7 + 1);
640
+ };
641
+
642
+ /** Work window: from the configured start, as long as the daily capacity. */
643
+ var WORK_START = (0, _agendaGrid.clockToMinutes)(SETTINGS.workday_starts_at);
644
+ var WORK_END = WORK_START + SETTINGS.daily_capacity * 60;
645
+
646
+ /* ================================================================== */
647
+ /* Geometry */
648
+ /* ================================================================== */
649
+
650
+ /** A departure from the app's 36px: 48px an hour, so a 30-min block (24px)
651
+ holds its name line. Half-hour lines are added for the same reason. */
652
+ var BLOCK_HOUR_HEIGHT = 48;
653
+ var HALF_HOUR = BLOCK_HOUR_HEIGHT / 2;
654
+ /** Under this a block shows its name line only (DayEvent.jsx's 36px). */
655
+ var TWO_LINE_HEIGHT = 36;
656
+ var minuteTop = function minuteTop(minutes) {
657
+ return minutes / 60 * BLOCK_HOUR_HEIGHT;
658
+ };
659
+
660
+ /* ================================================================== */
661
+ /* Styles */
662
+ /* ================================================================== */
663
+
664
+ /* The Agenda's hour grid at 48px an hour. Lines move to their own layer
665
+ (.slot-lines) so the off-hours tint sits under them. */
666
+ var StyledBlockHourGrid = (0, _styledComponents.default)(_agendaGrid.StyledHourGrid).withConfig({
667
+ displayName: "timeBlocks__StyledBlockHourGrid",
668
+ componentId: "sc-qxsot7-0"
669
+ })([".time-canvas{height:", "px;}.time-column{background-image:none;}.off-hours{position:absolute;left:0;right:0;background-color:var(--color-theme-200);}.slot-lines{position:absolute;inset:0;pointer-events:none;background-image:repeating-linear-gradient( to bottom,transparent 0,transparent ", "px,var(--border-primary) ", "px,var(--border-primary) ", "px ),repeating-linear-gradient( to bottom,transparent 0,transparent ", "px,var(--color-theme-transparent-300) ", "px,var(--color-theme-transparent-300) ", "px );}.time-column.past .block.suggested{opacity:0.5;}.time-column.reflowing .block.suggested{opacity:0.3;}"], 24 * BLOCK_HOUR_HEIGHT, BLOCK_HOUR_HEIGHT - 1, BLOCK_HOUR_HEIGHT - 1, BLOCK_HOUR_HEIGHT, HALF_HOUR - 1, HALF_HOUR - 1, HALF_HOUR);
670
+
671
+ /* The block's menu: the task menu's list (TaskOptionsMenu), text items. */
672
+ var StyledBlockMenu = _styledComponents.default.div.withConfig({
673
+ displayName: "timeBlocks__StyledBlockMenu",
674
+ componentId: "sc-qxsot7-1"
675
+ })([".menu-list{padding:8px 0;}"]);
676
+
677
+ /* A block's hover-only "…" (top right; centred in a one-line block). The
678
+ first line makes room for it while it shows. */
679
+ var BLOCK_MENU_ANCHOR = (0, _styledComponents.css)([".block-menu-anchor{position:absolute;top:1px;right:1px;display:flex;opacity:0;transition:opacity ", ";}&.compact .block-menu-anchor{top:50%;transform:translateY(-50%);}&:hover .block-menu-anchor,.block-menu-anchor.open{opacity:1;}&:hover .block-line,&.menu-open .block-line{padding-right:22px;}"], _shared.TRANSITION);
680
+
681
+ /* The unscheduled remainder in the All Day row: the pill, dashed in the
682
+ alert colour. */
683
+ var StyledUnscheduledPill = (0, _styledComponents.default)(_agendaGrid.StyledPill).withConfig({
684
+ displayName: "timeBlocks__StyledUnscheduledPill",
685
+ componentId: "sc-qxsot7-2"
686
+ })(["&&{justify-content:flex-start;background-color:var(--page-paper-main);border-style:dashed;border-width:1px;border-color:var(--red-alert);}"]);
687
+
688
+ /* ================================================================== */
689
+ /* Pieces */
690
+ /* ================================================================== */
691
+
692
+ /** The header's bar from the day's schedule (the shared CapacityBar). */
693
+ var DayCapacityBar = function DayCapacityBar(_ref) {
694
+ var day = _ref.day;
695
+ var schedule = scheduleOf(day);
696
+ if (!schedule) {
697
+ return /*#__PURE__*/_react.default.createElement(_CapacityBar.CapacityBar, {
698
+ scheduled: 0,
699
+ allocated: 0,
700
+ capacity: 0,
701
+ over: false,
702
+ tooltip: ""
703
+ });
704
+ }
705
+ var capacity = schedule.capacity,
706
+ allocated = schedule.allocated,
707
+ scheduled = schedule.scheduled;
708
+ var over = allocated > capacity;
709
+ var due = TASKS.filter(function (task) {
710
+ return (0, _agendaGrid.isoToDayNumber)(task.due_on) === day;
711
+ });
712
+ var done = due.filter(function (task) {
713
+ return task.is_completed;
714
+ }).length;
715
+ var title = ["".concat(formatHours(scheduled), " / ").concat(formatHours(allocated), " / ").concat(formatHours(capacity), " \u2014 scheduled / allocated / capacity"), over ? "Overbooked by ".concat(formatHours(allocated - capacity)) : null, due.length > 0 ? "Due: ".concat(done, " of ").concat(due.length, " completed") : null].filter(Boolean).join(" · ");
716
+ return /*#__PURE__*/_react.default.createElement(_CapacityBar.CapacityBar, {
717
+ scheduled: scheduled,
718
+ allocated: allocated,
719
+ capacity: capacity,
720
+ over: over,
721
+ tooltip: title
722
+ });
723
+ };
724
+ DayCapacityBar.displayName = "DayCapacityBar";
725
+
726
+ /** "1h 15m", "45m", "2h" — a block's length while it is resized. */
727
+ var formatBlockLength = function formatBlockLength(minutes) {
728
+ var hours = Math.floor(minutes / 60);
729
+ var rest = minutes % 60;
730
+ if (hours === 0) return "".concat(rest, "m");
731
+ return rest === 0 ? "".concat(hours, "h") : "".concat(hours, "h ").concat(rest, "m");
732
+ };
733
+
734
+ /** A state a story opens in (block interactions): drawn, not wired. */
735
+
736
+ /** A block's hover-only "…": the actions a pinned or a suggested block
737
+ offers. Clicks only close it. */
738
+ var BlockMenu = function BlockMenu(_ref2) {
739
+ var pinned = _ref2.pinned,
740
+ open = _ref2.open,
741
+ onOpen = _ref2.onOpen,
742
+ onClose = _ref2.onClose;
743
+ return /*#__PURE__*/_react.default.createElement("span", {
744
+ className: open ? "block-menu-anchor open" : "block-menu-anchor"
745
+ }, /*#__PURE__*/_react.default.createElement(_Menu.Menu, {
746
+ open: open,
747
+ onOpen: onOpen,
748
+ onClose: onClose,
749
+ position: "bottom-end",
750
+ target: /*#__PURE__*/_react.default.createElement(_IconButton.IconButton, {
751
+ type: "button",
752
+ size: "small",
753
+ variant: "text gray",
754
+ "aria-label": "Block options",
755
+ active: open
756
+ }, /*#__PURE__*/_react.default.createElement(_Icons.TreeDotsIcon, null))
757
+ }, /*#__PURE__*/_react.default.createElement(StyledBlockMenu, null, /*#__PURE__*/_react.default.createElement(_List.List, {
758
+ className: "menu-list",
759
+ tabIndex: 0
760
+ }, pinned ? /*#__PURE__*/_react.default.createElement(_List.ListItem, {
761
+ onClick: onClose
762
+ }, "Unpin (back to suggestions)") : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_List.ListItem, {
763
+ onClick: onClose
764
+ }, "Pin"), /*#__PURE__*/_react.default.createElement(_List.ListItem, {
765
+ onClick: onClose
766
+ }, "Pin all suggestions for today")), /*#__PURE__*/_react.default.createElement(_List.ListSeparator, null), /*#__PURE__*/_react.default.createElement(_List.ListItem, {
767
+ onClick: onClose
768
+ }, "Open task")))));
769
+ };
770
+ BlockMenu.displayName = "BlockMenu";
771
+ /** A timed event, read off the payload for the grid. */
772
+ var eventEntryOf = function eventEntryOf(event) {
773
+ var _event$meeting_url;
774
+ return {
775
+ key: "event-".concat(event.id),
776
+ kind: "event",
777
+ name: event.name,
778
+ startDay: (0, _agendaGrid.isoToDayNumber)(event.starts_on),
779
+ endDay: (0, _agendaGrid.isoToDayNumber)(event.ends_on),
780
+ color: event.color,
781
+ completed: false,
782
+ important: false,
783
+ participant: event.is_participant,
784
+ meetingUrl: (_event$meeting_url = event.meeting_url) !== null && _event$meeting_url !== void 0 ? _event$meeting_url : undefined,
785
+ startMinute: event.starts_on_time ? (0, _agendaGrid.clockToMinutes)(event.starts_on_time) : undefined,
786
+ endMinute: event.ends_on_time ? (0, _agendaGrid.clockToMinutes)(event.ends_on_time) : undefined
787
+ };
788
+ };
789
+
790
+ /* ================================================================== */
791
+ /* Pills (the new_task look, ./pillLook, shared with the simulation) */
792
+ /* ================================================================== */
793
+
794
+ /* A task or an event in the hour grid: the app's pill filled with its
795
+ palette colour (PILL_LOOK). Line 1 is the name with the length on the
796
+ right; line 2 the times and what the block is (fragments as dots,
797
+ overlaps as a warning chip). */
798
+ var StyledPillCard = _styledComponents.default.div.withConfig({
799
+ displayName: "timeBlocks__StyledPillCard",
800
+ componentId: "sc-qxsot7-3"
801
+ })(["", " cursor:pointer;transition:background ", ";.block-length{flex-shrink:0;}.block-time{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}&.completed{opacity:0.5;}&.continues-before{border-top-left-radius:0;border-top-right-radius:0;}&.continues-after{border-bottom-left-radius:0;border-bottom-right-radius:0;}", " .resize-handle{box-sizing:border-box;position:absolute;left:50%;display:none;width:24px;height:2px;border-top:3px double var(--border-primary);transform:translateX(-50%);cursor:ns-resize;}.resize-handle.top{top:3px;}.resize-handle.bottom{bottom:3px;}&:not(.compact):hover .resize-handle{display:block;}&.resizing{z-index:3;outline:1px solid var(--color-primary);}&.resizing .resize-handle.bottom{display:block;border-top-color:var(--color-primary);}"], _pillLook.PILL_LOOK, _shared.TRANSITION, BLOCK_MENU_ANCHOR);
802
+
803
+ /** A pinned or suggested block as a new_task pill: pinned is the palette
804
+ fill, a suggestion the colour's see-through hatch. */
805
+ var PillBlockCard = function PillBlockCard(_ref3) {
806
+ var block = _ref3.block,
807
+ style = _ref3.style,
808
+ start = _ref3.start,
809
+ end = _ref3.end,
810
+ label = _ref3.label,
811
+ _ref3$continuesBefore = _ref3.continuesBefore,
812
+ continuesBefore = _ref3$continuesBefore === void 0 ? false : _ref3$continuesBefore,
813
+ _ref3$continuesAfter = _ref3.continuesAfter,
814
+ continuesAfter = _ref3$continuesAfter === void 0 ? false : _ref3$continuesAfter,
815
+ shiftedFrom = _ref3.shiftedFrom,
816
+ linked = _ref3.linked,
817
+ onHover = _ref3.onHover,
818
+ showTaskIds = _ref3.showTaskIds,
819
+ menuOpen = _ref3.menuOpen,
820
+ onMenuOpen = _ref3.onMenuOpen,
821
+ onMenuClose = _ref3.onMenuClose,
822
+ resizedEnd = _ref3.resizedEnd;
823
+ var task = taskOf(block.task_id);
824
+ var project = task ? projectOf(task.project_id) : undefined;
825
+ if (!task || !project) return null;
826
+ var resizing = resizedEnd !== undefined;
827
+ var shownEnd = resizedEnd !== null && resizedEnd !== void 0 ? resizedEnd : end;
828
+ var labelEnd = resizing ? label.start + (shownEnd - start) : label.end;
829
+ var height = Math.max(minuteTop(shownEnd - start), 20);
830
+ var pinned = block.type === "pinned";
831
+ var overlaps = EVENTS.filter(function (event) {
832
+ return block.overlapping_event_ids.includes(event.id);
833
+ });
834
+ var linkKey = "".concat(block.task_id, "-").concat(block.day);
835
+ var _paletteOf = (0, _pillLook.paletteOf)(project.color),
836
+ base = _paletteOf.base;
837
+ var className = ["block", block.type, height < TWO_LINE_HEIGHT ? "compact" : "", linked ? "linked" : "", task.is_completed ? "completed" : "", menuOpen ? "menu-open" : "", resizing ? "resizing" : "", continuesBefore ? "continues-before" : "", continuesAfter ? "continues-after" : ""].filter(Boolean).join(" ");
838
+ /* A completed task's pinned block is history: no resize. */
839
+ var resizable = pinned && !task.is_completed;
840
+ return /*#__PURE__*/_react.default.createElement(StyledPillCard, {
841
+ className: className,
842
+ style: _objectSpread(_objectSpread({}, style), {}, {
843
+ height,
844
+ background: pinned ? (0, _pillLook.paletteFill)(base) : (0, _pillLook.tentativeHatch)(base, linked),
845
+ boxShadow: _pillLook.PAPER_RING
846
+ }),
847
+ onMouseEnter: pinned ? undefined : function () {
848
+ return onHover(linkKey);
849
+ },
850
+ onMouseLeave: pinned ? undefined : function () {
851
+ return onHover(null);
852
+ }
853
+ }, /*#__PURE__*/_react.default.createElement("span", {
854
+ className: "block-line"
855
+ }, /*#__PURE__*/_react.default.createElement("span", {
856
+ className: "block-glyph"
857
+ }, pinned ? /*#__PURE__*/_react.default.createElement(_Icons.PinSmallIcon, {
858
+ width: 12,
859
+ height: 12,
860
+ style: {
861
+ fill: base
862
+ },
863
+ "aria-label": "Pinned"
864
+ }) : /*#__PURE__*/_react.default.createElement(_Icons.SparkIcon, {
865
+ width: 12,
866
+ height: 12,
867
+ style: {
868
+ fill: base
869
+ },
870
+ "aria-label": "Suggested"
871
+ })), showTaskIds ? /*#__PURE__*/_react.default.createElement(_Typography.Caption1, {
872
+ color: "tertiary",
873
+ className: "block-meta fill-text",
874
+ tabularNums: true
875
+ }, "#".concat(task.id)) : null, /*#__PURE__*/_react.default.createElement(_Typography2.Typography, {
876
+ variant: "Caption 1",
877
+ weight: "regular",
878
+ className: "block-name",
879
+ color: task.is_important ? "alert" : "primary",
880
+ decoration: task.is_completed ? "line-through" : undefined
881
+ }, task.name), shiftedFrom ? /*#__PURE__*/_react.default.createElement(_Tooltip.Tooltip, {
882
+ title: shiftedFrom
883
+ }, /*#__PURE__*/_react.default.createElement("span", {
884
+ className: "block-glyph"
885
+ }, /*#__PURE__*/_react.default.createElement(_Icons.ClockSmallIcon, {
886
+ width: 12,
887
+ height: 12,
888
+ style: {
889
+ fill: "var(--color-theme-700)"
890
+ },
891
+ "aria-label": shiftedFrom
892
+ }))) : null, /*#__PURE__*/_react.default.createElement(_Typography.Caption1, {
893
+ color: "tertiary",
894
+ className: "block-length",
895
+ tabularNums: true
896
+ }, formatBlockLength(shownEnd - start))), /*#__PURE__*/_react.default.createElement("span", {
897
+ className: "block-detail"
898
+ }, /*#__PURE__*/_react.default.createElement(_Typography.Caption1, {
899
+ color: "secondary",
900
+ className: "block-time fill-text",
901
+ tabularNums: true
902
+ }, "".concat((0, _agendaGrid.formatTimeOfDay)(dayMinute(label.start)), " \u2013 ").concat((0, _agendaGrid.formatTimeOfDay)(dayMinute(labelEnd)))), block.fragment !== null && block.fragments !== null ? /*#__PURE__*/_react.default.createElement(_Tooltip.Tooltip, {
903
+ title: "Part ".concat(block.fragment, " of ").concat(block.fragments)
904
+ }, /*#__PURE__*/_react.default.createElement("span", {
905
+ className: "fragment-dots"
906
+ }, Array.from({
907
+ length: block.fragments
908
+ }, function (_, index) {
909
+ return /*#__PURE__*/_react.default.createElement("span", {
910
+ className: "fragment-dot",
911
+ key: index,
912
+ style: {
913
+ borderColor: base,
914
+ backgroundColor: index + 1 === block.fragment ? base : "transparent"
915
+ }
916
+ });
917
+ }))) : null, overlaps.map(function (event) {
918
+ return /*#__PURE__*/_react.default.createElement(_Tooltip.Tooltip, {
919
+ title: "Overlaps: ".concat(event.name),
920
+ key: event.id
921
+ }, /*#__PURE__*/_react.default.createElement("span", {
922
+ className: "overlap-chip"
923
+ }, /*#__PURE__*/_react.default.createElement(_Icons.WarningTriangleSmallIcon, {
924
+ width: 12,
925
+ height: 12,
926
+ style: {
927
+ fill: "var(--red-alert)",
928
+ flexShrink: 0
929
+ },
930
+ "aria-hidden": true
931
+ }), /*#__PURE__*/_react.default.createElement(_Typography.Caption1, {
932
+ color: "alert",
933
+ className: "block-name"
934
+ }, event.name)));
935
+ })), resizable ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
936
+ className: "resize-handle top"
937
+ }), /*#__PURE__*/_react.default.createElement("span", {
938
+ className: "resize-handle bottom"
939
+ })) : null, /*#__PURE__*/_react.default.createElement(BlockMenu, {
940
+ pinned: pinned,
941
+ open: menuOpen,
942
+ onOpen: onMenuOpen,
943
+ onClose: onMenuClose
944
+ }));
945
+ };
946
+ PillBlockCard.displayName = "PillBlockCard";
947
+
948
+ /** A timed event as a new_task pill: filled with the calendar's palette
949
+ colour; an event without the user stays neutral with its colour on the
950
+ leading edge (calendar-event-fill / calendar-event-muted). */
951
+ var PillEventCard = function PillEventCard(_ref4) {
952
+ var _style$height;
953
+ var entry = _ref4.entry,
954
+ style = _ref4.style,
955
+ label = _ref4.label,
956
+ _ref4$continuesBefore = _ref4.continuesBefore,
957
+ continuesBefore = _ref4$continuesBefore === void 0 ? false : _ref4$continuesBefore,
958
+ _ref4$continuesAfter = _ref4.continuesAfter,
959
+ continuesAfter = _ref4$continuesAfter === void 0 ? false : _ref4$continuesAfter;
960
+ var height = Number((_style$height = style.height) !== null && _style$height !== void 0 ? _style$height : 20);
961
+ var _paletteOf2 = (0, _pillLook.paletteOf)(entry.color),
962
+ base = _paletteOf2.base;
963
+ var muted = !entry.participant;
964
+ var paint = muted ? {
965
+ backgroundColor: _pillLook.MUTED_EVENT_FILL,
966
+ borderLeftColor: base,
967
+ boxShadow: _pillLook.PAPER_RING
968
+ } : {
969
+ backgroundColor: (0, _pillLook.paletteFill)(base),
970
+ boxShadow: _pillLook.PAPER_RING
971
+ };
972
+ var className = ["event", height < TWO_LINE_HEIGHT ? "compact" : "", continuesBefore ? "continues-before" : "", continuesAfter ? "continues-after" : ""].filter(Boolean).join(" ");
973
+ return /*#__PURE__*/_react.default.createElement(StyledPillCard, {
974
+ className: className,
975
+ style: _objectSpread(_objectSpread({}, style), paint)
976
+ }, /*#__PURE__*/_react.default.createElement("span", {
977
+ className: "block-line"
978
+ }, /*#__PURE__*/_react.default.createElement(_agendaGrid.EventGlyph, {
979
+ color: base
980
+ }), entry.meetingUrl ? /*#__PURE__*/_react.default.createElement(_agendaGrid.MeetingServiceIcon, {
981
+ url: entry.meetingUrl
982
+ }) : null, /*#__PURE__*/_react.default.createElement(_Typography2.Typography, {
983
+ variant: "Caption 1",
984
+ weight: "medium",
985
+ className: "block-name",
986
+ color: entry.participant ? "primary" : "tertiary"
987
+ }, entry.name), /*#__PURE__*/_react.default.createElement(_Typography.Caption1, {
988
+ color: "tertiary",
989
+ className: "block-length",
990
+ tabularNums: true
991
+ }, formatBlockLength(label.end - label.start))), /*#__PURE__*/_react.default.createElement("span", {
992
+ className: "block-detail"
993
+ }, /*#__PURE__*/_react.default.createElement(_Typography.Caption1, {
994
+ color: "secondary",
995
+ className: muted ? "block-time" : "block-time fill-text",
996
+ tabularNums: true
997
+ }, "".concat((0, _agendaGrid.formatTimeOfDay)(dayMinute(label.start)), " \u2013 ").concat((0, _agendaGrid.formatTimeOfDay)(dayMinute(label.end))))));
998
+ };
999
+ PillEventCard.displayName = "PillEventCard";
1000
+
1001
+ /* The All Day row: secondary text on a new_task fill follows the primary
1002
+ one. */
1003
+ var StyledAllDayRow = _styledComponents.default.div.withConfig({
1004
+ displayName: "timeBlocks__StyledAllDayRow",
1005
+ componentId: "sc-qxsot7-4"
1006
+ })([".fill-text{color:color-mix(in srgb,var(--color-theme-900) 80%,transparent);}"]);
1007
+
1008
+ /** All Day pills, new_task (AgendaItemPill with calendarEventPaint): a task
1009
+ is the palette fill with no border; a subtask stays a line with its
1010
+ circle in the palette colour. The unscheduled remainder keeps its own
1011
+ pill. */
1012
+ var renderNewTaskSegment = function renderNewTaskSegment(segment, style) {
1013
+ if (segment.key.startsWith("unscheduled-")) {
1014
+ return renderAllDaySegment(segment, style);
1015
+ }
1016
+ var _paletteOf3 = (0, _pillLook.paletteOf)(segment.color),
1017
+ base = _paletteOf3.base;
1018
+ var className = [segment.kind === "subtask" ? "subtask" : "", segment.completed ? "completed" : "", segment.continuesPrior ? "continues-prior" : "", segment.continuesAfter ? "continues-after" : ""].filter(Boolean).join(" ");
1019
+ if (segment.kind === "subtask") {
1020
+ return /*#__PURE__*/_react.default.createElement(_agendaGrid.StyledPill, {
1021
+ className: className,
1022
+ style: style
1023
+ }, /*#__PURE__*/_react.default.createElement(_Icons.CheckboxCircleBlankIcon, {
1024
+ width: 14,
1025
+ height: 14,
1026
+ style: {
1027
+ fill: base,
1028
+ flexShrink: 0
1029
+ },
1030
+ "aria-hidden": true
1031
+ }), /*#__PURE__*/_react.default.createElement(_Typography.Caption1, {
1032
+ className: "pill-name",
1033
+ decoration: segment.completed ? "line-through" : undefined
1034
+ }, segment.name));
1035
+ }
1036
+ return /*#__PURE__*/_react.default.createElement(_agendaGrid.StyledPill, {
1037
+ className: className || undefined,
1038
+ style: _objectSpread(_objectSpread({}, style), {}, {
1039
+ borderColor: "transparent",
1040
+ backgroundColor: (0, _pillLook.paletteFill)(base),
1041
+ boxShadow: _pillLook.PAPER_RING
1042
+ })
1043
+ }, /*#__PURE__*/_react.default.createElement("span", {
1044
+ className: "pill-lead"
1045
+ }, segment.taskNumber !== undefined ? /*#__PURE__*/_react.default.createElement(_Typography.Caption1, {
1046
+ color: "tertiary",
1047
+ className: "pill-time fill-text"
1048
+ }, "#".concat(segment.taskNumber)) : null, /*#__PURE__*/_react.default.createElement(_Typography.Caption1, {
1049
+ className: "pill-name",
1050
+ color: segment.important ? "alert" : "primary",
1051
+ decoration: segment.completed ? "line-through" : undefined
1052
+ }, segment.name)));
1053
+ };
1054
+ var MINUTES_PER_DAY = 24 * 60;
1055
+
1056
+ /** Minutes after midnight for an absolute minute (any day). */
1057
+ var dayMinute = function dayMinute(minutes) {
1058
+ return (minutes % MINUTES_PER_DAY + MINUTES_PER_DAY) % MINUTES_PER_DAY;
1059
+ };
1060
+
1061
+ /** The day an absolute minute falls on. */
1062
+ var dayOfMinute = function dayOfMinute(minutes) {
1063
+ return Math.floor(minutes / MINUTES_PER_DAY);
1064
+ };
1065
+
1066
+ /** "YYYY-MM-DD" + "HH:mm" on the owner's clock, as minutes since the epoch
1067
+ on the shown clock (the owner's moved by `shift`). */
1068
+ var absoluteMinute = function absoluteMinute(day, clock, shift) {
1069
+ return (0, _agendaGrid.isoToDayNumber)(day) * MINUTES_PER_DAY + (0, _agendaGrid.clockToMinutes)(clock) + shift;
1070
+ };
1071
+
1072
+ /** "29 Oct" — the planned day in the shifted-day tooltip. */
1073
+ var shortDateOf = function shortDateOf(day) {
1074
+ return "".concat((0, _agendaGrid.toDate)(day).getUTCDate(), " ").concat(_agendaGrid.SHORT_MONTHS[(0, _agendaGrid.toDate)(day).getUTCMonth()]);
1075
+ };
1076
+
1077
+ /** One item's part in one day column, in minutes of that day. */
1078
+
1079
+ /** The clock the grid shows: the owner's own, or a viewer's. */
1080
+
1081
+ var OWNER_CLOCK = {
1082
+ shift: 0,
1083
+ ownerClockName: ""
1084
+ };
1085
+ /** The hour grid with events and time blocks; overlapping items sit side by
1086
+ side (only events and pinned blocks can overlap). Items are placed by
1087
+ their absolute time, so on another clock they move between days and an
1088
+ item that crosses midnight is cut into two parts. */
1089
+ var TimeBlockGrid = function TimeBlockGrid(_ref5) {
1090
+ var days = _ref5.days,
1091
+ options = _ref5.options,
1092
+ demo = _ref5.demo,
1093
+ _ref5$clock = _ref5.clock,
1094
+ clock = _ref5$clock === void 0 ? OWNER_CLOCK : _ref5$clock;
1095
+ var scrollRef = (0, _react.useRef)(null);
1096
+ var _useState = (0, _react.useState)(null),
1097
+ _useState2 = _slicedToArray(_useState, 2),
1098
+ hovered = _useState2[0],
1099
+ setHovered = _useState2[1];
1100
+ var _useState3 = (0, _react.useState)(null),
1101
+ _useState4 = _slicedToArray(_useState3, 2),
1102
+ menuBlockId = _useState4[0],
1103
+ setMenuBlockId = _useState4[1];
1104
+ var menuBlock = TIME_BLOCKS.find(function (block) {
1105
+ return block.id === menuBlockId;
1106
+ });
1107
+ /* The task-day whose fragments read as one: hovered, or its menu open. */
1108
+ var linkedKey = hovered !== null && hovered !== void 0 ? hovered : menuBlock ? "".concat(menuBlock.task_id, "-").concat(menuBlock.day) : null;
1109
+ var shift = clock.shift;
1110
+ var now = TODAY_DAY * MINUTES_PER_DAY + NOW_MINUTES + shift;
1111
+ var today = dayOfMinute(now);
1112
+ (0, _react.useEffect)(function () {
1113
+ if (scrollRef.current) {
1114
+ /* An hour before the owner's work window on the shown clock — 08:00
1115
+ on the owner's own (calendar_starting_hours). */
1116
+ scrollRef.current.scrollTop = minuteTop(Math.max(0, dayMinute(WORK_START + shift) - 60));
1117
+ }
1118
+ /* A story's open menu opens once the grid has scrolled, so it lands
1119
+ beside its block. */
1120
+ if ((demo === null || demo === void 0 ? void 0 : demo.menuBlockId) !== undefined) setMenuBlockId(demo.menuBlockId);
1121
+ }, [demo, shift]);
1122
+ var items = [...(options.showEvents ? EVENTS : []).filter(function (event) {
1123
+ return event.starts_on_time !== null && event.ends_on_time !== null;
1124
+ }).map(function (event) {
1125
+ var _event$starts_on_time, _event$ends_on_time;
1126
+ return {
1127
+ kind: "event",
1128
+ entry: eventEntryOf(event),
1129
+ start: absoluteMinute(event.starts_on, (_event$starts_on_time = event.starts_on_time) !== null && _event$starts_on_time !== void 0 ? _event$starts_on_time : "00:00", shift),
1130
+ end: absoluteMinute(event.ends_on, (_event$ends_on_time = event.ends_on_time) !== null && _event$ends_on_time !== void 0 ? _event$ends_on_time : "00:00", shift)
1131
+ };
1132
+ }), ...(options.showTasks ? TIME_BLOCKS : []).filter(function (block) {
1133
+ var _taskOf;
1134
+ var completed = (_taskOf = taskOf(block.task_id)) === null || _taskOf === void 0 ? void 0 : _taskOf.is_completed;
1135
+ /* A completed task keeps its pinned blocks (when Show Completed is
1136
+ on) and loses its suggestions. */
1137
+ if (!completed) return true;
1138
+ return block.type === "pinned" && options.showCompleted;
1139
+ }).map(function (block) {
1140
+ return {
1141
+ kind: "block",
1142
+ block,
1143
+ start: absoluteMinute(block.day, block.starts_at, shift),
1144
+ end: absoluteMinute(block.day, block.ends_at, shift)
1145
+ };
1146
+ })];
1147
+
1148
+ /* The owner's work windows on the shown clock, a day either side of the
1149
+ week so a shifted window still reaches its edge columns. */
1150
+ var workWindows = Array.from({
1151
+ length: days.length + 2
1152
+ }, function (_, index) {
1153
+ return days[0] - 1 + index;
1154
+ }).filter(isWorkingDay).map(function (day) {
1155
+ return {
1156
+ start: day * MINUTES_PER_DAY + WORK_START + shift,
1157
+ end: day * MINUTES_PER_DAY + WORK_END + shift
1158
+ };
1159
+ });
1160
+
1161
+ /** The parts of [from, to) that fall on a day, in minutes of that day. */
1162
+ var clipTo = function clipTo(day, from, to) {
1163
+ var dayStart = day * MINUTES_PER_DAY;
1164
+ var start = Math.max(from, dayStart);
1165
+ var end = Math.min(to, dayStart + MINUTES_PER_DAY);
1166
+ return end > start ? {
1167
+ start: start - dayStart,
1168
+ end: end - dayStart
1169
+ } : null;
1170
+ };
1171
+ return /*#__PURE__*/_react.default.createElement(StyledBlockHourGrid, {
1172
+ ref: scrollRef,
1173
+ className: "hour-grid"
1174
+ }, /*#__PURE__*/_react.default.createElement("div", {
1175
+ className: "time-canvas"
1176
+ }, /*#__PURE__*/_react.default.createElement("div", {
1177
+ className: "time-gutter",
1178
+ style: {
1179
+ width: _agendaGrid.TIME_GUTTER
1180
+ }
1181
+ }, Array.from({
1182
+ length: 23
1183
+ }, function (_, index) {
1184
+ return index + 1;
1185
+ }).map(function (hour) {
1186
+ return /*#__PURE__*/_react.default.createElement(_Typography.Caption1, {
1187
+ color: "secondary",
1188
+ className: "hour-label",
1189
+ key: hour,
1190
+ style: {
1191
+ top: hour * BLOCK_HOUR_HEIGHT
1192
+ }
1193
+ }, (0, _agendaGrid.formatTimeOfDay)(hour * 60));
1194
+ })), /*#__PURE__*/_react.default.createElement("div", {
1195
+ className: "time-columns"
1196
+ }, days.map(function (day) {
1197
+ var resizing = TIME_BLOCKS.find(function (block) {
1198
+ var _demo$resizing;
1199
+ return block.id === (demo === null || demo === void 0 || (_demo$resizing = demo.resizing) === null || _demo$resizing === void 0 ? void 0 : _demo$resizing.blockId);
1200
+ });
1201
+ var classes = ["time-column", day === today ? "today" : "", day < today ? "past" : "", resizing && dayOfMinute(absoluteMinute(resizing.day, resizing.starts_at, shift)) === day ? "reflowing" : "", options.showNonWorking && (0, _agendaGrid.isWeekendDay)(day) ? "non-working" : ""].filter(Boolean).join(" ");
1202
+ /* Off-hours: what the work windows leave of the day, on days
1203
+ they touch at all (a day they miss is a day off, hatched). */
1204
+ var work = workWindows.map(function (window) {
1205
+ return clipTo(day, window.start, window.end);
1206
+ }).filter(function (part) {
1207
+ return Boolean(part);
1208
+ }).sort(function (a, b) {
1209
+ return a.start - b.start;
1210
+ });
1211
+ var offHours = [];
1212
+ if (work.length > 0) {
1213
+ var cursor = 0;
1214
+ work.forEach(function (part) {
1215
+ if (part.start > cursor) {
1216
+ offHours.push({
1217
+ start: cursor,
1218
+ end: part.start
1219
+ });
1220
+ }
1221
+ cursor = Math.max(cursor, part.end);
1222
+ });
1223
+ if (cursor < MINUTES_PER_DAY) {
1224
+ offHours.push({
1225
+ start: cursor,
1226
+ end: MINUTES_PER_DAY
1227
+ });
1228
+ }
1229
+ }
1230
+ var dayStart = day * MINUTES_PER_DAY;
1231
+ var parts = items.flatMap(function (item) {
1232
+ var part = clipTo(day, item.start, item.end);
1233
+ return part ? [_objectSpread(_objectSpread({
1234
+ item
1235
+ }, part), {}, {
1236
+ continuesBefore: item.start < dayStart,
1237
+ continuesAfter: item.end > dayStart + MINUTES_PER_DAY
1238
+ })] : [];
1239
+ });
1240
+ return /*#__PURE__*/_react.default.createElement("div", {
1241
+ className: classes,
1242
+ key: day
1243
+ }, offHours.map(function (part) {
1244
+ return /*#__PURE__*/_react.default.createElement("span", {
1245
+ className: "off-hours",
1246
+ key: part.start,
1247
+ style: {
1248
+ top: minuteTop(part.start),
1249
+ height: minuteTop(part.end - part.start)
1250
+ }
1251
+ });
1252
+ }), /*#__PURE__*/_react.default.createElement("span", {
1253
+ className: "slot-lines"
1254
+ }), (0, _agendaGrid.placeSideBySide)(parts, function (part) {
1255
+ return part.start;
1256
+ }, function (part) {
1257
+ return part.end;
1258
+ }).map(function (_ref6) {
1259
+ var _demo$resizing2;
1260
+ var part = _ref6.item,
1261
+ column = _ref6.column,
1262
+ columns = _ref6.columns;
1263
+ var placement = {
1264
+ top: minuteTop(part.start),
1265
+ left: "calc(".concat((0, _agendaGrid.percentOf)(column, columns), " + 2px)"),
1266
+ width: "calc(".concat((0, _agendaGrid.percentOf)(1, columns), " - 4px)")
1267
+ };
1268
+ var item = part.item;
1269
+ if (item.kind === "event") {
1270
+ var height = Math.max(minuteTop(part.end - part.start), 20);
1271
+ return /*#__PURE__*/_react.default.createElement(PillEventCard, {
1272
+ key: "".concat(item.entry.key, "-").concat(day),
1273
+ entry: item.entry,
1274
+ label: {
1275
+ start: item.start,
1276
+ end: item.end
1277
+ },
1278
+ continuesBefore: part.continuesBefore,
1279
+ continuesAfter: part.continuesAfter,
1280
+ style: _objectSpread(_objectSpread({}, placement), {}, {
1281
+ height
1282
+ })
1283
+ });
1284
+ }
1285
+ var block = item.block;
1286
+ var linkKey = "".concat(block.task_id, "-").concat(block.day);
1287
+ /* The layout keeps the block's saved length while it is
1288
+ dragged; the block itself draws the new one on top. */
1289
+ var resizedEnd = (demo === null || demo === void 0 || (_demo$resizing2 = demo.resizing) === null || _demo$resizing2 === void 0 ? void 0 : _demo$resizing2.blockId) === block.id ? absoluteMinute(block.day, demo.resizing.endsAt, shift) - dayStart : undefined;
1290
+ var plannedDay = (0, _agendaGrid.isoToDayNumber)(block.day);
1291
+ var shiftedFrom = shift !== 0 && block.type === "pinned" && dayOfMinute(item.start) !== plannedDay ? "Planned for ".concat(shortDateOf(plannedDay), " in ").concat(clock.ownerClockName) : undefined;
1292
+ return /*#__PURE__*/_react.default.createElement(PillBlockCard, {
1293
+ key: "".concat(block.id, "-").concat(day),
1294
+ block: block,
1295
+ style: placement,
1296
+ start: part.start,
1297
+ end: part.end,
1298
+ label: {
1299
+ start: item.start,
1300
+ end: item.end
1301
+ },
1302
+ continuesBefore: part.continuesBefore,
1303
+ continuesAfter: part.continuesAfter,
1304
+ shiftedFrom: shiftedFrom,
1305
+ linked: linkedKey === linkKey,
1306
+ onHover: setHovered,
1307
+ showTaskIds: options.showTaskIds,
1308
+ menuOpen: menuBlockId === block.id,
1309
+ onMenuOpen: function onMenuOpen() {
1310
+ return setMenuBlockId(block.id);
1311
+ },
1312
+ onMenuClose: function onMenuClose() {
1313
+ return setMenuBlockId(null);
1314
+ },
1315
+ resizedEnd: resizedEnd
1316
+ });
1317
+ }), day === today ? /*#__PURE__*/_react.default.createElement("span", {
1318
+ className: "now-line",
1319
+ style: {
1320
+ top: minuteTop(dayMinute(now))
1321
+ }
1322
+ }) : null);
1323
+ }))));
1324
+ };
1325
+ TimeBlockGrid.displayName = "TimeBlockGrid";
1326
+
1327
+ /** The All Day row keeps what has no time block: tasks without an estimate,
1328
+ subtasks, and the part of a day's allocation that did not fit. */
1329
+ var allDayEntriesFor = function allDayEntriesFor(options) {
1330
+ if (!options.showTasks) return [];
1331
+ var entries = [];
1332
+ TASKS.filter(function (task) {
1333
+ return task.estimate === null;
1334
+ }).forEach(function (task) {
1335
+ var _projectOf$color, _projectOf;
1336
+ if (task.is_completed && !options.showCompleted) return;
1337
+ entries.push({
1338
+ key: "task-".concat(task.id),
1339
+ kind: "task",
1340
+ name: task.name,
1341
+ startDay: (0, _agendaGrid.isoToDayNumber)(task.start_on),
1342
+ endDay: (0, _agendaGrid.isoToDayNumber)(task.due_on),
1343
+ color: (_projectOf$color = (_projectOf = projectOf(task.project_id)) === null || _projectOf === void 0 ? void 0 : _projectOf.color) !== null && _projectOf$color !== void 0 ? _projectOf$color : "",
1344
+ completed: task.is_completed,
1345
+ important: task.is_important,
1346
+ participant: true,
1347
+ taskNumber: task.id
1348
+ });
1349
+ });
1350
+ if (options.showSubtasks) {
1351
+ SUBTASKS.forEach(function (subtask) {
1352
+ var _projectOf$color2, _projectOf2;
1353
+ if (subtask.is_completed && !options.showCompleted) return;
1354
+ var parent = taskOf(subtask.task_id);
1355
+ entries.push({
1356
+ key: "subtask-".concat(subtask.id),
1357
+ kind: "subtask",
1358
+ name: subtask.name,
1359
+ startDay: (0, _agendaGrid.isoToDayNumber)(subtask.due_on),
1360
+ endDay: (0, _agendaGrid.isoToDayNumber)(subtask.due_on),
1361
+ color: parent ? (_projectOf$color2 = (_projectOf2 = projectOf(parent.project_id)) === null || _projectOf2 === void 0 ? void 0 : _projectOf2.color) !== null && _projectOf$color2 !== void 0 ? _projectOf$color2 : "" : "",
1362
+ completed: subtask.is_completed,
1363
+ important: false,
1364
+ participant: true
1365
+ });
1366
+ });
1367
+ }
1368
+ DAY_SCHEDULES.forEach(function (schedule) {
1369
+ return schedule.unscheduled.forEach(function (rest) {
1370
+ var task = taskOf(rest.task_id);
1371
+ if (!task) return;
1372
+ entries.push({
1373
+ /* The key marks the remainder for renderSegment. */
1374
+ key: "unscheduled-".concat(rest.task_id, "-").concat(schedule.day),
1375
+ kind: "task",
1376
+ name: "".concat(task.name, " \xB7 ").concat(formatHours(rest.minutes), " unscheduled"),
1377
+ startDay: (0, _agendaGrid.isoToDayNumber)(schedule.day),
1378
+ endDay: (0, _agendaGrid.isoToDayNumber)(schedule.day),
1379
+ color: "",
1380
+ completed: false,
1381
+ important: false,
1382
+ participant: true,
1383
+ taskNumber: task.id
1384
+ });
1385
+ });
1386
+ });
1387
+ return entries;
1388
+ };
1389
+ var renderAllDaySegment = function renderAllDaySegment(segment, style) {
1390
+ if (!segment.key.startsWith("unscheduled-")) return null;
1391
+ return /*#__PURE__*/_react.default.createElement(_Tooltip.Tooltip, {
1392
+ title: "Didn't fit into this day's free time"
1393
+ }, /*#__PURE__*/_react.default.createElement(StyledUnscheduledPill, {
1394
+ style: style
1395
+ }, /*#__PURE__*/_react.default.createElement(_Icons.WarningTriangleSmallIcon, {
1396
+ width: 12,
1397
+ height: 12,
1398
+ style: {
1399
+ fill: "var(--red-alert)",
1400
+ flexShrink: 0
1401
+ },
1402
+ "aria-hidden": true
1403
+ }), /*#__PURE__*/_react.default.createElement(_Typography.Caption1, {
1404
+ color: "alert",
1405
+ className: "pill-name"
1406
+ }, segment.name)));
1407
+ };
1408
+
1409
+ /* ================================================================== */
1410
+ /* Day list */
1411
+ /* ================================================================== */
1412
+
1413
+ /** The task as the Tasks tab's row reads it (day numbers for dates). */
1414
+ var listTaskOf = function listTaskOf(task) {
1415
+ var _task$estimate;
1416
+ return {
1417
+ id: task.id,
1418
+ project_id: task.project_id,
1419
+ task_list_id: 0,
1420
+ name: task.name,
1421
+ start_on: (0, _agendaGrid.isoToDayNumber)(task.start_on),
1422
+ due_on: (0, _agendaGrid.isoToDayNumber)(task.due_on),
1423
+ label_ids: [],
1424
+ is_important: task.is_important,
1425
+ is_completed: task.is_completed,
1426
+ estimate: (_task$estimate = task.estimate) !== null && _task$estimate !== void 0 ? _task$estimate : undefined
1427
+ };
1428
+ };
1429
+
1430
+ /** The day's tasks and subtasks per project, in My Work project order. */
1431
+ var dayGroupsFor = function dayGroupsFor(day, options, completedKeys) {
1432
+ return PROJECTS.map(function (project) {
1433
+ var tasks = TASKS.filter(function (task) {
1434
+ return task.project_id === project.id && (0, _agendaGrid.isoToDayNumber)(task.start_on) <= day && (0, _agendaGrid.isoToDayNumber)(task.due_on) >= day;
1435
+ }).map(function (task) {
1436
+ return {
1437
+ kind: "task",
1438
+ key: "task-".concat(task.id),
1439
+ task: listTaskOf(task)
1440
+ };
1441
+ });
1442
+ var subtasks = options.showSubtasks ? SUBTASKS.filter(function (subtask) {
1443
+ var _taskOf2;
1444
+ return (0, _agendaGrid.isoToDayNumber)(subtask.due_on) === day && ((_taskOf2 = taskOf(subtask.task_id)) === null || _taskOf2 === void 0 ? void 0 : _taskOf2.project_id) === project.id;
1445
+ }).flatMap(function (subtask) {
1446
+ var parent = taskOf(subtask.task_id);
1447
+ return parent ? [{
1448
+ kind: "subtask",
1449
+ key: "subtask-".concat(subtask.id),
1450
+ subtask: {
1451
+ id: subtask.id,
1452
+ task_id: subtask.task_id,
1453
+ name: subtask.name,
1454
+ due_on: (0, _agendaGrid.isoToDayNumber)(subtask.due_on),
1455
+ is_completed: subtask.is_completed
1456
+ },
1457
+ task: listTaskOf(parent)
1458
+ }] : [];
1459
+ }) : [];
1460
+ /* Completed now: the payload's state, flipped by a click in the list. */
1461
+ var rows = [...tasks, ...subtasks].filter(function (row) {
1462
+ return options.showCompleted || Boolean(row.kind === "task" ? row.task.is_completed : row.subtask.is_completed) === completedKeys.has(row.key);
1463
+ });
1464
+ return {
1465
+ project,
1466
+ rows
1467
+ };
1468
+ }).filter(function (group) {
1469
+ return group.rows.length > 0;
1470
+ });
1471
+ };
1472
+
1473
+ /** Whether the task has time on the day: blocks or an allocation. Tasks
1474
+ without an estimate and subtasks have neither and keep one line. */
1475
+ var hasDayPlan = function hasDayPlan(taskId, day) {
1476
+ return TIME_BLOCKS.some(function (block) {
1477
+ return block.task_id === taskId && (0, _agendaGrid.isoToDayNumber)(block.day) === day;
1478
+ }) || ALLOCATIONS.some(function (item) {
1479
+ return item.task_id === taskId && (0, _agendaGrid.isoToDayNumber)(item.day) === day;
1480
+ });
1481
+ };
1482
+
1483
+ /**
1484
+ * A row's second line: when the task's work happens today and what is left
1485
+ * for later days. "09:30 AM – 10:30 AM · pinned", "3 suggested blocks · 2h",
1486
+ * "1h left after today".
1487
+ */
1488
+ var DayBlocksLine = function DayBlocksLine(_ref7) {
1489
+ var _projectOf$color3, _projectOf3, _taskOf$project_id, _taskOf3;
1490
+ var taskId = _ref7.taskId,
1491
+ day = _ref7.day;
1492
+ var blocks = TIME_BLOCKS.filter(function (block) {
1493
+ return block.task_id === taskId && (0, _agendaGrid.isoToDayNumber)(block.day) === day;
1494
+ });
1495
+ var allocation = ALLOCATIONS.find(function (item) {
1496
+ return item.task_id === taskId && (0, _agendaGrid.isoToDayNumber)(item.day) === day;
1497
+ });
1498
+ var color = (_projectOf$color3 = (_projectOf3 = projectOf((_taskOf$project_id = (_taskOf3 = taskOf(taskId)) === null || _taskOf3 === void 0 ? void 0 : _taskOf3.project_id) !== null && _taskOf$project_id !== void 0 ? _taskOf$project_id : 0)) === null || _projectOf3 === void 0 ? void 0 : _projectOf3.color) !== null && _projectOf$color3 !== void 0 ? _projectOf$color3 : "";
1499
+ var pinned = blocks.filter(function (block) {
1500
+ return block.type === "pinned";
1501
+ });
1502
+ var suggested = blocks.filter(function (block) {
1503
+ return block.type === "suggested";
1504
+ });
1505
+ var suggestedMinutes = suggested.reduce(function (sum, block) {
1506
+ return sum + (0, _agendaGrid.clockToMinutes)(block.ends_at) - (0, _agendaGrid.clockToMinutes)(block.starts_at);
1507
+ }, 0);
1508
+ var timeOf = function timeOf(block) {
1509
+ return "".concat((0, _agendaGrid.formatTimeOfDay)((0, _agendaGrid.clockToMinutes)(block.starts_at)), " \u2013 ").concat((0, _agendaGrid.formatTimeOfDay)((0, _agendaGrid.clockToMinutes)(block.ends_at)));
1510
+ };
1511
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, pinned.map(function (block) {
1512
+ return /*#__PURE__*/_react.default.createElement("span", {
1513
+ className: "block-part",
1514
+ key: block.id
1515
+ }, /*#__PURE__*/_react.default.createElement(_Icons.PinSmallIcon, {
1516
+ width: 12,
1517
+ height: 12,
1518
+ style: {
1519
+ fill: color,
1520
+ flexShrink: 0
1521
+ },
1522
+ "aria-hidden": true
1523
+ }), /*#__PURE__*/_react.default.createElement(_Typography.Caption1, {
1524
+ color: "secondary"
1525
+ }, "".concat(timeOf(block), " \xB7 pinned")));
1526
+ }), suggested.length > 0 ? /*#__PURE__*/_react.default.createElement(_Tooltip.Tooltip, {
1527
+ title: suggested.map(timeOf).join(", ")
1528
+ }, /*#__PURE__*/_react.default.createElement("span", {
1529
+ className: "block-part"
1530
+ }, /*#__PURE__*/_react.default.createElement(_Icons.SparkIcon, {
1531
+ width: 12,
1532
+ height: 12,
1533
+ style: {
1534
+ fill: color,
1535
+ flexShrink: 0
1536
+ },
1537
+ "aria-hidden": true
1538
+ }), /*#__PURE__*/_react.default.createElement(_Typography.Caption1, {
1539
+ color: "secondary"
1540
+ }, "".concat(suggested.length, " suggested ").concat(suggested.length === 1 ? "block" : "blocks", " \xB7 ").concat(formatHours(suggestedMinutes))))) : null, allocation && allocation.left_after_day > 0 ? /*#__PURE__*/_react.default.createElement(_Typography.Caption1, {
1541
+ color: "tertiary",
1542
+ className: "block-part"
1543
+ }, "".concat(formatHours(allocation.left_after_day), " left after today")) : null);
1544
+ };
1545
+ DayBlocksLine.displayName = "DayBlocksLine";
1546
+
1547
+ /* The second line's parts, a dot between them (the list's signifier dot). */
1548
+ var StyledDayAgenda = _styledComponents.default.div.withConfig({
1549
+ displayName: "timeBlocks__StyledDayAgenda",
1550
+ componentId: "sc-qxsot7-5"
1551
+ })([".block-part{display:inline-flex;align-items:center;gap:4px;min-width:0;white-space:nowrap;}.block-part + .block-part::before{content:\"\";flex-shrink:0;width:2px;height:2px;margin:0 4px 0 2px;border-radius:100%;background-color:var(--color-theme-600);}"]);
1552
+
1553
+ /* ================================================================== */
1554
+ /* The page */
1555
+ /* ================================================================== */
1556
+
1557
+ var weekendShownFor = function weekendShownFor(options) {
1558
+ return function (day) {
1559
+ return options.showNonWorking && (0, _agendaGrid.isWeekendDay)(day);
1560
+ };
1561
+ };
1562
+ /** Header, All Day row and hour grid for the days shown (7 or 1). */
1563
+ var BlockDays = function BlockDays(_ref8) {
1564
+ var days = _ref8.days,
1565
+ options = _ref8.options,
1566
+ demo = _ref8.demo,
1567
+ clock = _ref8.clock;
1568
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_agendaGrid.DatedHeaders, {
1569
+ days: days,
1570
+ today: TODAY_DAY,
1571
+ isNonWorking: weekendShownFor(options),
1572
+ renderBar: function renderBar(day) {
1573
+ return /*#__PURE__*/_react.default.createElement(DayCapacityBar, {
1574
+ day: day
1575
+ });
1576
+ }
1577
+ }), /*#__PURE__*/_react.default.createElement(StyledAllDayRow, null, /*#__PURE__*/_react.default.createElement(_agendaGrid.LaneRow, {
1578
+ className: "all-day-row",
1579
+ days: days,
1580
+ entries: allDayEntriesFor(options),
1581
+ today: TODAY_DAY,
1582
+ isNonWorking: weekendShownFor(options),
1583
+ gutterWidth: _agendaGrid.TIME_GUTTER,
1584
+ gutter: /*#__PURE__*/_react.default.createElement(_Typography.Caption1, {
1585
+ color: "secondary"
1586
+ }, "All Day"),
1587
+ showTaskIds: options.showTaskIds,
1588
+ maxLanes: _agendaGrid.ALL_DAY_VISIBLE_LANES,
1589
+ renderSegment: renderNewTaskSegment
1590
+ })), /*#__PURE__*/_react.default.createElement(TimeBlockGrid, {
1591
+ days: days,
1592
+ options: options,
1593
+ demo: demo,
1594
+ clock: clock
1595
+ }));
1596
+ };
1597
+ BlockDays.displayName = "BlockDays";
1598
+
1599
+ /** The timezone states: a teammate viewing the schedule, or the owner
1600
+ after moving to another timezone. */
1601
+
1602
+ /* The toolbar's timezone note and "Show in my time" switch, before the
1603
+ options gear. */
1604
+ var StyledTimezoneControl = _styledComponents.default.div.withConfig({
1605
+ displayName: "timeBlocks__StyledTimezoneControl",
1606
+ componentId: "sc-qxsot7-6"
1607
+ })(["display:flex;align-items:center;gap:8px;margin-right:12px;white-space:nowrap;.c-label{cursor:pointer;}.timezone-divider{width:1px;height:16px;background-color:var(--color-theme-300);}"]);
1608
+
1609
+ /* The timezone-change notice: under the toolbar, inset from the paper. */
1610
+ var StyledTimezoneBanner = _styledComponents.default.div.withConfig({
1611
+ displayName: "timeBlocks__StyledTimezoneBanner",
1612
+ componentId: "sc-qxsot7-7"
1613
+ })(["flex-shrink:0;padding:12px 12px 0;.banner-actions{display:flex;align-items:center;gap:4px;}"]);
1614
+ var AgendaBody = function AgendaBody(_ref9) {
1615
+ var view = _ref9.view,
1616
+ tasks = _ref9.tasks,
1617
+ demo = _ref9.demo,
1618
+ timezone = _ref9.timezone;
1619
+ var _useState5 = (0, _react.useState)((timezone === null || timezone === void 0 ? void 0 : timezone.kind) === "viewer" && timezone.showInViewerTime),
1620
+ _useState6 = _slicedToArray(_useState5, 2),
1621
+ showInViewerTime = _useState6[0],
1622
+ setShowInViewerTime = _useState6[1];
1623
+ var _useState7 = (0, _react.useState)((timezone === null || timezone === void 0 ? void 0 : timezone.kind) === "changed"),
1624
+ _useState8 = _slicedToArray(_useState7, 2),
1625
+ bannerOpen = _useState8[0],
1626
+ setBannerOpen = _useState8[1];
1627
+ var viewer = (timezone === null || timezone === void 0 ? void 0 : timezone.kind) === "viewer" ? timezone.viewer : undefined;
1628
+ var clock = viewer && showInViewerTime ? {
1629
+ shift: viewer.utc_offset - OWNER.utc_offset,
1630
+ ownerClockName: "".concat(OWNER.first_name, "'s time (").concat(OWNER.timezone_abbr, ")")
1631
+ } : undefined;
1632
+ var _useState9 = (0, _react.useState)({
1633
+ showTasks: true,
1634
+ showEvents: true,
1635
+ showCompleted: true,
1636
+ showSubtasks: true,
1637
+ showNonWorking: true,
1638
+ showWeekNumbers: true,
1639
+ showTaskIds: true
1640
+ }),
1641
+ _useState0 = _slicedToArray(_useState9, 2),
1642
+ options = _useState0[0],
1643
+ setOptions = _useState0[1];
1644
+ var toggleOption = (0, _react.useCallback)(function (key) {
1645
+ return setOptions(function (previous) {
1646
+ return _objectSpread(_objectSpread({}, previous), {}, {
1647
+ [key]: !previous[key]
1648
+ });
1649
+ });
1650
+ }, []);
1651
+ /* The day view holds the viewport's height; its sides scroll. */
1652
+ var paperRef = (0, _react.useRef)(null);
1653
+ var fillHeight = (0, _agendaGrid.useViewportFillHeight)(paperRef, view === "day");
1654
+ var dayGrid = (0, _shared.useResizableWidth)({
1655
+ min: _agendaGrid.DAY_GRID_MIN_WIDTH,
1656
+ max: _agendaGrid.DAY_GRID_MAX_WIDTH,
1657
+ storageKey: _agendaGrid.DAY_GRID_WIDTH_STORAGE_KEY
1658
+ });
1659
+ var dayGroups = (0, _react.useMemo)(function () {
1660
+ return dayGroupsFor(TODAY_DAY, options, tasks.completed);
1661
+ }, [options, tasks.completed]);
1662
+ var step = view === "day" ? 1 : 7;
1663
+ return /*#__PURE__*/_react.default.createElement(_agendaGrid.StyledMyCalendarPaper, {
1664
+ type: "paper-2",
1665
+ ref: paperRef,
1666
+ className: fillHeight === null ? undefined : "fill-height",
1667
+ style: fillHeight === null ? undefined : {
1668
+ "--fill-height": "".concat(fillHeight, "px")
1669
+ }
1670
+ }, /*#__PURE__*/_react.default.createElement(_agendaGrid.StyledMyCalendarToolbar, null, /*#__PURE__*/_react.default.createElement(_Tooltip.Tooltip, {
1671
+ title: (0, _agendaGrid.periodLabelFor)(view, TODAY_DAY - step)
1672
+ }, /*#__PURE__*/_react.default.createElement(_IconButton.IconButton, {
1673
+ type: "button",
1674
+ size: "small",
1675
+ variant: "text gray",
1676
+ "aria-label": view === "day" ? "Previous Day" : "Previous Week"
1677
+ }, /*#__PURE__*/_react.default.createElement(_Icons.ArrowLeftIcon, null))), /*#__PURE__*/_react.default.createElement(_Tooltip.Tooltip, {
1678
+ title: (0, _agendaGrid.periodLabelFor)(view, TODAY_DAY + step)
1679
+ }, /*#__PURE__*/_react.default.createElement(_IconButton.IconButton, {
1680
+ type: "button",
1681
+ size: "small",
1682
+ variant: "text gray",
1683
+ "aria-label": view === "day" ? "Next Day" : "Next Week"
1684
+ }, /*#__PURE__*/_react.default.createElement(_Icons.ArrowRightIcon, null))), /*#__PURE__*/_react.default.createElement(_Typography.Body2, {
1685
+ weight: "bold",
1686
+ className: "period-label"
1687
+ }, (0, _agendaGrid.periodLabelFor)(view, TODAY_DAY)), /*#__PURE__*/_react.default.createElement("span", {
1688
+ className: "toolbar-spacer"
1689
+ }), viewer ? /*#__PURE__*/_react.default.createElement(StyledTimezoneControl, null, /*#__PURE__*/_react.default.createElement(_Typography.Caption1, {
1690
+ color: "secondary"
1691
+ }, showInViewerTime ? "Times shown in your timezone (".concat(viewer.timezone_abbr, ")") : "Times shown in ".concat(OWNER.first_name, "'s timezone (").concat(OWNER.timezone_abbr, ")")), /*#__PURE__*/_react.default.createElement("span", {
1692
+ className: "timezone-divider"
1693
+ }), /*#__PURE__*/_react.default.createElement(_Label.Label, {
1694
+ htmlFor: "show-in-my-time",
1695
+ weight: "regular"
1696
+ }, /*#__PURE__*/_react.default.createElement(_Typography.Caption1, null, "Show in my time")), /*#__PURE__*/_react.default.createElement(_Toggle.Toggle, {
1697
+ id: "show-in-my-time",
1698
+ size: "small",
1699
+ defaultChecked: showInViewerTime,
1700
+ onChange: function onChange(event) {
1701
+ return setShowInViewerTime(event.target.checked);
1702
+ }
1703
+ })) : null, /*#__PURE__*/_react.default.createElement(_agendaGrid.MyCalendarOptionsMenu, {
1704
+ options: options,
1705
+ onToggle: toggleOption
1706
+ })), (timezone === null || timezone === void 0 ? void 0 : timezone.kind) === "changed" && bannerOpen ? /*#__PURE__*/_react.default.createElement(StyledTimezoneBanner, null, /*#__PURE__*/_react.default.createElement(_InfoBox.InfoBox, {
1707
+ type: "note",
1708
+ showIcon: true,
1709
+ title: "".concat(timezone.change.pinned_blocks_in_previous_timezone, " pinned blocks were planned in ").concat(timezone.change.previous_timezone_abbr),
1710
+ action: /*#__PURE__*/_react.default.createElement("span", {
1711
+ className: "banner-actions"
1712
+ }, /*#__PURE__*/_react.default.createElement(_Button.Button, {
1713
+ variant: "text colored",
1714
+ size: "small",
1715
+ onClick: function onClick() {
1716
+ return setBannerOpen(false);
1717
+ }
1718
+ }, "Move to current timezone"), /*#__PURE__*/_react.default.createElement(_Tooltip.Tooltip, {
1719
+ title: "Dismiss"
1720
+ }, /*#__PURE__*/_react.default.createElement(_IconButton.IconButton, {
1721
+ type: "button",
1722
+ size: "small",
1723
+ variant: "text gray",
1724
+ "aria-label": "Dismiss",
1725
+ onClick: function onClick() {
1726
+ return setBannerOpen(false);
1727
+ }
1728
+ }, /*#__PURE__*/_react.default.createElement(_Icons.CancelCrossIcon, null))))
1729
+ }, /*#__PURE__*/_react.default.createElement(_Typography.Body2, {
1730
+ color: "secondary"
1731
+ }, "You're on ".concat(timezone.change.current_timezone_abbr, " now. They keep their ").concat(timezone.change.previous_timezone_abbr, " times until you move them.")))) : null, view === "week" ? /*#__PURE__*/_react.default.createElement(BlockDays, {
1732
+ days: WEEK_DAYS,
1733
+ options: options,
1734
+ clock: clock
1735
+ }) : /*#__PURE__*/_react.default.createElement(_agendaGrid.StyledDaySplit, {
1736
+ style: dayGrid.width === null ? undefined : {
1737
+ "--day-grid-width": "".concat(dayGrid.width, "px")
1738
+ }
1739
+ }, /*#__PURE__*/_react.default.createElement("div", {
1740
+ className: "day-grid"
1741
+ }, /*#__PURE__*/_react.default.createElement(BlockDays, {
1742
+ days: [TODAY_DAY],
1743
+ options: options,
1744
+ demo: demo,
1745
+ clock: clock
1746
+ }), /*#__PURE__*/_react.default.createElement(_shared.StyledPanelResizer, {
1747
+ role: "separator",
1748
+ "aria-label": "Resize calendar",
1749
+ "aria-orientation": "vertical",
1750
+ className: dayGrid.resizing ? "day-resizer resizing" : "day-resizer",
1751
+ onPointerDown: dayGrid.startResize
1752
+ })), /*#__PURE__*/_react.default.createElement(StyledDayAgenda, {
1753
+ className: "day-agenda"
1754
+ }, /*#__PURE__*/_react.default.createElement("div", {
1755
+ className: "agenda-header"
1756
+ }, /*#__PURE__*/_react.default.createElement(_Typography.Header3, null, "Tasks"), /*#__PURE__*/_react.default.createElement(_Tooltip.Tooltip, {
1757
+ title: "Add Task"
1758
+ }, /*#__PURE__*/_react.default.createElement(_IconButton.IconButton, {
1759
+ size: "small",
1760
+ variant: "text gray",
1761
+ "aria-label": "Add Task"
1762
+ }, /*#__PURE__*/_react.default.createElement(_Icons.AddCrossTinyIcon, null)))), /*#__PURE__*/_react.default.createElement(_MyWorkTasks.DayProjectList, {
1763
+ groups: dayGroups,
1764
+ state: tasks,
1765
+ empty: /*#__PURE__*/_react.default.createElement(_Typography.Body2, {
1766
+ color: "tertiary"
1767
+ }, "No tasks on this day."),
1768
+ extraFor: function extraFor(row) {
1769
+ return row.kind === "task" && hasDayPlan(row.task.id, TODAY_DAY) ? /*#__PURE__*/_react.default.createElement(DayBlocksLine, {
1770
+ taskId: row.task.id,
1771
+ day: TODAY_DAY
1772
+ }) : null;
1773
+ }
1774
+ }))));
1775
+ };
1776
+ AgendaBody.displayName = "AgendaBody";
1777
+ var TimeBlocksPage = function TimeBlocksPage(_ref0) {
1778
+ var initialView = _ref0.initialView,
1779
+ demo = _ref0.demo,
1780
+ timezone = _ref0.timezone;
1781
+ var tasks = (0, _MyWorkTasks.useMyWorkTasks)();
1782
+ var _useState1 = (0, _react.useState)(initialView),
1783
+ _useState10 = _slicedToArray(_useState1, 2),
1784
+ view = _useState10[0],
1785
+ setView = _useState10[1];
1786
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_agendaGrid.MyWorkTabs, {
1787
+ active: "agenda",
1788
+ onSelect: function onSelect() {
1789
+ return undefined;
1790
+ },
1791
+ tasksCount: tasks.openCount,
1792
+ controls: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_agendaGrid.AgendaFilter, null), /*#__PURE__*/_react.default.createElement(_agendaGrid.AgendaViewSwitch, {
1793
+ view: view,
1794
+ onChange: function onChange(next) {
1795
+ if (next === "week" || next === "day") setView(next);
1796
+ }
1797
+ }))
1798
+ }), /*#__PURE__*/_react.default.createElement(AgendaBody, {
1799
+ view: view,
1800
+ tasks: tasks,
1801
+ demo: demo,
1802
+ timezone: timezone
1803
+ }));
1804
+ };
1805
+ TimeBlocksPage.displayName = "TimeBlocksPage";
1806
+
1807
+ /** My Work's page header: the title and the add menu (MyWorkPageShell). */
1808
+ var MY_WORK_HEADER = /*#__PURE__*/_react.default.createElement(_shared.PageHeader, {
1809
+ title: "My Work"
1810
+ }, /*#__PURE__*/_react.default.createElement(_MyWorkTasks.MyWorkAddMenu, null));
1811
+ var WeekView = exports.WeekView = function WeekView() {
1812
+ return /*#__PURE__*/_react.default.createElement(_shared.PresentationShell, {
1813
+ header: MY_WORK_HEADER,
1814
+ floating: /*#__PURE__*/_react.default.createElement(_shared.FloatingControls, null),
1815
+ activeMenuItem: "My Work"
1816
+ }, /*#__PURE__*/_react.default.createElement(TimeBlocksPage, {
1817
+ initialView: "week"
1818
+ }));
1819
+ };
1820
+ var DayView = exports.DayView = function DayView() {
1821
+ return /*#__PURE__*/_react.default.createElement(_shared.PresentationShell, {
1822
+ header: MY_WORK_HEADER,
1823
+ floating: /*#__PURE__*/_react.default.createElement(_shared.FloatingControls, null),
1824
+ activeMenuItem: "My Work"
1825
+ }, /*#__PURE__*/_react.default.createElement(TimeBlocksPage, {
1826
+ initialView: "day"
1827
+ }));
1828
+ };
1829
+
1830
+ /* Block interactions: static states on Thursday's day view, where blocks
1831
+ are wide. Hover "…" on any block for the same menus. */
1832
+
1833
+ /** Thursday's blocks (TIME_BLOCKS ids) the stories open on. */
1834
+ var THURSDAY_BLOCK_IDS = {
1835
+ campaignBrief2of3: 11,
1836
+ paginationSpec: 12,
1837
+ homepageWireframes: 10
1838
+ };
1839
+ var SuggestedBlockMenu = exports.SuggestedBlockMenu = function SuggestedBlockMenu() {
1840
+ return /*#__PURE__*/_react.default.createElement(_shared.PresentationShell, {
1841
+ header: MY_WORK_HEADER,
1842
+ floating: /*#__PURE__*/_react.default.createElement(_shared.FloatingControls, null),
1843
+ activeMenuItem: "My Work"
1844
+ }, /*#__PURE__*/_react.default.createElement(TimeBlocksPage, {
1845
+ initialView: "day",
1846
+ demo: {
1847
+ menuBlockId: THURSDAY_BLOCK_IDS.campaignBrief2of3
1848
+ }
1849
+ }));
1850
+ };
1851
+ var PinnedBlockMenu = exports.PinnedBlockMenu = function PinnedBlockMenu() {
1852
+ return /*#__PURE__*/_react.default.createElement(_shared.PresentationShell, {
1853
+ header: MY_WORK_HEADER,
1854
+ floating: /*#__PURE__*/_react.default.createElement(_shared.FloatingControls, null),
1855
+ activeMenuItem: "My Work"
1856
+ }, /*#__PURE__*/_react.default.createElement(TimeBlocksPage, {
1857
+ initialView: "day",
1858
+ demo: {
1859
+ menuBlockId: THURSDAY_BLOCK_IDS.paginationSpec
1860
+ }
1861
+ }));
1862
+ };
1863
+ var ResizingPinnedBlock = exports.ResizingPinnedBlock = function ResizingPinnedBlock() {
1864
+ return /*#__PURE__*/_react.default.createElement(_shared.PresentationShell, {
1865
+ header: MY_WORK_HEADER,
1866
+ floating: /*#__PURE__*/_react.default.createElement(_shared.FloatingControls, null),
1867
+ activeMenuItem: "My Work"
1868
+ }, /*#__PURE__*/_react.default.createElement(TimeBlocksPage, {
1869
+ initialView: "day",
1870
+ demo: {
1871
+ resizing: {
1872
+ blockId: THURSDAY_BLOCK_IDS.homepageWireframes,
1873
+ endsAt: "10:45"
1874
+ }
1875
+ }
1876
+ }));
1877
+ };
1878
+
1879
+ /* Timezones. A teammate (Ana, Honolulu) views Marko's schedule: times are
1880
+ Marko's (CET) until she switches "Show in my time"; then every item moves
1881
+ eleven hours back, and a pinned block that lands on another day carries
1882
+ the clock icon and the day it was planned for. */
1883
+ var SomeoneElsesSchedule = exports.SomeoneElsesSchedule = function SomeoneElsesSchedule() {
1884
+ return /*#__PURE__*/_react.default.createElement(_shared.PresentationShell, {
1885
+ header: /*#__PURE__*/_react.default.createElement(_shared.PageHeader, {
1886
+ title: "".concat(OWNER.first_name, "'s Work")
1887
+ }),
1888
+ floating: /*#__PURE__*/_react.default.createElement(_shared.FloatingControls, null),
1889
+ activeMenuItem: "People"
1890
+ }, /*#__PURE__*/_react.default.createElement(TimeBlocksPage, {
1891
+ initialView: "week",
1892
+ timezone: {
1893
+ kind: "viewer",
1894
+ viewer: VIEWER,
1895
+ showInViewerTime: false
1896
+ }
1897
+ }));
1898
+ };
1899
+ var SomeoneElsesScheduleInMyTime = exports.SomeoneElsesScheduleInMyTime = function SomeoneElsesScheduleInMyTime() {
1900
+ return /*#__PURE__*/_react.default.createElement(_shared.PresentationShell, {
1901
+ header: /*#__PURE__*/_react.default.createElement(_shared.PageHeader, {
1902
+ title: "".concat(OWNER.first_name, "'s Work")
1903
+ }),
1904
+ floating: /*#__PURE__*/_react.default.createElement(_shared.FloatingControls, null),
1905
+ activeMenuItem: "People"
1906
+ }, /*#__PURE__*/_react.default.createElement(TimeBlocksPage, {
1907
+ initialView: "week",
1908
+ timezone: {
1909
+ kind: "viewer",
1910
+ viewer: VIEWER,
1911
+ showInViewerTime: true
1912
+ }
1913
+ }));
1914
+ };
1915
+
1916
+ /* The owner moved from CET to London: the notice over the week. The grid
1917
+ still draws the CET plan (the mock has no London-time payload). */
1918
+ var TimezoneChanged = exports.TimezoneChanged = function TimezoneChanged() {
1919
+ return /*#__PURE__*/_react.default.createElement(_shared.PresentationShell, {
1920
+ header: MY_WORK_HEADER,
1921
+ floating: /*#__PURE__*/_react.default.createElement(_shared.FloatingControls, null),
1922
+ activeMenuItem: "My Work"
1923
+ }, /*#__PURE__*/_react.default.createElement(TimeBlocksPage, {
1924
+ initialView: "week",
1925
+ timezone: {
1926
+ kind: "changed",
1927
+ change: TIMEZONE_CHANGE
1928
+ }
1929
+ }));
1930
+ };
1931
+ //# sourceMappingURL=timeBlocks.js.map