@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.
@@ -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='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'>
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 { shifts, pendingShiftId, claimText, claimingText, takenText, emptyText, className, onClaim } = p;
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('h_item gap_sm bd_t_1 bd_t_bd', isTaken ? 'op_50' : '')}
114
- style={{ paddingLeft: 12, paddingRight: 12, paddingTop: 8, paddingBottom: 8 }}
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='f h_0'>
117
- <div className='h_item gap_xs'>
118
- <span className='ellip ft_sm ft_bold'>{shift.title}</span>
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='outline'
123
- color='medium'
137
+ preset="outline"
138
+ color="medium"
124
139
  text={shift.openCountLabel}
125
140
  />
126
141
  )}
127
142
  </div>
128
143
 
129
- <div className='ft_tn cl_lt ellip'>{shift.timeLabel}</div>
144
+ <div className="ft_tn cl_lt ellip">{shift.timeLabel}</div>
130
145
 
131
146
  {!shift.location ? null : (
132
- <div className='ft_tn cl_lt ellip'>{shift.location}</div>
147
+ <div className="ft_tn cl_lt ellip">{shift.location}</div>
133
148
  )}
134
149
 
135
150
  {!shift.releasedByLabel ? null : (
136
- <div className='h_item gap_xs ft_tn cl_lt'>
151
+ <div className="h_item gap_xs ft_tn cl_lt">
137
152
  <AvatarImg
138
153
  square
139
- size='xtiny'
154
+ size="xtiny"
140
155
  displayName={shift.releasedByName || ''}
141
156
  urlPath={shift.releasedByPhotoUri || undefined}
142
157
  />
143
- <span className='ellip'>{shift.releasedByLabel}</span>
158
+ <span className="ellip">{shift.releasedByLabel}</span>
144
159
  </div>
145
160
  )}
146
161
  </div>
147
162
 
148
- {isTaken
149
- ? (
150
- <div className='no_shrink a_r'>
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
- {!shift.takenLabel ? null : (
158
- <div className='ft_tn cl_lt ellip'>{shift.takenLabel}</div>
159
- )}
160
- </div>
161
- )
162
- : (
163
- <Button
164
- className='no_shrink'
165
- preset='bg_primary'
166
- size='sm'
167
- // Any claim in flight freezes the whole board, so a
168
- // second press cannot open a second request
169
- disabled={!!pendingShiftId}
170
- text={isPending ? claimingText : claimText}
171
- onClick={() => onClaim(shift.id)}
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((p: CalendarApprovalQueueUIProps) => {
237
- const {
238
- requests,
239
- pendingRequestId,
240
- pendingDecision,
241
- approveText,
242
- approvingText,
243
- denyText,
244
- denyingText,
245
- noteByRequestId,
246
- notePlaceholder,
247
- emptyText,
248
- className,
249
- onApprove,
250
- onDeny,
251
- onChangeNote,
252
- } = p;
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('p_df', className)}>
257
- <CalendarRequestEmpty text={emptyText} />
258
- </div>
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
- return (
263
- <div className={cn('f h_0 app_scr auto_y', className)}>
264
- {requests.map((request) => {
265
- const isPending = pendingRequestId === request.id;
266
- const isApproving = isPending && pendingDecision === 'APPROVE';
267
- const isDenying = isPending && pendingDecision === 'DENY';
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
- return (
270
- <div
271
- key={request.id}
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
- <AvatarImg
285
- square
286
- size='xtiny'
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
- <span className='ellip ft_sm ft_bold'>{request.requesterName}</span>
323
+ {!request.submittedLabel ? null : (
324
+ <div className="ft_tn cl_lt ellip">
325
+ {request.submittedLabel}
326
+ </div>
327
+ )}
292
328
  </div>
293
329
 
294
- {!request.shiftTitle ? null : (
295
- <div className='ft_sm ellip'>{request.shiftTitle}</div>
296
- )}
297
-
298
- {!request.timeLabel ? null : (
299
- <div className='ft_tn cl_lt ellip'>{request.timeLabel}</div>
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
- {!request.submittedLabel ? null : (
307
- <div className='ft_tn cl_lt ellip'>{request.submittedLabel}</div>
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
- <div className='no_shrink h_item gap_xs'>
312
- <Button
313
- preset='bg_primary'
314
- size='sm'
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
- text={isApproving ? approvingText : approveText}
317
- onClick={() => onApprove(request.id)}
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
- {!onChangeNote ? null : (
331
- <Input
332
- fullWidth
333
- className='mt_sm ft_tn'
334
- preset='subtle'
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='bg_alt r_sm bd_1 bd_bd'
460
+ className="bg_alt r_sm bd_1 bd_bd"
436
461
  style={{ margin: 12, padding: 12 }}
437
462
  >
438
- <div className='h_item gap_xs ft_sm ft_bold'>
439
- <Icon name='alert-circle' />
440
- <span className='f ellip'>{issuedTitleText}</span>
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='ft_tn cl_err mt_sm'>{issuedWarningText}</p>
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='bg r_xs bd_1 bd_bd ft_tn mt_sm'
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='h_item gap_xs mt_sm'>
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='h_item gap_xs ft_tn link'
459
- position='top'
483
+ className="h_item gap_xs ft_tn link"
484
+ position="top"
460
485
  textToCopy={issued.url}
461
486
  >
462
- <Icon name='copy-1' />
487
+ <Icon name="copy-1" />
463
488
  <span>{copyText}</span>
464
489
  </TooltipClickToCopy>
465
490
 
466
- <span className='f' />
491
+ <span className="f" />
467
492
 
468
493
  <Button
469
- preset='outline'
470
- size='sm'
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
- <div className='p_df'>
481
- <CalendarRequestEmpty text={emptyText} />
482
- </div>
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('h_item gap_sm bd_t_1 bd_t_bd', isRevoking ? 'op_50' : '')}
491
- style={{ paddingLeft: 12, paddingRight: 12, paddingTop: 8, paddingBottom: 8 }}
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='f h_0'>
494
- <div className='h_item gap_xs'>
495
- <span className='ellip ft_sm ft_bold'>{subscription.name}</span>
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='outline'
499
- color='medium'
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='ft_tn cl_lt ellip'>{subscription.createdLabel}</div>
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='ft_tn cl_lt ellip'>{subscription.lastFetchedLabel}</div>
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='no_shrink'
515
- preset='outline'
516
- size='sm'
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='bd_t_1 bd_t_bd' style={{ padding: 12 }}>
564
+ <div className="bd_t_1 bd_t_bd" style={{ padding: 12 }}>
526
565
  <Button
527
- preset='bg_secondary'
528
- size='sm'
529
- leftIconName='link'
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 { Button, SegmentedControl, type SegmentedControlOption } from '@jsb188/react-web/ui/Button';
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='no_shrink h_item gap_sm bd_b_1 bd_b_bd'
54
- style={{ paddingLeft: 12, paddingRight: 12, paddingTop: 6, paddingBottom: 6 }}
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='bg_secondary'
58
- size='sm'
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='button'
67
- className='av_sm h_center'
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='arrow-left' />
81
+ <Icon name="arrow-left" />
73
82
  </button>
74
83
 
75
84
  <button
76
- type='button'
77
- className='av_sm h_center'
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='arrow-right' />
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='h_item gap_sm pointer unsel no_shrink'>
96
+ <label className="h_item gap_sm pointer unsel no_shrink">
88
97
  <ToggleSwitch
89
- size='sm'
98
+ size="sm"
90
99
  checked={mineOnly}
91
100
  onChange={(event) => onToggleMineOnly(event.currentTarget.checked)}
92
101
  />
93
- <span className='ft_tn cl_md'>{mineOnlyText}</span>
102
+ <span className="ft_tn cl_md">{mineOnlyText}</span>
94
103
  </label>
95
104
 
96
105
  <SegmentedControl
97
- className='no_shrink ft_sm'
98
- heightClassName='h_30'
99
- borderRadiusClassName='r_df'
100
- selectedBorderRadiusClassName='r_smw'
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}