@activecollab/components 2.0.576 → 2.0.578

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/dist/cjs/presentation/myWork/MyWorkTasks.js +83 -30
  2. package/dist/cjs/presentation/myWork/MyWorkTasks.js.map +1 -1
  3. package/dist/cjs/presentation/myWork/agendaGrid.js +1095 -0
  4. package/dist/cjs/presentation/myWork/agendaGrid.js.map +1 -0
  5. package/dist/cjs/presentation/reports/allReports.js +6 -0
  6. package/dist/cjs/presentation/reports/allReports.js.map +1 -1
  7. package/dist/cjs/presentation/reports/controls.js +6 -3
  8. package/dist/cjs/presentation/reports/controls.js.map +1 -1
  9. package/dist/cjs/presentation/reports/expenses.js +946 -0
  10. package/dist/cjs/presentation/reports/expenses.js.map +1 -0
  11. package/dist/cjs/presentation/shared/settings.js +6 -2
  12. package/dist/cjs/presentation/shared/settings.js.map +1 -1
  13. package/dist/cjs/presentation/shared/tokens.js +8 -1
  14. package/dist/cjs/presentation/shared/tokens.js.map +1 -1
  15. package/dist/cjs/presentation/timeboxes/AdjustmentList.js +31 -0
  16. package/dist/cjs/presentation/timeboxes/AdjustmentList.js.map +1 -0
  17. package/dist/cjs/presentation/timeboxes/AgendaDayView.js +1722 -0
  18. package/dist/cjs/presentation/timeboxes/AgendaDayView.js.map +1 -0
  19. package/dist/cjs/presentation/timeboxes/CapacityBar.js +54 -0
  20. package/dist/cjs/presentation/timeboxes/CapacityBar.js.map +1 -0
  21. package/dist/cjs/presentation/timeboxes/SimulationCard.js +47 -0
  22. package/dist/cjs/presentation/timeboxes/SimulationCard.js.map +1 -0
  23. package/dist/cjs/presentation/timeboxes/SimulationPanel.js +319 -0
  24. package/dist/cjs/presentation/timeboxes/SimulationPanel.js.map +1 -0
  25. package/dist/cjs/presentation/timeboxes/TimeRecordsSection.js +206 -0
  26. package/dist/cjs/presentation/timeboxes/TimeRecordsSection.js.map +1 -0
  27. package/dist/cjs/presentation/timeboxes/WorkloadView.js +887 -0
  28. package/dist/cjs/presentation/timeboxes/WorkloadView.js.map +1 -0
  29. package/dist/cjs/presentation/timeboxes/__tests__/timeboxes.test.js +699 -0
  30. package/dist/cjs/presentation/timeboxes/__tests__/timeboxes.test.js.map +1 -0
  31. package/dist/cjs/presentation/timeboxes/changes.js +293 -0
  32. package/dist/cjs/presentation/timeboxes/changes.js.map +1 -0
  33. package/dist/cjs/presentation/timeboxes/mockData.js +320 -0
  34. package/dist/cjs/presentation/timeboxes/mockData.js.map +1 -0
  35. package/dist/cjs/presentation/timeboxes/model.js +186 -0
  36. package/dist/cjs/presentation/timeboxes/model.js.map +1 -0
  37. package/dist/cjs/presentation/timeboxes/pillLook.js +72 -0
  38. package/dist/cjs/presentation/timeboxes/pillLook.js.map +1 -0
  39. package/dist/cjs/presentation/timeboxes/plan.js +181 -0
  40. package/dist/cjs/presentation/timeboxes/plan.js.map +1 -0
  41. package/dist/cjs/presentation/timeboxes/reducer.js +763 -0
  42. package/dist/cjs/presentation/timeboxes/reducer.js.map +1 -0
  43. package/dist/cjs/presentation/timeboxes/scheduler.js +147 -0
  44. package/dist/cjs/presentation/timeboxes/scheduler.js.map +1 -0
  45. package/dist/cjs/presentation/timeboxes/store.js +65 -0
  46. package/dist/cjs/presentation/timeboxes/store.js.map +1 -0
  47. package/dist/cjs/presentation/timeboxes/timeBlocks.js +1931 -0
  48. package/dist/cjs/presentation/timeboxes/timeBlocks.js.map +1 -0
  49. package/dist/cjs/presentation/timeboxes/timeboxSettings.js +369 -0
  50. package/dist/cjs/presentation/timeboxes/timeboxSettings.js.map +1 -0
  51. package/dist/cjs/presentation/timeboxes/tracked.js +189 -0
  52. package/dist/cjs/presentation/timeboxes/tracked.js.map +1 -0
  53. package/dist/esm/presentation/myWork/MyWorkTasks.d.ts +81 -1
  54. package/dist/esm/presentation/myWork/MyWorkTasks.d.ts.map +1 -1
  55. package/dist/esm/presentation/myWork/MyWorkTasks.js +76 -23
  56. package/dist/esm/presentation/myWork/MyWorkTasks.js.map +1 -1
  57. package/dist/esm/presentation/myWork/agendaGrid.d.ts +341 -0
  58. package/dist/esm/presentation/myWork/agendaGrid.d.ts.map +1 -0
  59. package/dist/esm/presentation/myWork/agendaGrid.js +1001 -0
  60. package/dist/esm/presentation/myWork/agendaGrid.js.map +1 -0
  61. package/dist/esm/presentation/reports/allReports.d.ts.map +1 -1
  62. package/dist/esm/presentation/reports/allReports.js +6 -0
  63. package/dist/esm/presentation/reports/allReports.js.map +1 -1
  64. package/dist/esm/presentation/reports/controls.d.ts +3 -1
  65. package/dist/esm/presentation/reports/controls.d.ts.map +1 -1
  66. package/dist/esm/presentation/reports/controls.js +6 -3
  67. package/dist/esm/presentation/reports/controls.js.map +1 -1
  68. package/dist/esm/presentation/reports/expenses.d.ts +62 -0
  69. package/dist/esm/presentation/reports/expenses.d.ts.map +1 -0
  70. package/dist/esm/presentation/reports/expenses.js +849 -0
  71. package/dist/esm/presentation/reports/expenses.js.map +1 -0
  72. package/dist/esm/presentation/shared/settings.d.ts +2 -0
  73. package/dist/esm/presentation/shared/settings.d.ts.map +1 -1
  74. package/dist/esm/presentation/shared/settings.js +5 -1
  75. package/dist/esm/presentation/shared/settings.js.map +1 -1
  76. package/dist/esm/presentation/shared/tokens.d.ts +6 -0
  77. package/dist/esm/presentation/shared/tokens.d.ts.map +1 -1
  78. package/dist/esm/presentation/shared/tokens.js +7 -0
  79. package/dist/esm/presentation/shared/tokens.js.map +1 -1
  80. package/dist/esm/presentation/timeboxes/AdjustmentList.d.ts +11 -0
  81. package/dist/esm/presentation/timeboxes/AdjustmentList.d.ts.map +1 -0
  82. package/dist/esm/presentation/timeboxes/AdjustmentList.js +22 -0
  83. package/dist/esm/presentation/timeboxes/AdjustmentList.js.map +1 -0
  84. package/dist/esm/presentation/timeboxes/AgendaDayView.d.ts +15 -0
  85. package/dist/esm/presentation/timeboxes/AgendaDayView.d.ts.map +1 -0
  86. package/dist/esm/presentation/timeboxes/AgendaDayView.js +1524 -0
  87. package/dist/esm/presentation/timeboxes/AgendaDayView.js.map +1 -0
  88. package/dist/esm/presentation/timeboxes/CapacityBar.d.ts +15 -0
  89. package/dist/esm/presentation/timeboxes/CapacityBar.d.ts.map +1 -0
  90. package/dist/esm/presentation/timeboxes/CapacityBar.js +48 -0
  91. package/dist/esm/presentation/timeboxes/CapacityBar.js.map +1 -0
  92. package/dist/esm/presentation/timeboxes/SimulationCard.d.ts +13 -0
  93. package/dist/esm/presentation/timeboxes/SimulationCard.d.ts.map +1 -0
  94. package/dist/esm/presentation/timeboxes/SimulationCard.js +41 -0
  95. package/dist/esm/presentation/timeboxes/SimulationCard.js.map +1 -0
  96. package/dist/esm/presentation/timeboxes/SimulationPanel.d.ts +18 -0
  97. package/dist/esm/presentation/timeboxes/SimulationPanel.d.ts.map +1 -0
  98. package/dist/esm/presentation/timeboxes/SimulationPanel.js +267 -0
  99. package/dist/esm/presentation/timeboxes/SimulationPanel.js.map +1 -0
  100. package/dist/esm/presentation/timeboxes/TimeRecordsSection.d.ts +14 -0
  101. package/dist/esm/presentation/timeboxes/TimeRecordsSection.d.ts.map +1 -0
  102. package/dist/esm/presentation/timeboxes/TimeRecordsSection.js +159 -0
  103. package/dist/esm/presentation/timeboxes/TimeRecordsSection.js.map +1 -0
  104. package/dist/esm/presentation/timeboxes/WorkloadView.d.ts +9 -0
  105. package/dist/esm/presentation/timeboxes/WorkloadView.d.ts.map +1 -0
  106. package/dist/esm/presentation/timeboxes/WorkloadView.js +761 -0
  107. package/dist/esm/presentation/timeboxes/WorkloadView.js.map +1 -0
  108. package/dist/esm/presentation/timeboxes/__tests__/timeboxes.test.d.ts +2 -0
  109. package/dist/esm/presentation/timeboxes/__tests__/timeboxes.test.d.ts.map +1 -0
  110. package/dist/esm/presentation/timeboxes/__tests__/timeboxes.test.js +640 -0
  111. package/dist/esm/presentation/timeboxes/__tests__/timeboxes.test.js.map +1 -0
  112. package/dist/esm/presentation/timeboxes/changes.d.ts +72 -0
  113. package/dist/esm/presentation/timeboxes/changes.d.ts.map +1 -0
  114. package/dist/esm/presentation/timeboxes/changes.js +224 -0
  115. package/dist/esm/presentation/timeboxes/changes.js.map +1 -0
  116. package/dist/esm/presentation/timeboxes/mockData.d.ts +16 -0
  117. package/dist/esm/presentation/timeboxes/mockData.d.ts.map +1 -0
  118. package/dist/esm/presentation/timeboxes/mockData.js +297 -0
  119. package/dist/esm/presentation/timeboxes/mockData.js.map +1 -0
  120. package/dist/esm/presentation/timeboxes/model.d.ts +136 -0
  121. package/dist/esm/presentation/timeboxes/model.d.ts.map +1 -0
  122. package/dist/esm/presentation/timeboxes/model.js +129 -0
  123. package/dist/esm/presentation/timeboxes/model.js.map +1 -0
  124. package/dist/esm/presentation/timeboxes/pillLook.d.ts +40 -0
  125. package/dist/esm/presentation/timeboxes/pillLook.d.ts.map +1 -0
  126. package/dist/esm/presentation/timeboxes/pillLook.js +65 -0
  127. package/dist/esm/presentation/timeboxes/pillLook.js.map +1 -0
  128. package/dist/esm/presentation/timeboxes/plan.d.ts +62 -0
  129. package/dist/esm/presentation/timeboxes/plan.d.ts.map +1 -0
  130. package/dist/esm/presentation/timeboxes/plan.js +116 -0
  131. package/dist/esm/presentation/timeboxes/plan.js.map +1 -0
  132. package/dist/esm/presentation/timeboxes/reducer.d.ts +203 -0
  133. package/dist/esm/presentation/timeboxes/reducer.d.ts.map +1 -0
  134. package/dist/esm/presentation/timeboxes/reducer.js +616 -0
  135. package/dist/esm/presentation/timeboxes/reducer.js.map +1 -0
  136. package/dist/esm/presentation/timeboxes/scheduler.d.ts +63 -0
  137. package/dist/esm/presentation/timeboxes/scheduler.d.ts.map +1 -0
  138. package/dist/esm/presentation/timeboxes/scheduler.js +120 -0
  139. package/dist/esm/presentation/timeboxes/scheduler.js.map +1 -0
  140. package/dist/esm/presentation/timeboxes/store.d.ts +23 -0
  141. package/dist/esm/presentation/timeboxes/store.d.ts.map +1 -0
  142. package/dist/esm/presentation/timeboxes/store.js +46 -0
  143. package/dist/esm/presentation/timeboxes/store.js.map +1 -0
  144. package/dist/esm/presentation/timeboxes/timeBlocks.d.ts +10 -0
  145. package/dist/esm/presentation/timeboxes/timeBlocks.d.ts.map +1 -0
  146. package/dist/esm/presentation/timeboxes/timeBlocks.js +1767 -0
  147. package/dist/esm/presentation/timeboxes/timeBlocks.js.map +1 -0
  148. package/dist/esm/presentation/timeboxes/timeboxSettings.d.ts +71 -0
  149. package/dist/esm/presentation/timeboxes/timeboxSettings.d.ts.map +1 -0
  150. package/dist/esm/presentation/timeboxes/timeboxSettings.js +302 -0
  151. package/dist/esm/presentation/timeboxes/timeboxSettings.js.map +1 -0
  152. package/dist/esm/presentation/timeboxes/tracked.d.ts +51 -0
  153. package/dist/esm/presentation/timeboxes/tracked.d.ts.map +1 -0
  154. package/dist/esm/presentation/timeboxes/tracked.js +136 -0
  155. package/dist/esm/presentation/timeboxes/tracked.js.map +1 -0
  156. package/package.json +1 -1
@@ -0,0 +1,761 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import React, { useEffect, useMemo, useState } from "react";
3
+ import styled from "styled-components";
4
+ import { NON_WORKING_HATCH, RoundAvatar, AVATAR_COLORS, StyledPagePaper, TRANSITION } from "../shared";
5
+ import { AdjustmentList } from "./AdjustmentList";
6
+ import { adjustmentLines, changedCells } from "./changes";
7
+ import { PROJECTS, TODAY, USERS } from "./mockData";
8
+ import { allocationOn, availableDays, capacityOn, clockToMinutes, datesBetween, formatMinutes, isSplit, minutesToClock, rangeOf, timeboxesOn } from "./model";
9
+ import { userDayLoad } from "./plan";
10
+ import { dayValueError, dayValueRange, previewDayValue, unsplitConfirmText } from "./reducer";
11
+ import { TB_CONTEXT, timeboxStore, useLastChange, useTimeboxState } from "./store";
12
+ import { Button } from "../../components/Button";
13
+ import { ConfirmDialog } from "../../components/ConfirmDialog";
14
+ import { Dialog } from "../../components/Dialog";
15
+ import { EditableHours } from "../../components/EditableHours";
16
+ import { IconButton } from "../../components/IconButton";
17
+ import { ArrowDownSmallIcon, CalendarIcon, ChecklistSmallIcon, ClockSmallIcon, EstimatesIcon, TreeDotsIcon, WarningTriangleSmallIcon } from "../../components/Icons";
18
+ import { List, ListItem, ListSeparator } from "../../components/List";
19
+ import { SkeletonLoader } from "../../components/Loaders/Skeleton";
20
+ import { Menu } from "../../components/Menu";
21
+ import { Tooltip } from "../../components/Tooltip";
22
+ import { Body2, Caption1, Caption2 } from "../../components/Typography";
23
+ import { formatHours } from "../../utils";
24
+
25
+ /**
26
+ * The Workload view of the Timeboxes simulation (the "Timeboxes –
27
+ * Simulation" story shows it under Workload in the main menu): the Workload
28
+ * page (src/components/Workload) on the Timeboxes model: a split task shows each day's total (untimed plus
29
+ * pinned) and edits it in place; a task that is not split shows the
30
+ * "h/d - Split" chip. Pinned timeboxes are the same parts as the split's
31
+ * days, so a pin in the Agenda splits the task here, and an edit here
32
+ * changes the suggestions there (the shared timeboxes store). What the last
33
+ * action changed is highlighted.
34
+ */
35
+ /* ================================================================== */
36
+ /* Geometry (WorkloadContext.js, workload.less) */
37
+ /* ================================================================== */
38
+
39
+ /** The week shown: Mon 2 – Sun 8 Nov. */
40
+ const WEEK = datesBetween("2026-11-02", "2026-11-08");
41
+ const LEFT_WIDTH = 270;
42
+ const DAY_WIDTH = 80;
43
+ /** Non-working days are half a column. */
44
+ const WEEKEND_WIDTH = 40;
45
+ const USER_ROW_HEIGHT = 40;
46
+ /** workload_plus: a task line is 80px, its bar 72px from 8px down. */
47
+ const TASK_LINE_HEIGHT = 80;
48
+ const EVENT_LINE_HEIGHT = 48;
49
+ const BAR_INSET = 8;
50
+ /** How long later days show their skeletons after a day value is saved. */
51
+ const PENDING_MS = 900;
52
+ const isWeekend = date => [0, 6].includes(new Date(date + "T00:00:00Z").getUTCDay());
53
+ const widthOf = date => isWeekend(date) ? WEEKEND_WIDTH : DAY_WIDTH;
54
+ const leftOf = date => WEEK.slice(0, WEEK.indexOf(date)).reduce((sum, day) => sum + widthOf(day), 0);
55
+ const SHORT_WEEKDAYS = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"];
56
+
57
+ /** The app's hours: "2:30", via the DS formatHours. */
58
+ const hoursOf = minutes => formatHours(minutes / 60);
59
+
60
+ /** What EditableHours hands back ("2:30", "2", "1.5") in whole minutes. */
61
+ const minutesOfInput = value => {
62
+ const text = value.trim().replace(",", ".");
63
+ if (text === "") return null;
64
+ if (text.includes(":")) {
65
+ const _text$split$map = text.split(":").map(Number),
66
+ hours = _text$split$map[0],
67
+ minutes = _text$split$map[1];
68
+ if (Number.isNaN(hours) || Number.isNaN(minutes)) return null;
69
+ return hours * 60 + minutes;
70
+ }
71
+ const hours = Number(text);
72
+ return Number.isNaN(hours) ? null : Math.round(hours * 60);
73
+ };
74
+ const projectOf = projectId => PROJECTS.find(project => project.id === projectId);
75
+
76
+ /** Text on a bar filled with a project colour: the app's readable dark
77
+ (getReadableTextColor), a data colour like the label chips'. */
78
+ const BAR_TEXT = "#303037";
79
+ const AVATARS = [AVATAR_COLORS.blue, AVATAR_COLORS.orange, AVATAR_COLORS.teal];
80
+
81
+ /* ================================================================== */
82
+ /* Styles */
83
+ /* ================================================================== */
84
+
85
+ /* The Workload paper: a 270px left column and the week's day columns;
86
+ every row a flex line of the two. */
87
+ const StyledWorkload = styled(StyledPagePaper).withConfig({
88
+ displayName: "WorkloadView__StyledWorkload",
89
+ componentId: "sc-azob6f-0"
90
+ })(["padding:0;overflow-x:auto;.wl-row{display:flex;min-width:", "px;}.wl-left{box-sizing:border-box;flex-shrink:0;width:", "px;border-right:1px solid var(--border-primary);}.wl-days{position:relative;display:flex;flex-shrink:0;}.wl-day{box-sizing:border-box;flex-shrink:0;border-right:1px solid var(--border-primary);}.wl-day.today{background-color:var(--color-primary-100);}.wl-day.weekend{background-color:var(--color-theme-200);background-image:", ";}.wl-header{border-bottom:1px solid var(--border-primary);}.wl-header .wl-left{display:flex;align-items:center;padding:0 8px;border-bottom:none;}.wl-month{box-sizing:border-box;height:33px;display:flex;align-items:center;padding:0 10px;border-bottom:1px solid var(--border-primary);}.wl-day-head{height:33px;display:flex;flex-direction:column;align-items:center;justify-content:center;text-transform:uppercase;overflow:hidden;}.wl-day-head .day-number{padding-top:1px;border-top:2px solid transparent;}.wl-day-head.today .day-number{border-top-color:var(--color-secondary);}.wl-user .wl-left{height:", "px;display:flex;align-items:center;gap:8px;padding:0 16px 0 8px;border-bottom:1px solid var(--border-primary);cursor:pointer;}.wl-user-name{max-width:140px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.wl-capacity-pill{margin-left:auto;padding:3px 8px;border-radius:12px;background-color:var(--color-theme-200);}.wl-toggle{display:flex;transition:transform ", ";}.wl-toggle.collapsed{transform:rotate(-90deg);}.wl-load{height:", "px;display:flex;flex-direction:column;align-items:center;justify-content:center;border-bottom:1px solid var(--border-primary);}.wl-load.changed{box-shadow:inset 0 0 0 2px var(--color-primary);}.wl-load.occupied{background-color:var(--success-surface);}.wl-load.overtime{background-color:var(--alert-surface);}&& .wl-load.occupied .load-value{color:var(--green-success);}&& .wl-load.overtime .load-value{color:var(--red-alert);}.wl-project .wl-left{display:flex;justify-content:flex-end;gap:16px;padding:8px 3px 0 8px;}.wl-project-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.wl-marker{flex-shrink:0;width:4px;border-radius:2px;}.wl-project.last .wl-left,.wl-project.last .wl-day{border-bottom:1px solid var(--border-primary);}.wl-completed-link{display:flex;justify-content:flex-end;padding:4px 23px 8px 0;cursor:pointer;}"], LEFT_WIDTH + 5 * DAY_WIDTH + 2 * WEEKEND_WIDTH, LEFT_WIDTH, NON_WORKING_HATCH, USER_ROW_HEIGHT, TRANSITION, USER_ROW_HEIGHT);
91
+
92
+ /* A task bar (Entities/WorkloadTask.js): radius 3px, the project colour as
93
+ fill and border (set inline), two lines. */
94
+ const StyledBar = styled.div.withConfig({
95
+ displayName: "WorkloadView__StyledBar",
96
+ componentId: "sc-azob6f-1"
97
+ })(["box-sizing:border-box;position:absolute;z-index:1;display:flex;flex-direction:column;gap:2px;padding:3px 5px;border-style:solid;border-width:1px 1px 1px 3px;border-radius:3px;overflow:hidden;transition:padding ", ";&:hover{padding-left:8px;padding-right:8px;}&.no-estimate{background-color:var(--page-paper-main);}&.completed{opacity:0.75;}.bar-line{display:flex;align-items:center;gap:4px;min-width:0;padding-right:24px;}.bar-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.split-chip{display:inline-flex;align-items:center;gap:4px;align-self:flex-start;padding:0 2px;border-radius:2px;cursor:pointer;transition:background-color ", ";}.split-chip:hover{background-color:color-mix(in srgb,", " 12%,transparent);}.estimate-line{display:inline-flex;align-items:center;gap:4px;}.split-days{display:flex;align-items:flex-end;gap:6px;}.split-day{position:relative;display:flex;flex:2 1 0;justify-content:center;min-width:0;border-radius:4px;background-color:var(--only-white);opacity:0.8;}.split-day.changed{opacity:1;box-shadow:0 0 0 2px var(--color-primary);}.split-day.weekend{flex:1 1 0;background-color:transparent;}.split-day.zero .c-editable-content,.split-day.zero input{color:var(--color-theme-500);}.pinned-mark{position:absolute;top:2px;right:2px;display:flex;}.bar-menu{position:absolute;top:2px;right:2px;opacity:0;transition:opacity ", ";}&:hover .bar-menu,.bar-menu.open{opacity:1;}"], TRANSITION, TRANSITION, BAR_TEXT, TRANSITION);
98
+
99
+ /* The inline error under a day cell after a refused value. */
100
+ const StyledCellError = styled.div.withConfig({
101
+ displayName: "WorkloadView__StyledCellError",
102
+ componentId: "sc-azob6f-2"
103
+ })(["position:absolute;z-index:5;max-width:260px;padding:4px 8px;border:1px solid var(--red-alert);border-radius:var(--ac-br-4);background-color:var(--page-paper-main);box-shadow:var(--shadow-popover);"]);
104
+
105
+ /* ================================================================== */
106
+ /* Rows */
107
+ /* ================================================================== */
108
+
109
+ /** Where a bar sits over the week: clipped to it. */
110
+ const barSpan = (startOn, dueOn) => {
111
+ const days = WEEK.filter(day => day >= startOn && day <= dueOn);
112
+ if (days.length === 0) return null;
113
+ return {
114
+ left: leftOf(days[0]),
115
+ width: days.reduce((sum, day) => sum + widthOf(day), 0),
116
+ days
117
+ };
118
+ };
119
+ /** A task's bar: the name, then the "Split" chip or the split's days. */
120
+ const TaskBar = _ref => {
121
+ var _projectOf$color, _projectOf, _task$estimate;
122
+ let changed = _ref.changed,
123
+ task = _ref.task,
124
+ user = _ref.user,
125
+ state = _ref.state,
126
+ top = _ref.top,
127
+ edit = _ref.edit,
128
+ onSaveDay = _ref.onSaveDay,
129
+ onSplit = _ref.onSplit,
130
+ onUnsplit = _ref.onUnsplit;
131
+ const _useState = useState(false),
132
+ menuOpen = _useState[0],
133
+ setMenuOpen = _useState[1];
134
+ const span = barSpan(task.startOn, task.dueOn);
135
+ if (!span) return null;
136
+ const color = (_projectOf$color = (_projectOf = projectOf(task.projectId)) == null ? void 0 : _projectOf.color) != null ? _projectOf$color : "";
137
+ const split = isSplit(state, task.id);
138
+ const days = availableDays(task, user);
139
+ const noEstimate = task.estimate === null;
140
+ const totals = new Map(span.days.map(day => [day, allocationOn(state, task, user, day)]));
141
+ const workdayValues = span.days.filter(day => !isWeekend(day)).map(day => {
142
+ var _totals$get;
143
+ return (_totals$get = totals.get(day)) != null ? _totals$get : 0;
144
+ });
145
+ const low = Math.min(...workdayValues);
146
+ const high = Math.max(...workdayValues);
147
+ const daily = task.estimate !== null && days.length > 0 ? task.estimate / days.length : 0;
148
+ const pending = edit.pending && edit.pending.taskId === task.id ? edit.pending : null;
149
+ return /*#__PURE__*/React.createElement(StyledBar, {
150
+ className: [noEstimate ? "no-estimate" : "", task.isCompleted ? "completed" : ""].filter(Boolean).join(" "),
151
+ style: {
152
+ top: top + BAR_INSET,
153
+ height: TASK_LINE_HEIGHT - BAR_INSET,
154
+ left: span.left + 1,
155
+ width: span.width - 2,
156
+ borderColor: color,
157
+ backgroundColor: noEstimate ? undefined : color
158
+ }
159
+ }, /*#__PURE__*/React.createElement("span", {
160
+ className: "bar-line"
161
+ }, /*#__PURE__*/React.createElement(Caption1, {
162
+ weight: "bold",
163
+ className: "bar-name",
164
+ style: {
165
+ color: noEstimate ? undefined : BAR_TEXT
166
+ },
167
+ decoration: task.isCompleted ? "line-through" : undefined
168
+ }, "" + (task.isImportant ? "! " : "") + task.name)), noEstimate ? /*#__PURE__*/React.createElement("span", {
169
+ className: "estimate-line"
170
+ }, /*#__PURE__*/React.createElement(WarningTriangleSmallIcon, {
171
+ width: 12,
172
+ height: 12,
173
+ style: {
174
+ fill: "var(--red-alert)"
175
+ },
176
+ "aria-hidden": true
177
+ }), /*#__PURE__*/React.createElement(Caption1, {
178
+ color: "alert"
179
+ }, "No estimate!")) : split ? /*#__PURE__*/React.createElement("div", {
180
+ className: "split-days"
181
+ }, span.days.map(day => {
182
+ var _totals$get2;
183
+ if (isWeekend(day)) {
184
+ return /*#__PURE__*/React.createElement("span", {
185
+ className: "split-day weekend",
186
+ key: day
187
+ });
188
+ }
189
+ const total = (_totals$get2 = totals.get(day)) != null ? _totals$get2 : 0;
190
+ const height = high === low ? 20 : 20 + 20 * (total - low) / (high - low);
191
+ const boxes = timeboxesOn(state, task.id, day);
192
+ const pinned = boxes.reduce((sum, part) => sum + part.durationMinutes, 0);
193
+ const range = dayValueRange(state, TB_CONTEXT, task.id, day);
194
+ const isPending = pending !== null && day > pending.after;
195
+ const cellKey = task.id + ":" + day;
196
+ const cell = /*#__PURE__*/React.createElement("span", {
197
+ className: ["split-day", total === 0 ? "zero" : "", changed.has(task.id + ":" + day) ? "changed" : ""].filter(Boolean).join(" "),
198
+ style: {
199
+ height
200
+ }
201
+ }, isPending ? /*#__PURE__*/React.createElement(SkeletonLoader, {
202
+ width: 32,
203
+ height: 12,
204
+ radius: 4
205
+ }) : /*#__PURE__*/React.createElement(EditableHours, {
206
+ key: cellKey + ":" + edit.version,
207
+ value: total / 60,
208
+ variant: "Caption 2",
209
+ weight: "bold",
210
+ disabled: range.locked || pending !== null || task.isCompleted,
211
+ invalid: edit.errorAt === cellKey,
212
+ onSave: event => onSaveDay(task, day, event.target.value)
213
+ }), boxes.length > 0 ? /*#__PURE__*/React.createElement(Tooltip, {
214
+ title: "Pinned " + formatMinutes(pinned) + ": " + boxes.map(part => {
215
+ const _rangeOf = rangeOf(part),
216
+ start = _rangeOf.start,
217
+ end = _rangeOf.end;
218
+ return minutesToClock(start) + "\u2013" + minutesToClock(end);
219
+ }).join(", ")
220
+ }, /*#__PURE__*/React.createElement("span", {
221
+ className: "pinned-mark"
222
+ }, /*#__PURE__*/React.createElement(ClockSmallIcon, {
223
+ width: 12,
224
+ height: 12,
225
+ style: {
226
+ fill: BAR_TEXT
227
+ },
228
+ "aria-label": "Pinned timeboxes"
229
+ }))) : null);
230
+ return range.locked ? /*#__PURE__*/React.createElement(Tooltip, {
231
+ key: day,
232
+ title: "The last workday takes what the other days leave"
233
+ }, cell) : /*#__PURE__*/React.createElement(React.Fragment, {
234
+ key: day
235
+ }, cell);
236
+ })) : days.length > 1 ? /*#__PURE__*/React.createElement(Tooltip, {
237
+ title: hoursOf((_task$estimate = task.estimate) != null ? _task$estimate : 0) + "h, Click to Split"
238
+ }, /*#__PURE__*/React.createElement("span", {
239
+ className: "split-chip",
240
+ role: "button",
241
+ tabIndex: 0,
242
+ onClick: () => onSplit(task)
243
+ }, /*#__PURE__*/React.createElement(EstimatesIcon, {
244
+ width: 12,
245
+ height: 12,
246
+ style: {
247
+ fill: BAR_TEXT
248
+ },
249
+ "aria-hidden": true
250
+ }), /*#__PURE__*/React.createElement(Caption1, {
251
+ weight: "bold",
252
+ style: {
253
+ color: BAR_TEXT
254
+ }
255
+ }, hoursOf(Math.round(daily)) + " h/d - Split"))) : /*#__PURE__*/React.createElement(Tooltip, {
256
+ title: "Time Estimation"
257
+ }, /*#__PURE__*/React.createElement("span", {
258
+ className: "estimate-line"
259
+ }, /*#__PURE__*/React.createElement(EstimatesIcon, {
260
+ width: 12,
261
+ height: 12,
262
+ style: {
263
+ fill: BAR_TEXT
264
+ },
265
+ "aria-hidden": true
266
+ }), /*#__PURE__*/React.createElement(Caption1, {
267
+ weight: "bold",
268
+ style: {
269
+ color: BAR_TEXT
270
+ }
271
+ }, hoursOf(Math.round(daily)) + " h/d"))), noEstimate ? null : /*#__PURE__*/React.createElement("span", {
272
+ className: menuOpen ? "bar-menu open" : "bar-menu"
273
+ }, /*#__PURE__*/React.createElement(Menu, {
274
+ open: menuOpen,
275
+ onOpen: () => setMenuOpen(true),
276
+ onClose: () => setMenuOpen(false),
277
+ position: "bottom-end",
278
+ target: /*#__PURE__*/React.createElement(IconButton, {
279
+ type: "button",
280
+ size: "small",
281
+ variant: "text gray",
282
+ "aria-label": "Task options",
283
+ active: menuOpen
284
+ }, /*#__PURE__*/React.createElement(TreeDotsIcon, {
285
+ style: {
286
+ fill: BAR_TEXT
287
+ }
288
+ }))
289
+ }, /*#__PURE__*/React.createElement(List, {
290
+ tabIndex: 0
291
+ }, split ? /*#__PURE__*/React.createElement(ListItem, {
292
+ onClick: () => {
293
+ setMenuOpen(false);
294
+ onUnsplit(task);
295
+ }
296
+ }, "Unsplit") : days.length > 1 ? /*#__PURE__*/React.createElement(ListItem, {
297
+ onClick: () => {
298
+ setMenuOpen(false);
299
+ onSplit(task);
300
+ }
301
+ }, "Split") : null, /*#__PURE__*/React.createElement(ListSeparator, null), /*#__PURE__*/React.createElement(ListItem, {
302
+ onClick: () => setMenuOpen(false)
303
+ }, "Open task")))));
304
+ };
305
+ TaskBar.displayName = "TaskBar";
306
+
307
+ /** A subtask's bar: the no-estimate look, on its due day. */
308
+ const SubtaskBar = _ref2 => {
309
+ let line = _ref2.line,
310
+ top = _ref2.top;
311
+ const span = barSpan(line.dueOn, line.dueOn);
312
+ if (!span) return null;
313
+ return /*#__PURE__*/React.createElement(StyledBar, {
314
+ className: line.completed ? "no-estimate completed" : "no-estimate",
315
+ style: {
316
+ top: top + BAR_INSET,
317
+ height: TASK_LINE_HEIGHT - BAR_INSET,
318
+ left: span.left + 1,
319
+ width: span.width - 2,
320
+ borderColor: line.color
321
+ }
322
+ }, /*#__PURE__*/React.createElement("span", {
323
+ className: "bar-line"
324
+ }, /*#__PURE__*/React.createElement(ChecklistSmallIcon, {
325
+ width: 12,
326
+ height: 12,
327
+ style: {
328
+ fill: "var(--color-theme-700)",
329
+ flexShrink: 0
330
+ },
331
+ "aria-hidden": true
332
+ }), /*#__PURE__*/React.createElement(Caption1, {
333
+ weight: "bold",
334
+ color: "secondary",
335
+ className: "bar-name"
336
+ }, line.name)), /*#__PURE__*/React.createElement("span", {
337
+ className: "estimate-line"
338
+ }, /*#__PURE__*/React.createElement(WarningTriangleSmallIcon, {
339
+ width: 12,
340
+ height: 12,
341
+ style: {
342
+ fill: "var(--red-alert)"
343
+ },
344
+ "aria-hidden": true
345
+ }), /*#__PURE__*/React.createElement(Caption1, {
346
+ color: "alert"
347
+ }, "No estimate!")));
348
+ };
349
+ SubtaskBar.displayName = "SubtaskBar";
350
+
351
+ /** The day columns' backgrounds under a row's bars. */
352
+ const DayBackgrounds = _ref3 => {
353
+ let height = _ref3.height;
354
+ return /*#__PURE__*/React.createElement(React.Fragment, null, WEEK.map(day => /*#__PURE__*/React.createElement("span", {
355
+ key: day,
356
+ className: ["wl-day", isWeekend(day) ? "weekend" : "", day === TODAY ? "today" : ""].filter(Boolean).join(" "),
357
+ style: {
358
+ width: widthOf(day),
359
+ height
360
+ }
361
+ })));
362
+ };
363
+ DayBackgrounds.displayName = "DayBackgrounds";
364
+
365
+ /* ================================================================== */
366
+ /* The page */
367
+ /* ================================================================== */
368
+
369
+ export const WorkloadView = _ref4 => {
370
+ var _lastChange$days, _adjust$lines;
371
+ let onMessage = _ref4.onMessage;
372
+ const state = useTimeboxState();
373
+ /* What the last action changed, from either view: the task days and the
374
+ user days they sum into. */
375
+ const lastChange = useLastChange();
376
+ const changed = changedCells(lastChange);
377
+ const changedLoads = new Set(((_lastChange$days = lastChange == null ? void 0 : lastChange.days) != null ? _lastChange$days : []).map(item => {
378
+ const owner = state.tasks.find(task => task.id === item.taskId);
379
+ return (owner == null ? void 0 : owner.assigneeId) + ":" + item.date;
380
+ }));
381
+ const _useState2 = useState(new Set()),
382
+ collapsed = _useState2[0],
383
+ setCollapsed = _useState2[1];
384
+ const _useState3 = useState(new Set()),
385
+ showCompleted = _useState3[0],
386
+ setShowCompleted = _useState3[1];
387
+ const _useState4 = useState(null),
388
+ splitTask = _useState4[0],
389
+ setSplitTask = _useState4[1];
390
+ const _useState5 = useState(null),
391
+ unsplitTask = _useState5[0],
392
+ setUnsplitTask = _useState5[1];
393
+ /* A day edit that shortens or deletes timeboxes, waiting for Save. */
394
+ const _useState6 = useState(null),
395
+ adjust = _useState6[0],
396
+ setAdjust = _useState6[1];
397
+ const _useState7 = useState({
398
+ errorAt: null,
399
+ error: "",
400
+ version: 0,
401
+ pending: null
402
+ }),
403
+ edit = _useState7[0],
404
+ setEdit = _useState7[1];
405
+
406
+ /* Later days settle after their skeletons. */
407
+ useEffect(() => {
408
+ if (!edit.pending) return undefined;
409
+ const timer = window.setTimeout(() => setEdit(previous => _extends({}, previous, {
410
+ pending: null
411
+ })), PENDING_MS);
412
+ return () => window.clearTimeout(timer);
413
+ }, [edit.pending]);
414
+
415
+ /* A refused value's message goes after a while. */
416
+ useEffect(() => {
417
+ if (!edit.errorAt) return undefined;
418
+ const timer = window.setTimeout(() => setEdit(previous => _extends({}, previous, {
419
+ errorAt: null
420
+ })), 4000);
421
+ return () => window.clearTimeout(timer);
422
+ }, [edit.errorAt, edit.version]);
423
+ const saveDay = (task, date, value) => {
424
+ const cellKey = task.id + ":" + date;
425
+ const minutes = minutesOfInput(value);
426
+ const error = minutes === null ? "Enter hours, e.g. 1:30" : dayValueError(state, TB_CONTEXT, task.id, date, minutes);
427
+ if (error || minutes === null) {
428
+ setEdit(previous => _extends({}, previous, {
429
+ errorAt: cellKey,
430
+ error: error != null ? error : "",
431
+ version: previous.version + 1
432
+ }));
433
+ onMessage(error != null ? error : "");
434
+ return;
435
+ }
436
+ const adjustments = previewDayValue(state, TB_CONTEXT, task.id, date, minutes);
437
+ if (adjustments.length > 0) {
438
+ setAdjust({
439
+ task,
440
+ date,
441
+ minutes,
442
+ lines: adjustmentLines(adjustments, state)
443
+ });
444
+ return;
445
+ }
446
+ commitDay(task, date, minutes);
447
+ };
448
+ const commitDay = (task, date, minutes) => {
449
+ var _result$error;
450
+ const result = timeboxStore.dispatch({
451
+ type: "editDayValue",
452
+ taskId: task.id,
453
+ date,
454
+ minutes
455
+ });
456
+ onMessage((_result$error = result.error) != null ? _result$error : "Saved " + task.name + " on " + date + ": " + formatMinutes(minutes));
457
+ setEdit(previous => _extends({}, previous, {
458
+ errorAt: null,
459
+ version: previous.version + 1,
460
+ pending: result.error ? null : {
461
+ taskId: task.id,
462
+ after: date
463
+ }
464
+ }));
465
+ };
466
+ const rows = useMemo(() => USERS.map(user => {
467
+ const tasks = state.tasks.filter(task => task.assigneeId === user.id && barSpan(task.startOn, task.dueOn) !== null);
468
+ const projects = PROJECTS.map(project => {
469
+ const projectTasks = tasks.filter(task => task.projectId === project.id).filter(task => showCompleted.has(user.id) || !task.isCompleted).sort((a, b) => a.startOn.localeCompare(b.startOn) || a.position - b.position);
470
+ const lines = projectTasks.flatMap(task => [{
471
+ kind: "task",
472
+ task
473
+ }, ...state.subtasks.filter(subtask => subtask.taskId === task.id).filter(subtask => showCompleted.has(user.id) || !subtask.isCompleted).map(subtask => ({
474
+ kind: "subtask",
475
+ name: subtask.name,
476
+ dueOn: subtask.dueOn,
477
+ color: project.color,
478
+ completed: subtask.isCompleted
479
+ }))]);
480
+ return {
481
+ project,
482
+ lines
483
+ };
484
+ }).filter(group => group.lines.length > 0);
485
+ const completedCount = tasks.filter(task => task.isCompleted).length;
486
+ return {
487
+ user,
488
+ projects,
489
+ completedCount
490
+ };
491
+ }), [state, showCompleted]);
492
+ const toggle = (set, id) => {
493
+ const next = new Set(set);
494
+ if (next.has(id)) next.delete(id);else next.add(id);
495
+ return next;
496
+ };
497
+
498
+ /* Marko's calendar events, as the Calendar Events row. */
499
+ const myEvents = state.events.filter(event => WEEK.includes(event.date));
500
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StyledWorkload, {
501
+ type: "paper-2"
502
+ }, /*#__PURE__*/React.createElement("div", {
503
+ className: "wl-row wl-header"
504
+ }, /*#__PURE__*/React.createElement("div", {
505
+ className: "wl-left"
506
+ }, /*#__PURE__*/React.createElement(Body2, {
507
+ color: "secondary"
508
+ }, USERS.length + " people")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
509
+ className: "wl-month"
510
+ }, /*#__PURE__*/React.createElement(Body2, {
511
+ color: "secondary"
512
+ }, "November 2026")), /*#__PURE__*/React.createElement("div", {
513
+ className: "wl-days"
514
+ }, WEEK.map(day => {
515
+ const date = new Date(day + "T00:00:00Z");
516
+ return /*#__PURE__*/React.createElement("div", {
517
+ key: day,
518
+ className: ["wl-day", "wl-day-head", isWeekend(day) ? "weekend" : "", day === TODAY ? "today" : ""].filter(Boolean).join(" "),
519
+ style: {
520
+ width: widthOf(day)
521
+ }
522
+ }, /*#__PURE__*/React.createElement(Caption2, {
523
+ weight: day === TODAY ? "bold" : "regular",
524
+ color: "secondary",
525
+ className: "day-number"
526
+ }, date.getUTCDate()), isWeekend(day) ? null : /*#__PURE__*/React.createElement(Caption2, {
527
+ weight: day === TODAY ? "bold" : "regular",
528
+ color: "secondary"
529
+ }, SHORT_WEEKDAYS[date.getUTCDay()]));
530
+ })))), rows.map((_ref5, userIndex) => {
531
+ let user = _ref5.user,
532
+ projects = _ref5.projects,
533
+ completedCount = _ref5.completedCount;
534
+ const isCollapsed = collapsed.has(user.id);
535
+ const weekly = WEEK.reduce((sum, day) => sum + capacityOn(user, day), 0);
536
+ return /*#__PURE__*/React.createElement(React.Fragment, {
537
+ key: user.id
538
+ }, /*#__PURE__*/React.createElement("div", {
539
+ className: "wl-row wl-user"
540
+ }, /*#__PURE__*/React.createElement("div", {
541
+ className: "wl-left",
542
+ onClick: () => setCollapsed(previous => toggle(previous, user.id))
543
+ }, /*#__PURE__*/React.createElement(RoundAvatar, {
544
+ $bg: AVATARS[userIndex % AVATARS.length],
545
+ $size: 24
546
+ }, user.name.split(" ").map(part => part[0]).join("")), /*#__PURE__*/React.createElement(Body2, {
547
+ className: "wl-user-name"
548
+ }, user.name), /*#__PURE__*/React.createElement(Caption1, {
549
+ color: "secondary",
550
+ className: "wl-capacity-pill"
551
+ }, formatMinutes(weekly) + " / week"), /*#__PURE__*/React.createElement("span", {
552
+ className: isCollapsed ? "wl-toggle collapsed" : "wl-toggle"
553
+ }, /*#__PURE__*/React.createElement(ArrowDownSmallIcon, {
554
+ style: {
555
+ fill: "var(--color-theme-700)"
556
+ },
557
+ "aria-hidden": true
558
+ }))), /*#__PURE__*/React.createElement("div", {
559
+ className: "wl-days"
560
+ }, WEEK.map(day => {
561
+ if (isWeekend(day)) {
562
+ return /*#__PURE__*/React.createElement("span", {
563
+ key: day,
564
+ className: "wl-day weekend wl-load",
565
+ style: {
566
+ width: widthOf(day)
567
+ }
568
+ });
569
+ }
570
+ const _userDayLoad = userDayLoad(state, TB_CONTEXT, user.id, day),
571
+ allocated = _userDayLoad.allocated,
572
+ capacity = _userDayLoad.capacity;
573
+ const left = capacity - allocated;
574
+ const className = ["wl-day", "wl-load", day === TODAY ? "today" : "", left < 0 ? "overtime" : allocated > 0 ? "occupied" : "", changedLoads.has(user.id + ":" + day) ? "changed" : ""].filter(Boolean).join(" ");
575
+ return /*#__PURE__*/React.createElement(Tooltip, {
576
+ key: day,
577
+ title: hoursOf(allocated) + " allocated of " + hoursOf(capacity)
578
+ }, /*#__PURE__*/React.createElement("span", {
579
+ className: className,
580
+ style: {
581
+ width: widthOf(day)
582
+ }
583
+ }, /*#__PURE__*/React.createElement(Body2, {
584
+ weight: allocated > 0 ? "bold" : "regular",
585
+ color: "tertiary",
586
+ className: "load-value"
587
+ }, left === 0 ? "✓" : hoursOf(Math.abs(left))), left < 0 ? /*#__PURE__*/React.createElement(Caption2, {
588
+ weight: "bold",
589
+ className: "load-value"
590
+ }, "OVER") : null));
591
+ }))), isCollapsed ? null : [...(user.id === USERS[0].id && myEvents.length > 0 ? [/*#__PURE__*/React.createElement("div", {
592
+ className: "wl-row wl-project",
593
+ key: "events"
594
+ }, /*#__PURE__*/React.createElement("div", {
595
+ className: "wl-left",
596
+ style: {
597
+ height: EVENT_LINE_HEIGHT * myEvents.length
598
+ }
599
+ }, /*#__PURE__*/React.createElement(Body2, {
600
+ className: "wl-project-name"
601
+ }, "Calendar Events"), /*#__PURE__*/React.createElement("span", {
602
+ className: "wl-marker",
603
+ style: {
604
+ backgroundColor: myEvents[0].color
605
+ }
606
+ })), /*#__PURE__*/React.createElement("div", {
607
+ className: "wl-days"
608
+ }, /*#__PURE__*/React.createElement(DayBackgrounds, {
609
+ height: EVENT_LINE_HEIGHT * myEvents.length
610
+ }), myEvents.map((event, index) => {
611
+ const span = barSpan(event.date, event.date);
612
+ if (!span) return null;
613
+ const minutes = clockToMinutes(event.endsOnTime) - clockToMinutes(event.startsOnTime);
614
+ return /*#__PURE__*/React.createElement(StyledBar, {
615
+ key: event.id,
616
+ className: "no-estimate",
617
+ style: {
618
+ top: index * EVENT_LINE_HEIGHT + 4,
619
+ height: EVENT_LINE_HEIGHT - 8,
620
+ left: span.left + 1,
621
+ width: span.width - 2,
622
+ borderColor: event.color
623
+ }
624
+ }, /*#__PURE__*/React.createElement("span", {
625
+ className: "bar-line"
626
+ }, /*#__PURE__*/React.createElement(CalendarIcon, {
627
+ width: 12,
628
+ height: 12,
629
+ style: {
630
+ fill: event.color,
631
+ flexShrink: 0
632
+ },
633
+ "aria-hidden": true
634
+ }), /*#__PURE__*/React.createElement(Caption1, {
635
+ weight: "bold",
636
+ className: "bar-name"
637
+ }, event.name)), /*#__PURE__*/React.createElement(Caption2, null, hoursOf(minutes) + "h"));
638
+ })))] : []), ...projects.map((_ref6, projectIndex) => {
639
+ let project = _ref6.project,
640
+ lines = _ref6.lines;
641
+ const last = projectIndex === projects.length - 1;
642
+ const height = TASK_LINE_HEIGHT * lines.length + (last ? 8 : 0);
643
+ return /*#__PURE__*/React.createElement("div", {
644
+ className: last ? "wl-row wl-project last" : "wl-row wl-project",
645
+ key: project.id
646
+ }, /*#__PURE__*/React.createElement("div", {
647
+ className: "wl-left",
648
+ style: {
649
+ height
650
+ }
651
+ }, /*#__PURE__*/React.createElement(Body2, {
652
+ className: "wl-project-name"
653
+ }, project.name), /*#__PURE__*/React.createElement("span", {
654
+ className: "wl-marker",
655
+ style: {
656
+ backgroundColor: project.color
657
+ }
658
+ })), /*#__PURE__*/React.createElement("div", {
659
+ className: "wl-days"
660
+ }, /*#__PURE__*/React.createElement(DayBackgrounds, {
661
+ height: height
662
+ }), lines.map((line, index) => line.kind === "task" ? /*#__PURE__*/React.createElement(TaskBar, {
663
+ key: line.task.id,
664
+ task: line.task,
665
+ user: user,
666
+ state: state,
667
+ top: index * TASK_LINE_HEIGHT,
668
+ edit: edit,
669
+ changed: changed,
670
+ onSaveDay: saveDay,
671
+ onSplit: setSplitTask,
672
+ onUnsplit: setUnsplitTask
673
+ }) : /*#__PURE__*/React.createElement(SubtaskBar, {
674
+ key: line.name + "-" + index,
675
+ line: line,
676
+ top: index * TASK_LINE_HEIGHT
677
+ })), lines.map((line, index) => {
678
+ if (line.kind !== "task" || !edit.errorAt) return null;
679
+ const _edit$errorAt$split = edit.errorAt.split(":"),
680
+ taskId = _edit$errorAt$split[0],
681
+ date = _edit$errorAt$split[1];
682
+ if (Number(taskId) !== line.task.id) return null;
683
+ return /*#__PURE__*/React.createElement(StyledCellError, {
684
+ key: "error-" + line.task.id,
685
+ style: {
686
+ top: index * TASK_LINE_HEIGHT + TASK_LINE_HEIGHT - 4,
687
+ left: leftOf(date)
688
+ }
689
+ }, /*#__PURE__*/React.createElement(Caption1, {
690
+ color: "alert"
691
+ }, edit.error));
692
+ })));
693
+ }), completedCount > 0 ? /*#__PURE__*/React.createElement("div", {
694
+ className: "wl-row",
695
+ key: "completed"
696
+ }, /*#__PURE__*/React.createElement("div", {
697
+ className: "wl-left wl-completed-link",
698
+ onClick: () => setShowCompleted(previous => toggle(previous, user.id))
699
+ }, /*#__PURE__*/React.createElement(Caption1, {
700
+ color: "tertiary"
701
+ }, showCompleted.has(user.id) ? "Hide Completed Tasks" : "Show " + completedCount + " Completed Task")), /*#__PURE__*/React.createElement("div", {
702
+ className: "wl-days"
703
+ }, /*#__PURE__*/React.createElement(DayBackgrounds, null))) : null]);
704
+ })), splitTask ? /*#__PURE__*/React.createElement(Dialog, {
705
+ open: true,
706
+ onClose: () => setSplitTask(null),
707
+ dismissOnBackdropClick: true
708
+ }, /*#__PURE__*/React.createElement(Dialog.Title, null, "Split Time Estimation"), /*#__PURE__*/React.createElement(Dialog.ContentDivider, null), /*#__PURE__*/React.createElement(Dialog.Content, null, /*#__PURE__*/React.createElement(Body2, null, "Split the time estimate to specify exactly how many hours the assignee should work on the task each day.")), /*#__PURE__*/React.createElement(Dialog.ContentDivider, null), /*#__PURE__*/React.createElement(Dialog.Actions, null, /*#__PURE__*/React.createElement(Button, {
709
+ variant: "primary",
710
+ onClick: () => {
711
+ var _result$error2;
712
+ const result = timeboxStore.dispatch({
713
+ type: "split",
714
+ taskId: splitTask.id
715
+ });
716
+ onMessage((_result$error2 = result.error) != null ? _result$error2 : "Split " + splitTask.name);
717
+ setSplitTask(null);
718
+ }
719
+ }, "Split"), /*#__PURE__*/React.createElement(Button, {
720
+ variant: "secondary",
721
+ onClick: () => setSplitTask(null)
722
+ }, "Cancel"))) : null, /*#__PURE__*/React.createElement(ConfirmDialog, {
723
+ open: adjust !== null,
724
+ dialogTitle: "Adjust timeboxes?",
725
+ dialogContent: /*#__PURE__*/React.createElement(AdjustmentList, {
726
+ lines: (_adjust$lines = adjust == null ? void 0 : adjust.lines) != null ? _adjust$lines : []
727
+ }),
728
+ confirmBtnText: "Save",
729
+ cancelBtnText: "Cancel",
730
+ onCancel: () => {
731
+ /* The cell goes back to its saved value. */
732
+ setAdjust(null);
733
+ setEdit(previous => _extends({}, previous, {
734
+ version: previous.version + 1
735
+ }));
736
+ },
737
+ onConfirm: () => {
738
+ if (adjust) commitDay(adjust.task, adjust.date, adjust.minutes);
739
+ setAdjust(null);
740
+ }
741
+ }), /*#__PURE__*/React.createElement(ConfirmDialog, {
742
+ open: unsplitTask !== null,
743
+ dialogTitle: "Unsplit the estimate?",
744
+ dialogContent: /*#__PURE__*/React.createElement(Body2, null, unsplitTask ? unsplitConfirmText(state, unsplitTask) : ""),
745
+ confirmBtnText: "Unsplit",
746
+ cancelBtnText: "Cancel",
747
+ onCancel: () => setUnsplitTask(null),
748
+ onConfirm: () => {
749
+ if (unsplitTask) {
750
+ timeboxStore.dispatch({
751
+ type: "unsplit",
752
+ taskId: unsplitTask.id
753
+ });
754
+ onMessage("Unsplit " + unsplitTask.name);
755
+ }
756
+ setUnsplitTask(null);
757
+ }
758
+ }));
759
+ };
760
+ WorkloadView.displayName = "WorkloadView";
761
+ //# sourceMappingURL=WorkloadView.js.map