@jsb188/calendar 1.1.10 → 1.1.11
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 +8 -6
- package/src/constants/calendar.ts +8 -1
- package/src/libs/calendar-geometry.ts +167 -91
- package/src/libs/calendar-gesture.ts +58 -15
- package/src/libs/calendar-now.ts +39 -0
- package/src/libs/calendar-range.ts +86 -27
- package/src/libs/calendar-state.ts +10 -3
- package/src/libs/calendar-url.ts +31 -8
- package/src/main.ts +3 -0
- package/src/modules/Calendar.tsx +369 -275
- package/src/modules/MiniCalendar.tsx +370 -0
- package/src/ui/CalendarAgendaUI.tsx +31 -11
- package/src/ui/CalendarCoverageUI.tsx +66 -23
- package/src/ui/CalendarEventDetailUI.tsx +122 -117
- package/src/ui/CalendarEventFormUI.tsx +86 -59
- package/src/ui/CalendarMonthUI.tsx +25 -21
- package/src/ui/CalendarRailUI.tsx +199 -139
- package/src/ui/CalendarRequestUI.tsx +216 -177
- package/src/ui/CalendarToolbarUI.tsx +27 -18
- package/src/ui/CalendarUI.tsx +255 -229
- package/src/ui/CalendarViolationUI.tsx +53 -30
- package/src/ui/CalendarYearUI.tsx +36 -50
- package/tests/calendar-geometry.test.ts +226 -78
- package/tests/calendar-gesture.test.ts +43 -12
- package/tests/calendar-range.test.ts +159 -33
- package/tests/calendar-url.test.ts +55 -12
|
@@ -34,10 +34,8 @@ export type CalendarRequestDecisionEnum = 'APPROVE' | 'DENY';
|
|
|
34
34
|
|
|
35
35
|
const CalendarRequestEmpty = memo((p: { text: string }) => {
|
|
36
36
|
return (
|
|
37
|
-
<div className=
|
|
38
|
-
<p className=
|
|
39
|
-
{p.text}
|
|
40
|
-
</p>
|
|
37
|
+
<div className="pattern_texture main_bf px_md py_lg rel v_center r_sm of">
|
|
38
|
+
<p className="rel z2 bg r px_25 py_sm cl_lt a_c ft_sm">{p.text}</p>
|
|
41
39
|
</div>
|
|
42
40
|
);
|
|
43
41
|
});
|
|
@@ -91,7 +89,16 @@ export interface CalendarOpenShiftsUIProps {
|
|
|
91
89
|
*/
|
|
92
90
|
|
|
93
91
|
export const CalendarOpenShiftsUI = memo((p: CalendarOpenShiftsUIProps) => {
|
|
94
|
-
const {
|
|
92
|
+
const {
|
|
93
|
+
shifts,
|
|
94
|
+
pendingShiftId,
|
|
95
|
+
claimText,
|
|
96
|
+
claimingText,
|
|
97
|
+
takenText,
|
|
98
|
+
emptyText,
|
|
99
|
+
className,
|
|
100
|
+
onClaim,
|
|
101
|
+
} = p;
|
|
95
102
|
|
|
96
103
|
if (!shifts.length) {
|
|
97
104
|
return (
|
|
@@ -110,67 +117,69 @@ export const CalendarOpenShiftsUI = memo((p: CalendarOpenShiftsUIProps) => {
|
|
|
110
117
|
return (
|
|
111
118
|
<div
|
|
112
119
|
key={shift.id}
|
|
113
|
-
className={cn(
|
|
114
|
-
|
|
120
|
+
className={cn(
|
|
121
|
+
'h_item gap_sm bd_t_1 bd_t_bd',
|
|
122
|
+
isTaken ? 'op_50' : '',
|
|
123
|
+
)}
|
|
124
|
+
style={{
|
|
125
|
+
paddingLeft: 12,
|
|
126
|
+
paddingRight: 12,
|
|
127
|
+
paddingTop: 8,
|
|
128
|
+
paddingBottom: 8,
|
|
129
|
+
}}
|
|
115
130
|
>
|
|
116
|
-
<div className=
|
|
117
|
-
<div className=
|
|
118
|
-
<span className=
|
|
131
|
+
<div className="f h_0">
|
|
132
|
+
<div className="h_item gap_xs">
|
|
133
|
+
<span className="ellip ft_sm ft_bold">{shift.title}</span>
|
|
119
134
|
|
|
120
135
|
{!shift.openCountLabel ? null : (
|
|
121
136
|
<SimpleLabel
|
|
122
|
-
preset=
|
|
123
|
-
color=
|
|
137
|
+
preset="outline"
|
|
138
|
+
color="medium"
|
|
124
139
|
text={shift.openCountLabel}
|
|
125
140
|
/>
|
|
126
141
|
)}
|
|
127
142
|
</div>
|
|
128
143
|
|
|
129
|
-
<div className=
|
|
144
|
+
<div className="ft_tn cl_lt ellip">{shift.timeLabel}</div>
|
|
130
145
|
|
|
131
146
|
{!shift.location ? null : (
|
|
132
|
-
<div className=
|
|
147
|
+
<div className="ft_tn cl_lt ellip">{shift.location}</div>
|
|
133
148
|
)}
|
|
134
149
|
|
|
135
150
|
{!shift.releasedByLabel ? null : (
|
|
136
|
-
<div className=
|
|
151
|
+
<div className="h_item gap_xs ft_tn cl_lt">
|
|
137
152
|
<AvatarImg
|
|
138
153
|
square
|
|
139
|
-
size=
|
|
154
|
+
size="xtiny"
|
|
140
155
|
displayName={shift.releasedByName || ''}
|
|
141
156
|
urlPath={shift.releasedByPhotoUri || undefined}
|
|
142
157
|
/>
|
|
143
|
-
<span className=
|
|
158
|
+
<span className="ellip">{shift.releasedByLabel}</span>
|
|
144
159
|
</div>
|
|
145
160
|
)}
|
|
146
161
|
</div>
|
|
147
162
|
|
|
148
|
-
{isTaken
|
|
149
|
-
|
|
150
|
-
<
|
|
151
|
-
<SimpleLabel
|
|
152
|
-
preset='outline'
|
|
153
|
-
color='medium'
|
|
154
|
-
text={takenText}
|
|
155
|
-
/>
|
|
163
|
+
{isTaken ? (
|
|
164
|
+
<div className="no_shrink a_r">
|
|
165
|
+
<SimpleLabel preset="outline" color="medium" text={takenText} />
|
|
156
166
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
)}
|
|
167
|
+
{!shift.takenLabel ? null : (
|
|
168
|
+
<div className="ft_tn cl_lt ellip">{shift.takenLabel}</div>
|
|
169
|
+
)}
|
|
170
|
+
</div>
|
|
171
|
+
) : (
|
|
172
|
+
<Button
|
|
173
|
+
className="no_shrink"
|
|
174
|
+
preset="bg_primary"
|
|
175
|
+
size="sm"
|
|
176
|
+
// Any claim in flight freezes the whole board, so a
|
|
177
|
+
// second press cannot open a second request
|
|
178
|
+
disabled={!!pendingShiftId}
|
|
179
|
+
text={isPending ? claimingText : claimText}
|
|
180
|
+
onClick={() => onClaim(shift.id)}
|
|
181
|
+
/>
|
|
182
|
+
)}
|
|
174
183
|
</div>
|
|
175
184
|
);
|
|
176
185
|
})}
|
|
@@ -233,118 +242,134 @@ export interface CalendarApprovalQueueUIProps {
|
|
|
233
242
|
* word, so the row does not reflow under the pointer mid-click.
|
|
234
243
|
*/
|
|
235
244
|
|
|
236
|
-
export const CalendarApprovalQueueUI = memo(
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
245
|
+
export const CalendarApprovalQueueUI = memo(
|
|
246
|
+
(p: CalendarApprovalQueueUIProps) => {
|
|
247
|
+
const {
|
|
248
|
+
requests,
|
|
249
|
+
pendingRequestId,
|
|
250
|
+
pendingDecision,
|
|
251
|
+
approveText,
|
|
252
|
+
approvingText,
|
|
253
|
+
denyText,
|
|
254
|
+
denyingText,
|
|
255
|
+
noteByRequestId,
|
|
256
|
+
notePlaceholder,
|
|
257
|
+
emptyText,
|
|
258
|
+
className,
|
|
259
|
+
onApprove,
|
|
260
|
+
onDeny,
|
|
261
|
+
onChangeNote,
|
|
262
|
+
} = p;
|
|
263
|
+
|
|
264
|
+
if (!requests.length) {
|
|
265
|
+
return (
|
|
266
|
+
<div className={cn('p_df', className)}>
|
|
267
|
+
<CalendarRequestEmpty text={emptyText} />
|
|
268
|
+
</div>
|
|
269
|
+
);
|
|
270
|
+
}
|
|
253
271
|
|
|
254
|
-
if (!requests.length) {
|
|
255
272
|
return (
|
|
256
|
-
<div className={cn('
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
273
|
+
<div className={cn('f h_0 app_scr auto_y', className)}>
|
|
274
|
+
{requests.map((request) => {
|
|
275
|
+
const isPending = pendingRequestId === request.id;
|
|
276
|
+
const isApproving = isPending && pendingDecision === 'APPROVE';
|
|
277
|
+
const isDenying = isPending && pendingDecision === 'DENY';
|
|
261
278
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
279
|
+
return (
|
|
280
|
+
<div
|
|
281
|
+
key={request.id}
|
|
282
|
+
className={cn('bd_t_1 bd_t_bd', isPending ? 'op_50' : '')}
|
|
283
|
+
style={{
|
|
284
|
+
paddingLeft: 12,
|
|
285
|
+
paddingRight: 12,
|
|
286
|
+
paddingTop: 8,
|
|
287
|
+
paddingBottom: 8,
|
|
288
|
+
}}
|
|
289
|
+
>
|
|
290
|
+
<div className="h_item gap_sm">
|
|
291
|
+
<div className="f h_0">
|
|
292
|
+
<div className="h_item gap_xs">
|
|
293
|
+
<SimpleLabel
|
|
294
|
+
preset="outline"
|
|
295
|
+
color={request.kindColor || 'medium'}
|
|
296
|
+
text={request.kindLabel}
|
|
297
|
+
/>
|
|
298
|
+
|
|
299
|
+
<AvatarImg
|
|
300
|
+
square
|
|
301
|
+
size="xtiny"
|
|
302
|
+
displayName={request.requesterName}
|
|
303
|
+
urlPath={request.requesterPhotoUri || undefined}
|
|
304
|
+
/>
|
|
305
|
+
|
|
306
|
+
<span className="ellip ft_sm ft_bold">
|
|
307
|
+
{request.requesterName}
|
|
308
|
+
</span>
|
|
309
|
+
</div>
|
|
310
|
+
|
|
311
|
+
{!request.shiftTitle ? null : (
|
|
312
|
+
<div className="ft_sm ellip">{request.shiftTitle}</div>
|
|
313
|
+
)}
|
|
268
314
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
className={cn('bd_t_1 bd_t_bd', isPending ? 'op_50' : '')}
|
|
273
|
-
style={{ paddingLeft: 12, paddingRight: 12, paddingTop: 8, paddingBottom: 8 }}
|
|
274
|
-
>
|
|
275
|
-
<div className='h_item gap_sm'>
|
|
276
|
-
<div className='f h_0'>
|
|
277
|
-
<div className='h_item gap_xs'>
|
|
278
|
-
<SimpleLabel
|
|
279
|
-
preset='outline'
|
|
280
|
-
color={request.kindColor || 'medium'}
|
|
281
|
-
text={request.kindLabel}
|
|
282
|
-
/>
|
|
315
|
+
{!request.timeLabel ? null : (
|
|
316
|
+
<div className="ft_tn cl_lt ellip">{request.timeLabel}</div>
|
|
317
|
+
)}
|
|
283
318
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
displayName={request.requesterName}
|
|
288
|
-
urlPath={request.requesterPhotoUri || undefined}
|
|
289
|
-
/>
|
|
319
|
+
{!request.reason ? null : (
|
|
320
|
+
<div className="ft_tn cl_md pre_wrap">{request.reason}</div>
|
|
321
|
+
)}
|
|
290
322
|
|
|
291
|
-
|
|
323
|
+
{!request.submittedLabel ? null : (
|
|
324
|
+
<div className="ft_tn cl_lt ellip">
|
|
325
|
+
{request.submittedLabel}
|
|
326
|
+
</div>
|
|
327
|
+
)}
|
|
292
328
|
</div>
|
|
293
329
|
|
|
294
|
-
|
|
295
|
-
<
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
{!request.reason ? null : (
|
|
303
|
-
<div className='ft_tn cl_md pre_wrap'>{request.reason}</div>
|
|
304
|
-
)}
|
|
330
|
+
<div className="no_shrink h_item gap_xs">
|
|
331
|
+
<Button
|
|
332
|
+
preset="bg_primary"
|
|
333
|
+
size="sm"
|
|
334
|
+
disabled={isPending}
|
|
335
|
+
text={isApproving ? approvingText : approveText}
|
|
336
|
+
onClick={() => onApprove(request.id)}
|
|
337
|
+
/>
|
|
305
338
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
339
|
+
<Button
|
|
340
|
+
preset="outline"
|
|
341
|
+
size="sm"
|
|
342
|
+
disabled={isPending}
|
|
343
|
+
text={isDenying ? denyingText : denyText}
|
|
344
|
+
onClick={() => onDeny(request.id)}
|
|
345
|
+
/>
|
|
346
|
+
</div>
|
|
309
347
|
</div>
|
|
310
348
|
|
|
311
|
-
|
|
312
|
-
<
|
|
313
|
-
|
|
314
|
-
|
|
349
|
+
{!onChangeNote ? null : (
|
|
350
|
+
<Input
|
|
351
|
+
fullWidth
|
|
352
|
+
className="mt_sm ft_tn"
|
|
353
|
+
preset="subtle"
|
|
354
|
+
name={`schedule_request_note_${request.id}`}
|
|
355
|
+
placeholder={notePlaceholder}
|
|
315
356
|
disabled={isPending}
|
|
316
|
-
|
|
317
|
-
|
|
357
|
+
value={noteByRequestId?.get(request.id) || ''}
|
|
358
|
+
onInput={(e) =>
|
|
359
|
+
onChangeNote(
|
|
360
|
+
request.id,
|
|
361
|
+
(e.currentTarget as HTMLInputElement).value,
|
|
362
|
+
)
|
|
363
|
+
}
|
|
318
364
|
/>
|
|
319
|
-
|
|
320
|
-
<Button
|
|
321
|
-
preset='outline'
|
|
322
|
-
size='sm'
|
|
323
|
-
disabled={isPending}
|
|
324
|
-
text={isDenying ? denyingText : denyText}
|
|
325
|
-
onClick={() => onDeny(request.id)}
|
|
326
|
-
/>
|
|
327
|
-
</div>
|
|
365
|
+
)}
|
|
328
366
|
</div>
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
name={`schedule_request_note_${request.id}`}
|
|
336
|
-
placeholder={notePlaceholder}
|
|
337
|
-
disabled={isPending}
|
|
338
|
-
value={noteByRequestId?.get(request.id) || ''}
|
|
339
|
-
onInput={(e) => onChangeNote(request.id, (e.currentTarget as HTMLInputElement).value)}
|
|
340
|
-
/>
|
|
341
|
-
)}
|
|
342
|
-
</div>
|
|
343
|
-
);
|
|
344
|
-
})}
|
|
345
|
-
</div>
|
|
346
|
-
);
|
|
347
|
-
});
|
|
367
|
+
);
|
|
368
|
+
})}
|
|
369
|
+
</div>
|
|
370
|
+
);
|
|
371
|
+
},
|
|
372
|
+
);
|
|
348
373
|
|
|
349
374
|
/**
|
|
350
375
|
* One live subscription. There is no token here on purpose: the server stores
|
|
@@ -432,42 +457,42 @@ export const CalendarSubscribeUI = memo((p: CalendarSubscribeUIProps) => {
|
|
|
432
457
|
<div className={cn('f h_0 app_scr auto_y', className)}>
|
|
433
458
|
{!issued ? null : (
|
|
434
459
|
<div
|
|
435
|
-
className=
|
|
460
|
+
className="bg_alt r_sm bd_1 bd_bd"
|
|
436
461
|
style={{ margin: 12, padding: 12 }}
|
|
437
462
|
>
|
|
438
|
-
<div className=
|
|
439
|
-
<Icon name=
|
|
440
|
-
<span className=
|
|
463
|
+
<div className="h_item gap_xs ft_sm ft_bold">
|
|
464
|
+
<Icon name="alert-circle" />
|
|
465
|
+
<span className="f ellip">{issuedTitleText}</span>
|
|
441
466
|
</div>
|
|
442
467
|
|
|
443
|
-
<p className=
|
|
468
|
+
<p className="ft_tn cl_err mt_sm">{issuedWarningText}</p>
|
|
444
469
|
|
|
445
470
|
{/* A <div> already breaks long unbroken strings globally, which is
|
|
446
471
|
what lets the whole token stay visible instead of clipping */}
|
|
447
472
|
<div
|
|
448
|
-
className=
|
|
473
|
+
className="bg r_xs bd_1 bd_bd ft_tn mt_sm"
|
|
449
474
|
style={{ padding: 8 }}
|
|
450
475
|
>
|
|
451
476
|
{issued.url}
|
|
452
477
|
</div>
|
|
453
478
|
|
|
454
|
-
<div className=
|
|
479
|
+
<div className="h_item gap_xs mt_sm">
|
|
455
480
|
{/* TooltipClickToCopy owns the clipboard write and its own
|
|
456
481
|
"copied" feedback, so nothing about it needs page state */}
|
|
457
482
|
<TooltipClickToCopy
|
|
458
|
-
className=
|
|
459
|
-
position=
|
|
483
|
+
className="h_item gap_xs ft_tn link"
|
|
484
|
+
position="top"
|
|
460
485
|
textToCopy={issued.url}
|
|
461
486
|
>
|
|
462
|
-
<Icon name=
|
|
487
|
+
<Icon name="copy-1" />
|
|
463
488
|
<span>{copyText}</span>
|
|
464
489
|
</TooltipClickToCopy>
|
|
465
490
|
|
|
466
|
-
<span className=
|
|
491
|
+
<span className="f" />
|
|
467
492
|
|
|
468
493
|
<Button
|
|
469
|
-
preset=
|
|
470
|
-
size=
|
|
494
|
+
preset="outline"
|
|
495
|
+
size="sm"
|
|
471
496
|
text={doneText}
|
|
472
497
|
onClick={onDismissIssued}
|
|
473
498
|
/>
|
|
@@ -475,58 +500,72 @@ export const CalendarSubscribeUI = memo((p: CalendarSubscribeUIProps) => {
|
|
|
475
500
|
</div>
|
|
476
501
|
)}
|
|
477
502
|
|
|
478
|
-
{!subscriptions.length
|
|
479
|
-
|
|
480
|
-
<
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
)
|
|
484
|
-
: subscriptions.map((subscription) => {
|
|
503
|
+
{!subscriptions.length ? (
|
|
504
|
+
<div className="p_df">
|
|
505
|
+
<CalendarRequestEmpty text={emptyText} />
|
|
506
|
+
</div>
|
|
507
|
+
) : (
|
|
508
|
+
subscriptions.map((subscription) => {
|
|
485
509
|
const isRevoking = pendingRevokeId === subscription.id;
|
|
486
510
|
|
|
487
511
|
return (
|
|
488
512
|
<div
|
|
489
513
|
key={subscription.id}
|
|
490
|
-
className={cn(
|
|
491
|
-
|
|
514
|
+
className={cn(
|
|
515
|
+
'h_item gap_sm bd_t_1 bd_t_bd',
|
|
516
|
+
isRevoking ? 'op_50' : '',
|
|
517
|
+
)}
|
|
518
|
+
style={{
|
|
519
|
+
paddingLeft: 12,
|
|
520
|
+
paddingRight: 12,
|
|
521
|
+
paddingTop: 8,
|
|
522
|
+
paddingBottom: 8,
|
|
523
|
+
}}
|
|
492
524
|
>
|
|
493
|
-
<div className=
|
|
494
|
-
<div className=
|
|
495
|
-
<span className=
|
|
525
|
+
<div className="f h_0">
|
|
526
|
+
<div className="h_item gap_xs">
|
|
527
|
+
<span className="ellip ft_sm ft_bold">
|
|
528
|
+
{subscription.name}
|
|
529
|
+
</span>
|
|
496
530
|
|
|
497
531
|
<SimpleLabel
|
|
498
|
-
preset=
|
|
499
|
-
color=
|
|
532
|
+
preset="outline"
|
|
533
|
+
color="medium"
|
|
500
534
|
text={subscription.scopeLabel}
|
|
501
535
|
/>
|
|
502
536
|
</div>
|
|
503
537
|
|
|
504
538
|
{!subscription.createdLabel ? null : (
|
|
505
|
-
<div className=
|
|
539
|
+
<div className="ft_tn cl_lt ellip">
|
|
540
|
+
{subscription.createdLabel}
|
|
541
|
+
</div>
|
|
506
542
|
)}
|
|
507
543
|
|
|
508
544
|
{!subscription.lastFetchedLabel ? null : (
|
|
509
|
-
<div className=
|
|
545
|
+
<div className="ft_tn cl_lt ellip">
|
|
546
|
+
{subscription.lastFetchedLabel}
|
|
547
|
+
</div>
|
|
510
548
|
)}
|
|
511
549
|
</div>
|
|
512
550
|
|
|
513
551
|
<Button
|
|
514
|
-
className=
|
|
515
|
-
preset=
|
|
516
|
-
size=
|
|
552
|
+
className="no_shrink"
|
|
553
|
+
preset="outline"
|
|
554
|
+
size="sm"
|
|
517
555
|
disabled={isRevoking}
|
|
518
556
|
text={isRevoking ? revokingText : revokeText}
|
|
519
557
|
onClick={() => onRevoke(subscription.id)}
|
|
520
558
|
/>
|
|
521
559
|
</div>
|
|
522
560
|
);
|
|
523
|
-
})
|
|
561
|
+
})
|
|
562
|
+
)}
|
|
524
563
|
|
|
525
|
-
<div className=
|
|
564
|
+
<div className="bd_t_1 bd_t_bd" style={{ padding: 12 }}>
|
|
526
565
|
<Button
|
|
527
|
-
preset=
|
|
528
|
-
size=
|
|
529
|
-
leftIconName=
|
|
566
|
+
preset="bg_secondary"
|
|
567
|
+
size="sm"
|
|
568
|
+
leftIconName="link"
|
|
530
569
|
disabled={!!creating}
|
|
531
570
|
text={creating ? creatingText : createText}
|
|
532
571
|
onClick={onCreate}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { cn } from '@jsb188/app/utils/string.ts';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
SegmentedControl,
|
|
5
|
+
type SegmentedControlOption,
|
|
6
|
+
} from '@jsb188/react-web/ui/Button';
|
|
3
7
|
import { ToggleSwitch } from '@jsb188/react-web/ui/Form';
|
|
4
8
|
import { Icon } from '@jsb188/react-web/svgs/Icon';
|
|
5
9
|
import { memo } from 'react';
|
|
@@ -50,12 +54,17 @@ export const CalendarToolbarUI = memo((p: CalendarToolbarUIProps) => {
|
|
|
50
54
|
|
|
51
55
|
return (
|
|
52
56
|
<div
|
|
53
|
-
className=
|
|
54
|
-
style={{
|
|
57
|
+
className="no_shrink h_item gap_sm bd_b_1 bd_b_bd"
|
|
58
|
+
style={{
|
|
59
|
+
paddingLeft: 12,
|
|
60
|
+
paddingRight: 12,
|
|
61
|
+
paddingTop: 6,
|
|
62
|
+
paddingBottom: 6,
|
|
63
|
+
}}
|
|
55
64
|
>
|
|
56
65
|
<Button
|
|
57
|
-
preset=
|
|
58
|
-
size=
|
|
66
|
+
preset="bg_secondary"
|
|
67
|
+
size="sm"
|
|
59
68
|
text={todayText}
|
|
60
69
|
onClick={onToday}
|
|
61
70
|
/>
|
|
@@ -63,41 +72,41 @@ export const CalendarToolbarUI = memo((p: CalendarToolbarUIProps) => {
|
|
|
63
72
|
{/* No IconButton exists in the kit, so these are the documented raw
|
|
64
73
|
pattern: a bare button wrapping an Icon */}
|
|
65
74
|
<button
|
|
66
|
-
type=
|
|
67
|
-
className=
|
|
75
|
+
type="button"
|
|
76
|
+
className="av_sm h_center"
|
|
68
77
|
aria-label={previousText}
|
|
69
78
|
title={previousText}
|
|
70
79
|
onClick={() => onStep(-1)}
|
|
71
80
|
>
|
|
72
|
-
<Icon name=
|
|
81
|
+
<Icon name="arrow-left" />
|
|
73
82
|
</button>
|
|
74
83
|
|
|
75
84
|
<button
|
|
76
|
-
type=
|
|
77
|
-
className=
|
|
85
|
+
type="button"
|
|
86
|
+
className="av_sm h_center"
|
|
78
87
|
aria-label={nextText}
|
|
79
88
|
title={nextText}
|
|
80
89
|
onClick={() => onStep(1)}
|
|
81
90
|
>
|
|
82
|
-
<Icon name=
|
|
91
|
+
<Icon name="arrow-right" />
|
|
83
92
|
</button>
|
|
84
93
|
|
|
85
94
|
<span className={cn('f ellip ft_md ft_bold')}>{title}</span>
|
|
86
95
|
|
|
87
|
-
<label className=
|
|
96
|
+
<label className="h_item gap_sm pointer unsel no_shrink">
|
|
88
97
|
<ToggleSwitch
|
|
89
|
-
size=
|
|
98
|
+
size="sm"
|
|
90
99
|
checked={mineOnly}
|
|
91
100
|
onChange={(event) => onToggleMineOnly(event.currentTarget.checked)}
|
|
92
101
|
/>
|
|
93
|
-
<span className=
|
|
102
|
+
<span className="ft_tn cl_md">{mineOnlyText}</span>
|
|
94
103
|
</label>
|
|
95
104
|
|
|
96
105
|
<SegmentedControl
|
|
97
|
-
className=
|
|
98
|
-
heightClassName=
|
|
99
|
-
borderRadiusClassName=
|
|
100
|
-
selectedBorderRadiusClassName=
|
|
106
|
+
className="no_shrink ft_sm"
|
|
107
|
+
heightClassName="h_30"
|
|
108
|
+
borderRadiusClassName="r_df"
|
|
109
|
+
selectedBorderRadiusClassName="r_smw"
|
|
101
110
|
gapSize={3}
|
|
102
111
|
options={viewOptions}
|
|
103
112
|
selectedValue={selectedView}
|