@ledvance/ui-biz-bundle 1.1.141 → 1.1.143
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 +1 -1
- package/src/hooks/DeviceDpStateHooks.ts +1 -1
- package/src/modules/flags/FlagPage.tsx +4 -1
- package/src/modules/mood/MixMood/RecommendMixMoodItem.tsx +1 -1
- package/src/modules/mood/RecommendMoodItem.tsx +1 -1
- package/src/modules/timeSchedule/TimeScheduleEditpage.tsx +1 -1
- package/src/modules/timer/TimerPage.tsx +1 -1
- package/src/newModules/biorhythm/BiorhythmActions.ts +403 -451
- package/src/newModules/biorhythm/BiorhythmBean.ts +230 -230
- package/src/newModules/biorhythm/BiorhythmEditPage.tsx +18 -20
- package/src/newModules/biorhythm/BiorhythmPage.tsx +653 -698
- package/src/newModules/biorhythm/IconSelect.tsx +88 -88
- package/src/newModules/biorhythm/Router.ts +33 -33
- package/src/newModules/biorhythm/iconListData.ts +30 -30
- package/src/newModules/biorhythm/pIdList.ts +35 -35
- package/src/newModules/energyConsumption/EnergyConsumptionActions.ts +66 -28
- package/src/newModules/energyConsumption/EnergyConsumptionCard.tsx +172 -0
- package/src/newModules/energyConsumption/EnergyConsumptionChart.tsx +204 -118
- package/src/newModules/energyConsumption/EnergyConsumptionDetail.tsx +3 -0
- package/src/newModules/energyConsumption/EnergyConsumptionPage.tsx +16 -0
- package/src/newModules/energyConsumption/co2Data.ts +5 -0
- package/src/newModules/energyConsumption/component/NewBarChart.tsx +172 -168
- package/src/newModules/energyConsumption/component/PowerLineChart.tsx +108 -0
- package/src/newModules/energyConsumption/res/energy-chart.png +0 -0
- package/src/newModules/energyConsumption/res/index.ts +3 -0
- package/src/newModules/fixedTime/FixedTimeDetailPage.tsx +1 -1
- package/src/newModules/mood/RecommendMoodItem.tsx +1 -1
- package/src/newModules/sleepWakeUp/SleepWakeUpDetailPage.tsx +1 -1
- package/src/newModules/swithInching/SwithInching.tsx +1 -1
- package/src/newModules/timeSchedule/TimeScheduleActions.ts +12 -12
- package/tsconfig.json +73 -46
|
@@ -1,698 +1,653 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} from '
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} from '
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
const
|
|
63
|
-
const
|
|
64
|
-
const
|
|
65
|
-
const
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}, [
|
|
87
|
-
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
state.
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
state.
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
case '
|
|
131
|
-
return I18n.getLang('
|
|
132
|
-
case '
|
|
133
|
-
return I18n.getLang('
|
|
134
|
-
case '
|
|
135
|
-
return I18n.getLang('
|
|
136
|
-
case '
|
|
137
|
-
return I18n.getLang('
|
|
138
|
-
|
|
139
|
-
return
|
|
140
|
-
|
|
141
|
-
|
|
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
|
-
case '
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
case '
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
case '
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
case '
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
return { icon:
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
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
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
<
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
<View
|
|
323
|
-
style={{
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
<View
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
top: 0,
|
|
655
|
-
zIndex: 999,
|
|
656
|
-
}}
|
|
657
|
-
/>
|
|
658
|
-
)}
|
|
659
|
-
</ScrollView>
|
|
660
|
-
</Page>
|
|
661
|
-
<Modal.List
|
|
662
|
-
type={'radio'}
|
|
663
|
-
visible={state.showGradientTypeSelectModal}
|
|
664
|
-
value={state.gradient}
|
|
665
|
-
dataSource={[
|
|
666
|
-
{
|
|
667
|
-
title: I18n.getLang('add_new_dynamic_mood_color_changing_mode_value'),
|
|
668
|
-
key: BiorhythmGradientType.EntireGradient.toString(),
|
|
669
|
-
value: BiorhythmGradientType.EntireGradient,
|
|
670
|
-
},
|
|
671
|
-
{
|
|
672
|
-
title: I18n.getLang('add_new_dynamic_mood_color_changing_mode_value2'),
|
|
673
|
-
key: BiorhythmGradientType.DirectGradient.toString(),
|
|
674
|
-
value: BiorhythmGradientType.DirectGradient,
|
|
675
|
-
},
|
|
676
|
-
]}
|
|
677
|
-
title={I18n.getLang('add_new_dynamic_mood_color_changing_mode_headline')}
|
|
678
|
-
onMaskPress={() => {
|
|
679
|
-
showGradientTypeSelectModal(false)
|
|
680
|
-
}}
|
|
681
|
-
onCancel={() => {
|
|
682
|
-
showGradientTypeSelectModal(false)
|
|
683
|
-
}}
|
|
684
|
-
cancelText={I18n.getLang('auto_scan_system_cancel')}
|
|
685
|
-
confirmText={I18n.getLang('auto_scan_system_wifi_confirm')}
|
|
686
|
-
onConfirm={(item: BiorhythmGradientType) => {
|
|
687
|
-
state.gradient = item
|
|
688
|
-
requestSetBiorhythm()
|
|
689
|
-
showGradientTypeSelectModal(false)
|
|
690
|
-
}}
|
|
691
|
-
/>
|
|
692
|
-
</>
|
|
693
|
-
)
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
export default withTheme(BiorhythmPage)
|
|
697
|
-
|
|
698
|
-
|
|
1
|
+
import Card from '@ledvance/base/src/components/Card'
|
|
2
|
+
import DeleteButton from '@ledvance/base/src/components/DeleteButton'
|
|
3
|
+
import Page from '@ledvance/base/src/components/Page'
|
|
4
|
+
import Spacer from '@ledvance/base/src/components/Spacer'
|
|
5
|
+
import LdvWeekView from '@ledvance/base/src/components/weekSelect'
|
|
6
|
+
import ThemeType from '@ledvance/base/src/config/themeType'
|
|
7
|
+
import { useParams } from '@ledvance/base/src/hooks/Hooks'
|
|
8
|
+
import I18n from '@ledvance/base/src/i18n'
|
|
9
|
+
import { useDeviceInfo, useSystemTimeFormate, } from '@ledvance/base/src/models/modules/NativePropsSlice'
|
|
10
|
+
import res from '@ledvance/base/src/res'
|
|
11
|
+
import { cctToColor } from '@ledvance/base/src/utils/cctUtils'
|
|
12
|
+
import { convertMinutesTo12HourFormat, loopText, showDialog as showCommonDialog } from '@ledvance/base/src/utils/common'
|
|
13
|
+
import { useNavigation } from '@react-navigation/native'
|
|
14
|
+
import { useDebounceFn, useReactive, useUpdateEffect } from 'ahooks'
|
|
15
|
+
import { useConflictTask } from 'hooks/DeviceDpStateHooks'
|
|
16
|
+
import { cloneDeep, sortBy } from 'lodash'
|
|
17
|
+
import React, { useCallback, useMemo } from 'react'
|
|
18
|
+
import { FlatList, Image, Linking, ScrollView, Switch, Text, TouchableOpacity, View } from 'react-native'
|
|
19
|
+
import { Dialog, Modal, Utils } from 'tuya-panel-kit'
|
|
20
|
+
import { ui_biz_routerKey } from '../../navigation/Routers'
|
|
21
|
+
import { useBiorhythm } from './BiorhythmActions'
|
|
22
|
+
import {
|
|
23
|
+
BiorhythmBean,
|
|
24
|
+
BiorhythmGradientType,
|
|
25
|
+
colorTemperatureValue,
|
|
26
|
+
getDefBiorhythmUIState,
|
|
27
|
+
Plan,
|
|
28
|
+
} from './BiorhythmBean'
|
|
29
|
+
import { BiorhythmEditPageParams } from './BiorhythmEditPage'
|
|
30
|
+
import RhythmsCircle from './circular/RhythmsCircle'
|
|
31
|
+
import iconList from './iconListData'
|
|
32
|
+
import pIdList from './pIdList'
|
|
33
|
+
|
|
34
|
+
const cx = Utils.RatioUtils.convertX
|
|
35
|
+
const { withTheme } = Utils.ThemeUtils
|
|
36
|
+
const width = Utils.RatioUtils.width
|
|
37
|
+
|
|
38
|
+
interface UIState extends BiorhythmBean {
|
|
39
|
+
showGradientTypeSelectModal: boolean;
|
|
40
|
+
flag: symbol;
|
|
41
|
+
timeSchedule: any[]
|
|
42
|
+
loading: boolean
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface BiorhythmPageParams {
|
|
46
|
+
biorhythmDpCode: string
|
|
47
|
+
conflictDps: {
|
|
48
|
+
randomTimeDpCode?: string
|
|
49
|
+
fixedTimeDpCode?: string
|
|
50
|
+
sleepDpCode?: string
|
|
51
|
+
wakeUpDpCode?: string
|
|
52
|
+
}
|
|
53
|
+
isSupportTemperature: boolean
|
|
54
|
+
isSupportBrightness: boolean
|
|
55
|
+
isMixLight?: boolean
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const BiorhythmPage = (props: { theme?: ThemeType }) => {
|
|
59
|
+
const params = useParams<BiorhythmPageParams>()
|
|
60
|
+
const navigation = useNavigation()
|
|
61
|
+
const [biorhythm, setBiorhythm] = useBiorhythm(params.biorhythmDpCode)
|
|
62
|
+
const deviceInfo = useDeviceInfo()
|
|
63
|
+
const { productId } = deviceInfo
|
|
64
|
+
const is24Hour = useSystemTimeFormate()
|
|
65
|
+
const devicesJudge = pIdList.some(val => val === productId)
|
|
66
|
+
const [checkConflict, resolveConflict] = useConflictTask(params.conflictDps)
|
|
67
|
+
|
|
68
|
+
const state = useReactive<UIState>({
|
|
69
|
+
...biorhythm,
|
|
70
|
+
showGradientTypeSelectModal: false,
|
|
71
|
+
flag: Symbol(),
|
|
72
|
+
timeSchedule: [],
|
|
73
|
+
loading: false
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
const timeImg = useMemo(() => {
|
|
77
|
+
if (is24Hour) {
|
|
78
|
+
return devicesJudge ? res.ic_warning_amber_sun : res.ic_warning_amber_new
|
|
79
|
+
} else {
|
|
80
|
+
return devicesJudge ? res.ic_warning_amber_sun_12 : res.ic_warning_amber_new_12
|
|
81
|
+
}
|
|
82
|
+
}, [is24Hour, devicesJudge])
|
|
83
|
+
|
|
84
|
+
const showGradientTypeSelectModal = useCallback((show: boolean) => {
|
|
85
|
+
state.showGradientTypeSelectModal = show
|
|
86
|
+
}, [])
|
|
87
|
+
|
|
88
|
+
const onPlanEdited = useCallback((isAdd: boolean, newPlan: Plan) => {
|
|
89
|
+
if (isAdd) {
|
|
90
|
+
state.planList.push(newPlan)
|
|
91
|
+
state.planList = sortBy(state.planList, p => p.time)
|
|
92
|
+
} else {
|
|
93
|
+
state.planList = state.planList.map(plan => (plan.index === newPlan.index ? newPlan : plan))
|
|
94
|
+
}
|
|
95
|
+
state.flag = Symbol()
|
|
96
|
+
}, [])
|
|
97
|
+
|
|
98
|
+
const onPlanDelete = useCallback((id: number) => {
|
|
99
|
+
state.planList = state.planList.filter(plan => plan.index !== id)
|
|
100
|
+
state.flag = Symbol()
|
|
101
|
+
}, [])
|
|
102
|
+
|
|
103
|
+
const requestSetBiorhythm = useCallback(async (pushFeature: boolean = true) => {
|
|
104
|
+
state.loading = true
|
|
105
|
+
const planList = state.planList?.map(item => {
|
|
106
|
+
return { ...item, icon: `${item.icon}` }
|
|
107
|
+
})
|
|
108
|
+
.sort((a, b) => a.time - b.time)
|
|
109
|
+
const res = await setBiorhythm(cloneDeep({ ...state, planList }), pushFeature)
|
|
110
|
+
state.loading = false
|
|
111
|
+
if (res.success) {
|
|
112
|
+
console.log('设置生物节律 OK')
|
|
113
|
+
}
|
|
114
|
+
}, [])
|
|
115
|
+
|
|
116
|
+
useUpdateEffect(() => {
|
|
117
|
+
if (state.planList?.length === 0) {
|
|
118
|
+
const data = getDefBiorhythmUIState()
|
|
119
|
+
data.planList = data.planList?.map(item => {
|
|
120
|
+
return { ...item, icon: `${item.icon}` }
|
|
121
|
+
})
|
|
122
|
+
setBiorhythm(cloneDeep(data)).then()
|
|
123
|
+
}
|
|
124
|
+
}, [state.planList])
|
|
125
|
+
|
|
126
|
+
const setTimer = value => {
|
|
127
|
+
switch (value) {
|
|
128
|
+
case 'Sunrise':
|
|
129
|
+
return I18n.getLang('bio_ryhthm_default_field_text')
|
|
130
|
+
case 'Wake Up':
|
|
131
|
+
return I18n.getLang('bio_ryhthm_default_field_text2')
|
|
132
|
+
case 'Sunlight':
|
|
133
|
+
return I18n.getLang('bio_ryhthm_default_field_text3')
|
|
134
|
+
case 'Comfortable':
|
|
135
|
+
return I18n.getLang('bio_ryhthm_default_field_text4')
|
|
136
|
+
case 'Night light':
|
|
137
|
+
return I18n.getLang('bio_ryhthm_default_field_text5')
|
|
138
|
+
default:
|
|
139
|
+
return value
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const minimumEnable = useCallback((plan: Plan) => {
|
|
144
|
+
let enable = false
|
|
145
|
+
state.planList.filter(p => p.index !== plan.index).forEach(item => {
|
|
146
|
+
const diff = Math.abs(plan.time - item.time)
|
|
147
|
+
if (diff < 15) enable = true
|
|
148
|
+
})
|
|
149
|
+
return enable
|
|
150
|
+
}, [state.planList])
|
|
151
|
+
|
|
152
|
+
const nameRepeat = useCallback((plan: Plan) => {
|
|
153
|
+
return !!state.planList.filter(p => p.index !== plan.index).find(p => p.name === plan.name)
|
|
154
|
+
}, [state.planList])
|
|
155
|
+
|
|
156
|
+
const showDeleteBtn = useMemo(() => {
|
|
157
|
+
return state.planList?.length > 1
|
|
158
|
+
}, [state.planList?.length])
|
|
159
|
+
|
|
160
|
+
const { run } = useDebounceFn(requestSetBiorhythm, { wait: 300 })
|
|
161
|
+
|
|
162
|
+
useUpdateEffect(() => {
|
|
163
|
+
run()
|
|
164
|
+
}, [state.flag])
|
|
165
|
+
|
|
166
|
+
const replaceImg = (img) => {
|
|
167
|
+
const item = iconList?.find(val => val.id === Number(img))
|
|
168
|
+
switch (img) {
|
|
169
|
+
case 'rhythm_icon1':
|
|
170
|
+
case '31':
|
|
171
|
+
return { icon: res.biorhythom_icon1, iconId: 1 }
|
|
172
|
+
case 'rhythm_icon2':
|
|
173
|
+
case '33':
|
|
174
|
+
return { icon: res.biorhythom_icon5, iconId: 5 }
|
|
175
|
+
case 'rhythm_icon3':
|
|
176
|
+
case '35':
|
|
177
|
+
return { icon: res.biorhythom_icon2, iconId: 2 }
|
|
178
|
+
case 'rhythm_icon4':
|
|
179
|
+
case '32':
|
|
180
|
+
return { icon: res.biorhythom_icon9, iconId: 9 }
|
|
181
|
+
case 'rhythm_icon12':
|
|
182
|
+
case '39':
|
|
183
|
+
return { icon: res.biorhythom_icon3, iconId: 3 }
|
|
184
|
+
default:
|
|
185
|
+
return { icon: item?.icon, iconId: item?.id }
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
useUpdateEffect(() => {
|
|
190
|
+
const planList = biorhythm.planList?.map(item => {
|
|
191
|
+
return {
|
|
192
|
+
...item,
|
|
193
|
+
icon: replaceImg(item?.iconId || item?.icon)?.icon,
|
|
194
|
+
iconId: replaceImg(item?.iconId || item?.icon)?.iconId,
|
|
195
|
+
}
|
|
196
|
+
})
|
|
197
|
+
state.enable = biorhythm.enable
|
|
198
|
+
state.gradient = biorhythm.gradient
|
|
199
|
+
state.weeks = biorhythm.weeks
|
|
200
|
+
state.planList = planList
|
|
201
|
+
|
|
202
|
+
}, [JSON.stringify(biorhythm)])
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
const setImg = (id) => {
|
|
206
|
+
const imgIcon = iconList?.find(val => val?.id === Number(id))?.icon
|
|
207
|
+
return imgIcon || ''
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
const openLink = () => {
|
|
211
|
+
const url = I18n.getLang('biorhythm_product_link') // 需要打开的链接
|
|
212
|
+
Linking.openURL(url).catch((error) => console.error('无法打开链接:', error))
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const sunHomeText = string => {
|
|
216
|
+
const text = string.split('SUN@HOME')
|
|
217
|
+
return text?.length === 1 &&
|
|
218
|
+
<Text style={{ fontSize: cx(14), color: props.theme?.global.fontColor }}>{text[0]}</Text> ||
|
|
219
|
+
<Text style={{
|
|
220
|
+
fontSize: cx(14),
|
|
221
|
+
flexDirection: 'row',
|
|
222
|
+
}}>
|
|
223
|
+
<Text style={{ color: props.theme?.global.fontColor }}>{text[0]}</Text>
|
|
224
|
+
<Text
|
|
225
|
+
onPress={openLink}
|
|
226
|
+
style={{
|
|
227
|
+
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
228
|
+
color: props.theme?.button.primary,
|
|
229
|
+
textDecorationLine: 'underline',
|
|
230
|
+
flexWrap: 'wrap',
|
|
231
|
+
}}>SUN@HOME</Text>
|
|
232
|
+
<Text style={{ color: props.theme?.global.fontColor }}>{text[1]}</Text>
|
|
233
|
+
</Text>
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
const randomIcon = () => {
|
|
237
|
+
const iconIdList = state.planList?.map(item => {
|
|
238
|
+
return item.iconId
|
|
239
|
+
})
|
|
240
|
+
const allIcon = iconList?.map(item => {
|
|
241
|
+
return item.id
|
|
242
|
+
})
|
|
243
|
+
const availableChart = allIcon.filter((element) => !iconIdList.includes(element))
|
|
244
|
+
const randomIndex = Math.floor(Math.random() * availableChart.length)
|
|
245
|
+
return availableChart[randomIndex]
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
const convertPlandata = useCallback(() => {
|
|
249
|
+
return state.planList.map(item => {
|
|
250
|
+
return {
|
|
251
|
+
...item,
|
|
252
|
+
noActiveColor: '#474e5d',
|
|
253
|
+
activeColor: '#F7EB2A',
|
|
254
|
+
color: item?.brightness === 0 ? '#000' : !params.isSupportTemperature && cctToColor(1) || cctToColor(item.colorTemperature.toFixed(), item?.brightness)
|
|
255
|
+
}
|
|
256
|
+
}).filter(plan => plan.enable)
|
|
257
|
+
}, [JSON.stringify(state.planList), params.isSupportTemperature])
|
|
258
|
+
|
|
259
|
+
return (
|
|
260
|
+
<>
|
|
261
|
+
<Page
|
|
262
|
+
backText={deviceInfo.name}
|
|
263
|
+
onBackClick={navigation.goBack}
|
|
264
|
+
headlineText={I18n.getLang('add_new_trigger_time_system_back_text')}
|
|
265
|
+
headlineIconContent={<Switch
|
|
266
|
+
value={state.enable}
|
|
267
|
+
thumbColor={props.theme?.icon.primary}
|
|
268
|
+
trackColor={{ false: '#00000026', true: '#ff660036' }}
|
|
269
|
+
onValueChange={async enable => {
|
|
270
|
+
const biorhythmTask = {
|
|
271
|
+
startTime: 0,
|
|
272
|
+
endTime: 1440,
|
|
273
|
+
weeks: biorhythm.weeks,
|
|
274
|
+
enable: biorhythm.enable,
|
|
275
|
+
channel: 1
|
|
276
|
+
}
|
|
277
|
+
if (enable && checkConflict(biorhythmTask)) {
|
|
278
|
+
return showCommonDialog({
|
|
279
|
+
method: 'confirm',
|
|
280
|
+
title: I18n.getLang('conflict_dialog_active_item_bio_rhythm_titel'),
|
|
281
|
+
subTitle: I18n.getLang('conflict_dialog_active_item_bio_rhythm_description'),
|
|
282
|
+
onConfirm: (_, { close }) => {
|
|
283
|
+
resolveConflict()
|
|
284
|
+
close()
|
|
285
|
+
state.loading = true
|
|
286
|
+
state.enable = enable
|
|
287
|
+
requestSetBiorhythm(false)
|
|
288
|
+
},
|
|
289
|
+
onCancel: () => {
|
|
290
|
+
Dialog.close()
|
|
291
|
+
}
|
|
292
|
+
})
|
|
293
|
+
}
|
|
294
|
+
state.loading = true
|
|
295
|
+
state.enable = enable
|
|
296
|
+
requestSetBiorhythm(false)
|
|
297
|
+
}}
|
|
298
|
+
/>}
|
|
299
|
+
loading={state.loading}
|
|
300
|
+
>
|
|
301
|
+
<ScrollView nestedScrollEnabled={true} style={{ position: 'relative' }}>
|
|
302
|
+
<View style={{ marginHorizontal: cx(24) }}>
|
|
303
|
+
{sunHomeText(I18n.getLang(devicesJudge ? 'bio_ryhthm_default_description_text' : 'bio_ryhthm_non_sun_home_products_description_text'))}
|
|
304
|
+
</View>
|
|
305
|
+
<View style={{ height: cx(10) }}/>
|
|
306
|
+
<LdvWeekView
|
|
307
|
+
value={state.weeks}
|
|
308
|
+
style={{ marginHorizontal: cx(24) }}
|
|
309
|
+
onSelect={(index: number) => {
|
|
310
|
+
const rawIndex = index - 1
|
|
311
|
+
const newWeeks = cloneDeep(state.weeks)
|
|
312
|
+
newWeeks[rawIndex] = newWeeks[rawIndex] === 1 ? 0 : 1
|
|
313
|
+
if (!newWeeks.every(item => item === 0)) {
|
|
314
|
+
state.weeks = newWeeks
|
|
315
|
+
requestSetBiorhythm(false)
|
|
316
|
+
}
|
|
317
|
+
}}/>
|
|
318
|
+
<Spacer/>
|
|
319
|
+
<Text style={{ marginHorizontal: cx(24), color: props.theme?.global.fontColor, fontSize: cx(14) }}>
|
|
320
|
+
{loopText(state.weeks)}
|
|
321
|
+
</Text>
|
|
322
|
+
<View style={{ marginHorizontal: cx(24), marginTop: cx(16) }}>
|
|
323
|
+
<Text style={{ color: props.theme?.global.fontColor }}>
|
|
324
|
+
{I18n.getLang('bio_ryhthm_default_selectionfield_topic_text')}
|
|
325
|
+
</Text>
|
|
326
|
+
<TouchableOpacity
|
|
327
|
+
onPress={() => {
|
|
328
|
+
showGradientTypeSelectModal(true)
|
|
329
|
+
}}
|
|
330
|
+
>
|
|
331
|
+
<View
|
|
332
|
+
style={{
|
|
333
|
+
flexDirection: 'row',
|
|
334
|
+
borderRadius: cx(4),
|
|
335
|
+
backgroundColor: props.theme?.textInput.background,
|
|
336
|
+
alignItems: 'center',
|
|
337
|
+
flex: 1,
|
|
338
|
+
height: cx(44),
|
|
339
|
+
borderBottomWidth: cx(1),
|
|
340
|
+
borderBottomColor: props.theme?.textInput.line,
|
|
341
|
+
}}
|
|
342
|
+
>
|
|
343
|
+
<Text style={{
|
|
344
|
+
fontSize: cx(16),
|
|
345
|
+
color: props.theme?.textInput.fontColor,
|
|
346
|
+
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
347
|
+
paddingLeft: cx(16),
|
|
348
|
+
}}>
|
|
349
|
+
{
|
|
350
|
+
I18n.getLang(
|
|
351
|
+
state.gradient === BiorhythmGradientType.DirectGradient
|
|
352
|
+
? 'add_new_dynamic_mood_color_changing_mode_value2'
|
|
353
|
+
: 'add_new_dynamic_mood_color_changing_mode_value',
|
|
354
|
+
)
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
</Text>
|
|
358
|
+
</View>
|
|
359
|
+
</TouchableOpacity>
|
|
360
|
+
</View>
|
|
361
|
+
<View style={{ height: cx(20) }}/>
|
|
362
|
+
{/* <TimeCircular
|
|
363
|
+
planEdit={true}
|
|
364
|
+
planList={state.planList}
|
|
365
|
+
onPanMoved={(id, time) => {
|
|
366
|
+
state.planList = state.planList.map(plan => {
|
|
367
|
+
return {
|
|
368
|
+
...plan,
|
|
369
|
+
time: plan.index === id ? time : plan.time,
|
|
370
|
+
}
|
|
371
|
+
})
|
|
372
|
+
state.flag = Symbol()
|
|
373
|
+
}}
|
|
374
|
+
replaceStatus={devicesJudge}
|
|
375
|
+
gradient={state.gradient === BiorhythmGradientType.DirectGradient}
|
|
376
|
+
isSupportTemperature={!params.isSupportTemperature} /> */}
|
|
377
|
+
<View style={{ alignItems: 'center', justifyContent: 'center' }}>
|
|
378
|
+
<RhythmsCircle
|
|
379
|
+
size={250}
|
|
380
|
+
ringWidth={40}
|
|
381
|
+
thumbSize={36}
|
|
382
|
+
timeImg={timeImg}
|
|
383
|
+
gradientMode={state.gradient === BiorhythmGradientType.EntireGradient}
|
|
384
|
+
data={convertPlandata()}
|
|
385
|
+
onRelease={(planList) => {
|
|
386
|
+
state.planList = state.planList.map(item => {
|
|
387
|
+
return {
|
|
388
|
+
...item,
|
|
389
|
+
time: planList.find(p => p.index === item.index)?.time
|
|
390
|
+
}
|
|
391
|
+
})
|
|
392
|
+
state.flag = Symbol()
|
|
393
|
+
}}
|
|
394
|
+
/>
|
|
395
|
+
</View>
|
|
396
|
+
<View
|
|
397
|
+
style={{
|
|
398
|
+
flexDirection: 'row',
|
|
399
|
+
justifyContent: 'space-between',
|
|
400
|
+
marginHorizontal: cx(24),
|
|
401
|
+
marginBottom: cx(-8),
|
|
402
|
+
marginTop: cx(26),
|
|
403
|
+
}}>
|
|
404
|
+
{state.planList.length === 8 && <View
|
|
405
|
+
style={{ marginVertical: cx(10), flexDirection: 'row', alignItems: 'center', width: width - cx(48) }}>
|
|
406
|
+
<Image style={{ width: cx(16), height: cx(16), tintColor: props.theme?.global.warning }}
|
|
407
|
+
source={{ uri: res.ic_warning_amber }}/>
|
|
408
|
+
<Text
|
|
409
|
+
style={{
|
|
410
|
+
flexWrap: 'wrap',
|
|
411
|
+
fontSize: cx(12),
|
|
412
|
+
color: props.theme?.global.fontColor
|
|
413
|
+
}}>{I18n.getLang('add_new_trigger_time_warning_max_number_text')}</Text>
|
|
414
|
+
</View>}
|
|
415
|
+
{state.planList.length < 8 &&
|
|
416
|
+
<>
|
|
417
|
+
<Text
|
|
418
|
+
style={{
|
|
419
|
+
fontSize: cx(16),
|
|
420
|
+
fontWeight: 'bold',
|
|
421
|
+
color: props.theme?.global.fontColor,
|
|
422
|
+
}}>{I18n.getLang('bio_ryhthm_default_subheadline_text')}</Text>
|
|
423
|
+
<TouchableOpacity
|
|
424
|
+
onPress={() => {
|
|
425
|
+
const ids: number[] = state.planList.map(p => p.index)
|
|
426
|
+
const newPlan: Plan = {
|
|
427
|
+
index: Math.max(...ids) + 1,
|
|
428
|
+
icon: res.rhythm_icon1,
|
|
429
|
+
time: 0,
|
|
430
|
+
name: '',
|
|
431
|
+
colorTemperature: 0,
|
|
432
|
+
brightness: 100,
|
|
433
|
+
action: [
|
|
434
|
+
{
|
|
435
|
+
uri: 'model/attribute/set/LightCtrl/ColorTemperature',
|
|
436
|
+
startValue: `${colorTemperatureValue(0)}`,
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
uri: 'model/attribute/set/LightCtrl/Brightness',
|
|
440
|
+
startValue: '100',
|
|
441
|
+
},
|
|
442
|
+
],
|
|
443
|
+
enable: true,
|
|
444
|
+
iconId: randomIcon(),
|
|
445
|
+
}
|
|
446
|
+
const editPageParams: BiorhythmEditPageParams = {
|
|
447
|
+
planData: newPlan,
|
|
448
|
+
isAdd: true,
|
|
449
|
+
onPlanEdited,
|
|
450
|
+
onPlanDelete,
|
|
451
|
+
minimumEnable,
|
|
452
|
+
nameRepeat,
|
|
453
|
+
iconIdList: state.planList?.map(item => {
|
|
454
|
+
return item.iconId
|
|
455
|
+
}),
|
|
456
|
+
isMixRGBWLamp: !!params.isMixLight,
|
|
457
|
+
isSupportTemperature: params.isSupportTemperature,
|
|
458
|
+
isSupportBrightness: params.isSupportBrightness,
|
|
459
|
+
showDeleteBtn
|
|
460
|
+
}
|
|
461
|
+
navigation.navigate(ui_biz_routerKey.bi_biz_biological_edit, editPageParams)
|
|
462
|
+
}}>
|
|
463
|
+
<Image source={{ uri: res.biorhythom_add }}
|
|
464
|
+
style={{ height: cx(24), width: cx(24), tintColor: props.theme?.icon.primary }}/>
|
|
465
|
+
</TouchableOpacity>
|
|
466
|
+
</>
|
|
467
|
+
}
|
|
468
|
+
</View>
|
|
469
|
+
<FlatList
|
|
470
|
+
data={state.planList}
|
|
471
|
+
style={{
|
|
472
|
+
flex: 1,
|
|
473
|
+
marginTop: cx(12),
|
|
474
|
+
}}
|
|
475
|
+
nestedScrollEnabled={true}
|
|
476
|
+
ListHeaderComponent={() => (<Spacer height={cx(16)}/>)}
|
|
477
|
+
ItemSeparatorComponent={() => (<Spacer height={cx(16)}/>)}
|
|
478
|
+
renderItem={({ item }) => {
|
|
479
|
+
const bgColor = item?.brightness === 0 ? '#000' : !params.isSupportTemperature && cctToColor(1) || cctToColor(item.colorTemperature.toFixed(), item?.brightness)
|
|
480
|
+
return (
|
|
481
|
+
<Card
|
|
482
|
+
style={{ marginHorizontal: cx(24) }}
|
|
483
|
+
onPress={() => {
|
|
484
|
+
const editPageParams: BiorhythmEditPageParams = {
|
|
485
|
+
planData: {
|
|
486
|
+
...item,
|
|
487
|
+
name: setTimer(item?.name)
|
|
488
|
+
},
|
|
489
|
+
isAdd: false,
|
|
490
|
+
onPlanEdited,
|
|
491
|
+
onPlanDelete,
|
|
492
|
+
minimumEnable,
|
|
493
|
+
nameRepeat,
|
|
494
|
+
iconIdList: state.planList?.map(item => {
|
|
495
|
+
return item.iconId
|
|
496
|
+
}),
|
|
497
|
+
isMixRGBWLamp: !!params.isMixLight,
|
|
498
|
+
isSupportTemperature: params.isSupportTemperature,
|
|
499
|
+
isSupportBrightness: params.isSupportBrightness,
|
|
500
|
+
showDeleteBtn
|
|
501
|
+
}
|
|
502
|
+
navigation.navigate(ui_biz_routerKey.bi_biz_biological_edit, editPageParams)
|
|
503
|
+
}}
|
|
504
|
+
>
|
|
505
|
+
<View
|
|
506
|
+
style={{
|
|
507
|
+
flex: 1,
|
|
508
|
+
flexDirection: 'column',
|
|
509
|
+
}}
|
|
510
|
+
>
|
|
511
|
+
<View style={{ flex: 1, flexDirection: 'row', justifyContent: 'space-between', marginTop: cx(16) }}>
|
|
512
|
+
<View style={{ flexDirection: 'row', justifyContent: 'center', alignItems: 'center' }}>
|
|
513
|
+
<Image
|
|
514
|
+
source={{ uri: setImg(item?.iconId) }}
|
|
515
|
+
style={{
|
|
516
|
+
width: cx(24),
|
|
517
|
+
height: cx(24),
|
|
518
|
+
marginStart: cx(10),
|
|
519
|
+
marginRight: cx(6),
|
|
520
|
+
tintColor: props.theme?.icon.normal,
|
|
521
|
+
}}
|
|
522
|
+
/>
|
|
523
|
+
<Text
|
|
524
|
+
style={{
|
|
525
|
+
fontSize: cx(16),
|
|
526
|
+
color: props.theme?.global.fontColor,
|
|
527
|
+
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
528
|
+
}}
|
|
529
|
+
>
|
|
530
|
+
{convertMinutesTo12HourFormat(item.time, is24Hour)}
|
|
531
|
+
</Text>
|
|
532
|
+
</View>
|
|
533
|
+
<Switch
|
|
534
|
+
value={item.enable}
|
|
535
|
+
thumbColor={props.theme?.icon.primary}
|
|
536
|
+
trackColor={{ false: '#00000026', true: '#ff660036' }}
|
|
537
|
+
onValueChange={e => {
|
|
538
|
+
item.enable = e
|
|
539
|
+
requestSetBiorhythm()
|
|
540
|
+
}}
|
|
541
|
+
style={{ marginRight: cx(10) }}
|
|
542
|
+
/>
|
|
543
|
+
</View>
|
|
544
|
+
<View style={{ flex: 1, flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
545
|
+
<Text
|
|
546
|
+
style={{
|
|
547
|
+
fontSize: cx(12),
|
|
548
|
+
color: props.theme?.global.secondFontColor,
|
|
549
|
+
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
550
|
+
paddingLeft: cx(20),
|
|
551
|
+
}}
|
|
552
|
+
>
|
|
553
|
+
{setTimer(item?.name)}
|
|
554
|
+
</Text>
|
|
555
|
+
</View>
|
|
556
|
+
<View
|
|
557
|
+
style={{
|
|
558
|
+
width: cx(295),
|
|
559
|
+
height: cx(24),
|
|
560
|
+
backgroundColor: bgColor,
|
|
561
|
+
marginLeft: cx(20),
|
|
562
|
+
marginTop: cx(5),
|
|
563
|
+
marginBottom: cx(24),
|
|
564
|
+
borderRadius: cx(8),
|
|
565
|
+
}}/>
|
|
566
|
+
</View>
|
|
567
|
+
</Card>
|
|
568
|
+
)
|
|
569
|
+
}}
|
|
570
|
+
keyExtractor={item => `${item.index}`}
|
|
571
|
+
ListFooterComponent={() => {
|
|
572
|
+
return (
|
|
573
|
+
<View style={{ marginHorizontal: cx(24) }}>
|
|
574
|
+
<Spacer/>
|
|
575
|
+
<DeleteButton
|
|
576
|
+
text={I18n.getLang('bio_ryhthm_default_button_reset_text')}
|
|
577
|
+
textStyle={{
|
|
578
|
+
fontSize: cx(16),
|
|
579
|
+
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
580
|
+
}}
|
|
581
|
+
onPress={() => {
|
|
582
|
+
showCommonDialog({
|
|
583
|
+
method: 'confirm',
|
|
584
|
+
title: I18n.getLang('bio_ryhthm_reset_description_text'),
|
|
585
|
+
onConfirm: (_, { close }) => {
|
|
586
|
+
const defBiorhythmUIState = getDefBiorhythmUIState()
|
|
587
|
+
state.enable = defBiorhythmUIState.enable
|
|
588
|
+
state.weeks = defBiorhythmUIState.weeks
|
|
589
|
+
state.gradient = defBiorhythmUIState.gradient
|
|
590
|
+
state.planList = defBiorhythmUIState.planList
|
|
591
|
+
requestSetBiorhythm()
|
|
592
|
+
close()
|
|
593
|
+
}
|
|
594
|
+
})
|
|
595
|
+
}}
|
|
596
|
+
/>
|
|
597
|
+
<Spacer/>
|
|
598
|
+
</View>
|
|
599
|
+
)
|
|
600
|
+
}}
|
|
601
|
+
/>
|
|
602
|
+
{!state.enable && (
|
|
603
|
+
<View
|
|
604
|
+
style={{
|
|
605
|
+
backgroundColor: 'rgba(0,0,0,.5)',
|
|
606
|
+
width: '100%',
|
|
607
|
+
height: '100%',
|
|
608
|
+
position: 'absolute',
|
|
609
|
+
top: 0,
|
|
610
|
+
zIndex: 999,
|
|
611
|
+
}}
|
|
612
|
+
/>
|
|
613
|
+
)}
|
|
614
|
+
</ScrollView>
|
|
615
|
+
</Page>
|
|
616
|
+
<Modal.List
|
|
617
|
+
type={'radio'}
|
|
618
|
+
visible={state.showGradientTypeSelectModal}
|
|
619
|
+
value={state.gradient}
|
|
620
|
+
dataSource={[
|
|
621
|
+
{
|
|
622
|
+
title: I18n.getLang('add_new_dynamic_mood_color_changing_mode_value'),
|
|
623
|
+
key: BiorhythmGradientType.EntireGradient.toString(),
|
|
624
|
+
value: BiorhythmGradientType.EntireGradient,
|
|
625
|
+
},
|
|
626
|
+
{
|
|
627
|
+
title: I18n.getLang('add_new_dynamic_mood_color_changing_mode_value2'),
|
|
628
|
+
key: BiorhythmGradientType.DirectGradient.toString(),
|
|
629
|
+
value: BiorhythmGradientType.DirectGradient,
|
|
630
|
+
},
|
|
631
|
+
]}
|
|
632
|
+
title={I18n.getLang('add_new_dynamic_mood_color_changing_mode_headline')}
|
|
633
|
+
onMaskPress={() => {
|
|
634
|
+
showGradientTypeSelectModal(false)
|
|
635
|
+
}}
|
|
636
|
+
onCancel={() => {
|
|
637
|
+
showGradientTypeSelectModal(false)
|
|
638
|
+
}}
|
|
639
|
+
cancelText={I18n.getLang('auto_scan_system_cancel')}
|
|
640
|
+
confirmText={I18n.getLang('auto_scan_system_wifi_confirm')}
|
|
641
|
+
onConfirm={(item: BiorhythmGradientType) => {
|
|
642
|
+
state.gradient = item
|
|
643
|
+
requestSetBiorhythm()
|
|
644
|
+
showGradientTypeSelectModal(false)
|
|
645
|
+
}}
|
|
646
|
+
/>
|
|
647
|
+
</>
|
|
648
|
+
)
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
export default withTheme(BiorhythmPage)
|
|
652
|
+
|
|
653
|
+
|