@activecollab/components 2.0.577 → 2.0.579

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 (148) hide show
  1. package/dist/cjs/components/ViewSwitcher/useApplyToAllOffer.js +3 -1
  2. package/dist/cjs/components/ViewSwitcher/useApplyToAllOffer.js.map +1 -1
  3. package/dist/cjs/presentation/myWork/MyWorkTasks.js +83 -30
  4. package/dist/cjs/presentation/myWork/MyWorkTasks.js.map +1 -1
  5. package/dist/cjs/presentation/myWork/agendaGrid.js +1095 -0
  6. package/dist/cjs/presentation/myWork/agendaGrid.js.map +1 -0
  7. package/dist/cjs/presentation/shared/settings.js +6 -2
  8. package/dist/cjs/presentation/shared/settings.js.map +1 -1
  9. package/dist/cjs/presentation/shared/tokens.js +8 -1
  10. package/dist/cjs/presentation/shared/tokens.js.map +1 -1
  11. package/dist/cjs/presentation/timeboxes/AdjustmentList.js +31 -0
  12. package/dist/cjs/presentation/timeboxes/AdjustmentList.js.map +1 -0
  13. package/dist/cjs/presentation/timeboxes/AgendaDayView.js +1722 -0
  14. package/dist/cjs/presentation/timeboxes/AgendaDayView.js.map +1 -0
  15. package/dist/cjs/presentation/timeboxes/CapacityBar.js +54 -0
  16. package/dist/cjs/presentation/timeboxes/CapacityBar.js.map +1 -0
  17. package/dist/cjs/presentation/timeboxes/SimulationCard.js +47 -0
  18. package/dist/cjs/presentation/timeboxes/SimulationCard.js.map +1 -0
  19. package/dist/cjs/presentation/timeboxes/SimulationPanel.js +319 -0
  20. package/dist/cjs/presentation/timeboxes/SimulationPanel.js.map +1 -0
  21. package/dist/cjs/presentation/timeboxes/TimeRecordsSection.js +206 -0
  22. package/dist/cjs/presentation/timeboxes/TimeRecordsSection.js.map +1 -0
  23. package/dist/cjs/presentation/timeboxes/WorkloadView.js +887 -0
  24. package/dist/cjs/presentation/timeboxes/WorkloadView.js.map +1 -0
  25. package/dist/cjs/presentation/timeboxes/__tests__/timeboxes.test.js +699 -0
  26. package/dist/cjs/presentation/timeboxes/__tests__/timeboxes.test.js.map +1 -0
  27. package/dist/cjs/presentation/timeboxes/changes.js +293 -0
  28. package/dist/cjs/presentation/timeboxes/changes.js.map +1 -0
  29. package/dist/cjs/presentation/timeboxes/mockData.js +320 -0
  30. package/dist/cjs/presentation/timeboxes/mockData.js.map +1 -0
  31. package/dist/cjs/presentation/timeboxes/model.js +186 -0
  32. package/dist/cjs/presentation/timeboxes/model.js.map +1 -0
  33. package/dist/cjs/presentation/timeboxes/pillLook.js +72 -0
  34. package/dist/cjs/presentation/timeboxes/pillLook.js.map +1 -0
  35. package/dist/cjs/presentation/timeboxes/plan.js +181 -0
  36. package/dist/cjs/presentation/timeboxes/plan.js.map +1 -0
  37. package/dist/cjs/presentation/timeboxes/reducer.js +763 -0
  38. package/dist/cjs/presentation/timeboxes/reducer.js.map +1 -0
  39. package/dist/cjs/presentation/timeboxes/scheduler.js +147 -0
  40. package/dist/cjs/presentation/timeboxes/scheduler.js.map +1 -0
  41. package/dist/cjs/presentation/timeboxes/store.js +65 -0
  42. package/dist/cjs/presentation/timeboxes/store.js.map +1 -0
  43. package/dist/cjs/presentation/timeboxes/timeBlocks.js +1931 -0
  44. package/dist/cjs/presentation/timeboxes/timeBlocks.js.map +1 -0
  45. package/dist/cjs/presentation/timeboxes/timeboxSettings.js +369 -0
  46. package/dist/cjs/presentation/timeboxes/timeboxSettings.js.map +1 -0
  47. package/dist/cjs/presentation/timeboxes/tracked.js +189 -0
  48. package/dist/cjs/presentation/timeboxes/tracked.js.map +1 -0
  49. package/dist/esm/components/ViewSwitcher/useApplyToAllOffer.d.ts.map +1 -1
  50. package/dist/esm/components/ViewSwitcher/useApplyToAllOffer.js +4 -2
  51. package/dist/esm/components/ViewSwitcher/useApplyToAllOffer.js.map +1 -1
  52. package/dist/esm/presentation/myWork/MyWorkTasks.d.ts +81 -1
  53. package/dist/esm/presentation/myWork/MyWorkTasks.d.ts.map +1 -1
  54. package/dist/esm/presentation/myWork/MyWorkTasks.js +76 -23
  55. package/dist/esm/presentation/myWork/MyWorkTasks.js.map +1 -1
  56. package/dist/esm/presentation/myWork/agendaGrid.d.ts +341 -0
  57. package/dist/esm/presentation/myWork/agendaGrid.d.ts.map +1 -0
  58. package/dist/esm/presentation/myWork/agendaGrid.js +1001 -0
  59. package/dist/esm/presentation/myWork/agendaGrid.js.map +1 -0
  60. package/dist/esm/presentation/shared/settings.d.ts +2 -0
  61. package/dist/esm/presentation/shared/settings.d.ts.map +1 -1
  62. package/dist/esm/presentation/shared/settings.js +5 -1
  63. package/dist/esm/presentation/shared/settings.js.map +1 -1
  64. package/dist/esm/presentation/shared/tokens.d.ts +6 -0
  65. package/dist/esm/presentation/shared/tokens.d.ts.map +1 -1
  66. package/dist/esm/presentation/shared/tokens.js +7 -0
  67. package/dist/esm/presentation/shared/tokens.js.map +1 -1
  68. package/dist/esm/presentation/timeboxes/AdjustmentList.d.ts +11 -0
  69. package/dist/esm/presentation/timeboxes/AdjustmentList.d.ts.map +1 -0
  70. package/dist/esm/presentation/timeboxes/AdjustmentList.js +22 -0
  71. package/dist/esm/presentation/timeboxes/AdjustmentList.js.map +1 -0
  72. package/dist/esm/presentation/timeboxes/AgendaDayView.d.ts +15 -0
  73. package/dist/esm/presentation/timeboxes/AgendaDayView.d.ts.map +1 -0
  74. package/dist/esm/presentation/timeboxes/AgendaDayView.js +1524 -0
  75. package/dist/esm/presentation/timeboxes/AgendaDayView.js.map +1 -0
  76. package/dist/esm/presentation/timeboxes/CapacityBar.d.ts +15 -0
  77. package/dist/esm/presentation/timeboxes/CapacityBar.d.ts.map +1 -0
  78. package/dist/esm/presentation/timeboxes/CapacityBar.js +48 -0
  79. package/dist/esm/presentation/timeboxes/CapacityBar.js.map +1 -0
  80. package/dist/esm/presentation/timeboxes/SimulationCard.d.ts +13 -0
  81. package/dist/esm/presentation/timeboxes/SimulationCard.d.ts.map +1 -0
  82. package/dist/esm/presentation/timeboxes/SimulationCard.js +41 -0
  83. package/dist/esm/presentation/timeboxes/SimulationCard.js.map +1 -0
  84. package/dist/esm/presentation/timeboxes/SimulationPanel.d.ts +18 -0
  85. package/dist/esm/presentation/timeboxes/SimulationPanel.d.ts.map +1 -0
  86. package/dist/esm/presentation/timeboxes/SimulationPanel.js +267 -0
  87. package/dist/esm/presentation/timeboxes/SimulationPanel.js.map +1 -0
  88. package/dist/esm/presentation/timeboxes/TimeRecordsSection.d.ts +14 -0
  89. package/dist/esm/presentation/timeboxes/TimeRecordsSection.d.ts.map +1 -0
  90. package/dist/esm/presentation/timeboxes/TimeRecordsSection.js +159 -0
  91. package/dist/esm/presentation/timeboxes/TimeRecordsSection.js.map +1 -0
  92. package/dist/esm/presentation/timeboxes/WorkloadView.d.ts +9 -0
  93. package/dist/esm/presentation/timeboxes/WorkloadView.d.ts.map +1 -0
  94. package/dist/esm/presentation/timeboxes/WorkloadView.js +761 -0
  95. package/dist/esm/presentation/timeboxes/WorkloadView.js.map +1 -0
  96. package/dist/esm/presentation/timeboxes/__tests__/timeboxes.test.d.ts +2 -0
  97. package/dist/esm/presentation/timeboxes/__tests__/timeboxes.test.d.ts.map +1 -0
  98. package/dist/esm/presentation/timeboxes/__tests__/timeboxes.test.js +640 -0
  99. package/dist/esm/presentation/timeboxes/__tests__/timeboxes.test.js.map +1 -0
  100. package/dist/esm/presentation/timeboxes/changes.d.ts +72 -0
  101. package/dist/esm/presentation/timeboxes/changes.d.ts.map +1 -0
  102. package/dist/esm/presentation/timeboxes/changes.js +224 -0
  103. package/dist/esm/presentation/timeboxes/changes.js.map +1 -0
  104. package/dist/esm/presentation/timeboxes/mockData.d.ts +16 -0
  105. package/dist/esm/presentation/timeboxes/mockData.d.ts.map +1 -0
  106. package/dist/esm/presentation/timeboxes/mockData.js +297 -0
  107. package/dist/esm/presentation/timeboxes/mockData.js.map +1 -0
  108. package/dist/esm/presentation/timeboxes/model.d.ts +136 -0
  109. package/dist/esm/presentation/timeboxes/model.d.ts.map +1 -0
  110. package/dist/esm/presentation/timeboxes/model.js +129 -0
  111. package/dist/esm/presentation/timeboxes/model.js.map +1 -0
  112. package/dist/esm/presentation/timeboxes/pillLook.d.ts +40 -0
  113. package/dist/esm/presentation/timeboxes/pillLook.d.ts.map +1 -0
  114. package/dist/esm/presentation/timeboxes/pillLook.js +65 -0
  115. package/dist/esm/presentation/timeboxes/pillLook.js.map +1 -0
  116. package/dist/esm/presentation/timeboxes/plan.d.ts +62 -0
  117. package/dist/esm/presentation/timeboxes/plan.d.ts.map +1 -0
  118. package/dist/esm/presentation/timeboxes/plan.js +116 -0
  119. package/dist/esm/presentation/timeboxes/plan.js.map +1 -0
  120. package/dist/esm/presentation/timeboxes/reducer.d.ts +203 -0
  121. package/dist/esm/presentation/timeboxes/reducer.d.ts.map +1 -0
  122. package/dist/esm/presentation/timeboxes/reducer.js +616 -0
  123. package/dist/esm/presentation/timeboxes/reducer.js.map +1 -0
  124. package/dist/esm/presentation/timeboxes/scheduler.d.ts +63 -0
  125. package/dist/esm/presentation/timeboxes/scheduler.d.ts.map +1 -0
  126. package/dist/esm/presentation/timeboxes/scheduler.js +120 -0
  127. package/dist/esm/presentation/timeboxes/scheduler.js.map +1 -0
  128. package/dist/esm/presentation/timeboxes/store.d.ts +23 -0
  129. package/dist/esm/presentation/timeboxes/store.d.ts.map +1 -0
  130. package/dist/esm/presentation/timeboxes/store.js +46 -0
  131. package/dist/esm/presentation/timeboxes/store.js.map +1 -0
  132. package/dist/esm/presentation/timeboxes/timeBlocks.d.ts +10 -0
  133. package/dist/esm/presentation/timeboxes/timeBlocks.d.ts.map +1 -0
  134. package/dist/esm/presentation/timeboxes/timeBlocks.js +1767 -0
  135. package/dist/esm/presentation/timeboxes/timeBlocks.js.map +1 -0
  136. package/dist/esm/presentation/timeboxes/timeboxSettings.d.ts +71 -0
  137. package/dist/esm/presentation/timeboxes/timeboxSettings.d.ts.map +1 -0
  138. package/dist/esm/presentation/timeboxes/timeboxSettings.js +302 -0
  139. package/dist/esm/presentation/timeboxes/timeboxSettings.js.map +1 -0
  140. package/dist/esm/presentation/timeboxes/tracked.d.ts +51 -0
  141. package/dist/esm/presentation/timeboxes/tracked.d.ts.map +1 -0
  142. package/dist/esm/presentation/timeboxes/tracked.js +136 -0
  143. package/dist/esm/presentation/timeboxes/tracked.js.map +1 -0
  144. package/dist/index.js +3 -1
  145. package/dist/index.js.map +1 -1
  146. package/dist/index.min.js +1 -1
  147. package/dist/index.min.js.map +1 -1
  148. package/package.json +1 -1
@@ -0,0 +1,297 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import { datesBetween } from "./model";
3
+
4
+ /* The simulated week: Mon 2 – Fri 6 Nov 2026, "today" is Wednesday. */
5
+ export const WEEK_START = "2026-11-02";
6
+ export const WEEK_END = "2026-11-06";
7
+ export const WEEK_DAYS = datesBetween(WEEK_START, WEEK_END);
8
+ export const TODAY = "2026-11-04";
9
+ const FULL_WEEK = {
10
+ 1: 480,
11
+ 2: 480,
12
+ 3: 480,
13
+ 4: 480,
14
+ 5: 480
15
+ };
16
+ export const ME = 1;
17
+ export const USERS = [{
18
+ id: ME,
19
+ name: "Marko Stamenkovic",
20
+ capacity: FULL_WEEK
21
+ }, {
22
+ id: 2,
23
+ name: "Ana Petrovic",
24
+ capacity: FULL_WEEK
25
+ }, {
26
+ id: 3,
27
+ name: "Ivan Jovanovic",
28
+ capacity: _extends({}, FULL_WEEK, {
29
+ 5: 240
30
+ })
31
+ }];
32
+ export const PROJECTS = [{
33
+ id: 11,
34
+ name: "Website Redesign",
35
+ company: "ActiveCollab Inc.",
36
+ color: "#91C1FE"
37
+ }, {
38
+ id: 12,
39
+ name: "Platform API",
40
+ company: "ActiveCollab Inc.",
41
+ color: "#F5AA80"
42
+ }, {
43
+ id: 13,
44
+ name: "Mobile App",
45
+ company: "Northwind Traders",
46
+ color: "#C2B0FB"
47
+ }];
48
+ const task = fields => _extends({
49
+ isImportant: false,
50
+ isCompleted: false
51
+ }, fields);
52
+
53
+ /* Marko's tasks are the brief's A–F, in My Work order; Ana's and Ivan's
54
+ feed the Workload only. Estimates in minutes. */
55
+ export const TASKS = [/* A */task({
56
+ id: 101,
57
+ projectId: 11,
58
+ name: "Homepage hero copy",
59
+ startOn: "2026-11-04",
60
+ dueOn: "2026-11-04",
61
+ position: 1,
62
+ assigneeId: ME,
63
+ estimate: 60
64
+ }), /* B */task({
65
+ id: 102,
66
+ projectId: 12,
67
+ name: "API rate limits",
68
+ startOn: "2026-11-04",
69
+ dueOn: "2026-11-04",
70
+ position: 2,
71
+ assigneeId: ME,
72
+ estimate: 90
73
+ }), /* C */task({
74
+ id: 103,
75
+ projectId: 11,
76
+ name: "Onboarding emails",
77
+ startOn: "2026-11-04",
78
+ dueOn: "2026-11-04",
79
+ position: 3,
80
+ assigneeId: ME,
81
+ estimate: 120
82
+ }), /* D */task({
83
+ id: 104,
84
+ projectId: 12,
85
+ name: "Workload export",
86
+ startOn: "2026-11-02",
87
+ dueOn: "2026-11-05",
88
+ position: 4,
89
+ assigneeId: ME,
90
+ estimate: 360
91
+ }), /* E */task({
92
+ id: 105,
93
+ projectId: 13,
94
+ name: "Release notes",
95
+ startOn: "2026-11-03",
96
+ dueOn: "2026-11-06",
97
+ position: 5,
98
+ assigneeId: ME,
99
+ estimate: 480
100
+ }), /* F */task({
101
+ id: 106,
102
+ projectId: 11,
103
+ name: "Fix login copy",
104
+ startOn: "2026-11-04",
105
+ dueOn: "2026-11-04",
106
+ position: 6,
107
+ assigneeId: ME,
108
+ estimate: null
109
+ }), task({
110
+ id: 201,
111
+ projectId: 11,
112
+ name: "Design QA pass",
113
+ startOn: "2026-11-02",
114
+ dueOn: "2026-11-04",
115
+ position: 1,
116
+ assigneeId: 2,
117
+ estimate: 720
118
+ }), task({
119
+ id: 202,
120
+ projectId: 13,
121
+ name: "Icon refresh",
122
+ startOn: "2026-11-03",
123
+ dueOn: "2026-11-06",
124
+ position: 2,
125
+ assigneeId: 2,
126
+ estimate: 600
127
+ }), task({
128
+ id: 301,
129
+ projectId: 12,
130
+ name: "Billing webhooks",
131
+ startOn: "2026-11-02",
132
+ dueOn: "2026-11-06",
133
+ position: 1,
134
+ assigneeId: 3,
135
+ estimate: 1200
136
+ }), task({
137
+ id: 302,
138
+ projectId: 12,
139
+ name: "Fix CSV import",
140
+ startOn: "2026-11-05",
141
+ dueOn: "2026-11-06",
142
+ position: 2,
143
+ assigneeId: 3,
144
+ estimate: 240
145
+ })];
146
+ export const SUBTASKS = [{
147
+ id: 9001,
148
+ taskId: 101,
149
+ name: "Review copy",
150
+ dueOn: "2026-11-04",
151
+ isCompleted: false
152
+ }];
153
+
154
+ /* A and B are pinned; D is split 1h30 a day with an hour pinned on
155
+ Thursday; Ana's QA pass and Ivan's CSV fix are split too. */
156
+ export const PARTS = [{
157
+ id: "p1",
158
+ taskId: 101,
159
+ date: "2026-11-04",
160
+ startsOnTime: "09:30",
161
+ durationMinutes: 60
162
+ }, {
163
+ id: "p2",
164
+ taskId: 102,
165
+ date: "2026-11-04",
166
+ startsOnTime: "11:00",
167
+ durationMinutes: 90
168
+ }, {
169
+ id: "p3",
170
+ taskId: 104,
171
+ date: "2026-11-02",
172
+ startsOnTime: null,
173
+ durationMinutes: 90
174
+ }, {
175
+ id: "p4",
176
+ taskId: 104,
177
+ date: "2026-11-03",
178
+ startsOnTime: null,
179
+ durationMinutes: 90
180
+ }, {
181
+ id: "p5",
182
+ taskId: 104,
183
+ date: "2026-11-04",
184
+ startsOnTime: null,
185
+ durationMinutes: 90
186
+ }, {
187
+ id: "p6",
188
+ taskId: 104,
189
+ date: "2026-11-05",
190
+ startsOnTime: "10:00",
191
+ durationMinutes: 60
192
+ }, {
193
+ id: "p7",
194
+ taskId: 104,
195
+ date: "2026-11-05",
196
+ startsOnTime: null,
197
+ durationMinutes: 30
198
+ }, {
199
+ id: "p8",
200
+ taskId: 201,
201
+ date: "2026-11-02",
202
+ startsOnTime: null,
203
+ durationMinutes: 300
204
+ }, {
205
+ id: "p9",
206
+ taskId: 201,
207
+ date: "2026-11-03",
208
+ startsOnTime: null,
209
+ durationMinutes: 240
210
+ }, {
211
+ id: "p10",
212
+ taskId: 201,
213
+ date: "2026-11-04",
214
+ startsOnTime: null,
215
+ durationMinutes: 180
216
+ }, {
217
+ id: "p11",
218
+ taskId: 302,
219
+ date: "2026-11-05",
220
+ startsOnTime: "13:00",
221
+ durationMinutes: 120
222
+ }, {
223
+ id: "p12",
224
+ taskId: 302,
225
+ date: "2026-11-05",
226
+ startsOnTime: null,
227
+ durationMinutes: 60
228
+ }, {
229
+ id: "p13",
230
+ taskId: 302,
231
+ date: "2026-11-06",
232
+ startsOnTime: null,
233
+ durationMinutes: 60
234
+ }];
235
+ export const EVENTS = [{
236
+ id: 1,
237
+ name: "Sprint planning",
238
+ calendarName: "Team",
239
+ color: "#63A7DE",
240
+ date: "2026-11-04",
241
+ startsOnTime: "14:00",
242
+ endsOnTime: "15:00",
243
+ isParticipant: true,
244
+ meetingUrl: "https://zoom.us/j/84213377610"
245
+ }];
246
+
247
+ /* Marko's tracked time, against the plan planDay() gives:
248
+ - Mon: D 1h of its 1h30 suggestion (a past day partly done);
249
+ - Tue: D 1h30 (full), E 2h30 of its 2h (30m past its blocks);
250
+ - Wed: A 1h on its 09:30–10:30 timebox; C 45m on 09:00–09:30 and
251
+ 10:30–10:45, nothing on 12:30–13:30; B nothing yet. */
252
+ export const TIME_RECORDS = [{
253
+ id: "t1",
254
+ taskId: 104,
255
+ userId: ME,
256
+ recordDate: "2026-11-02",
257
+ minutes: 60
258
+ }, {
259
+ id: "t2",
260
+ taskId: 104,
261
+ userId: ME,
262
+ recordDate: "2026-11-03",
263
+ minutes: 90
264
+ }, {
265
+ id: "t3",
266
+ taskId: 105,
267
+ userId: ME,
268
+ recordDate: "2026-11-03",
269
+ minutes: 150
270
+ }, {
271
+ id: "t4",
272
+ taskId: 101,
273
+ userId: ME,
274
+ recordDate: "2026-11-04",
275
+ minutes: 60
276
+ }, {
277
+ id: "t5",
278
+ taskId: 103,
279
+ userId: ME,
280
+ recordDate: "2026-11-04",
281
+ minutes: 45
282
+ }];
283
+ export const SETTINGS = {
284
+ workdayStartsAt: "09:00",
285
+ minGapMinutes: 15,
286
+ pause: null
287
+ };
288
+ export const initialState = () => ({
289
+ tasks: TASKS.map(item => _extends({}, item)),
290
+ subtasks: SUBTASKS.map(item => _extends({}, item)),
291
+ parts: PARTS.map(item => _extends({}, item)),
292
+ events: EVENTS.map(item => _extends({}, item)),
293
+ settings: _extends({}, SETTINGS),
294
+ timeRecords: TIME_RECORDS.map(item => _extends({}, item)),
295
+ nextId: 100
296
+ });
297
+ //# sourceMappingURL=mockData.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mockData.js","names":["datesBetween","WEEK_START","WEEK_END","WEEK_DAYS","TODAY","FULL_WEEK","ME","USERS","id","name","capacity","_extends","PROJECTS","company","color","task","fields","isImportant","isCompleted","TASKS","projectId","startOn","dueOn","position","assigneeId","estimate","SUBTASKS","taskId","PARTS","date","startsOnTime","durationMinutes","EVENTS","calendarName","endsOnTime","isParticipant","meetingUrl","TIME_RECORDS","userId","recordDate","minutes","SETTINGS","workdayStartsAt","minGapMinutes","pause","initialState","tasks","map","item","subtasks","parts","events","settings","timeRecords","nextId"],"sources":["../../../../src/presentation/timeboxes/mockData.ts"],"sourcesContent":["import {\n DateKey,\n TbEvent,\n TbPart,\n TbProject,\n TbSettings,\n TbState,\n TbSubtask,\n TbTask,\n TbTimeRecord,\n TbUser,\n datesBetween,\n} from \"./model\";\n\n/* The simulated week: Mon 2 – Fri 6 Nov 2026, \"today\" is Wednesday. */\nexport const WEEK_START: DateKey = \"2026-11-02\";\nexport const WEEK_END: DateKey = \"2026-11-06\";\nexport const WEEK_DAYS: DateKey[] = datesBetween(WEEK_START, WEEK_END);\nexport const TODAY: DateKey = \"2026-11-04\";\n\nconst FULL_WEEK = { 1: 480, 2: 480, 3: 480, 4: 480, 5: 480 };\n\nexport const ME = 1;\n\nexport const USERS: TbUser[] = [\n { id: ME, name: \"Marko Stamenkovic\", capacity: FULL_WEEK },\n { id: 2, name: \"Ana Petrovic\", capacity: FULL_WEEK },\n { id: 3, name: \"Ivan Jovanovic\", capacity: { ...FULL_WEEK, 5: 240 } },\n];\n\nexport const PROJECTS: TbProject[] = [\n {\n id: 11,\n name: \"Website Redesign\",\n company: \"ActiveCollab Inc.\",\n color: \"#91C1FE\",\n },\n {\n id: 12,\n name: \"Platform API\",\n company: \"ActiveCollab Inc.\",\n color: \"#F5AA80\",\n },\n {\n id: 13,\n name: \"Mobile App\",\n company: \"Northwind Traders\",\n color: \"#C2B0FB\",\n },\n];\n\nconst task = (\n fields: Omit<TbTask, \"isImportant\" | \"isCompleted\"> &\n Partial<Pick<TbTask, \"isImportant\" | \"isCompleted\">>\n): TbTask => ({ isImportant: false, isCompleted: false, ...fields });\n\n/* Marko's tasks are the brief's A–F, in My Work order; Ana's and Ivan's\n feed the Workload only. Estimates in minutes. */\nexport const TASKS: TbTask[] = [\n /* A */ task({\n id: 101,\n projectId: 11,\n name: \"Homepage hero copy\",\n startOn: \"2026-11-04\",\n dueOn: \"2026-11-04\",\n position: 1,\n assigneeId: ME,\n estimate: 60,\n }),\n /* B */ task({\n id: 102,\n projectId: 12,\n name: \"API rate limits\",\n startOn: \"2026-11-04\",\n dueOn: \"2026-11-04\",\n position: 2,\n assigneeId: ME,\n estimate: 90,\n }),\n /* C */ task({\n id: 103,\n projectId: 11,\n name: \"Onboarding emails\",\n startOn: \"2026-11-04\",\n dueOn: \"2026-11-04\",\n position: 3,\n assigneeId: ME,\n estimate: 120,\n }),\n /* D */ task({\n id: 104,\n projectId: 12,\n name: \"Workload export\",\n startOn: \"2026-11-02\",\n dueOn: \"2026-11-05\",\n position: 4,\n assigneeId: ME,\n estimate: 360,\n }),\n /* E */ task({\n id: 105,\n projectId: 13,\n name: \"Release notes\",\n startOn: \"2026-11-03\",\n dueOn: \"2026-11-06\",\n position: 5,\n assigneeId: ME,\n estimate: 480,\n }),\n /* F */ task({\n id: 106,\n projectId: 11,\n name: \"Fix login copy\",\n startOn: \"2026-11-04\",\n dueOn: \"2026-11-04\",\n position: 6,\n assigneeId: ME,\n estimate: null,\n }),\n task({\n id: 201,\n projectId: 11,\n name: \"Design QA pass\",\n startOn: \"2026-11-02\",\n dueOn: \"2026-11-04\",\n position: 1,\n assigneeId: 2,\n estimate: 720,\n }),\n task({\n id: 202,\n projectId: 13,\n name: \"Icon refresh\",\n startOn: \"2026-11-03\",\n dueOn: \"2026-11-06\",\n position: 2,\n assigneeId: 2,\n estimate: 600,\n }),\n task({\n id: 301,\n projectId: 12,\n name: \"Billing webhooks\",\n startOn: \"2026-11-02\",\n dueOn: \"2026-11-06\",\n position: 1,\n assigneeId: 3,\n estimate: 1200,\n }),\n task({\n id: 302,\n projectId: 12,\n name: \"Fix CSV import\",\n startOn: \"2026-11-05\",\n dueOn: \"2026-11-06\",\n position: 2,\n assigneeId: 3,\n estimate: 240,\n }),\n];\n\nexport const SUBTASKS: TbSubtask[] = [\n {\n id: 9001,\n taskId: 101,\n name: \"Review copy\",\n dueOn: \"2026-11-04\",\n isCompleted: false,\n },\n];\n\n/* A and B are pinned; D is split 1h30 a day with an hour pinned on\n Thursday; Ana's QA pass and Ivan's CSV fix are split too. */\nexport const PARTS: TbPart[] = [\n {\n id: \"p1\",\n taskId: 101,\n date: \"2026-11-04\",\n startsOnTime: \"09:30\",\n durationMinutes: 60,\n },\n {\n id: \"p2\",\n taskId: 102,\n date: \"2026-11-04\",\n startsOnTime: \"11:00\",\n durationMinutes: 90,\n },\n {\n id: \"p3\",\n taskId: 104,\n date: \"2026-11-02\",\n startsOnTime: null,\n durationMinutes: 90,\n },\n {\n id: \"p4\",\n taskId: 104,\n date: \"2026-11-03\",\n startsOnTime: null,\n durationMinutes: 90,\n },\n {\n id: \"p5\",\n taskId: 104,\n date: \"2026-11-04\",\n startsOnTime: null,\n durationMinutes: 90,\n },\n {\n id: \"p6\",\n taskId: 104,\n date: \"2026-11-05\",\n startsOnTime: \"10:00\",\n durationMinutes: 60,\n },\n {\n id: \"p7\",\n taskId: 104,\n date: \"2026-11-05\",\n startsOnTime: null,\n durationMinutes: 30,\n },\n {\n id: \"p8\",\n taskId: 201,\n date: \"2026-11-02\",\n startsOnTime: null,\n durationMinutes: 300,\n },\n {\n id: \"p9\",\n taskId: 201,\n date: \"2026-11-03\",\n startsOnTime: null,\n durationMinutes: 240,\n },\n {\n id: \"p10\",\n taskId: 201,\n date: \"2026-11-04\",\n startsOnTime: null,\n durationMinutes: 180,\n },\n {\n id: \"p11\",\n taskId: 302,\n date: \"2026-11-05\",\n startsOnTime: \"13:00\",\n durationMinutes: 120,\n },\n {\n id: \"p12\",\n taskId: 302,\n date: \"2026-11-05\",\n startsOnTime: null,\n durationMinutes: 60,\n },\n {\n id: \"p13\",\n taskId: 302,\n date: \"2026-11-06\",\n startsOnTime: null,\n durationMinutes: 60,\n },\n];\n\nexport const EVENTS: TbEvent[] = [\n {\n id: 1,\n name: \"Sprint planning\",\n calendarName: \"Team\",\n color: \"#63A7DE\",\n date: \"2026-11-04\",\n startsOnTime: \"14:00\",\n endsOnTime: \"15:00\",\n isParticipant: true,\n meetingUrl: \"https://zoom.us/j/84213377610\",\n },\n];\n\n/* Marko's tracked time, against the plan planDay() gives:\n - Mon: D 1h of its 1h30 suggestion (a past day partly done);\n - Tue: D 1h30 (full), E 2h30 of its 2h (30m past its blocks);\n - Wed: A 1h on its 09:30–10:30 timebox; C 45m on 09:00–09:30 and\n 10:30–10:45, nothing on 12:30–13:30; B nothing yet. */\nexport const TIME_RECORDS: TbTimeRecord[] = [\n { id: \"t1\", taskId: 104, userId: ME, recordDate: \"2026-11-02\", minutes: 60 },\n { id: \"t2\", taskId: 104, userId: ME, recordDate: \"2026-11-03\", minutes: 90 },\n { id: \"t3\", taskId: 105, userId: ME, recordDate: \"2026-11-03\", minutes: 150 },\n { id: \"t4\", taskId: 101, userId: ME, recordDate: \"2026-11-04\", minutes: 60 },\n { id: \"t5\", taskId: 103, userId: ME, recordDate: \"2026-11-04\", minutes: 45 },\n];\n\nexport const SETTINGS: TbSettings = {\n workdayStartsAt: \"09:00\",\n minGapMinutes: 15,\n pause: null,\n};\n\nexport const initialState = (): TbState => ({\n tasks: TASKS.map((item) => ({ ...item })),\n subtasks: SUBTASKS.map((item) => ({ ...item })),\n parts: PARTS.map((item) => ({ ...item })),\n events: EVENTS.map((item) => ({ ...item })),\n settings: { ...SETTINGS },\n timeRecords: TIME_RECORDS.map((item) => ({ ...item })),\n nextId: 100,\n});\n"],"mappings":";AAAA,SAWEA,YAAY,QACP,SAAS;;AAEhB;AACA,OAAO,MAAMC,UAAmB,GAAG,YAAY;AAC/C,OAAO,MAAMC,QAAiB,GAAG,YAAY;AAC7C,OAAO,MAAMC,SAAoB,GAAGH,YAAY,CAACC,UAAU,EAAEC,QAAQ,CAAC;AACtE,OAAO,MAAME,KAAc,GAAG,YAAY;AAE1C,MAAMC,SAAS,GAAG;EAAE,CAAC,EAAE,GAAG;EAAE,CAAC,EAAE,GAAG;EAAE,CAAC,EAAE,GAAG;EAAE,CAAC,EAAE,GAAG;EAAE,CAAC,EAAE;AAAI,CAAC;AAE5D,OAAO,MAAMC,EAAE,GAAG,CAAC;AAEnB,OAAO,MAAMC,KAAe,GAAG,CAC7B;EAAEC,EAAE,EAAEF,EAAE;EAAEG,IAAI,EAAE,mBAAmB;EAAEC,QAAQ,EAAEL;AAAU,CAAC,EAC1D;EAAEG,EAAE,EAAE,CAAC;EAAEC,IAAI,EAAE,cAAc;EAAEC,QAAQ,EAAEL;AAAU,CAAC,EACpD;EAAEG,EAAE,EAAE,CAAC;EAAEC,IAAI,EAAE,gBAAgB;EAAEC,QAAQ,EAAAC,QAAA,KAAON,SAAS;IAAE,CAAC,EAAE;EAAG;AAAG,CAAC,CACtE;AAED,OAAO,MAAMO,QAAqB,GAAG,CACnC;EACEJ,EAAE,EAAE,EAAE;EACNC,IAAI,EAAE,kBAAkB;EACxBI,OAAO,EAAE,mBAAmB;EAC5BC,KAAK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AI,CAAG,CAAC;EAC/CE,KAAK,EAAEtB,KAAK,CAACmB,GAAG,CAAEC,IAAI,IAAArC,QAAA,KAAWqC,IAAI,CAAG,CAAC;EACzCG,MAAM,EAAEnB,MAAM,CAACe,GAAG,CAAEC,IAAI,IAAArC,QAAA,KAAWqC,IAAI,CAAG,CAAC;EAC3CI,QAAQ,EAAAzC,QAAA,KAAO8B,QAAQ,CAAE;EACzBY,WAAW,EAAEhB,YAAY,CAACU,GAAG,CAAEC,IAAI,IAAArC,QAAA,KAAWqC,IAAI,CAAG,CAAC;EACtDM,MAAM,EAAE;AACV,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,136 @@
1
+ /**
2
+ * Timeboxes — the model behind the "Timeboxes – Agenda Day" and
3
+ * "Timeboxes – Workload" simulations.
4
+ *
5
+ * An estimate split and a timebox are the same thing: a task's split is a
6
+ * list of parts, one untimed part per day (it feeds suggestions) and any
7
+ * number of timed parts (pinned timeboxes). A day's allocation is the sum of
8
+ * the task's parts on that day; the estimate is the sum of all parts.
9
+ *
10
+ * All math is in whole minutes. Dates are "YYYY-MM-DD", clocks "HH:MM".
11
+ */
12
+ export type DateKey = string;
13
+ export type Clock = string;
14
+ export declare const MINUTES_PER_DAY: number;
15
+ /** Durations and start times snap to this. */
16
+ export declare const SNAP_MINUTES = 5;
17
+ export declare const MIN_GAP_OPTIONS: readonly [5, 10, 15, 30, 60];
18
+ export type MinGap = (typeof MIN_GAP_OPTIONS)[number];
19
+ export interface TbProject {
20
+ id: number;
21
+ name: string;
22
+ company: string;
23
+ color: string;
24
+ }
25
+ export interface TbUser {
26
+ id: number;
27
+ name: string;
28
+ /** ISO weekday (1 = Monday) → capacity in minutes; missing or 0 = off. */
29
+ capacity: Record<number, number>;
30
+ }
31
+ export interface TbTask {
32
+ id: number;
33
+ projectId: number;
34
+ name: string;
35
+ startOn: DateKey;
36
+ dueOn: DateKey;
37
+ isImportant: boolean;
38
+ isCompleted: boolean;
39
+ /** My Work list order. */
40
+ position: number;
41
+ assigneeId: number;
42
+ /** The assignee's estimate in minutes; null when there is none. */
43
+ estimate: number | null;
44
+ }
45
+ export interface TbSubtask {
46
+ id: number;
47
+ taskId: number;
48
+ name: string;
49
+ dueOn: DateKey;
50
+ isCompleted: boolean;
51
+ }
52
+ export interface TbPart {
53
+ id: string;
54
+ taskId: number;
55
+ date: DateKey;
56
+ startsOnTime: Clock | null;
57
+ durationMinutes: number;
58
+ }
59
+ export interface TbEvent {
60
+ id: number;
61
+ name: string;
62
+ calendarName: string;
63
+ color: string;
64
+ date: DateKey;
65
+ startsOnTime: Clock;
66
+ endsOnTime: Clock;
67
+ isParticipant: boolean;
68
+ meetingUrl: string | null;
69
+ }
70
+ export interface TbSettings {
71
+ workdayStartsAt: Clock;
72
+ minGapMinutes: MinGap;
73
+ pause: {
74
+ startsAt: Clock;
75
+ minutes: number;
76
+ } | null;
77
+ }
78
+ export interface TbTimeRecord {
79
+ id: string;
80
+ taskId: number;
81
+ userId: number;
82
+ recordDate: DateKey;
83
+ minutes: number;
84
+ }
85
+ /** Everything the simulation changes. Projects and users are fixed. */
86
+ export interface TbState {
87
+ tasks: TbTask[];
88
+ subtasks: TbSubtask[];
89
+ parts: TbPart[];
90
+ events: TbEvent[];
91
+ settings: TbSettings;
92
+ /** Tracked time: display only, nothing is planned from it. */
93
+ timeRecords: TbTimeRecord[];
94
+ /** Next id for parts and events the simulation creates. */
95
+ nextId: number;
96
+ }
97
+ export declare const clockToMinutes: (clock: Clock) => number;
98
+ export declare const minutesToClock: (minutes: number) => Clock;
99
+ /** Down to the 5-minute grid. */
100
+ export declare const snapDown: (minutes: number) => number;
101
+ /** To the nearest step of the 5-minute grid. */
102
+ export declare const snap: (minutes: number) => number;
103
+ /** "1h", "1h30", "45m" — the concept's hours. */
104
+ export declare const formatMinutes: (minutes: number) => string;
105
+ export declare const addDays: (date: DateKey, days: number) => DateKey;
106
+ /** ISO weekday, 1 = Monday … 7 = Sunday. */
107
+ export declare const isoWeekday: (date: DateKey) => number;
108
+ /** Every date from start to end, both included. */
109
+ export declare const datesBetween: (start: DateKey, end: DateKey) => DateKey[];
110
+ export declare const capacityOn: (user: TbUser, date: DateKey) => number;
111
+ /** The days in the task's range the assignee works (TaskSplitterByAssignee
112
+ gives the other days 0). */
113
+ export declare const availableDays: (task: TbTask, user: TbUser) => DateKey[];
114
+ /**
115
+ * An even spread of whole minutes over days, as the app's add(): each day
116
+ * the total over the day count, rounded down to whole minutes, with the
117
+ * leftover minutes on the last days so the parts still sum to the total.
118
+ */
119
+ export declare const evenSpread: (total: number, days: DateKey[]) => Map<DateKey, number>;
120
+ export declare const partsOf: (state: TbState, taskId: number) => TbPart[];
121
+ export declare const isSplit: (state: TbState, taskId: number) => boolean;
122
+ export declare const isTimebox: (part: TbPart) => boolean;
123
+ export declare const timeboxesOn: (state: TbState, taskId: number, date: DateKey) => TbPart[];
124
+ export declare const untimedPartOn: (state: TbState, taskId: number, date: DateKey) => TbPart | undefined;
125
+ export declare const pinnedOn: (state: TbState, taskId: number, date: DateKey) => number;
126
+ /** The day's allocation: the parts on it once split, else the even share. */
127
+ export declare const allocationOn: (state: TbState, task: TbTask, user: TbUser, date: DateKey) => number;
128
+ /** What the day still leaves to suggestions: allocation − pinned. */
129
+ export declare const untimedOn: (state: TbState, task: TbTask, user: TbUser, date: DateKey) => number;
130
+ export interface TimeRange {
131
+ start: number;
132
+ end: number;
133
+ }
134
+ export declare const rangeOf: (part: TbPart) => TimeRange;
135
+ export declare const overlaps: (a: TimeRange, b: TimeRange) => boolean;
136
+ //# sourceMappingURL=model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../../src/presentation/timeboxes/model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAC7B,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC;AAE3B,eAAO,MAAM,eAAe,QAAU,CAAC;AAEvC,8C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AY,GACvB,OAAO,OAAO,EACd,MAAM,MAAM,EACZ,MAAM,MAAM,EACZ,MAAM,OAAO,KACZ,MAMF,CAAC;AAEF,qEAAqE;AACrE,eAAO,MAAM,SAAS,GACpB,OAAO,OAAO,EACd,MAAM,MAAM,EACZ,MAAM,MAAM,EACZ,MAAM,OAAO,KACZ,MACqE,CAAC;AAEzE,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED,eAAO,MAAM,OAAO,GAAI,MAAM,MAAM,KAAG,SAGtC,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,GAAG,SAAS,EAAE,GAAG,SAAS,KAAG,OAClB,CAAC"}
@@ -0,0 +1,129 @@
1
+ /**
2
+ * Timeboxes — the model behind the "Timeboxes – Agenda Day" and
3
+ * "Timeboxes – Workload" simulations.
4
+ *
5
+ * An estimate split and a timebox are the same thing: a task's split is a
6
+ * list of parts, one untimed part per day (it feeds suggestions) and any
7
+ * number of timed parts (pinned timeboxes). A day's allocation is the sum of
8
+ * the task's parts on that day; the estimate is the sum of all parts.
9
+ *
10
+ * All math is in whole minutes. Dates are "YYYY-MM-DD", clocks "HH:MM".
11
+ */
12
+
13
+ export const MINUTES_PER_DAY = 24 * 60;
14
+
15
+ /** Durations and start times snap to this. */
16
+ export const SNAP_MINUTES = 5;
17
+ export const MIN_GAP_OPTIONS = [5, 10, 15, 30, 60];
18
+
19
+ /* ------------------------------------------------------------------ */
20
+ /* Payload shapes */
21
+ /* ------------------------------------------------------------------ */
22
+
23
+ /** Everything the simulation changes. Projects and users are fixed. */
24
+
25
+ /* ------------------------------------------------------------------ */
26
+ /* Time */
27
+ /* ------------------------------------------------------------------ */
28
+
29
+ export const clockToMinutes = clock => {
30
+ const _clock$split$map = clock.split(":").map(Number),
31
+ hours = _clock$split$map[0],
32
+ minutes = _clock$split$map[1];
33
+ return hours * 60 + minutes;
34
+ };
35
+ export const minutesToClock = minutes => String(Math.floor(minutes / 60)).padStart(2, "0") + ":" + String(minutes % 60).padStart(2, "0");
36
+
37
+ /** Down to the 5-minute grid. */
38
+ export const snapDown = minutes => Math.floor(minutes / SNAP_MINUTES) * SNAP_MINUTES;
39
+
40
+ /** To the nearest step of the 5-minute grid. */
41
+ export const snap = minutes => Math.round(minutes / SNAP_MINUTES) * SNAP_MINUTES;
42
+
43
+ /** "1h", "1h30", "45m" — the concept's hours. */
44
+ export const formatMinutes = minutes => {
45
+ const hours = Math.floor(minutes / 60);
46
+ const rest = minutes % 60;
47
+ if (hours === 0) return rest + "m";
48
+ return rest === 0 ? hours + "h" : hours + "h" + String(rest).padStart(2, "0");
49
+ };
50
+ const toUtc = date => new Date(date + "T00:00:00Z");
51
+ export const addDays = (date, days) => {
52
+ const next = toUtc(date);
53
+ next.setUTCDate(next.getUTCDate() + days);
54
+ return next.toISOString().slice(0, 10);
55
+ };
56
+
57
+ /** ISO weekday, 1 = Monday … 7 = Sunday. */
58
+ export const isoWeekday = date => (toUtc(date).getUTCDay() + 6) % 7 + 1;
59
+
60
+ /** Every date from start to end, both included. */
61
+ export const datesBetween = (start, end) => {
62
+ const dates = [];
63
+ for (let date = start; date <= end; date = addDays(date, 1)) {
64
+ dates.push(date);
65
+ }
66
+ return dates;
67
+ };
68
+
69
+ /* ------------------------------------------------------------------ */
70
+ /* Availability and allocation */
71
+ /* ------------------------------------------------------------------ */
72
+
73
+ export const capacityOn = (user, date) => {
74
+ var _user$capacity$isoWee;
75
+ return (_user$capacity$isoWee = user.capacity[isoWeekday(date)]) != null ? _user$capacity$isoWee : 0;
76
+ };
77
+
78
+ /** The days in the task's range the assignee works (TaskSplitterByAssignee
79
+ gives the other days 0). */
80
+ export const availableDays = (task, user) => datesBetween(task.startOn, task.dueOn).filter(date => capacityOn(user, date) > 0);
81
+
82
+ /**
83
+ * An even spread of whole minutes over days, as the app's add(): each day
84
+ * the total over the day count, rounded down to whole minutes, with the
85
+ * leftover minutes on the last days so the parts still sum to the total.
86
+ */
87
+ export const evenSpread = (total, days) => {
88
+ const spread = new Map();
89
+ if (days.length === 0) return spread;
90
+ const base = Math.floor(total / days.length);
91
+ const leftover = total - base * days.length;
92
+ days.forEach((date, index) => {
93
+ spread.set(date, base + (index >= days.length - leftover ? 1 : 0));
94
+ });
95
+ return spread;
96
+ };
97
+ export const partsOf = (state, taskId) => state.parts.filter(part => part.taskId === taskId);
98
+ export const isSplit = (state, taskId) => state.parts.some(part => part.taskId === taskId);
99
+ export const isTimebox = part => part.startsOnTime !== null;
100
+ export const timeboxesOn = (state, taskId, date) => partsOf(state, taskId).filter(part => part.date === date && isTimebox(part)).sort((a, b) => {
101
+ var _a$startsOnTime, _b$startsOnTime;
102
+ return clockToMinutes((_a$startsOnTime = a.startsOnTime) != null ? _a$startsOnTime : "00:00") - clockToMinutes((_b$startsOnTime = b.startsOnTime) != null ? _b$startsOnTime : "00:00");
103
+ });
104
+ export const untimedPartOn = (state, taskId, date) => state.parts.find(part => part.taskId === taskId && part.date === date && part.startsOnTime === null);
105
+ const sum = parts => parts.reduce((total, part) => total + part.durationMinutes, 0);
106
+ export const pinnedOn = (state, taskId, date) => sum(timeboxesOn(state, taskId, date));
107
+
108
+ /** The day's allocation: the parts on it once split, else the even share. */
109
+ export const allocationOn = (state, task, user, date) => {
110
+ var _evenSpread$get;
111
+ if (isSplit(state, task.id)) {
112
+ return sum(partsOf(state, task.id).filter(part => part.date === date));
113
+ }
114
+ if (task.estimate === null) return 0;
115
+ return (_evenSpread$get = evenSpread(task.estimate, availableDays(task, user)).get(date)) != null ? _evenSpread$get : 0;
116
+ };
117
+
118
+ /** What the day still leaves to suggestions: allocation − pinned. */
119
+ export const untimedOn = (state, task, user, date) => allocationOn(state, task, user, date) - pinnedOn(state, task.id, date);
120
+ export const rangeOf = part => {
121
+ var _part$startsOnTime;
122
+ const start = clockToMinutes((_part$startsOnTime = part.startsOnTime) != null ? _part$startsOnTime : "00:00");
123
+ return {
124
+ start,
125
+ end: start + part.durationMinutes
126
+ };
127
+ };
128
+ export const overlaps = (a, b) => a.start < b.end && b.start < a.end;
129
+ //# sourceMappingURL=model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.js","names":["MINUTES_PER_DAY","SNAP_MINUTES","MIN_GAP_OPTIONS","clockToMinutes","clock","_clock$split$map","split","map","Number","hours","minutes","minutesToClock","String","Math","floor","padStart","snapDown","snap","round","formatMinutes","rest","toUtc","date","Date","addDays","days","next","setUTCDate","getUTCDate","toISOString","slice","isoWeekday","getUTCDay","datesBetween","start","end","dates","push","capacityOn","user","_user$capacity$isoWee","capacity","availableDays","task","startOn","dueOn","filter","evenSpread","total","spread","Map","length","base","leftover","forEach","index","set","partsOf","state","taskId","parts","part","isSplit","some","isTimebox","startsOnTime","timeboxesOn","sort","a","b","_a$startsOnTime","_b$startsOnTime","untimedPartOn","find","sum","reduce","durationMinutes","pinnedOn","allocationOn","_evenSpread$get","id","estimate","get","untimedOn","rangeOf","_part$startsOnTime","overlaps"],"sources":["../../../../src/presentation/timeboxes/model.ts"],"sourcesContent":["/**\n * Timeboxes — the model behind the \"Timeboxes – Agenda Day\" and\n * \"Timeboxes – Workload\" simulations.\n *\n * An estimate split and a timebox are the same thing: a task's split is a\n * list of parts, one untimed part per day (it feeds suggestions) and any\n * number of timed parts (pinned timeboxes). A day's allocation is the sum of\n * the task's parts on that day; the estimate is the sum of all parts.\n *\n * All math is in whole minutes. Dates are \"YYYY-MM-DD\", clocks \"HH:MM\".\n */\n\nexport type DateKey = string;\nexport type Clock = string;\n\nexport const MINUTES_PER_DAY = 24 * 60;\n\n/** Durations and start times snap to this. */\nexport const SNAP_MINUTES = 5;\n\nexport const MIN_GAP_OPTIONS = [5, 10, 15, 30, 60] as const;\nexport type MinGap = (typeof MIN_GAP_OPTIONS)[number];\n\n/* ------------------------------------------------------------------ */\n/* Payload shapes */\n/* ------------------------------------------------------------------ */\n\nexport interface TbProject {\n /* mirrors: Project (id, name, company, label colour) */\n id: number;\n name: string;\n company: string;\n color: string;\n}\n\nexport interface TbUser {\n /* mirrors: User (id, display_name) + workweek capacity\n (loadUsersWorkweekCapacities: minutes per ISO weekday, 0 = day off) */\n id: number;\n name: string;\n /** ISO weekday (1 = Monday) → capacity in minutes; missing or 0 = off. */\n capacity: Record<number, number>;\n}\n\nexport interface TbTask {\n /* mirrors: Task (id, project_id, name, start_on, due_on, is_important,\n is_completed) + Assignee (user_id, estimate); estimate in minutes here,\n the payload has hours */\n id: number;\n projectId: number;\n name: string;\n startOn: DateKey;\n dueOn: DateKey;\n isImportant: boolean;\n isCompleted: boolean;\n /** My Work list order. */\n position: number;\n assigneeId: number;\n /** The assignee's estimate in minutes; null when there is none. */\n estimate: number | null;\n}\n\nexport interface TbSubtask {\n /* mirrors: Subtask (id, task_id, name, due_on, is_completed) */\n id: number;\n taskId: number;\n name: string;\n dueOn: DateKey;\n isCompleted: boolean;\n}\n\nexport interface TbPart {\n /* mirrors: TaskSplit (task_id, date, duration) + starts_on_time, which is\n no payload yet: null is the day's untimed part, a time is a pinned\n timebox */\n id: string;\n taskId: number;\n date: DateKey;\n startsOnTime: Clock | null;\n durationMinutes: number;\n}\n\nexport interface TbEvent {\n /* mirrors: GET /calendars/events/for-screen events[] (name, color,\n starts_on, starts_on_time, ends_on_time, is_participant, meeting_url) */\n id: number;\n name: string;\n calendarName: string;\n color: string;\n date: DateKey;\n startsOnTime: Clock;\n endsOnTime: Clock;\n isParticipant: boolean;\n meetingUrl: string | null;\n}\n\nexport interface TbSettings {\n /* mirrors: no payload yet (the user's timebox settings) */\n workdayStartsAt: Clock;\n minGapMinutes: MinGap;\n pause: { startsAt: Clock; minutes: number } | null;\n}\n\nexport interface TbTimeRecord {\n /* mirrors: TimeRecord (parent_id, user_id, record_date, value); value in\n minutes here, the payload has hours. A record has no start time. */\n id: string;\n taskId: number;\n userId: number;\n recordDate: DateKey;\n minutes: number;\n}\n\n/** Everything the simulation changes. Projects and users are fixed. */\nexport interface TbState {\n tasks: TbTask[];\n subtasks: TbSubtask[];\n parts: TbPart[];\n events: TbEvent[];\n settings: TbSettings;\n /** Tracked time: display only, nothing is planned from it. */\n timeRecords: TbTimeRecord[];\n /** Next id for parts and events the simulation creates. */\n nextId: number;\n}\n\n/* ------------------------------------------------------------------ */\n/* Time */\n/* ------------------------------------------------------------------ */\n\nexport const clockToMinutes = (clock: Clock): number => {\n const [hours, minutes] = clock.split(\":\").map(Number);\n return hours * 60 + minutes;\n};\n\nexport const minutesToClock = (minutes: number): Clock =>\n `${String(Math.floor(minutes / 60)).padStart(2, \"0\")}:${String(\n minutes % 60\n ).padStart(2, \"0\")}`;\n\n/** Down to the 5-minute grid. */\nexport const snapDown = (minutes: number): number =>\n Math.floor(minutes / SNAP_MINUTES) * SNAP_MINUTES;\n\n/** To the nearest step of the 5-minute grid. */\nexport const snap = (minutes: number): number =>\n Math.round(minutes / SNAP_MINUTES) * SNAP_MINUTES;\n\n/** \"1h\", \"1h30\", \"45m\" — the concept's hours. */\nexport const formatMinutes = (minutes: number): string => {\n const hours = Math.floor(minutes / 60);\n const rest = minutes % 60;\n if (hours === 0) return `${rest}m`;\n return rest === 0 ? `${hours}h` : `${hours}h${String(rest).padStart(2, \"0\")}`;\n};\n\nconst toUtc = (date: DateKey): Date => new Date(`${date}T00:00:00Z`);\n\nexport const addDays = (date: DateKey, days: number): DateKey => {\n const next = toUtc(date);\n next.setUTCDate(next.getUTCDate() + days);\n return next.toISOString().slice(0, 10);\n};\n\n/** ISO weekday, 1 = Monday … 7 = Sunday. */\nexport const isoWeekday = (date: DateKey): number =>\n ((toUtc(date).getUTCDay() + 6) % 7) + 1;\n\n/** Every date from start to end, both included. */\nexport const datesBetween = (start: DateKey, end: DateKey): DateKey[] => {\n const dates: DateKey[] = [];\n for (let date = start; date <= end; date = addDays(date, 1)) {\n dates.push(date);\n }\n return dates;\n};\n\n/* ------------------------------------------------------------------ */\n/* Availability and allocation */\n/* ------------------------------------------------------------------ */\n\nexport const capacityOn = (user: TbUser, date: DateKey): number =>\n user.capacity[isoWeekday(date)] ?? 0;\n\n/** The days in the task's range the assignee works (TaskSplitterByAssignee\n gives the other days 0). */\nexport const availableDays = (task: TbTask, user: TbUser): DateKey[] =>\n datesBetween(task.startOn, task.dueOn).filter(\n (date) => capacityOn(user, date) > 0\n );\n\n/**\n * An even spread of whole minutes over days, as the app's add(): each day\n * the total over the day count, rounded down to whole minutes, with the\n * leftover minutes on the last days so the parts still sum to the total.\n */\nexport const evenSpread = (\n total: number,\n days: DateKey[]\n): Map<DateKey, number> => {\n const spread = new Map<DateKey, number>();\n if (days.length === 0) return spread;\n const base = Math.floor(total / days.length);\n const leftover = total - base * days.length;\n days.forEach((date, index) => {\n spread.set(date, base + (index >= days.length - leftover ? 1 : 0));\n });\n return spread;\n};\n\nexport const partsOf = (state: TbState, taskId: number): TbPart[] =>\n state.parts.filter((part) => part.taskId === taskId);\n\nexport const isSplit = (state: TbState, taskId: number): boolean =>\n state.parts.some((part) => part.taskId === taskId);\n\nexport const isTimebox = (part: TbPart): boolean => part.startsOnTime !== null;\n\nexport const timeboxesOn = (\n state: TbState,\n taskId: number,\n date: DateKey\n): TbPart[] =>\n partsOf(state, taskId)\n .filter((part) => part.date === date && isTimebox(part))\n .sort(\n (a, b) =>\n clockToMinutes(a.startsOnTime ?? \"00:00\") -\n clockToMinutes(b.startsOnTime ?? \"00:00\")\n );\n\nexport const untimedPartOn = (\n state: TbState,\n taskId: number,\n date: DateKey\n): TbPart | undefined =>\n state.parts.find(\n (part) =>\n part.taskId === taskId && part.date === date && part.startsOnTime === null\n );\n\nconst sum = (parts: TbPart[]): number =>\n parts.reduce((total, part) => total + part.durationMinutes, 0);\n\nexport const pinnedOn = (\n state: TbState,\n taskId: number,\n date: DateKey\n): number => sum(timeboxesOn(state, taskId, date));\n\n/** The day's allocation: the parts on it once split, else the even share. */\nexport const allocationOn = (\n state: TbState,\n task: TbTask,\n user: TbUser,\n date: DateKey\n): number => {\n if (isSplit(state, task.id)) {\n return sum(partsOf(state, task.id).filter((part) => part.date === date));\n }\n if (task.estimate === null) return 0;\n return evenSpread(task.estimate, availableDays(task, user)).get(date) ?? 0;\n};\n\n/** What the day still leaves to suggestions: allocation − pinned. */\nexport const untimedOn = (\n state: TbState,\n task: TbTask,\n user: TbUser,\n date: DateKey\n): number =>\n allocationOn(state, task, user, date) - pinnedOn(state, task.id, date);\n\nexport interface TimeRange {\n start: number;\n end: number;\n}\n\nexport const rangeOf = (part: TbPart): TimeRange => {\n const start = clockToMinutes(part.startsOnTime ?? \"00:00\");\n return { start, end: start + part.durationMinutes };\n};\n\nexport const overlaps = (a: TimeRange, b: TimeRange): boolean =>\n a.start < b.end && b.start < a.end;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA,OAAO,MAAMA,eAAe,GAAG,EAAE,GAAG,EAAE;;AAEtC;AACA,OAAO,MAAMC,YAAY,GAAG,CAAC;AAE7B,OAAO,MAAMC,eAAe,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAU;;AAG3D;AACA;AACA;;AAwFA;;AAaA;AACA;AACA;;AAEA,OAAO,MAAMC,cAAc,GAAIC,KAAY,IAAa;EACtD,MAAAC,gBAAA,GAAyBD,KAAK,CAACE,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,CAACC,MAAM,CAAC;IAA9CC,KAAK,GAAAJ,gBAAA;IAAEK,OAAO,GAAAL,gBAAA;EACrB,OAAOI,KAAK,GAAG,EAAE,GAAGC,OAAO;AAC7B,CAAC;AAED,OAAO,MAAMC,cAAc,GAAID,OAAe,IACzCE,MAAM,CAACC,IAAI,CAACC,KAAK,CAACJ,OAAO,GAAG,EAAE,CAAC,CAAC,CAACK,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,SAAIH,MAAM,CAC5DF,OAAO,GAAG,EACZ,CAAC,CAACK,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAG;;AAEtB;AACA,OAAO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