@jsb188/calendar 1.1.10 → 1.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +16 -15
- package/src/constants/calendar.ts +17 -3
- package/src/libs/calendar-geometry.ts +165 -91
- package/src/libs/calendar-gesture.ts +58 -15
- package/src/libs/calendar-now.ts +39 -0
- package/src/libs/calendar-range.ts +88 -27
- package/src/libs/calendar-state.ts +21 -156
- package/src/libs/calendar-url.ts +55 -8
- package/src/libs/roster-layout.ts +388 -0
- package/src/main.ts +3 -0
- package/src/modules/Calendar.tsx +375 -287
- package/src/modules/MiniCalendar.tsx +376 -0
- package/src/types/calendar.d.ts +7 -1
- package/src/types/shift-form.d.ts +19 -0
- package/src/ui/CalendarAgendaUI.tsx +43 -14
- package/src/ui/CalendarMonthUI.tsx +38 -26
- package/src/ui/CalendarToolbarUI.tsx +50 -27
- package/src/ui/CalendarUI.tsx +280 -226
- package/src/ui/CalendarYearUI.tsx +36 -50
- package/src/ui/RosterUI.tsx +273 -0
- package/src/ui/ShiftFormUI.tsx +333 -0
- package/tests/calendar-geometry.test.ts +230 -84
- package/tests/calendar-gesture.test.ts +43 -12
- package/tests/calendar-range.test.ts +159 -33
- package/tests/calendar-url.test.ts +77 -12
- package/tests/roster-layout.test.ts +210 -0
- package/src/ui/CalendarCoverageUI.tsx +0 -199
- package/src/ui/CalendarEventDetailUI.tsx +0 -260
- package/src/ui/CalendarEventFormUI.tsx +0 -239
- package/src/ui/CalendarRailUI.tsx +0 -282
- package/src/ui/CalendarRequestUI.tsx +0 -537
- package/src/ui/CalendarViolationUI.tsx +0 -207
package/src/ui/CalendarUI.tsx
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import i18n from '@jsb188/app/i18n/index.ts';
|
|
1
2
|
import { cn } from '@jsb188/app/utils/string.ts';
|
|
2
3
|
import { memo } from 'react';
|
|
3
4
|
import {
|
|
@@ -6,7 +7,10 @@ import {
|
|
|
6
7
|
CALENDAR_GUTTER_WIDTH,
|
|
7
8
|
} from '../constants/calendar.ts';
|
|
8
9
|
import type { CalendarAllDayBarObj } from '../libs/calendar-geometry.ts';
|
|
9
|
-
import type {
|
|
10
|
+
import type {
|
|
11
|
+
CalendarDayObj,
|
|
12
|
+
CalendarEventLayoutObj,
|
|
13
|
+
} from '../types/calendar.d.ts';
|
|
10
14
|
|
|
11
15
|
/**
|
|
12
16
|
* Stateless calendar UI.
|
|
@@ -27,70 +31,72 @@ import type { CalendarDayObj, CalendarEventLayoutObj } from '../types/calendar.d
|
|
|
27
31
|
* The left-hand hour labels.
|
|
28
32
|
*/
|
|
29
33
|
|
|
30
|
-
export const CalendarTimeGutterUI = memo(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
export const CalendarTimeGutterUI = memo(
|
|
35
|
+
(p: {
|
|
36
|
+
hourHeight: number;
|
|
37
|
+
// Labels for hours 0..23, already formatted and localized by the caller
|
|
38
|
+
hourLabels: string[];
|
|
39
|
+
}) => {
|
|
40
|
+
const { hourHeight, hourLabels } = p;
|
|
36
41
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
42
|
+
return (
|
|
43
|
+
<div
|
|
44
|
+
className="no_shrink rel"
|
|
45
|
+
style={{ width: CALENDAR_GUTTER_WIDTH }}
|
|
46
|
+
>
|
|
47
|
+
{hourLabels.map((label, hour) => (
|
|
48
|
+
<div
|
|
49
|
+
key={hour}
|
|
50
|
+
className="abs w_f a_r ft_xxs cl_lt"
|
|
51
|
+
// Pulled up by half a line so the label sits ON its gridline
|
|
52
|
+
// rather than hanging below it. Midnight is unlabelled: it is
|
|
53
|
+
// the day boundary the header already names.
|
|
54
|
+
style={{ top: hour * hourHeight - 7, paddingRight: 6 }}
|
|
55
|
+
>
|
|
56
|
+
{hour === 0 ? null : label}
|
|
57
|
+
</div>
|
|
58
|
+
))}
|
|
59
|
+
</div>
|
|
60
|
+
);
|
|
61
|
+
},
|
|
62
|
+
);
|
|
57
63
|
|
|
58
64
|
/**
|
|
59
65
|
* The horizontal hour lines behind the day columns.
|
|
60
66
|
*/
|
|
61
67
|
|
|
62
|
-
export const CalendarHourLinesUI = memo(
|
|
63
|
-
hourCount: number;
|
|
64
|
-
|
|
65
|
-
}) => {
|
|
66
|
-
const { hourCount, hourHeight } = p;
|
|
68
|
+
export const CalendarHourLinesUI = memo(
|
|
69
|
+
(p: { hourCount: number; hourHeight: number }) => {
|
|
70
|
+
const { hourCount, hourHeight } = p;
|
|
67
71
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
72
|
+
return (
|
|
73
|
+
<>
|
|
74
|
+
{Array.from({ length: hourCount }, (_unused, hour) => (
|
|
75
|
+
<div
|
|
76
|
+
key={hour}
|
|
77
|
+
className="abs w_f bd_t_1 bd_t_bd"
|
|
78
|
+
style={{ top: hour * hourHeight }}
|
|
79
|
+
/>
|
|
80
|
+
))}
|
|
81
|
+
</>
|
|
82
|
+
);
|
|
83
|
+
},
|
|
84
|
+
);
|
|
80
85
|
|
|
81
86
|
/**
|
|
82
87
|
* The "now" line, drawn only on the day that is actually today.
|
|
83
88
|
*/
|
|
84
89
|
|
|
85
|
-
export const CalendarNowLineUI = memo((p: {
|
|
86
|
-
topOffset: number;
|
|
87
|
-
}) => {
|
|
90
|
+
export const CalendarNowLineUI = memo((p: { topOffset: number }) => {
|
|
88
91
|
return (
|
|
89
92
|
<div
|
|
90
|
-
className=
|
|
93
|
+
className="abs w_f z3"
|
|
91
94
|
style={{ top: p.topOffset }}
|
|
92
95
|
>
|
|
93
|
-
<div
|
|
96
|
+
<div
|
|
97
|
+
className="bg_red"
|
|
98
|
+
style={{ height: 2 }}
|
|
99
|
+
/>
|
|
94
100
|
</div>
|
|
95
101
|
);
|
|
96
102
|
});
|
|
@@ -131,181 +137,227 @@ export interface CalendarEventUIProps {
|
|
|
131
137
|
* One event block in the time grid.
|
|
132
138
|
*/
|
|
133
139
|
|
|
134
|
-
export const CalendarEventUI = memo(
|
|
135
|
-
|
|
136
|
-
|
|
140
|
+
export const CalendarEventUI = memo(
|
|
141
|
+
(p: CalendarEventUIProps) => {
|
|
142
|
+
const { layout, hourHeight, selected, editable, timeLabel, onSelect } = p;
|
|
143
|
+
const { event } = layout;
|
|
137
144
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
145
|
+
const top = (layout.startMinute / 60) * hourHeight;
|
|
146
|
+
// Never shorter than a line of text, or it stops being clickable
|
|
147
|
+
const height = Math.max(
|
|
148
|
+
((layout.endMinute - layout.startMinute) / 60) * hourHeight,
|
|
149
|
+
16,
|
|
150
|
+
);
|
|
141
151
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
152
|
+
return (
|
|
153
|
+
<button
|
|
154
|
+
type="button"
|
|
155
|
+
className={cn(
|
|
156
|
+
'abs of a_l r_xs bd_1 bd_bd',
|
|
157
|
+
// A stacked event has to paint over the ones behind it, and the
|
|
158
|
+
// selected one over everything
|
|
159
|
+
selected ? 'z3' : 'z2',
|
|
160
|
+
getCalendarEventStatusClassName(event.status),
|
|
161
|
+
event.isMine ? 'bg_active' : 'bg_alt',
|
|
162
|
+
event.pending ? 'op_60' : '',
|
|
163
|
+
event.kind === 'BLOCK' ? 'pattern_texture cl_lt' : '',
|
|
164
|
+
)}
|
|
165
|
+
style={{
|
|
166
|
+
top,
|
|
167
|
+
height,
|
|
168
|
+
left: `${layout.left * 100}%`,
|
|
169
|
+
width: `calc(${layout.width * 100}% - 2px)`,
|
|
170
|
+
paddingLeft: 4,
|
|
171
|
+
paddingRight: 4,
|
|
172
|
+
// A continued block keeps square edges where it was cut, so the
|
|
173
|
+
// user can see it runs off the end of the day
|
|
174
|
+
borderTopLeftRadius: layout.continuesFromPreviousDay ? 0 : undefined,
|
|
175
|
+
borderTopRightRadius: layout.continuesFromPreviousDay ? 0 : undefined,
|
|
176
|
+
borderBottomLeftRadius: layout.continuesToNextDay ? 0 : undefined,
|
|
177
|
+
borderBottomRightRadius: layout.continuesToNextDay ? 0 : undefined,
|
|
178
|
+
borderLeftColor: event.color || undefined,
|
|
179
|
+
borderLeftWidth: event.color ? 3 : undefined,
|
|
180
|
+
}}
|
|
181
|
+
onClick={() => onSelect(event.id)}
|
|
182
|
+
aria-current={selected ? 'true' : undefined}
|
|
183
|
+
data-calendar-event-id={event.id}
|
|
184
|
+
>
|
|
185
|
+
<span className="ellip ft_xxs ft_bold">{event.title}</span>
|
|
186
|
+
{event.breach ? (
|
|
187
|
+
<span
|
|
188
|
+
className={cn(
|
|
189
|
+
'abs r_5',
|
|
190
|
+
event.breach === 'BLOCK' ? 'bg_err' : 'bg_warn',
|
|
191
|
+
)}
|
|
192
|
+
style={{ width: 6, height: 6, right: 3, top: 3 }}
|
|
193
|
+
/>
|
|
194
|
+
) : null}
|
|
195
|
+
{(event.openCount || 0) > 0 ? (
|
|
196
|
+
<span className="pill bg_amber_alt_lt ft_xxs">
|
|
197
|
+
{i18n.t('calendar.open_count', { count: event.openCount })}
|
|
198
|
+
</span>
|
|
199
|
+
) : null}
|
|
174
200
|
|
|
175
|
-
|
|
176
|
-
|
|
201
|
+
{/* Below roughly 40 minutes there is only room for one line */}
|
|
202
|
+
{height >= 32 ? (
|
|
203
|
+
<span className="ellip ft_xxs cl_lt">{timeLabel}</span>
|
|
204
|
+
) : null}
|
|
177
205
|
|
|
178
|
-
|
|
206
|
+
{/* Resize grips. Only offered when the block is tall enough to leave
|
|
179
207
|
a middle over to grab for moving — on a short block the grips
|
|
180
208
|
would cover the whole thing and moving would become impossible */}
|
|
181
|
-
|
|
182
|
-
? (
|
|
209
|
+
{editable && height >= 28 ? (
|
|
183
210
|
<>
|
|
184
211
|
<span
|
|
185
|
-
className=
|
|
186
|
-
style={{
|
|
187
|
-
|
|
212
|
+
className="abs w_f"
|
|
213
|
+
style={{
|
|
214
|
+
top: 0,
|
|
215
|
+
left: 0,
|
|
216
|
+
height: 6,
|
|
217
|
+
cursor: 'ns-resize',
|
|
218
|
+
touchAction: 'none',
|
|
219
|
+
}}
|
|
220
|
+
data-calendar-edge="START"
|
|
188
221
|
/>
|
|
189
222
|
<span
|
|
190
|
-
className=
|
|
191
|
-
style={{
|
|
192
|
-
|
|
223
|
+
className="abs w_f"
|
|
224
|
+
style={{
|
|
225
|
+
bottom: 0,
|
|
226
|
+
left: 0,
|
|
227
|
+
height: 6,
|
|
228
|
+
cursor: 'ns-resize',
|
|
229
|
+
touchAction: 'none',
|
|
230
|
+
}}
|
|
231
|
+
data-calendar-edge="END"
|
|
193
232
|
/>
|
|
194
233
|
</>
|
|
195
|
-
)
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
234
|
+
) : null}
|
|
235
|
+
</button>
|
|
236
|
+
);
|
|
237
|
+
},
|
|
238
|
+
(prev, next) =>
|
|
239
|
+
// The layout objects are rebuilt on every data change, so comparing them by
|
|
240
|
+
// identity would defeat the memo; compare what is actually drawn
|
|
241
|
+
prev.layout.event === next.layout.event &&
|
|
242
|
+
prev.layout.startMinute === next.layout.startMinute &&
|
|
243
|
+
prev.layout.endMinute === next.layout.endMinute &&
|
|
244
|
+
prev.layout.left === next.layout.left &&
|
|
245
|
+
prev.layout.width === next.layout.width &&
|
|
246
|
+
prev.layout.continuesFromPreviousDay ===
|
|
247
|
+
next.layout.continuesFromPreviousDay &&
|
|
248
|
+
prev.layout.continuesToNextDay === next.layout.continuesToNextDay &&
|
|
249
|
+
prev.hourHeight === next.hourHeight &&
|
|
250
|
+
prev.selected === next.selected &&
|
|
251
|
+
prev.editable === next.editable &&
|
|
252
|
+
prev.timeLabel === next.timeLabel &&
|
|
253
|
+
prev.onSelect === next.onSelect,
|
|
254
|
+
);
|
|
215
255
|
|
|
216
256
|
/**
|
|
217
257
|
* The all-day band above the time grid.
|
|
218
258
|
*/
|
|
219
259
|
|
|
220
|
-
export const CalendarAllDayBandUI = memo(
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
260
|
+
export const CalendarAllDayBandUI = memo(
|
|
261
|
+
(p: {
|
|
262
|
+
bars: CalendarAllDayBarObj[];
|
|
263
|
+
dayCount: number;
|
|
264
|
+
selectedEventId: string | null;
|
|
265
|
+
onSelect: (eventId: string) => void;
|
|
266
|
+
}) => {
|
|
267
|
+
const { bars, dayCount, selectedEventId, onSelect } = p;
|
|
227
268
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
269
|
+
if (!bars.length) {
|
|
270
|
+
return null;
|
|
271
|
+
}
|
|
231
272
|
|
|
232
|
-
|
|
273
|
+
const rowCount = Math.max(...bars.map((bar) => bar.row)) + 1;
|
|
233
274
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
275
|
+
return (
|
|
276
|
+
<div
|
|
277
|
+
className="no_shrink rel bd_b_1 bd_b_bd"
|
|
278
|
+
style={{
|
|
279
|
+
marginLeft: CALENDAR_GUTTER_WIDTH,
|
|
280
|
+
height: rowCount * (CALENDAR_ALL_DAY_ROW_HEIGHT + 2) + 4,
|
|
281
|
+
}}
|
|
282
|
+
>
|
|
283
|
+
{bars.map((bar) => (
|
|
284
|
+
<button
|
|
285
|
+
key={bar.event.id}
|
|
286
|
+
type="button"
|
|
287
|
+
className={cn(
|
|
288
|
+
'abs of a_l r_xs ellip ft_xxs',
|
|
289
|
+
getCalendarEventStatusClassName(bar.event.status),
|
|
290
|
+
bar.event.isMine ? 'bg_active' : 'bg_alt',
|
|
291
|
+
bar.event.pending ? 'op_60' : '',
|
|
292
|
+
bar.event.kind === 'BLOCK' ? 'pattern_texture cl_lt' : '',
|
|
293
|
+
selectedEventId === bar.event.id ? 'z3' : 'z2',
|
|
294
|
+
)}
|
|
295
|
+
style={{
|
|
296
|
+
top: bar.row * (CALENDAR_ALL_DAY_ROW_HEIGHT + 2) + 2,
|
|
297
|
+
height: CALENDAR_ALL_DAY_ROW_HEIGHT,
|
|
298
|
+
left: `${(bar.startDayIndex / dayCount) * 100}%`,
|
|
299
|
+
width: `calc(${((bar.endDayIndex - bar.startDayIndex + 1) / dayCount) * 100}% - 2px)`,
|
|
300
|
+
paddingLeft: 4,
|
|
301
|
+
paddingRight: 4,
|
|
302
|
+
borderTopLeftRadius: bar.continuesFromPreviousDay ? 0 : undefined,
|
|
303
|
+
borderBottomLeftRadius: bar.continuesFromPreviousDay
|
|
304
|
+
? 0
|
|
305
|
+
: undefined,
|
|
306
|
+
borderTopRightRadius: bar.continuesToNextDay ? 0 : undefined,
|
|
307
|
+
borderBottomRightRadius: bar.continuesToNextDay ? 0 : undefined,
|
|
308
|
+
}}
|
|
309
|
+
onClick={() => onSelect(bar.event.id)}
|
|
310
|
+
aria-current={selectedEventId === bar.event.id ? 'true' : undefined}
|
|
311
|
+
>
|
|
312
|
+
{bar.event.title}
|
|
313
|
+
</button>
|
|
314
|
+
))}
|
|
315
|
+
</div>
|
|
316
|
+
);
|
|
317
|
+
},
|
|
318
|
+
);
|
|
273
319
|
|
|
274
320
|
/**
|
|
275
321
|
* The day-of-week header row above the grid.
|
|
276
322
|
*/
|
|
277
323
|
|
|
278
|
-
export const CalendarDayHeaderUI = memo(
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
324
|
+
export const CalendarDayHeaderUI = memo(
|
|
325
|
+
(p: {
|
|
326
|
+
days: CalendarDayObj[];
|
|
327
|
+
// Pre-formatted per day: the weekday abbreviation and the day number
|
|
328
|
+
dayLabels: Array<{ weekday: string; dayNumber: string }>;
|
|
329
|
+
onSelectDay?: (dateKey: string) => void;
|
|
330
|
+
}) => {
|
|
331
|
+
const { days, dayLabels, onSelectDay } = p;
|
|
285
332
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
333
|
+
return (
|
|
334
|
+
<div
|
|
335
|
+
className="no_shrink h_stretch bd_b_1 bd_b_bd"
|
|
336
|
+
style={{ marginLeft: CALENDAR_GUTTER_WIDTH }}
|
|
337
|
+
>
|
|
338
|
+
{days.map((day, index) => (
|
|
339
|
+
<button
|
|
340
|
+
key={day.dateKey}
|
|
341
|
+
type="button"
|
|
342
|
+
className={cn('f a_c', day.isWeekend ? 'bg_alt' : '')}
|
|
343
|
+
style={{ paddingTop: 4, paddingBottom: 4 }}
|
|
344
|
+
disabled={!onSelectDay}
|
|
345
|
+
onClick={onSelectDay ? () => onSelectDay(day.dateKey) : undefined}
|
|
346
|
+
>
|
|
347
|
+
<span className="ellip ft_xxs cl_lt">
|
|
348
|
+
{dayLabels[index]?.weekday}
|
|
349
|
+
</span>
|
|
350
|
+
<span
|
|
351
|
+
className={cn('ellip ft_sm', day.isToday ? 'ft_bold' : 'cl_md')}
|
|
352
|
+
>
|
|
353
|
+
{dayLabels[index]?.dayNumber}
|
|
354
|
+
</span>
|
|
355
|
+
</button>
|
|
356
|
+
))}
|
|
357
|
+
</div>
|
|
358
|
+
);
|
|
359
|
+
},
|
|
360
|
+
);
|
|
309
361
|
|
|
310
362
|
/**
|
|
311
363
|
* The ghost block shown while a range is being drawn, moved, or resized.
|
|
@@ -315,33 +367,35 @@ export const CalendarDayHeaderUI = memo((p: {
|
|
|
315
367
|
* than something that exists yet.
|
|
316
368
|
*/
|
|
317
369
|
|
|
318
|
-
export const CalendarDraftBlockUI = memo(
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
370
|
+
export const CalendarDraftBlockUI = memo(
|
|
371
|
+
(p: {
|
|
372
|
+
startMinute: number;
|
|
373
|
+
endMinute: number;
|
|
374
|
+
hourHeight: number;
|
|
375
|
+
label: string;
|
|
376
|
+
}) => {
|
|
377
|
+
const { startMinute, endMinute, hourHeight, label } = p;
|
|
325
378
|
|
|
326
|
-
|
|
327
|
-
|
|
379
|
+
const top = (startMinute / 60) * hourHeight;
|
|
380
|
+
const height = Math.max(((endMinute - startMinute) / 60) * hourHeight, 16);
|
|
328
381
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
}
|
|
382
|
+
return (
|
|
383
|
+
<div
|
|
384
|
+
className="abs of a_l r_xs bd_1 bd_bd bg_active z4"
|
|
385
|
+
style={{
|
|
386
|
+
top,
|
|
387
|
+
height,
|
|
388
|
+
left: 0,
|
|
389
|
+
width: 'calc(100% - 2px)',
|
|
390
|
+
paddingLeft: 4,
|
|
391
|
+
paddingRight: 4,
|
|
392
|
+
opacity: 0.8,
|
|
393
|
+
// The ghost must never eat the pointer stream that is drawing it
|
|
394
|
+
pointerEvents: 'none',
|
|
395
|
+
}}
|
|
396
|
+
>
|
|
397
|
+
<span className="ellip ft_xxs ft_bold">{label}</span>
|
|
398
|
+
</div>
|
|
399
|
+
);
|
|
400
|
+
},
|
|
401
|
+
);
|