@activecollab/components 2.0.533 → 2.0.535

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 (49) hide show
  1. package/dist/cjs/presentation/myWork/MyWorkListSettingsDialog.js +250 -0
  2. package/dist/cjs/presentation/myWork/MyWorkListSettingsDialog.js.map +1 -0
  3. package/dist/cjs/presentation/myWork/MyWorkTasks.js +1789 -0
  4. package/dist/cjs/presentation/myWork/MyWorkTasks.js.map +1 -0
  5. package/dist/cjs/presentation/shared/PanelResizer.js +104 -0
  6. package/dist/cjs/presentation/shared/PanelResizer.js.map +1 -0
  7. package/dist/cjs/presentation/shared/TaskSheetContent.js +381 -0
  8. package/dist/cjs/presentation/shared/TaskSheetContent.js.map +1 -0
  9. package/dist/cjs/presentation/shared/dashboardWidgets.js +26 -7
  10. package/dist/cjs/presentation/shared/dashboardWidgets.js.map +1 -1
  11. package/dist/cjs/presentation/shared/index.js +45 -1
  12. package/dist/cjs/presentation/shared/index.js.map +1 -1
  13. package/dist/cjs/presentation/shared/portfolioDetails.js +130 -38
  14. package/dist/cjs/presentation/shared/portfolioDetails.js.map +1 -1
  15. package/dist/cjs/presentation/shared/tokens.js +13 -1
  16. package/dist/cjs/presentation/shared/tokens.js.map +1 -1
  17. package/dist/esm/presentation/myWork/MyWorkListSettingsDialog.d.ts +12 -0
  18. package/dist/esm/presentation/myWork/MyWorkListSettingsDialog.d.ts.map +1 -0
  19. package/dist/esm/presentation/myWork/MyWorkListSettingsDialog.js +209 -0
  20. package/dist/esm/presentation/myWork/MyWorkListSettingsDialog.js.map +1 -0
  21. package/dist/esm/presentation/myWork/MyWorkTasks.d.ts +89 -0
  22. package/dist/esm/presentation/myWork/MyWorkTasks.d.ts.map +1 -0
  23. package/dist/esm/presentation/myWork/MyWorkTasks.js +1639 -0
  24. package/dist/esm/presentation/myWork/MyWorkTasks.js.map +1 -0
  25. package/dist/esm/presentation/shared/PanelResizer.d.ts +29 -0
  26. package/dist/esm/presentation/shared/PanelResizer.d.ts.map +1 -0
  27. package/dist/esm/presentation/shared/PanelResizer.js +86 -0
  28. package/dist/esm/presentation/shared/PanelResizer.js.map +1 -0
  29. package/dist/esm/presentation/shared/TaskSheetContent.d.ts +44 -0
  30. package/dist/esm/presentation/shared/TaskSheetContent.d.ts.map +1 -0
  31. package/dist/esm/presentation/shared/TaskSheetContent.js +349 -0
  32. package/dist/esm/presentation/shared/TaskSheetContent.js.map +1 -0
  33. package/dist/esm/presentation/shared/dashboardWidgets.d.ts +8 -2
  34. package/dist/esm/presentation/shared/dashboardWidgets.d.ts.map +1 -1
  35. package/dist/esm/presentation/shared/dashboardWidgets.js +34 -15
  36. package/dist/esm/presentation/shared/dashboardWidgets.js.map +1 -1
  37. package/dist/esm/presentation/shared/index.d.ts +5 -1
  38. package/dist/esm/presentation/shared/index.d.ts.map +1 -1
  39. package/dist/esm/presentation/shared/index.js +3 -1
  40. package/dist/esm/presentation/shared/index.js.map +1 -1
  41. package/dist/esm/presentation/shared/portfolioDetails.d.ts +14 -1
  42. package/dist/esm/presentation/shared/portfolioDetails.d.ts.map +1 -1
  43. package/dist/esm/presentation/shared/portfolioDetails.js +115 -37
  44. package/dist/esm/presentation/shared/portfolioDetails.js.map +1 -1
  45. package/dist/esm/presentation/shared/tokens.d.ts +11 -0
  46. package/dist/esm/presentation/shared/tokens.d.ts.map +1 -1
  47. package/dist/esm/presentation/shared/tokens.js +12 -0
  48. package/dist/esm/presentation/shared/tokens.js.map +1 -1
  49. package/package.json +1 -1
@@ -0,0 +1,1639 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import React, { useCallback, useMemo, useRef, useState } from "react";
3
+ import styled from "styled-components";
4
+ import { GlobalAddButton } from "../../components/Button/GlobalAddButton";
5
+ import { Chip, ChipGroup } from "../../components/Chip";
6
+ import { CompleteCheckbox } from "../../components/CompleteCheckbox";
7
+ import { Dot } from "../../components/Dot";
8
+ import { IconButton } from "../../components/IconButton";
9
+ import { CalendarAddXIcon, CalendarIcon, ChecklistSmallIcon, ClockAddIcon, ClockStopwatchIcon, CollapseAllIcon, CollapseExpandSingleIcon, DependencySmallIcon, ExpandAllIcon, EyeOffSmallIcon, MessageSmallIcon, RecurringCheckmarkSmallIcon, ReorderIcon, SettingsIcon, TaskAddIcon } from "../../components/Icons";
10
+ import { List, ListItem } from "../../components/List";
11
+ import { Menu } from "../../components/Menu";
12
+ import { PillButton } from "../../components/PillButton";
13
+ import { Select } from "../../components/Select";
14
+ import { Signifier } from "../../components/Signifier";
15
+ import { Tooltip } from "../../components/Tooltip";
16
+ import { Body2, Caption1, Caption2, Header2, Header3 } from "../../components/Typography";
17
+ import { ValueButton } from "../../components/ValueButton";
18
+ import { formatHours, useResizeObserver } from "../../utils";
19
+ import { DUE_BAR_TRACK, LG, MD, StyledPagePaper, TaskOptionsMenu, TRANSITION } from "../shared";
20
+
21
+ /**
22
+ * "My Work → Tasks" tab, mirroring `components/MyWork/UserTasksList.jsx` in
23
+ * the app: the By Project list (`TeamTasksGroupedByProjectList.jsx` — one
24
+ * shared paper, a CardBand per project, task-list groups inside) and the By
25
+ * Due Date / By Start Date lists (`UserTaskGroupedByDateList.jsx` — one paper,
26
+ * date buckets, a Project column). Rows mirror `ListView/TaskItem.js`.
27
+ *
28
+ * Live: grouping, collapse / expand (band, group, all), complete, stopwatch.
29
+ */
30
+
31
+ /* ================================================================== */
32
+ /* Dates */
33
+ /* ================================================================== */
34
+
35
+ const day = function (month, date, year) {
36
+ if (year === void 0) {
37
+ year = 2026;
38
+ }
39
+ return Date.UTC(year, month - 1, date) / 86400000;
40
+ };
41
+
42
+ /** Same "today" as the Calendar tab of this story. */
43
+ const TODAY = day(10, 15);
44
+ const SHORT_MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
45
+ const toDate = dayNumber => new Date(dayNumber * 86400000);
46
+ const mondayOf = dayNumber => dayNumber - (toDate(dayNumber).getUTCDay() + 6) % 7;
47
+ const formatDay = function (dayNumber, withMonth) {
48
+ if (withMonth === void 0) {
49
+ withMonth = true;
50
+ }
51
+ const date = toDate(dayNumber);
52
+ return withMonth ? SHORT_MONTHS[date.getUTCMonth()] + " " + date.getUTCDate() + "." : date.getUTCDate() + ".";
53
+ };
54
+ const formatLong = dayNumber => {
55
+ const date = toDate(dayNumber);
56
+ return SHORT_MONTHS[date.getUTCMonth()] + " " + date.getUTCDate() + ". " + date.getUTCFullYear();
57
+ };
58
+
59
+ /* ================================================================== */
60
+ /* Mock data */
61
+ /* ================================================================== */
62
+
63
+ const LABELS = [{
64
+ id: 1,
65
+ name: "NEW",
66
+ color: "#5E9E52"
67
+ }, {
68
+ id: 2,
69
+ name: "BLOCKED",
70
+ color: "#D9534F"
71
+ }, {
72
+ id: 3,
73
+ name: "BLOG",
74
+ color: "#4A86C8"
75
+ }, {
76
+ id: 4,
77
+ name: "SHEPHERD",
78
+ color: "#4E9A5F"
79
+ }, {
80
+ id: 5,
81
+ name: "CLOUD",
82
+ color: "#6E7180"
83
+ }, {
84
+ id: 6,
85
+ name: "WEB APP",
86
+ color: "#6E7180"
87
+ }, {
88
+ id: 7,
89
+ name: "BACKEND",
90
+ color: "#6E7180"
91
+ }, {
92
+ id: 8,
93
+ name: "SECURITY",
94
+ color: "#D9534F"
95
+ }, {
96
+ id: 9,
97
+ name: "INTEGRATIONS",
98
+ color: "#4A86C8"
99
+ }, {
100
+ id: 10,
101
+ name: "EXPORT",
102
+ color: "#6E7180"
103
+ }, {
104
+ id: 11,
105
+ name: "IMPLEMENTATION-REPORT",
106
+ color: "#6E7180"
107
+ }, {
108
+ id: 12,
109
+ name: "FRONTEND",
110
+ color: "#8467C9"
111
+ }, {
112
+ id: 13,
113
+ name: "DESIGN",
114
+ color: "#C98A2E"
115
+ }];
116
+ const labelById = id => LABELS.find(label => label.id === id);
117
+
118
+ /** Labels shown before "+N" (the app's default label count). */
119
+ const SHOWN_LABELS = 2;
120
+ const PROJECT_LABELS = [{
121
+ id: 21,
122
+ name: "PRODUCT",
123
+ color: "#9C8CE0"
124
+ }, {
125
+ id: 22,
126
+ name: "CLIENT",
127
+ color: "#FF9C9C"
128
+ }, {
129
+ id: 23,
130
+ name: "OPERATIONS",
131
+ color: "#84C3A3"
132
+ }];
133
+ /** In the user's My Work project order. */
134
+ const PROJECTS = [{
135
+ id: 2775,
136
+ name: "Export Project v1",
137
+ company: "ActiveCollab Inc.",
138
+ label_id: 21
139
+ }, {
140
+ id: 1912,
141
+ name: "Website Relaunch",
142
+ company: "Northwind Traders",
143
+ label_id: 22
144
+ }, {
145
+ id: 2873,
146
+ name: "Tasks Calendar v1",
147
+ company: "ActiveCollab Inc.",
148
+ label_id: 0
149
+ }, {
150
+ id: 2677,
151
+ name: "Project Portfolios v1",
152
+ company: "ActiveCollab Inc.",
153
+ label_id: 21
154
+ }, {
155
+ id: 1626,
156
+ name: "Ops",
157
+ company: "ActiveCollab Inc.",
158
+ label_id: 23
159
+ }, {
160
+ id: 2607,
161
+ name: "Technical Intake",
162
+ company: "ActiveCollab Inc.",
163
+ label_id: 0
164
+ }];
165
+ const projectById = id => PROJECTS.find(project => project.id === id);
166
+
167
+ /** The project calendar's fallback colour for a project with no label. */
168
+ const UNLABELED_PROJECT_COLOR = "#63A7DE";
169
+
170
+ /** A project's colour on a calendar: its label's, else the default. */
171
+ export const projectCalendarColor = projectId => {
172
+ var _PROJECT_LABELS$find$, _PROJECT_LABELS$find;
173
+ return (_PROJECT_LABELS$find$ = (_PROJECT_LABELS$find = PROJECT_LABELS.find(label => label.id === projectById(projectId).label_id)) == null ? void 0 : _PROJECT_LABELS$find.color) != null ? _PROJECT_LABELS$find$ : UNLABELED_PROJECT_COLOR;
174
+ };
175
+
176
+ /** `show_project_id_mode`: "#1475: Ilija Test". */
177
+ const projectDisplayName = project => "#" + project.id + ": " + project.name;
178
+ const TASK_LISTS = [{
179
+ id: 501,
180
+ project_id: 2775,
181
+ name: "Backend"
182
+ }, {
183
+ id: 502,
184
+ project_id: 2775,
185
+ name: "Frontend"
186
+ }, {
187
+ id: 511,
188
+ project_id: 1912,
189
+ name: "Design"
190
+ }, {
191
+ id: 512,
192
+ project_id: 1912,
193
+ name: "Content"
194
+ }, {
195
+ id: 521,
196
+ project_id: 2873,
197
+ name: "Month View"
198
+ }, {
199
+ id: 522,
200
+ project_id: 2873,
201
+ name: "Week & Day View"
202
+ }, {
203
+ id: 531,
204
+ project_id: 2677,
205
+ name: "Launch"
206
+ }, {
207
+ id: 541,
208
+ project_id: 1626,
209
+ name: "In Progress"
210
+ }, {
211
+ id: 542,
212
+ project_id: 1626,
213
+ name: "Backlog"
214
+ }, {
215
+ id: 551,
216
+ project_id: 2607,
217
+ name: "Triage"
218
+ }];
219
+ const TASKS = [/* Export Project v1 */
220
+ {
221
+ id: 444328,
222
+ project_id: 2775,
223
+ task_list_id: 501,
224
+ name: "Add rate limiting to the export API",
225
+ start_on: day(10, 5),
226
+ due_on: day(10, 9),
227
+ label_ids: [4],
228
+ comments_count: 1,
229
+ dependencies: 1
230
+ }, {
231
+ id: 452110,
232
+ project_id: 2775,
233
+ task_list_id: 501,
234
+ name: "Speed up large file exports",
235
+ start_on: day(10, 13),
236
+ due_on: day(10, 16),
237
+ label_ids: [7],
238
+ open_subtasks: 2,
239
+ comments_count: 3,
240
+ tracked: 5.5,
241
+ estimate: 8
242
+ }, {
243
+ id: 452117,
244
+ project_id: 2775,
245
+ task_list_id: 501,
246
+ name: "Retry failed export jobs",
247
+ start_on: null,
248
+ due_on: null,
249
+ label_ids: [7, 10],
250
+ estimate: 4
251
+ }, {
252
+ id: 452203,
253
+ project_id: 2775,
254
+ task_list_id: 502,
255
+ name: "Show export progress",
256
+ start_on: day(10, 15),
257
+ due_on: day(10, 15),
258
+ label_ids: [12],
259
+ comments_count: 2,
260
+ tracked: 2,
261
+ estimate: 3,
262
+ stopwatch: "running"
263
+ }, {
264
+ id: 452208,
265
+ project_id: 2775,
266
+ task_list_id: 502,
267
+ name: "Write the download link email",
268
+ start_on: null,
269
+ due_on: day(10, 21),
270
+ label_ids: [],
271
+ is_hidden_from_clients: true,
272
+ comments_count: 1
273
+ }, /* Website Relaunch */
274
+ {
275
+ id: 324329,
276
+ project_id: 1912,
277
+ task_list_id: 511,
278
+ name: "Redesign the homepage hero",
279
+ start_on: day(10, 9),
280
+ due_on: day(10, 13),
281
+ label_ids: [1],
282
+ open_subtasks: 1,
283
+ comments_count: 8,
284
+ dependencies: 1,
285
+ is_hidden_from_clients: true,
286
+ tracked: 8,
287
+ estimate: 6
288
+ }, {
289
+ id: 371989,
290
+ project_id: 1912,
291
+ task_list_id: 511,
292
+ name: "Navigation redesign",
293
+ start_on: null,
294
+ due_on: day(11, 12),
295
+ label_ids: [13],
296
+ open_subtasks: 1,
297
+ comments_count: 3,
298
+ dependencies: 2,
299
+ tracked: 9,
300
+ estimate: 4.5
301
+ }, {
302
+ id: 325400,
303
+ project_id: 1912,
304
+ task_list_id: 512,
305
+ name: "Update pricing page copy",
306
+ start_on: day(10, 14),
307
+ due_on: day(10, 19),
308
+ label_ids: [2, 3],
309
+ open_subtasks: 1,
310
+ comments_count: 1,
311
+ dependencies: 1,
312
+ created_from_recurring_task: false,
313
+ tracked: 4,
314
+ estimate: 36
315
+ }, {
316
+ id: 418239,
317
+ project_id: 1912,
318
+ task_list_id: 512,
319
+ name: "Case studies section",
320
+ start_on: day(10, 20),
321
+ due_on: day(10, 24),
322
+ label_ids: [],
323
+ comments_count: 4,
324
+ estimate: 15
325
+ }, /* Tasks Calendar v1 */
326
+ {
327
+ id: 471201,
328
+ project_id: 2873,
329
+ task_list_id: 521,
330
+ name: "Build the month view",
331
+ start_on: day(10, 6),
332
+ due_on: day(10, 14),
333
+ label_ids: [12],
334
+ comments_count: 8,
335
+ dependencies: 2,
336
+ tracked: 12,
337
+ estimate: 10,
338
+ stopwatch: "paused"
339
+ }, {
340
+ id: 471204,
341
+ project_id: 2873,
342
+ task_list_id: 521,
343
+ name: "Show week numbers",
344
+ start_on: day(10, 19),
345
+ due_on: day(10, 20),
346
+ label_ids: [12],
347
+ estimate: 2
348
+ }, {
349
+ id: 471210,
350
+ project_id: 2873,
351
+ task_list_id: 522,
352
+ name: "Add meeting links to events",
353
+ start_on: day(10, 14),
354
+ due_on: day(10, 22),
355
+ label_ids: [12, 9],
356
+ comments_count: 3,
357
+ tracked: 1.25,
358
+ estimate: 5
359
+ }, {
360
+ id: 471215,
361
+ project_id: 2873,
362
+ task_list_id: 522,
363
+ name: "Build the day view",
364
+ start_on: day(10, 26),
365
+ due_on: day(10, 30),
366
+ label_ids: [13]
367
+ }, {
368
+ id: 471219,
369
+ project_id: 2873,
370
+ task_list_id: 522,
371
+ name: "Add events to the calendar API",
372
+ start_on: null,
373
+ due_on: null,
374
+ label_ids: [7, 5, 8],
375
+ comments_count: 2
376
+ }, /* Project Portfolios v1 */
377
+ {
378
+ id: 466147,
379
+ project_id: 2677,
380
+ task_list_id: 531,
381
+ name: "Write the launch announcement",
382
+ start_on: null,
383
+ due_on: day(9, 29),
384
+ label_ids: [11],
385
+ comments_count: 4
386
+ }, {
387
+ id: 466150,
388
+ project_id: 2677,
389
+ task_list_id: 531,
390
+ name: "Add a project health widget",
391
+ start_on: day(10, 12),
392
+ due_on: day(10, 17),
393
+ label_ids: [12, 13],
394
+ is_important: true,
395
+ open_subtasks: 1,
396
+ comments_count: 6,
397
+ tracked: 9,
398
+ estimate: 6
399
+ }, {
400
+ id: 466162,
401
+ project_id: 2677,
402
+ task_list_id: 531,
403
+ name: "Write a help article",
404
+ start_on: day(10, 28),
405
+ due_on: day(11, 3),
406
+ label_ids: [3]
407
+ }, /* Ops */
408
+ {
409
+ id: 405625,
410
+ project_id: 1626,
411
+ task_list_id: 541,
412
+ name: "Plan the server maintenance window",
413
+ start_on: day(10, 15),
414
+ due_on: day(10, 16),
415
+ label_ids: [5],
416
+ comments_count: 2,
417
+ created_from_recurring_task: true
418
+ }, {
419
+ id: 405640,
420
+ project_id: 1626,
421
+ task_list_id: 541,
422
+ name: "Rotate API keys",
423
+ start_on: null,
424
+ due_on: day(10, 15),
425
+ label_ids: [8, 4],
426
+ is_important: true,
427
+ created_from_recurring_task: true
428
+ }, {
429
+ id: 405702,
430
+ project_id: 1626,
431
+ task_list_id: 541,
432
+ name: "Test backup restore",
433
+ start_on: day(10, 12),
434
+ due_on: day(10, 18),
435
+ label_ids: [5],
436
+ created_from_recurring_task: true,
437
+ tracked: 1.5,
438
+ estimate: 2
439
+ }, {
440
+ id: 405733,
441
+ project_id: 1626,
442
+ task_list_id: 542,
443
+ name: "Upgrade the cache server",
444
+ start_on: null,
445
+ due_on: null,
446
+ label_ids: [7],
447
+ comments_count: 1,
448
+ dependencies: 1
449
+ }, /* Technical Intake */
450
+ {
451
+ id: 456774,
452
+ project_id: 2607,
453
+ task_list_id: 551,
454
+ name: "Review attachments in comments",
455
+ start_on: null,
456
+ due_on: null,
457
+ label_ids: [5, 6],
458
+ is_important: true
459
+ }, {
460
+ id: 471915,
461
+ project_id: 2607,
462
+ task_list_id: 551,
463
+ name: "Fix formatting in exported reports",
464
+ start_on: null,
465
+ due_on: null,
466
+ label_ids: [7, 10, 8, 5],
467
+ comments_count: 3
468
+ }, {
469
+ id: 471936,
470
+ project_id: 2607,
471
+ task_list_id: 551,
472
+ name: "Remove an outdated dependency",
473
+ start_on: null,
474
+ due_on: null,
475
+ label_ids: [8, 7],
476
+ comments_count: 1
477
+ }, {
478
+ id: 471943,
479
+ project_id: 2607,
480
+ task_list_id: 551,
481
+ name: "Improve errors for invalid filters",
482
+ start_on: day(10, 21),
483
+ due_on: day(10, 23),
484
+ label_ids: [7, 4]
485
+ },
486
+ /* A busy Tuesday (Oct 20): enough on one day to fill the calendar's
487
+ All Day row past its ten lanes. */
488
+ {
489
+ id: 472301,
490
+ project_id: 2775,
491
+ task_list_id: 501,
492
+ name: "Limit concurrent exports",
493
+ start_on: null,
494
+ due_on: day(10, 20),
495
+ label_ids: [7]
496
+ }, {
497
+ id: 472302,
498
+ project_id: 2775,
499
+ task_list_id: 502,
500
+ name: "Design the export history empty state",
501
+ start_on: day(10, 20),
502
+ due_on: day(10, 20),
503
+ label_ids: [12],
504
+ comments_count: 2
505
+ }, {
506
+ id: 472303,
507
+ project_id: 1912,
508
+ task_list_id: 511,
509
+ name: "Fix hero image cropping",
510
+ start_on: null,
511
+ due_on: day(10, 20),
512
+ label_ids: [13],
513
+ is_important: true
514
+ }, {
515
+ id: 472304,
516
+ project_id: 1912,
517
+ task_list_id: 512,
518
+ name: "Update meta descriptions",
519
+ start_on: null,
520
+ due_on: day(10, 20),
521
+ label_ids: []
522
+ }, {
523
+ id: 472305,
524
+ project_id: 2873,
525
+ task_list_id: 521,
526
+ name: "Highlight today in the calendar",
527
+ start_on: day(10, 19),
528
+ due_on: day(10, 20),
529
+ label_ids: [12]
530
+ }, {
531
+ id: 472306,
532
+ project_id: 2873,
533
+ task_list_id: 522,
534
+ name: "Limit rows in the All Day section",
535
+ start_on: day(10, 20),
536
+ due_on: day(10, 21),
537
+ label_ids: [12],
538
+ estimate: 4
539
+ }, {
540
+ id: 472307,
541
+ project_id: 2677,
542
+ task_list_id: 531,
543
+ name: "Create an onboarding checklist",
544
+ start_on: null,
545
+ due_on: day(10, 20),
546
+ label_ids: []
547
+ }, {
548
+ id: 472308,
549
+ project_id: 1626,
550
+ task_list_id: 541,
551
+ name: "Renew SSL certificates",
552
+ start_on: null,
553
+ due_on: day(10, 20),
554
+ label_ids: [8]
555
+ }, {
556
+ id: 472309,
557
+ project_id: 1626,
558
+ task_list_id: 541,
559
+ name: "Update staging servers",
560
+ start_on: day(10, 20),
561
+ due_on: day(10, 21),
562
+ label_ids: [7],
563
+ tracked: 1.5,
564
+ estimate: 3
565
+ }, {
566
+ id: 472310,
567
+ project_id: 1626,
568
+ task_list_id: 542,
569
+ name: "Clean up old logs",
570
+ start_on: null,
571
+ due_on: day(10, 20),
572
+ label_ids: [5]
573
+ }, {
574
+ id: 472311,
575
+ project_id: 2607,
576
+ task_list_id: 551,
577
+ name: "Fix calendar sync after the time change",
578
+ start_on: null,
579
+ due_on: day(10, 20),
580
+ label_ids: [2]
581
+ }, {
582
+ id: 472312,
583
+ project_id: 2607,
584
+ task_list_id: 551,
585
+ name: "Fix week numbers at year end",
586
+ start_on: day(10, 20),
587
+ due_on: day(10, 22),
588
+ label_ids: []
589
+ }, /* Completed: on the calendar views only. */
590
+ {
591
+ id: 472320,
592
+ project_id: 2775,
593
+ task_list_id: 501,
594
+ name: "Set up export monitoring",
595
+ start_on: day(10, 12),
596
+ due_on: day(10, 14),
597
+ label_ids: [7],
598
+ is_completed: true
599
+ }, {
600
+ id: 472321,
601
+ project_id: 1912,
602
+ task_list_id: 512,
603
+ name: "Proofread the About page",
604
+ start_on: null,
605
+ due_on: day(10, 15),
606
+ label_ids: [],
607
+ is_completed: true
608
+ }, {
609
+ id: 472322,
610
+ project_id: 2873,
611
+ task_list_id: 521,
612
+ name: "Agree on the month view layout",
613
+ start_on: day(10, 5),
614
+ due_on: day(10, 9),
615
+ label_ids: [12],
616
+ is_completed: true
617
+ }, {
618
+ id: 472323,
619
+ project_id: 1626,
620
+ task_list_id: 541,
621
+ name: "Renew the domain",
622
+ start_on: null,
623
+ due_on: day(10, 13),
624
+ label_ids: [],
625
+ is_completed: true
626
+ }, {
627
+ id: 472324,
628
+ project_id: 2677,
629
+ task_list_id: 531,
630
+ name: "Collect beta feedback",
631
+ start_on: day(10, 19),
632
+ due_on: day(10, 20),
633
+ label_ids: [],
634
+ is_completed: true
635
+ }];
636
+ const SUBTASKS = [{
637
+ id: 90011,
638
+ task_id: 324329,
639
+ name: "Choose the hero image",
640
+ due_on: day(10, 16)
641
+ }, {
642
+ id: 90012,
643
+ task_id: 418239,
644
+ name: "Add image descriptions",
645
+ due_on: null
646
+ }, {
647
+ id: 90013,
648
+ task_id: 444328,
649
+ name: "Test the rate limits",
650
+ due_on: day(10, 20)
651
+ }, {
652
+ id: 90014,
653
+ task_id: 371989,
654
+ name: "Mobile menu layout",
655
+ due_on: day(10, 15)
656
+ }, /* Due on the busy Tuesday too. */
657
+ {
658
+ id: 90021,
659
+ task_id: 472302,
660
+ name: "Write the empty state text",
661
+ due_on: day(10, 20)
662
+ }, {
663
+ id: 90022,
664
+ task_id: 472306,
665
+ name: "Check the day view",
666
+ due_on: day(10, 20)
667
+ }, {
668
+ id: 90023,
669
+ task_id: 472309,
670
+ name: "Restart the web server",
671
+ due_on: day(10, 20)
672
+ }, {
673
+ id: 90024,
674
+ task_id: 418239,
675
+ name: "Pick three case studies",
676
+ due_on: day(10, 20)
677
+ }, /* Completed: on the calendar views only. */
678
+ {
679
+ id: 90031,
680
+ task_id: 452110,
681
+ name: "Profile the export job",
682
+ due_on: day(10, 14),
683
+ is_completed: true
684
+ }, {
685
+ id: 90032,
686
+ task_id: 472306,
687
+ name: "Agree on the row limit",
688
+ due_on: day(10, 20),
689
+ is_completed: true
690
+ }];
691
+ const taskById = id => TASKS.find(task => task.id === id);
692
+
693
+ /* ================================================================== */
694
+ /* Rows and grouping */
695
+ /* ================================================================== */
696
+
697
+ const GROUP_OPTIONS = [{
698
+ id: "start_date",
699
+ name: "By Start Date"
700
+ }, {
701
+ id: "date",
702
+ name: "By Due Date"
703
+ }, {
704
+ id: "project",
705
+ name: "By Project"
706
+ }];
707
+ /** Every row, completed ones included: what the calendar views draw. */
708
+ const ALL_ROWS = [...TASKS.map(task => ({
709
+ kind: "task",
710
+ key: "task-" + task.id,
711
+ task
712
+ })), ...SUBTASKS.map(subtask => ({
713
+ kind: "subtask",
714
+ key: "subtask-" + subtask.id,
715
+ subtask,
716
+ task: taskById(subtask.task_id)
717
+ }))];
718
+ /** Completed in the payload (not by a click in this session). */
719
+ const isPayloadCompleted = row => Boolean(row.kind === "task" ? row.task.is_completed : row.subtask.is_completed);
720
+
721
+ /** The lists' rows: open work only, as My Work loads it. */
722
+ const ROWS = ALL_ROWS.filter(row => !isPayloadCompleted(row));
723
+
724
+ /** Completed now: the payload's state, flipped by a click in this session
725
+ (so a completed task can be reopened from the day list). */
726
+ const isRowCompleted = (row, toggled) => isPayloadCompleted(row) !== toggled.has(row.key);
727
+
728
+ /** A subtask takes its task's dates when it has none (selector.userTasks.jsx). */
729
+ const datesOf = row => {
730
+ var _row$subtask$due_on, _row$subtask$due_on2;
731
+ return row.kind === "task" ? {
732
+ start: row.task.start_on,
733
+ due: row.task.due_on
734
+ } : {
735
+ start: (_row$subtask$due_on = row.subtask.due_on) != null ? _row$subtask$due_on : row.task.start_on,
736
+ due: (_row$subtask$due_on2 = row.subtask.due_on) != null ? _row$subtask$due_on2 : row.task.due_on
737
+ };
738
+ };
739
+ const nameOf = row => row.kind === "task" ? row.task.name : row.subtask.name;
740
+ const BUCKETS = [{
741
+ key: "overdue",
742
+ name: "Overdue"
743
+ }, {
744
+ key: "started",
745
+ name: "Started"
746
+ }, {
747
+ key: "today",
748
+ name: "Today"
749
+ }, {
750
+ key: "tomorrow",
751
+ name: "Tomorrow"
752
+ }, {
753
+ key: "restOfWeek",
754
+ name: "Rest of Week"
755
+ }, {
756
+ key: "nextWeek",
757
+ name: "Next Week"
758
+ }, {
759
+ key: "upcoming",
760
+ name: "Upcoming"
761
+ }, {
762
+ key: "notSet",
763
+ name: "Not Set"
764
+ }];
765
+
766
+ /** userWorkGroupByDate: overdue always goes by the due date. */
767
+ const bucketOf = (row, byStart) => {
768
+ const _datesOf = datesOf(row),
769
+ start = _datesOf.start,
770
+ due = _datesOf.due;
771
+ if (!byStart && due === null || byStart && start === null) {
772
+ return "notSet";
773
+ }
774
+ if (due !== null && due < TODAY) return "overdue";
775
+ if (byStart && start !== null && start < TODAY) return "started";
776
+ const reference = byStart ? start : due;
777
+ if (reference === TODAY) return "today";
778
+ if (reference === TODAY + 1) return "tomorrow";
779
+ const monday = mondayOf(TODAY);
780
+ if (reference <= monday + 6) return "restOfWeek";
781
+ if (reference <= monday + 13) return "nextWeek";
782
+ return "upcoming";
783
+ };
784
+ const dateGroups = byStart => {
785
+ const reference = row => {
786
+ var _ref;
787
+ const _datesOf2 = datesOf(row),
788
+ start = _datesOf2.start,
789
+ due = _datesOf2.due;
790
+ return (_ref = byStart ? start : due) != null ? _ref : Number.MAX_SAFE_INTEGER;
791
+ };
792
+ return BUCKETS.map(bucket => ({
793
+ key: (byStart ? "start" : "due") + ":" + bucket.key,
794
+ name: bucket.name,
795
+ alert: bucket.key === "overdue",
796
+ rows: ROWS.filter(row => bucketOf(row, byStart) === bucket.key).sort((a, b) => reference(a) - reference(b) || nameOf(a).localeCompare(nameOf(b), undefined, {
797
+ sensitivity: "base"
798
+ }))
799
+ })).filter(group => group.rows.length > 0);
800
+ };
801
+ const projectGroups = function (rows) {
802
+ if (rows === void 0) {
803
+ rows = ROWS;
804
+ }
805
+ return PROJECTS.map(project => {
806
+ const lists = TASK_LISTS.filter(list => list.project_id === project.id).map(list => ({
807
+ key: "list:" + list.id,
808
+ name: list.name,
809
+ rows: rows.filter(row => row.task.task_list_id === list.id)
810
+ })).filter(list => list.rows.length > 0);
811
+ return {
812
+ project,
813
+ lists,
814
+ count: lists.reduce((sum, list) => sum + list.rows.length, 0)
815
+ };
816
+ }).filter(group => group.count > 0);
817
+ };
818
+
819
+ /* ================================================================== */
820
+ /* For the calendar views */
821
+ /* ================================================================== */
822
+
823
+ /** A row as the calendar views place it: a task runs start…due, a subtask
824
+ sits on its own due date only (calendarItems.js). */
825
+
826
+ export const MY_WORK_CALENDAR_ROWS = ALL_ROWS.map(row => row.kind === "task" ? {
827
+ key: row.key,
828
+ kind: "task",
829
+ taskId: row.task.id,
830
+ name: row.task.name,
831
+ projectId: row.task.project_id,
832
+ start: row.task.start_on,
833
+ due: row.task.due_on,
834
+ important: Boolean(row.task.is_important),
835
+ completed: isPayloadCompleted(row)
836
+ } : {
837
+ key: row.key,
838
+ kind: "subtask",
839
+ taskId: row.task.id,
840
+ name: row.subtask.name,
841
+ projectId: row.task.project_id,
842
+ start: row.subtask.due_on,
843
+ due: row.subtask.due_on,
844
+ important: false,
845
+ completed: isPayloadCompleted(row)
846
+ });
847
+
848
+ /** Is a calendar row completed now (payload, flipped by a click). */
849
+ export const isCalendarRowCompleted = (row, toggled) => row.completed !== toggled.has(row.key);
850
+
851
+ /** Is the row on the day: a task when start…due covers it (getTasksByDate),
852
+ a subtask when it is due that day. */
853
+ const isOnDay = (row, dayNumber) => {
854
+ var _row$task$start_on, _row$task$due_on;
855
+ if (row.kind === "subtask") return row.subtask.due_on === dayNumber;
856
+ const start = (_row$task$start_on = row.task.start_on) != null ? _row$task$start_on : row.task.due_on;
857
+ const due = (_row$task$due_on = row.task.due_on) != null ? _row$task$due_on : row.task.start_on;
858
+ if (start === null || due === null) return false;
859
+ return start <= dayNumber && Math.max(start, due) >= dayNumber;
860
+ };
861
+
862
+ /* ================================================================== */
863
+ /* State */
864
+ /* ================================================================== */
865
+
866
+ /* ================================================================== */
867
+ /* Display settings */
868
+ /* ================================================================== */
869
+
870
+ const DEFAULT_DISPLAY_SETTINGS = {
871
+ columns: [{
872
+ type: "Identifier",
873
+ value: true
874
+ }, {
875
+ type: "Date",
876
+ value: true
877
+ }, {
878
+ type: "Label",
879
+ value: true,
880
+ label_count: SHOWN_LABELS
881
+ }, {
882
+ type: "Time",
883
+ value: true
884
+ }],
885
+ task_signifiers: [{
886
+ name: "comments",
887
+ value: true
888
+ }, {
889
+ name: "dependencies",
890
+ value: true
891
+ }, {
892
+ name: "subtasks",
893
+ value: true
894
+ }, {
895
+ name: "client_visibility",
896
+ value: true
897
+ }, {
898
+ name: "recurrence",
899
+ value: true
900
+ }]
901
+ };
902
+ const isColumnOn = (settings, type) => {
903
+ var _settings$columns$fin, _settings$columns$fin2;
904
+ return (_settings$columns$fin = (_settings$columns$fin2 = settings.columns.find(column => column.type === type)) == null ? void 0 : _settings$columns$fin2.value) != null ? _settings$columns$fin : true;
905
+ };
906
+ const isSignifierOn = (settings, name) => {
907
+ var _settings$task_signif, _settings$task_signif2;
908
+ return (_settings$task_signif = (_settings$task_signif2 = settings.task_signifiers.find(signifier => signifier.name === name)) == null ? void 0 : _settings$task_signif2.value) != null ? _settings$task_signif : true;
909
+ };
910
+ const labelCountOf = settings => {
911
+ var _settings$columns$fin3, _settings$columns$fin4;
912
+ return (_settings$columns$fin3 = (_settings$columns$fin4 = settings.columns.find(column => column.type === "Label")) == null ? void 0 : _settings$columns$fin4.label_count) != null ? _settings$columns$fin3 : SHOWN_LABELS;
913
+ };
914
+
915
+ /** The list's classes for the columns the settings turn off. */
916
+ const hiddenColumnsClass = settings => [["Identifier", "hide-id"], ["Date", "hide-date"], ["Label", "hide-label"], ["Time", "hide-time"]].filter(_ref2 => {
917
+ let type = _ref2[0];
918
+ return !isColumnOn(settings, type);
919
+ }).map(_ref3 => {
920
+ let className = _ref3[1];
921
+ return className;
922
+ }).join(" ");
923
+ /** Lives in the page, so the tab chip and the tab controls see it too. */
924
+ export const useMyWorkTasks = () => {
925
+ const _useState = useState("project"),
926
+ groupBy = _useState[0],
927
+ setGroupBy = _useState[1];
928
+ const _useState2 = useState(new Set()),
929
+ completed = _useState2[0],
930
+ setCompleted = _useState2[1];
931
+ const _useState3 = useState(new Set()),
932
+ collapsed = _useState3[0],
933
+ setCollapsedKeys = _useState3[1];
934
+ const _useState4 = useState(DEFAULT_DISPLAY_SETTINGS),
935
+ displaySettings = _useState4[0],
936
+ setDisplaySettings = _useState4[1];
937
+ const _useState5 = useState(() => TASKS.reduce((all, task) => {
938
+ var _task$stopwatch;
939
+ return _extends({}, all, {
940
+ [task.id]: (_task$stopwatch = task.stopwatch) != null ? _task$stopwatch : "idle"
941
+ });
942
+ }, {})),
943
+ stopwatches = _useState5[0],
944
+ setStopwatches = _useState5[1];
945
+ const toggleCompleted = useCallback(key => setCompleted(previous => {
946
+ const next = new Set(previous);
947
+ if (next.has(key)) {
948
+ next.delete(key);
949
+ } else {
950
+ next.add(key);
951
+ }
952
+ return next;
953
+ }), []);
954
+
955
+ /* One running stopwatch at a time: starting one pauses the running one. */
956
+ const toggleStopwatch = useCallback(taskId => setStopwatches(previous => {
957
+ if (previous[taskId] === "running") {
958
+ return _extends({}, previous, {
959
+ [taskId]: "paused"
960
+ });
961
+ }
962
+ const next = {};
963
+ Object.keys(previous).forEach(id => {
964
+ next[Number(id)] = previous[Number(id)] === "running" ? "paused" : previous[Number(id)];
965
+ });
966
+ return _extends({}, next, {
967
+ [taskId]: "running"
968
+ });
969
+ }), []);
970
+ const setCollapsed = useCallback((keys, collapse) => setCollapsedKeys(previous => {
971
+ const next = new Set(previous);
972
+ keys.forEach(key => collapse ? next.add(key) : next.delete(key));
973
+ return next;
974
+ }), []);
975
+ return {
976
+ groupBy,
977
+ setGroupBy,
978
+ completed,
979
+ toggleCompleted,
980
+ stopwatches,
981
+ toggleStopwatch,
982
+ collapsed,
983
+ setCollapsed,
984
+ openCount: ROWS.filter(row => !completed.has(row.key)).length,
985
+ displaySettings,
986
+ setDisplaySettings
987
+ };
988
+ };
989
+
990
+ /* ================================================================== */
991
+ /* Tab controls */
992
+ /* ================================================================== */
993
+
994
+ const StyledGroupBy = styled.div.withConfig({
995
+ displayName: "MyWorkTasks__StyledGroupBy",
996
+ componentId: "sc-xtwv8c-0"
997
+ })(["display:flex;font-size:14px;.c-simple-menu__trigger:hover{color:var(--color-primary);}"]);
998
+
999
+ /** MyGroupedByPicker.jsx + MyWorkProjectsReorderControl, for #section-controls. */
1000
+ export const MyWorkTasksControls = _ref4 => {
1001
+ var _current$name;
1002
+ let state = _ref4.state,
1003
+ _ref4$hideGroupBy = _ref4.hideGroupBy,
1004
+ hideGroupBy = _ref4$hideGroupBy === void 0 ? false : _ref4$hideGroupBy;
1005
+ const _useState6 = useState(false),
1006
+ open = _useState6[0],
1007
+ setOpen = _useState6[1];
1008
+ const current = GROUP_OPTIONS.find(option => option.id === state.groupBy);
1009
+ return /*#__PURE__*/React.createElement(React.Fragment, null, state.groupBy === "project" ? /*#__PURE__*/React.createElement(Tooltip, {
1010
+ title: "Reorder Projects"
1011
+ }, /*#__PURE__*/React.createElement(IconButton, {
1012
+ variant: "text gray",
1013
+ "aria-label": "Reorder Projects"
1014
+ }, /*#__PURE__*/React.createElement(ReorderIcon, null))) : null, hideGroupBy ? null : /*#__PURE__*/React.createElement(StyledGroupBy, null, /*#__PURE__*/React.createElement(Menu, {
1015
+ open: open,
1016
+ onOpen: () => setOpen(true),
1017
+ onClose: () => setOpen(false),
1018
+ position: "bottom-end",
1019
+ target: /*#__PURE__*/React.createElement(ValueButton, {
1020
+ active: open,
1021
+ label: "Group",
1022
+ value: (_current$name = current == null ? void 0 : current.name) != null ? _current$name : ""
1023
+ })
1024
+ }, /*#__PURE__*/React.createElement(Select, {
1025
+ options: GROUP_OPTIONS,
1026
+ selected: state.groupBy,
1027
+ onChange: value => {
1028
+ setOpen(false);
1029
+ state.setGroupBy(String(value));
1030
+ },
1031
+ forceCloseMenu: true,
1032
+ disableSearch: true,
1033
+ keepSameOptionsOrder: true,
1034
+ disabledInternalSort: true
1035
+ }))));
1036
+ };
1037
+ const StyledAddMenuList = styled(List).withConfig({
1038
+ displayName: "MyWorkTasks__StyledAddMenuList",
1039
+ componentId: "sc-xtwv8c-1"
1040
+ })(["padding:8px 0;svg{width:20px;height:20px;}"]);
1041
+
1042
+ /** MyAddMenu.jsx — the My Work "+" for every tab. No-op items. */
1043
+ export const MyWorkAddMenu = () => {
1044
+ const _useState7 = useState(false),
1045
+ open = _useState7[0],
1046
+ setOpen = _useState7[1];
1047
+ const close = useCallback(() => setOpen(false), []);
1048
+ return /*#__PURE__*/React.createElement(Menu, {
1049
+ open: open,
1050
+ onOpen: () => setOpen(true),
1051
+ onClose: close,
1052
+ position: "bottom-end",
1053
+ target: /*#__PURE__*/React.createElement(GlobalAddButton, null)
1054
+ }, /*#__PURE__*/React.createElement(StyledAddMenuList, null, /*#__PURE__*/React.createElement(ListItem, {
1055
+ onClick: close
1056
+ }, /*#__PURE__*/React.createElement(TaskAddIcon, null), "Add Task"), /*#__PURE__*/React.createElement(ListItem, {
1057
+ onClick: close
1058
+ }, /*#__PURE__*/React.createElement(ClockAddIcon, null), "Add Time Record"), /*#__PURE__*/React.createElement(ListItem, {
1059
+ onClick: close
1060
+ }, /*#__PURE__*/React.createElement(CalendarAddXIcon, null), "Add Availability Record")));
1061
+ };
1062
+
1063
+ /* ================================================================== */
1064
+ /* Styles */
1065
+ /* ================================================================== */
1066
+
1067
+ /* Light: --new-list-line = theme-300, --new-list-header-line = border-primary. */
1068
+ const LIST_LINE = "var(--color-theme-300)";
1069
+ const HEADER_LINE = "var(--border-primary)";
1070
+ const COL = {
1071
+ id: 64,
1072
+ project: 250,
1073
+ /* The app's Start & Due Date column: 138px. */
1074
+ date: 138,
1075
+ label: 160,
1076
+ time: 156,
1077
+ menu: 40
1078
+ };
1079
+ const StyledList = styled.div.withConfig({
1080
+ displayName: "MyWorkTasks__StyledList",
1081
+ componentId: "sc-xtwv8c-2"
1082
+ })(["display:flex;flex-direction:column;.list-row{display:flex;align-items:stretch;height:37px;box-sizing:border-box;border-bottom:1px solid ", ";}.cell{display:none;align-items:center;flex-shrink:0;box-sizing:border-box;min-width:0;@media (min-width:", "){display:flex;}}.cell-id{width:", "px;padding:0 4px;justify-content:center;}.cell-project{width:", "px;padding:0 12px;}.cell-date{width:", "px;padding:0 12px;justify-content:flex-end;}.cell-label{width:", "px;padding:0 12px;gap:6px;}.cell-time{width:", "px;padding:0 4px 0 12px;justify-content:flex-end;gap:4px;}.cell-menu{display:flex;align-items:center;justify-content:center;flex-shrink:0;width:", "px;margin-right:4px;}&.hide-id .cell-id,&.hide-date .cell-date,&.hide-label .cell-label,&.hide-time .cell-time{display:none;}.truncate{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;}.empty-mark{color:var(--color-theme-500);}"], LIST_LINE, LG, COL.id, COL.project, COL.date, COL.label, COL.time, COL.menu);
1083
+ const StyledColumnsHeader = styled.div.withConfig({
1084
+ displayName: "MyWorkTasks__StyledColumnsHeader",
1085
+ componentId: "sc-xtwv8c-3"
1086
+ })(["&.list-row{border-bottom-color:", ";}.collapse-all{display:flex;align-items:center;flex-shrink:0;width:24px;margin-left:28px;padding-right:4px;svg{fill:var(--color-theme-600);}}.col-name{display:flex;align-items:center;flex:1;min-width:0;padding-left:4px;}.cell-time{justify-content:flex-end;}.settings{display:none;@media (min-width:", "){display:flex;}}"], HEADER_LINE, LG);
1087
+ const StyledHeading = styled.div.withConfig({
1088
+ displayName: "MyWorkTasks__StyledHeading",
1089
+ componentId: "sc-xtwv8c-4"
1090
+ })(["&.list-row{height:37px;align-items:center;padding-left:24px;cursor:pointer;transition:background-color ", ";&:hover{background-color:var(--color-theme-transparent-200);}}&.spaced{margin-top:24px;}.heading-count{display:flex;flex-shrink:0;position:relative;top:1px;margin:0 8px;}&.alert .heading-name{color:var(--red-alert);}&.collapsed .heading-name{color:var(--color-theme-600);}"], TRANSITION);
1091
+ const StyledExpandToggle = styled(IconButton).withConfig({
1092
+ displayName: "MyWorkTasks__StyledExpandToggle",
1093
+ componentId: "sc-xtwv8c-5"
1094
+ })(["flex-shrink:0;margin-left:-4px;svg{transition:transform 200ms;}&.collapsed svg{transform:rotate(180deg);}"]);
1095
+ const StyledRow = styled.div.withConfig({
1096
+ displayName: "MyWorkTasks__StyledRow",
1097
+ componentId: "sc-xtwv8c-6"
1098
+ })(["&.list-row{padding-left:28px;cursor:pointer;transition:background-color ", ";&:hover{background-color:var(--color-theme-transparent-200);}}.cell-check{display:flex;align-items:center;flex-shrink:0;padding-right:4px;}.cell-check .c-complete-checkbox{width:20px;height:20px;}.cell-check .c-complete-checkbox svg{width:40px;height:40px;}.cell-check .c-complete-checkbox.is-done,.cell-check .c-complete-checkbox.is-done:hover{box-shadow:none;border-color:var(--color-theme-500);}.cell-check .c-complete-checkbox.is-done svg polyline{stroke:var(--color-theme-500);}.cell-name{display:flex;flex:1;align-items:center;gap:4px;min-width:0;overflow:hidden;margin-right:4px;padding-left:4px;}.task-name{flex-shrink:1;min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color:var(--color-theme-800);}.task-name-text{font-size:calc(1em + 2px);}&.important .task-name{color:var(--red-alert);}&.completed .task-name{color:var(--color-theme-500);}&:hover .task-name{color:var(--color-primary);text-decoration:underline;}.parent-name{flex-shrink:1;min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;}.task-signifiers{display:none;flex-shrink:0;align-items:center;@media (min-width:", "){display:flex;}.c-signifier::before{content:\"\";flex-shrink:0;width:2px;height:2px;margin:0 6px;border-radius:100%;background-color:var(--color-theme-600);}}.project-link:hover{text-decoration:underline;}.date-start{margin-right:4px;white-space:nowrap;}.date-due{white-space:nowrap;color:var(--color-theme-700);&.overdue{color:var(--red-alert);}}.label-more{color:var(--color-theme-600);}.time-slot{position:relative;display:flex;align-items:center;justify-content:center;width:32px;height:100%;flex-shrink:0;}.time-bar{width:100%;height:4px;border-radius:4px;background:", ";overflow:hidden;span{display:block;height:100%;border-radius:4px;background-color:var(--color-theme-700);}&.over span{background-color:var(--red-alert);}}.stopwatch{position:absolute;inset:0;margin:auto;width:32px;justify-content:center;opacity:0;transition:opacity ", ";svg{width:20px;height:20px;fill:var(--color-theme-600);}&.running,&.paused{opacity:1;}&.running svg{fill:var(--red-alert);}&.paused svg{fill:var(--color-orange-lighter);}}&:hover .stopwatch{opacity:1;}.time-bar{transition:opacity ", ";}&:hover .time-bar,.time-slot.active .time-bar{opacity:0;}.time-values{display:flex;align-items:center;}.time-pill{min-width:calc(5ch + 4px);padding:0 2px;justify-content:center;}.time-value{color:var(--color-theme-800);&.over{color:var(--red-alert);}}.time-slash{padding:0 2px;color:var(--color-theme-600);}.row-options{opacity:0;transition:opacity ", ";svg{fill:var(--color-theme-500);}}&:hover .row-options,.row-options.open{opacity:1;svg{fill:var(--color-theme-700);}}"], TRANSITION, MD, DUE_BAR_TRACK, TRANSITION, TRANSITION, TRANSITION);
1099
+ const StyledPaper = styled(StyledPagePaper).withConfig({
1100
+ displayName: "MyWorkTasks__StyledPaper",
1101
+ componentId: "sc-xtwv8c-7"
1102
+ })(["margin-bottom:32px;padding-bottom:16px;overflow:hidden;&.by-project{padding-bottom:0;}"]);
1103
+
1104
+ /* CardBand.jsx */
1105
+ const StyledProjectCard = styled.section.withConfig({
1106
+ displayName: "MyWorkTasks__StyledProjectCard",
1107
+ componentId: "sc-xtwv8c-8"
1108
+ })(["border-bottom:1px solid ", ";&:last-child{border-bottom:0;}&.expanded{padding-bottom:24px;}.band{position:relative;display:flex;align-items:center;height:72px;box-sizing:border-box;padding:0 4px 0 24px;background-color:color-mix( in srgb,var(--color-theme-transparent-500) 13%,transparent );cursor:pointer;}&.expanded .band{border-bottom:1px solid ", ";}.band-text{display:flex;flex:1;flex-direction:column;gap:3px;min-width:0;padding:0 5px;}.band-company{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;text-transform:uppercase;letter-spacing:0.06em;}.band-title{display:flex;align-items:center;gap:8px;min-width:0;}.band-name{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-size:calc(1em + 2px);&:hover{text-decoration:underline;}}.band-count{flex-shrink:0;position:relative;top:1px;}.band-toggle{margin:-4px 0 -4px -4px;}"], HEADER_LINE, HEADER_LINE);
1109
+
1110
+ /* ================================================================== */
1111
+ /* Pieces */
1112
+ /* ================================================================== */
1113
+
1114
+ const COUNT_CHIP_BACKGROUND = "color-mix(in srgb, var(--color-theme-300) 20%, transparent)";
1115
+
1116
+ /** The count Chip of bands and group headings. */
1117
+ export const CountChip = _ref5 => {
1118
+ let count = _ref5.count,
1119
+ _ref5$backgroundColor = _ref5.backgroundColor,
1120
+ backgroundColor = _ref5$backgroundColor === void 0 ? COUNT_CHIP_BACKGROUND : _ref5$backgroundColor,
1121
+ _ref5$color = _ref5.color,
1122
+ color = _ref5$color === void 0 ? "var(--color-theme-800)" : _ref5$color,
1123
+ _ref5$size = _ref5.size,
1124
+ size = _ref5$size === void 0 ? "regular" : _ref5$size;
1125
+ return /*#__PURE__*/React.createElement(Chip, {
1126
+ label: "" + count,
1127
+ size: size,
1128
+ backgroundColor: backgroundColor,
1129
+ color: color,
1130
+ typographyProps: {
1131
+ weight: "medium",
1132
+ tabularNums: true
1133
+ }
1134
+ });
1135
+ };
1136
+ const ExpandToggle = _ref6 => {
1137
+ let expanded = _ref6.expanded,
1138
+ tooltip = _ref6.tooltip,
1139
+ className = _ref6.className,
1140
+ onClick = _ref6.onClick;
1141
+ return /*#__PURE__*/React.createElement(Tooltip, {
1142
+ title: expanded ? "Collapse " + tooltip : "Expand " + tooltip
1143
+ }, /*#__PURE__*/React.createElement(StyledExpandToggle, {
1144
+ variant: "text gray",
1145
+ className: [className, expanded ? "" : "collapsed"].filter(Boolean).join(" "),
1146
+ "aria-label": expanded ? "Collapse " + tooltip : "Expand " + tooltip,
1147
+ onClick: event => {
1148
+ event.stopPropagation();
1149
+ onClick == null || onClick();
1150
+ }
1151
+ }, /*#__PURE__*/React.createElement(CollapseExpandSingleIcon, null)));
1152
+ };
1153
+ const EmptyMark = () => /*#__PURE__*/React.createElement(Body2, {
1154
+ className: "empty-mark"
1155
+ }, "\u2014");
1156
+ const ColumnsHeader = _ref7 => {
1157
+ let showProject = _ref7.showProject,
1158
+ allCollapsed = _ref7.allCollapsed,
1159
+ onCollapseAll = _ref7.onCollapseAll;
1160
+ return /*#__PURE__*/React.createElement(StyledColumnsHeader, {
1161
+ className: "list-row"
1162
+ }, /*#__PURE__*/React.createElement("div", {
1163
+ className: "collapse-all"
1164
+ }, /*#__PURE__*/React.createElement(Tooltip, {
1165
+ title: allCollapsed ? "Expand All" : "Collapse All"
1166
+ }, /*#__PURE__*/React.createElement(IconButton, {
1167
+ size: "small",
1168
+ variant: "text gray",
1169
+ "aria-label": allCollapsed ? "Expand All" : "Collapse All",
1170
+ onClick: onCollapseAll
1171
+ }, allCollapsed ? /*#__PURE__*/React.createElement(ExpandAllIcon, null) : /*#__PURE__*/React.createElement(CollapseAllIcon, null)))), /*#__PURE__*/React.createElement("div", {
1172
+ className: "cell cell-id"
1173
+ }, /*#__PURE__*/React.createElement(Caption1, {
1174
+ color: "tertiary"
1175
+ }, "ID")), /*#__PURE__*/React.createElement("div", {
1176
+ className: "col-name"
1177
+ }, /*#__PURE__*/React.createElement(Caption1, {
1178
+ color: "tertiary",
1179
+ className: "truncate"
1180
+ }, "Name")), showProject ? /*#__PURE__*/React.createElement("div", {
1181
+ className: "cell cell-project"
1182
+ }, /*#__PURE__*/React.createElement(Caption1, {
1183
+ color: "tertiary",
1184
+ className: "truncate"
1185
+ }, "Project")) : null, /*#__PURE__*/React.createElement("div", {
1186
+ className: "cell cell-date"
1187
+ }, /*#__PURE__*/React.createElement(Caption1, {
1188
+ color: "tertiary",
1189
+ className: "truncate"
1190
+ }, "Start & Due Date")), /*#__PURE__*/React.createElement("div", {
1191
+ className: "cell cell-label"
1192
+ }, /*#__PURE__*/React.createElement(Caption1, {
1193
+ color: "tertiary",
1194
+ className: "truncate"
1195
+ }, "Label")), /*#__PURE__*/React.createElement("div", {
1196
+ className: "cell cell-time"
1197
+ }, /*#__PURE__*/React.createElement(Caption1, {
1198
+ color: "tertiary",
1199
+ className: "truncate"
1200
+ }, "Time")), /*#__PURE__*/React.createElement("div", {
1201
+ className: "cell-menu"
1202
+ }, /*#__PURE__*/React.createElement(Tooltip, {
1203
+ title: "Settings"
1204
+ }, /*#__PURE__*/React.createElement(IconButton, {
1205
+ size: "small",
1206
+ variant: "text gray",
1207
+ "aria-label": "Settings",
1208
+ className: "settings"
1209
+ }, /*#__PURE__*/React.createElement(SettingsIcon, null)))));
1210
+ };
1211
+ const GroupHeading = _ref8 => {
1212
+ let name = _ref8.name,
1213
+ count = _ref8.count,
1214
+ expanded = _ref8.expanded,
1215
+ alert = _ref8.alert,
1216
+ spaced = _ref8.spaced,
1217
+ tooltip = _ref8.tooltip,
1218
+ onToggle = _ref8.onToggle;
1219
+ return /*#__PURE__*/React.createElement(StyledHeading, {
1220
+ className: ["list-row", spaced ? "spaced" : "", alert ? "alert" : "", expanded ? "" : "collapsed"].filter(Boolean).join(" "),
1221
+ onClick: onToggle
1222
+ }, /*#__PURE__*/React.createElement(Header3, {
1223
+ className: "heading-name"
1224
+ }, name), /*#__PURE__*/React.createElement("span", {
1225
+ className: "heading-count"
1226
+ }, /*#__PURE__*/React.createElement(CountChip, {
1227
+ count: count
1228
+ })), /*#__PURE__*/React.createElement(ExpandToggle, {
1229
+ expanded: expanded,
1230
+ tooltip: tooltip,
1231
+ onClick: onToggle
1232
+ }));
1233
+ };
1234
+ const DateCell = _ref9 => {
1235
+ let start = _ref9.start,
1236
+ due = _ref9.due,
1237
+ neutralOverdue = _ref9.neutralOverdue,
1238
+ completed = _ref9.completed;
1239
+ if (start === null && due === null) {
1240
+ return /*#__PURE__*/React.createElement(EmptyMark, null);
1241
+ }
1242
+ const overdue = !completed && !neutralOverdue && due !== null && due < TODAY;
1243
+ const sameMonth = start !== null && due !== null && toDate(start).getUTCMonth() === toDate(due).getUTCMonth();
1244
+ const range = start !== null && due !== null && start !== due;
1245
+ const tooltip = range ? formatLong(start) + " \u2013 " + formatLong(due) : formatLong(due != null ? due : start);
1246
+ return /*#__PURE__*/React.createElement(Tooltip, {
1247
+ title: tooltip
1248
+ }, /*#__PURE__*/React.createElement(PillButton, {
1249
+ tone: "ghost",
1250
+ icon: /*#__PURE__*/React.createElement(CalendarIcon, null),
1251
+ placeholder: "Dates"
1252
+ }, range ? /*#__PURE__*/React.createElement(Body2, {
1253
+ color: "tertiary",
1254
+ className: "date-start"
1255
+ }, formatDay(start) + " -") : null, /*#__PURE__*/React.createElement(Body2, {
1256
+ weight: overdue ? "medium" : "regular",
1257
+ className: overdue ? "date-due overdue" : "date-due"
1258
+ }, range ? formatDay(due, !sameMonth) : formatDay(due != null ? due : start))));
1259
+ };
1260
+ const LabelCell = _ref0 => {
1261
+ let labelIds = _ref0.labelIds,
1262
+ shownCount = _ref0.shownCount;
1263
+ if (labelIds.length === 0) {
1264
+ return /*#__PURE__*/React.createElement(EmptyMark, null);
1265
+ }
1266
+ const labels = labelIds.map(labelById).filter(label => Boolean(label));
1267
+ const shown = labels.slice(0, shownCount);
1268
+ const rest = labels.length - shown.length;
1269
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ChipGroup, {
1270
+ joined: true
1271
+ }, shown.map(label => /*#__PURE__*/React.createElement(Chip, {
1272
+ key: label.id,
1273
+ label: label.name,
1274
+ tint: label.color,
1275
+ size: "tiny",
1276
+ typographyProps: {
1277
+ weight: "medium"
1278
+ }
1279
+ }))), rest > 0 ? /*#__PURE__*/React.createElement(Tooltip, {
1280
+ title: labels.slice(shownCount).map(label => label.name).join(", ")
1281
+ }, /*#__PURE__*/React.createElement(Caption1, {
1282
+ className: "label-more"
1283
+ }, "+" + rest)) : null);
1284
+ };
1285
+ const TimeCell = _ref1 => {
1286
+ var _task$tracked, _task$estimate;
1287
+ let task = _ref1.task,
1288
+ stopwatch = _ref1.stopwatch,
1289
+ onStopwatch = _ref1.onStopwatch;
1290
+ const tracked = (_task$tracked = task.tracked) != null ? _task$tracked : 0;
1291
+ const estimate = (_task$estimate = task.estimate) != null ? _task$estimate : 0;
1292
+ const over = estimate > 0 && tracked > estimate;
1293
+ const showBar = tracked > 0 && estimate > 0;
1294
+ const stopwatchTooltip = stopwatch === "running" ? "Pause Stopwatch" : stopwatch === "paused" ? "Resume Stopwatch" : "Start Stopwatch";
1295
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
1296
+ className: stopwatch === "idle" ? "time-slot" : "time-slot active"
1297
+ }, showBar ? /*#__PURE__*/React.createElement("div", {
1298
+ className: over ? "time-bar over" : "time-bar"
1299
+ }, /*#__PURE__*/React.createElement("span", {
1300
+ style: {
1301
+ width: Math.min(100, tracked / estimate * 100) + "%"
1302
+ }
1303
+ })) : null, /*#__PURE__*/React.createElement(Tooltip, {
1304
+ title: stopwatchTooltip
1305
+ }, /*#__PURE__*/React.createElement(PillButton, {
1306
+ tone: "ghost",
1307
+ inset: "tight",
1308
+ "aria-label": stopwatchTooltip,
1309
+ className: "stopwatch " + stopwatch,
1310
+ onClick: event => {
1311
+ event.stopPropagation();
1312
+ onStopwatch();
1313
+ }
1314
+ }, /*#__PURE__*/React.createElement(ClockStopwatchIcon, null)))), /*#__PURE__*/React.createElement("div", {
1315
+ className: "time-values"
1316
+ }, /*#__PURE__*/React.createElement(PillButton, {
1317
+ tone: "ghost",
1318
+ compact: true,
1319
+ className: "time-pill"
1320
+ }, /*#__PURE__*/React.createElement(Body2, {
1321
+ tabularNums: true,
1322
+ className: over ? "time-value over" : "time-value"
1323
+ }, tracked > 0 ? formatHours(tracked, false, false, "short") : "—")), /*#__PURE__*/React.createElement(Body2, {
1324
+ className: "time-slash"
1325
+ }, "/"), /*#__PURE__*/React.createElement(PillButton, {
1326
+ tone: "ghost",
1327
+ compact: true,
1328
+ className: "time-pill"
1329
+ }, /*#__PURE__*/React.createElement(Body2, {
1330
+ tabularNums: true,
1331
+ className: "time-value"
1332
+ }, estimate > 0 ? formatHours(estimate, false, false, "short") : "—"))));
1333
+ };
1334
+ const TaskSignifiers = _ref10 => {
1335
+ let task = _ref10.task,
1336
+ settings = _ref10.settings;
1337
+ const items = [];
1338
+ const on = name => isSignifierOn(settings, name);
1339
+ if (task.open_subtasks && on("subtasks")) {
1340
+ items.push(/*#__PURE__*/React.createElement(Signifier, {
1341
+ key: "subtasks",
1342
+ type: ChecklistSmallIcon,
1343
+ value: task.open_subtasks,
1344
+ tooltipText: "Subtasks"
1345
+ }));
1346
+ }
1347
+ if (task.comments_count && on("comments")) {
1348
+ items.push(/*#__PURE__*/React.createElement(Signifier, {
1349
+ key: "comments",
1350
+ type: MessageSmallIcon,
1351
+ value: task.comments_count,
1352
+ tooltipText: "Comments"
1353
+ }));
1354
+ }
1355
+ if (task.dependencies && on("dependencies")) {
1356
+ items.push(/*#__PURE__*/React.createElement(Signifier, {
1357
+ key: "dependencies",
1358
+ type: DependencySmallIcon,
1359
+ value: task.dependencies,
1360
+ tooltipText: "Dependencies"
1361
+ }));
1362
+ }
1363
+ if (task.is_hidden_from_clients && on("client_visibility")) {
1364
+ items.push(/*#__PURE__*/React.createElement(Signifier, {
1365
+ key: "hidden",
1366
+ type: EyeOffSmallIcon,
1367
+ tooltipText: "Hidden From Clients"
1368
+ }));
1369
+ }
1370
+ if (task.created_from_recurring_task && on("recurrence")) {
1371
+ items.push(/*#__PURE__*/React.createElement(Signifier, {
1372
+ key: "recurring",
1373
+ type: RecurringCheckmarkSmallIcon,
1374
+ tooltipText: "Made from recurring task"
1375
+ }));
1376
+ }
1377
+ return items.length > 0 ? /*#__PURE__*/React.createElement("span", {
1378
+ className: "task-signifiers"
1379
+ }, items) : null;
1380
+ };
1381
+ const TaskRow = _ref11 => {
1382
+ let row = _ref11.row,
1383
+ showProject = _ref11.showProject,
1384
+ neutralOverdue = _ref11.neutralOverdue,
1385
+ state = _ref11.state;
1386
+ const completed = isRowCompleted(row, state.completed);
1387
+ const _datesOf3 = datesOf(row),
1388
+ start = _datesOf3.start,
1389
+ due = _datesOf3.due;
1390
+ const project = projectById(row.task.project_id);
1391
+ const isTask = row.kind === "task";
1392
+ const important = isTask && row.task.is_important;
1393
+ return /*#__PURE__*/React.createElement(StyledRow, {
1394
+ className: ["list-row", important ? "important" : "", completed ? "completed" : ""].filter(Boolean).join(" ")
1395
+ }, /*#__PURE__*/React.createElement("span", {
1396
+ className: "cell-check"
1397
+ }, /*#__PURE__*/React.createElement(CompleteCheckbox, {
1398
+ completed: completed,
1399
+ className: completed ? "is-done" : undefined,
1400
+ onClick: event => {
1401
+ event.stopPropagation();
1402
+ state.toggleCompleted(row.key);
1403
+ }
1404
+ })), /*#__PURE__*/React.createElement("div", {
1405
+ className: "cell cell-id"
1406
+ }, isTask ? /*#__PURE__*/React.createElement(Tooltip, {
1407
+ title: "Copy Link"
1408
+ }, /*#__PURE__*/React.createElement(Body2, {
1409
+ color: "tertiary",
1410
+ tabularNums: true
1411
+ }, "#" + row.task.id)) : /*#__PURE__*/React.createElement(EmptyMark, null)), /*#__PURE__*/React.createElement("div", {
1412
+ className: "cell-name"
1413
+ }, /*#__PURE__*/React.createElement(Body2, {
1414
+ className: "task-name"
1415
+ }, /*#__PURE__*/React.createElement("span", {
1416
+ className: "task-name-text"
1417
+ }, isTask ? row.task.name : row.subtask.name)), isTask ? /*#__PURE__*/React.createElement(TaskSignifiers, {
1418
+ task: row.task,
1419
+ settings: state.displaySettings
1420
+ }) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Dot, {
1421
+ size: 4,
1422
+ color: "var(--color-theme-500)"
1423
+ }), /*#__PURE__*/React.createElement(Body2, {
1424
+ color: "tertiary",
1425
+ className: "parent-name"
1426
+ }, "Task: " + row.task.name))), showProject ? /*#__PURE__*/React.createElement("div", {
1427
+ className: "cell cell-project"
1428
+ }, /*#__PURE__*/React.createElement(Body2, {
1429
+ color: "tertiary",
1430
+ className: "truncate project-link"
1431
+ }, projectDisplayName(project))) : null, /*#__PURE__*/React.createElement("div", {
1432
+ className: "cell cell-date"
1433
+ }, /*#__PURE__*/React.createElement(DateCell, {
1434
+ start: isTask ? start : null,
1435
+ due: due,
1436
+ neutralOverdue: neutralOverdue,
1437
+ completed: completed
1438
+ })), /*#__PURE__*/React.createElement("div", {
1439
+ className: "cell cell-label"
1440
+ }, isTask ? /*#__PURE__*/React.createElement(LabelCell, {
1441
+ labelIds: row.task.label_ids,
1442
+ shownCount: labelCountOf(state.displaySettings)
1443
+ }) : /*#__PURE__*/React.createElement(EmptyMark, null)), /*#__PURE__*/React.createElement("div", {
1444
+ className: "cell cell-time"
1445
+ }, isTask ? /*#__PURE__*/React.createElement(TimeCell, {
1446
+ task: row.task,
1447
+ stopwatch: state.stopwatches[row.task.id],
1448
+ onStopwatch: () => state.toggleStopwatch(row.task.id)
1449
+ }) : null), /*#__PURE__*/React.createElement("div", {
1450
+ className: "cell-menu"
1451
+ }, /*#__PURE__*/React.createElement(TaskOptionsMenu, {
1452
+ targetClassName: "row-options"
1453
+ })));
1454
+ };
1455
+
1456
+ /* ================================================================== */
1457
+ /* The lists */
1458
+ /* ================================================================== */
1459
+
1460
+ const GroupedRows = _ref12 => {
1461
+ let groups = _ref12.groups,
1462
+ showProject = _ref12.showProject,
1463
+ tooltip = _ref12.tooltip,
1464
+ state = _ref12.state;
1465
+ return /*#__PURE__*/React.createElement(React.Fragment, null, groups.map((group, index) => {
1466
+ const expanded = !state.collapsed.has(group.key);
1467
+ return /*#__PURE__*/React.createElement("div", {
1468
+ key: group.key
1469
+ }, /*#__PURE__*/React.createElement(GroupHeading, {
1470
+ name: group.name,
1471
+ count: group.rows.length,
1472
+ expanded: expanded,
1473
+ alert: group.alert,
1474
+ spaced: index > 0,
1475
+ tooltip: tooltip,
1476
+ onToggle: () => state.setCollapsed([group.key], expanded)
1477
+ }), expanded ? group.rows.map(row => /*#__PURE__*/React.createElement(TaskRow, {
1478
+ key: row.key,
1479
+ row: row,
1480
+ showProject: showProject,
1481
+ neutralOverdue: Boolean(group.alert),
1482
+ state: state
1483
+ })) : null);
1484
+ }));
1485
+ };
1486
+ const ByDateList = _ref13 => {
1487
+ let state = _ref13.state,
1488
+ byStart = _ref13.byStart;
1489
+ const groups = useMemo(() => dateGroups(byStart), [byStart]);
1490
+ const keys = groups.map(group => group.key);
1491
+ const allCollapsed = keys.every(key => state.collapsed.has(key));
1492
+ return /*#__PURE__*/React.createElement(StyledPaper, {
1493
+ type: "paper-2"
1494
+ }, /*#__PURE__*/React.createElement(StyledList, {
1495
+ className: hiddenColumnsClass(state.displaySettings) || undefined
1496
+ }, /*#__PURE__*/React.createElement(ColumnsHeader, {
1497
+ showProject: true,
1498
+ allCollapsed: allCollapsed,
1499
+ onCollapseAll: () => state.setCollapsed(keys, !allCollapsed)
1500
+ }), /*#__PURE__*/React.createElement(GroupedRows, {
1501
+ groups: groups,
1502
+ showProject: true,
1503
+ tooltip: "Group",
1504
+ state: state
1505
+ })));
1506
+ };
1507
+ const ByProjectList = _ref14 => {
1508
+ let state = _ref14.state;
1509
+ const groups = useMemo(projectGroups, []);
1510
+ return /*#__PURE__*/React.createElement(StyledPaper, {
1511
+ type: "paper-2",
1512
+ className: "by-project"
1513
+ }, groups.map(_ref15 => {
1514
+ let project = _ref15.project,
1515
+ lists = _ref15.lists,
1516
+ count = _ref15.count;
1517
+ const projectKey = "project:" + project.id;
1518
+ const expanded = !state.collapsed.has(projectKey);
1519
+ const listKeys = lists.map(list => list.key);
1520
+ const allCollapsed = listKeys.every(key => state.collapsed.has(key));
1521
+ return /*#__PURE__*/React.createElement(StyledProjectCard, {
1522
+ key: project.id,
1523
+ className: expanded ? "expanded" : undefined
1524
+ }, /*#__PURE__*/React.createElement("div", {
1525
+ className: "band",
1526
+ onClick: () => state.setCollapsed([projectKey], expanded)
1527
+ }, /*#__PURE__*/React.createElement("div", {
1528
+ className: "band-text"
1529
+ }, /*#__PURE__*/React.createElement(Caption2, {
1530
+ color: "tertiary",
1531
+ weight: "bold",
1532
+ className: "band-company"
1533
+ }, project.company), /*#__PURE__*/React.createElement("div", {
1534
+ className: "band-title"
1535
+ }, /*#__PURE__*/React.createElement(Header2, {
1536
+ color: "theme-secondary",
1537
+ className: "band-name"
1538
+ }, projectDisplayName(project)), /*#__PURE__*/React.createElement("span", {
1539
+ className: "band-count"
1540
+ }, /*#__PURE__*/React.createElement(CountChip, {
1541
+ count: count
1542
+ })), /*#__PURE__*/React.createElement(ExpandToggle, {
1543
+ expanded: expanded,
1544
+ tooltip: "Project",
1545
+ className: "band-toggle",
1546
+ onClick: () => state.setCollapsed([projectKey], expanded)
1547
+ })))), expanded ? /*#__PURE__*/React.createElement(StyledList, {
1548
+ className: hiddenColumnsClass(state.displaySettings) || undefined
1549
+ }, /*#__PURE__*/React.createElement(ColumnsHeader, {
1550
+ showProject: false,
1551
+ allCollapsed: allCollapsed,
1552
+ onCollapseAll: () => state.setCollapsed(listKeys, !allCollapsed)
1553
+ }), /*#__PURE__*/React.createElement(GroupedRows, {
1554
+ groups: lists,
1555
+ showProject: false,
1556
+ tooltip: "Task List",
1557
+ state: state
1558
+ })) : null);
1559
+ }));
1560
+ };
1561
+
1562
+ /* The day view's list: the Calendar page's agenda layout (project name, a
1563
+ dot, the company — Agenda/CalendarTasks.jsx) with the Tasks tab's rows. */
1564
+ const StyledDayProjects = styled.div.withConfig({
1565
+ displayName: "MyWorkTasks__StyledDayProjects",
1566
+ componentId: "sc-xtwv8c-9"
1567
+ })(["display:flex;flex-direction:column;gap:20px;.day-project-name{display:flex;align-items:center;gap:8px;min-width:0;margin-bottom:4px;}.day-project-name > :first-child{min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;}.day-project-name > :not(:first-child){flex-shrink:0;}&.no-label .list-row .cell-label,&.no-time .list-row .cell-time{display:none;}&& .list-row{padding-left:0;}"]);
1568
+
1569
+ /** The narrowest the name may get before a column gives way to it. */
1570
+ const DAY_NAME_MIN_WIDTH = 240;
1571
+ /** What a row always draws besides the name: checkbox, ID, dates, menu. */
1572
+ const DAY_ROW_FIXED_WIDTH = 28 + COL.id + COL.date + COL.menu + 4;
1573
+
1574
+ /** Which optional columns a list of this width has room for. */
1575
+ const dayColumnsFor = width => ({
1576
+ label: width >= DAY_ROW_FIXED_WIDTH + COL.label + COL.time + DAY_NAME_MIN_WIDTH,
1577
+ time: width >= DAY_ROW_FIXED_WIDTH + COL.time + DAY_NAME_MIN_WIDTH
1578
+ });
1579
+
1580
+ /**
1581
+ * The day view's task list: the day's tasks and subtasks per project, each
1582
+ * drawn with the Tasks tab's own row, so completing one here completes it on
1583
+ * the Tasks tab too. Rows keep the By Project order (task list, then the
1584
+ * list's own order).
1585
+ */
1586
+ export const MyWorkDayTasks = _ref16 => {
1587
+ var _useResizeObserver$wi, _useResizeObserver;
1588
+ let dayNumber = _ref16.day,
1589
+ state = _ref16.state,
1590
+ showCompleted = _ref16.showCompleted,
1591
+ showSubtasks = _ref16.showSubtasks,
1592
+ empty = _ref16.empty;
1593
+ const groups = useMemo(() => projectGroups(ALL_ROWS.filter(row => isOnDay(row, dayNumber) && (showSubtasks || row.kind === "task") && (showCompleted || !isRowCompleted(row, state.completed)))), [dayNumber, showSubtasks, showCompleted, state.completed]);
1594
+ /* The list's own width, not the viewport's: the panel beside the calendar
1595
+ changes with the user's resize. */
1596
+ const listRef = useRef(null);
1597
+ const listWidth = (_useResizeObserver$wi = (_useResizeObserver = useResizeObserver(listRef)) == null ? void 0 : _useResizeObserver.width) != null ? _useResizeObserver$wi : Infinity;
1598
+ const columns = dayColumnsFor(listWidth);
1599
+ const className = [columns.label ? "" : "no-label", columns.time ? "" : "no-time"].filter(Boolean).join(" ") || undefined;
1600
+ return /*#__PURE__*/React.createElement(StyledDayProjects, {
1601
+ ref: listRef,
1602
+ className: className
1603
+ }, groups.length === 0 ? empty : null, groups.map(_ref17 => {
1604
+ let project = _ref17.project,
1605
+ lists = _ref17.lists;
1606
+ return /*#__PURE__*/React.createElement("section", {
1607
+ key: project.id
1608
+ }, /*#__PURE__*/React.createElement("div", {
1609
+ className: "day-project-name"
1610
+ }, /*#__PURE__*/React.createElement(Header3, {
1611
+ color: "theme-primary"
1612
+ }, project.name), /*#__PURE__*/React.createElement(Dot, {
1613
+ color: "var(--color-theme-600)",
1614
+ size: 4
1615
+ }), /*#__PURE__*/React.createElement(Body2, {
1616
+ color: "tertiary"
1617
+ }, project.company)), /*#__PURE__*/React.createElement(StyledList, {
1618
+ className: hiddenColumnsClass(state.displaySettings) || undefined
1619
+ }, lists.flatMap(list => list.rows).map(row => /*#__PURE__*/React.createElement(TaskRow, {
1620
+ key: row.key,
1621
+ row: row,
1622
+ showProject: false,
1623
+ neutralOverdue: false,
1624
+ state: state
1625
+ }))));
1626
+ }));
1627
+ };
1628
+
1629
+ /** UserTasksList.jsx: the tab's content under the tab bar. */
1630
+ export const MyWorkTasks = _ref18 => {
1631
+ let state = _ref18.state;
1632
+ return state.groupBy === "project" ? /*#__PURE__*/React.createElement(ByProjectList, {
1633
+ state: state
1634
+ }) : /*#__PURE__*/React.createElement(ByDateList, {
1635
+ state: state,
1636
+ byStart: state.groupBy === "start_date"
1637
+ });
1638
+ };
1639
+ //# sourceMappingURL=MyWorkTasks.js.map