@ledvance/group-ui-biz-bundle 1.0.46 → 1.0.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/package.json +1 -1
  2. package/src/modules/biorhythm/BiorhythmActions.ts +5 -13
  3. package/src/modules/biorhythm/BiorhythmBean.ts +6 -6
  4. package/src/modules/biorhythm/BiorhythmPage.tsx +373 -420
  5. package/src/modules/biorhythm/Router.ts +34 -0
  6. package/src/modules/fixedTimeForPlug/Router.ts +25 -0
  7. package/src/modules/fixedTimingForLight/Router.ts +25 -0
  8. package/src/modules/flags/Router.ts +25 -0
  9. package/src/modules/mood/AddMoodPage.tsx +2 -2
  10. package/src/modules/mood_new/AddMoodPage.tsx +197 -0
  11. package/src/modules/mood_new/DynamicMoodEditorPage.tsx +654 -0
  12. package/src/modules/mood_new/Interface.ts +219 -0
  13. package/src/modules/mood_new/MixDynamicMoodEditor.tsx +788 -0
  14. package/src/modules/mood_new/MoodActions.ts +227 -0
  15. package/src/modules/mood_new/MoodInfo.ts +2151 -0
  16. package/src/modules/mood_new/MoodItem.tsx +148 -0
  17. package/src/modules/mood_new/MoodPage.tsx +374 -0
  18. package/src/modules/mood_new/MoodParse.ts +442 -0
  19. package/src/modules/mood_new/RecommendMoodItem.tsx +69 -0
  20. package/src/modules/mood_new/Router.ts +43 -0
  21. package/src/modules/mood_new/StaticMoodEditorPage.tsx +293 -0
  22. package/src/modules/music/Router.ts +16 -0
  23. package/src/modules/randomTimeForPlug/Router.ts +25 -0
  24. package/src/modules/randomTimingForLight/Router.ts +25 -0
  25. package/src/modules/remoteSwitch/Router.ts +16 -0
  26. package/src/modules/select/Router.ts +16 -0
  27. package/src/modules/switchGradient/Router.ts +16 -0
  28. package/src/modules/timeSchedule/Interface.ts +150 -0
  29. package/src/modules/timeSchedule/Router.ts +25 -0
  30. package/src/modules/timeSchedule/TimeScheduleActions.ts +140 -0
  31. package/src/modules/timeSchedule/TimeScheduleDetailPage.tsx +625 -0
  32. package/src/modules/timeSchedule/TimeSchedulePage.tsx +220 -0
  33. package/src/modules/timeSchedule/components/ManuaSettings.tsx +376 -0
  34. package/src/modules/timeSchedule/components/ScheduleCard.tsx +109 -0
  35. package/src/modules/timeSchedule/components/Summary.tsx +124 -0
  36. package/src/modules/timer/Router.ts +16 -0
  37. package/src/navigation/Routers.ts +1 -0
@@ -10,7 +10,7 @@ import {
10
10
  getDefBiorhythmUIState,
11
11
  Plan,
12
12
  } from './BiorhythmBean'
13
- import { Modal, Utils, Toast } from 'tuya-panel-kit'
13
+ import { Modal, Utils } from 'tuya-panel-kit'
14
14
  import { sortBy, cloneDeep } from 'lodash'
15
15
  import iconList from './iconListData'
16
16
  import pIdList from './pIdList'
@@ -19,7 +19,6 @@ import {
19
19
  useGroupDevices,
20
20
  } from '@ledvance/base/src/models/modules/NativePropsSlice'
21
21
  import I18n from '@ledvance/base/src/i18n'
22
- import LDVTopBar from '@ledvance/base/src/components/ldvTopBar'
23
22
  import res from '@ledvance/base/src/res'
24
23
  import { ui_biz_routerKey } from '../../navigation/Routers'
25
24
  import BiologicalRes from './res/BiologicalRes'
@@ -29,6 +28,7 @@ import { BiorhythmEditPageParams } from './BiorhythmDetailPage'
29
28
  import { useBiorhythm } from './BiorhythmActions'
30
29
  import { showDialog as showCommonDialog, showDialog } from '@ledvance/base/src/utils/common'
31
30
  import { useParams } from '@ledvance/base/src/hooks/Hooks'
31
+ import Page from '@ledvance/base/src/components/Page'
32
32
  import Spacer from '@ledvance/base/src/components/Spacer'
33
33
  import ApplyForDeviceList from '@ledvance/base/src/components/ApplyForDeviceList'
34
34
  import DeleteButton from '@ledvance/base/src/components/DeleteButton'
@@ -60,7 +60,7 @@ const BiorhythmPage = () => {
60
60
  const [groupDevices] = useGroupDevices()
61
61
  const { productId } = deviceInfo
62
62
  const devicesJudge = pIdList.some(val => val === productId)
63
-
63
+
64
64
  const state = useReactive<UIState>({
65
65
  ...cloneDeep(biorhythm),
66
66
  showGradientTypeSelectModal: false,
@@ -88,19 +88,10 @@ const BiorhythmPage = () => {
88
88
  state.flag = Symbol()
89
89
  }, [])
90
90
 
91
- const requestSetBiorhythm: () => void = useCallback(async () => {
91
+ const requestSetBiorhythm = useCallback(async () => {
92
+ state.loading = true
92
93
  const planList = state.planList?.map(item => { return { ...item, icon: `${item.icon}` } })
93
- .sort((a, b) => {
94
- const timeA = a.startTime.split(":");
95
- const timeB = b.startTime.split(":");
96
- // 比较小时
97
- if (parseInt(timeA[0]) !== parseInt(timeB[0])) {
98
- return parseInt(timeA[0]) - parseInt(timeB[0]);
99
- }
100
- // 如果小时相等,比较分钟
101
- return parseInt(timeA[1]) - parseInt(timeB[1]);
102
- });
103
- // await userOperation(deviceId, false)
94
+ .sort((a, b) => a.time - b.time);
104
95
  const res = await setBiorhythm(cloneDeep({ ...state, planList }))
105
96
  state.loading = false
106
97
  console.log('设置生物节律res', res)
@@ -123,28 +114,20 @@ const BiorhythmPage = () => {
123
114
  }
124
115
  }
125
116
 
126
- const minimumEnable = (plan: Plan) => {
127
- const [h, m] = plan.startTime.split(':').map(str => parseInt(str, 10))
128
- const min = h * 60 + m
129
- const minutes = state.planList
130
- .filter(item => item.id !== plan.id && item.enable)
131
- .map(item => {
132
- const [hour, minute] = item.startTime.split(':').map(str => parseInt(str, 10))
133
- return hour * 60 + minute
134
- })
117
+ const minimumEnable = useCallback((plan: Plan) => {
135
118
  let enable = false
136
- minutes.forEach(item => {
137
- const diff = Math.abs(min - item)
119
+ state.planList.filter(p => p.index !== plan.id).forEach(item => {
120
+ const diff = Math.abs(plan.time - item.time)
138
121
  if (diff < 15) enable = true
139
122
  })
140
123
  return enable
141
- }
124
+ }, [state.planList])
142
125
 
143
126
  const showDeleteBtn = useMemo(() => {
144
127
  return state.planList?.length > 1
145
128
  }, [state.planList?.length])
146
129
 
147
- const { run } = useDebounceFn(requestSetBiorhythm, { wait: 200 })
130
+ const { run } = useDebounceFn(requestSetBiorhythm, { wait: 300 })
148
131
 
149
132
  useUpdateEffect(() => {
150
133
  run()
@@ -189,7 +172,7 @@ const BiorhythmPage = () => {
189
172
  state.planList = planList
190
173
  }, [JSON.stringify(biorhythm)])
191
174
 
192
- useEffect(() =>{
175
+ useEffect(() => {
193
176
  const weeks: string[] = setDataSource(
194
177
  biorhythm.repeatPeriod.map(item => {
195
178
  return item?.enabled ? 1 : 0
@@ -253,275 +236,194 @@ const BiorhythmPage = () => {
253
236
  }
254
237
 
255
238
  return (
256
- <>
257
- <View style={{ flex: 1, flexDirection: 'column' }}>
258
- <LDVTopBar
259
- title={deviceInfo.name}
260
- onBackPress={() => {
261
- navigation.goBack()
262
- }}
263
- />
264
- <ScrollView nestedScrollEnabled={true} style={{ position: 'relative' }}>
265
- <View
266
- style={{
267
- height: cx(60),
268
- flexDirection: 'row',
269
- justifyContent: 'space-between',
270
- alignItems: 'center',
271
- marginHorizontal: cx(24),
272
- }}
273
- >
274
- <Text
239
+ <Page
240
+ backText={deviceInfo.name}
241
+ onBackClick={navigation.goBack}
242
+ headlineText={I18n.getLang('add_new_trigger_time_system_back_text')}
243
+ headlineContent={<Switch
244
+ value={state.enable}
245
+ thumbColor={'#f60'}
246
+ trackColor={{ false: '#00000026', true: '#ff660036' }}
247
+ onValueChange={async enable => {
248
+ if (enable) return showDialog({
249
+ method: 'confirm',
250
+ title: I18n.getLang('conflict_dialog_active_item_bio_rhythm_titel'),
251
+ subTitle: I18n.getLang('group_conflict_feature'),
252
+ confirmText: I18n.getLang('registration_dialog_button_yes'),
253
+ cancelText: I18n.getLang('registration_dialog_button_no'),
254
+ onConfirm: async (_, { close }) => {
255
+ close()
256
+ state.loading = true
257
+ state.enable = enable
258
+ state.flag = Symbol()
259
+ }
260
+ })
261
+ state.loading = true
262
+ state.enable = enable
263
+ state.flag = Symbol()
264
+ }}
265
+ />}
266
+ loading={state.loading}
267
+ >
268
+ <>
269
+ <View style={{ flex: 1, flexDirection: 'column' }}>
270
+ <ScrollView nestedScrollEnabled={true} style={{ position: 'relative' }}>
271
+ <View style={{ marginHorizontal: cx(24) }}>
272
+ {sunHomeText(I18n.getLang(devicesJudge ? 'bio_ryhthm_default_description_text' : 'bio_ryhthm_non_sun_home_products_description_text'))}
273
+ </View>
274
+ <View style={{ height: cx(10) }} />
275
+ <View
275
276
  style={{
276
- color: '#FF6600',
277
- fontSize: cx(24),
278
- fontFamily: 'helvetica_neue_lt_std_roman',
277
+ flexDirection: 'row',
278
+ justifyContent: 'space-between',
279
+ marginHorizontal: cx(24),
279
280
  }}
280
281
  >
281
- {I18n.getLang('add_new_trigger_time_system_back_text')}
282
- </Text>
283
- <Switch
284
- value={state.enable}
285
- thumbColor={'#f60'}
286
- trackColor={{ false: '#00000026', true: '#ff660036' }}
287
- onValueChange={async enable => {
288
- if (enable) return showDialog({
289
- method: 'confirm',
290
- title: I18n.getLang('conflict_dialog_active_item_bio_rhythm_titel'),
291
- subTitle: I18n.getLang('group_conflict_feature'),
292
- confirmText: I18n.getLang('registration_dialog_button_yes'),
293
- cancelText: I18n.getLang('registration_dialog_button_no'),
294
- onConfirm: async (_, { close }) => {
295
- state.loading = true
296
- state.enable = enable
297
- close()
298
- state.flag = Symbol()
299
- }
300
- })
301
- state.loading = true
302
- state.enable = enable
303
- state.flag = Symbol()
304
- }}
305
- />
306
- </View>
307
- <View style={{ marginHorizontal: cx(24) }}>
308
- {sunHomeText(I18n.getLang(devicesJudge ? 'bio_ryhthm_default_description_text' : 'bio_ryhthm_non_sun_home_products_description_text'))}
309
- </View>
310
- <View style={{ height: cx(10) }} />
311
- <View
312
- style={{
313
- flexDirection: 'row',
314
- justifyContent: 'space-between',
315
- marginHorizontal: cx(24),
316
- }}
317
- >
318
- {state.repeatPeriod.map((period, idx) => {
319
- return (
320
- <TouchableOpacity
321
- key={period.title}
322
- onPress={() => {
323
- state.repeatPeriod = state.repeatPeriod.map((period, index) => {
324
- if(idx === index){
325
- return {
326
- ...period,
327
- enabled: !period.enabled
328
- }
329
- }
330
- return period
331
- })
332
- // period.enabled = !period.enabled
333
- state.flag = Symbol()
334
- }}
335
- >
336
- <View
337
- style={{
338
- width: cx(40),
339
- height: cx(40),
340
- justifyContent: 'center',
341
- alignItems: 'center',
342
- borderRadius: cx(20),
343
- backgroundColor: period.enabled ? '#ffe0d4' : '#fff',
344
- borderWidth: cx(1),
345
- borderColor: '#f60',
282
+ {state.repeatPeriod.map((period) => {
283
+ return (
284
+ <TouchableOpacity
285
+ key={period.title}
286
+ onPress={() => {
287
+ const periodNum = state.repeatPeriod.filter(p => p.enabled)?.length
288
+ if (periodNum === 1 && period.enabled) return
289
+ period.enabled = !period.enabled
290
+ state.flag = Symbol()
346
291
  }}
347
292
  >
348
- <Text
293
+ <View
349
294
  style={{
350
- color: '#FF6600',
351
- textAlign: 'center',
295
+ width: cx(40),
296
+ height: cx(40),
297
+ justifyContent: 'center',
298
+ alignItems: 'center',
299
+ borderRadius: cx(20),
300
+ backgroundColor: period.enabled ? '#ffe0d4' : '#fff',
301
+ borderWidth: cx(1),
302
+ borderColor: '#f60',
352
303
  }}
353
304
  >
354
- {period.title}
355
- </Text>
356
- </View>
357
- </TouchableOpacity>
358
- )
359
- })}
360
- </View>
361
- <View style={{ marginHorizontal: cx(24), marginTop: cx(20) }}>
362
- <Text>{state.weekString}</Text>
363
- </View>
364
- <View style={{ marginHorizontal: cx(24), marginTop: cx(16) }}>
365
- <Text>
366
- {I18n.getLang('bio_ryhthm_default_selectionfield_topic_text')}
367
- </Text>
368
- <TouchableOpacity
369
- onPress={() => {
370
- showGradientTypeSelectModal(true)
371
- }}
372
- >
373
- <View
374
- style={{
375
- flexDirection: 'row',
376
- borderRadius: cx(4),
377
- backgroundColor: '#f6f6f6',
378
- alignItems: 'center',
379
- flex: 1,
380
- height: cx(44),
381
- borderBottomWidth: cx(1),
382
- borderBottomColor: '#cbcbcb',
305
+ <Text
306
+ style={{
307
+ color: '#FF6600',
308
+ textAlign: 'center',
309
+ }}
310
+ >
311
+ {period.title}
312
+ </Text>
313
+ </View>
314
+ </TouchableOpacity>
315
+ )
316
+ })}
317
+ </View>
318
+ <View style={{ marginHorizontal: cx(24), marginTop: cx(20) }}>
319
+ <Text>{state.weekString}</Text>
320
+ </View>
321
+ <View style={{ marginHorizontal: cx(24), marginTop: cx(16) }}>
322
+ <Text>
323
+ {I18n.getLang('bio_ryhthm_default_selectionfield_topic_text')}
324
+ </Text>
325
+ <TouchableOpacity
326
+ onPress={() => {
327
+ showGradientTypeSelectModal(true)
383
328
  }}
384
329
  >
385
- <Text style={{
386
- fontSize: cx(16),
387
- color: '#000',
388
- fontFamily: 'helvetica_neue_lt_std_roman',
389
- paddingLeft: cx(16),
390
- }}>
391
- {
392
- I18n.getLang(
393
- state.gradient === BiorhythmGradientType.DirectGradient
394
- ? 'add_new_dynamic_mood_color_changing_mode_value2'
395
- : 'add_new_dynamic_mood_color_changing_mode_value',
396
- )
397
- }
398
-
399
- </Text>
400
- </View>
401
- </TouchableOpacity>
402
- </View>
403
- <View style={{ height: cx(20) }} />
404
- <TimeCircular
405
- planEdit={true}
406
- planList={state.planList}
407
- onPanMoved={(id, time) => {
408
- state.planList = state.planList.map(plan => {
409
- return {
410
- ...plan,
411
- startTime: plan.id === id ? time : plan.startTime,
412
- }
413
- })
414
- state.flag = Symbol()
415
- }}
416
- replaceStatus={devicesJudge}
417
- gradient={state.gradient === BiorhythmGradientType.DirectGradient}
418
- isSupportTemperature={!params.isSupportTemperature} />
419
- <View
420
- style={{
421
- flexDirection: 'row',
422
- justifyContent: 'space-between',
423
- marginHorizontal: cx(24),
424
- marginBottom: cx(-8),
425
- marginTop: cx(26),
426
- }}>
427
- {state.planList.length === 8 && <View
428
- style={{ marginVertical: cx(10), flexDirection: 'row', alignItems: 'center', width: width - cx(48) }}>
429
- <Image style={{ width: cx(16), height: cx(16), tintColor: '#ff9500' }} source={res.ic_warning_amber} />
430
- <Text
431
- style={{
432
- flexWrap: 'wrap',
433
- fontSize: cx(12),
434
- }}>{I18n.getLang('add_new_trigger_time_warning_max_number_text')}</Text>
435
- </View>}
436
- {state.planList.length < 8 &&
437
- <>
438
- <Text
439
- style={{
440
- fontSize: cx(16),
441
- fontWeight: 'bold',
442
- color: 'rgb(0,0,0)',
443
- }}>{I18n.getLang('bio_ryhthm_default_subheadline_text')}</Text>
444
- <TouchableOpacity
445
- onPress={() => {
446
- const ids: number[] = state.planList.map(p => p.id)
447
- const newPlan: Plan = {
448
- id: Math.max(...ids) + 1,
449
- icon: res.rhythm_icon1,
450
- startTime: '00:00',
451
- name: '',
452
- colorTemperature: 0,
453
- brightness: 100,
454
- action: [
455
- {
456
- uri: 'model/attribute/set/LightCtrl/ColorTemperature',
457
- startValue: `${colorTemperatureValue(0)}`,
458
- },
459
- {
460
- uri: 'model/attribute/set/LightCtrl/Brightness',
461
- startValue: '100',
462
- },
463
- ],
464
- enable: true,
465
- iconId: randomIcon(),
466
- }
467
- const editPageParams: BiorhythmEditPageParams = {
468
- planData: newPlan,
469
- isAdd: true,
470
- onPlanEdited,
471
- onPlanDelete,
472
- minimumEnable,
473
- iconIdList: state.planList?.map(item => {
474
- return item.iconId
475
- }),
476
- isMixLight: params.isMixLight,
477
- isSupportTemperature: params.isSupportTemperature,
478
- isSupportBrightness: params.isSupportBrightness,
479
- showDeleteBtn
480
- }
481
- navigation.navigate(ui_biz_routerKey.group_ui_biz_biological_detail, editPageParams)
482
- }}>
483
- <Image source={BiologicalRes.biorhythom_add} style={{ height: cx(24), width: cx(24) }} />
484
- </TouchableOpacity>
485
- </>
486
- }
487
- </View>
488
- <FlatList
489
- data={state.planList}
490
- style={{
491
- flex: 1,
492
- marginTop: cx(12),
493
- }}
494
- nestedScrollEnabled={true}
495
- renderItem={({ item }) => {
496
- const type = typeof item?.icon === 'string'
497
- const bgColor = item?.brightness === 0 ? '#000' : !params.isSupportTemperature && cctToColor(1) || cctToColor(item.colorTemperature.toFixed(), item?.brightness)
498
- return (
499
330
  <View
500
331
  style={{
501
- height: cx(118),
502
- backgroundColor: 'white',
503
- elevation: cx(7),
504
- shadowColor: '#000000',
505
- shadowOpacity: 0.2,
506
- shadowRadius: cx(7),
507
- shadowOffset: {
508
- width: 0,
509
- height: cx(4),
510
- },
511
- borderRadius: cx(10),
512
- marginHorizontal: cx(24),
513
- marginVertical: cx(8),
332
+ flexDirection: 'row',
333
+ borderRadius: cx(4),
334
+ backgroundColor: '#f6f6f6',
335
+ alignItems: 'center',
336
+ flex: 1,
337
+ height: cx(44),
338
+ borderBottomWidth: cx(1),
339
+ borderBottomColor: '#cbcbcb',
514
340
  }}
515
341
  >
342
+ <Text style={{
343
+ fontSize: cx(16),
344
+ color: '#000',
345
+ fontFamily: 'helvetica_neue_lt_std_roman',
346
+ paddingLeft: cx(16),
347
+ }}>
348
+ {
349
+ I18n.getLang(
350
+ state.gradient === BiorhythmGradientType.DirectGradient
351
+ ? 'add_new_dynamic_mood_color_changing_mode_value2'
352
+ : 'add_new_dynamic_mood_color_changing_mode_value',
353
+ )
354
+ }
355
+
356
+ </Text>
357
+ </View>
358
+ </TouchableOpacity>
359
+ </View>
360
+ <View style={{ height: cx(20) }} />
361
+ <TimeCircular
362
+ planEdit={true}
363
+ planList={state.planList}
364
+ onPanMoved={(id, time) => {
365
+ state.planList = state.planList.map(plan => {
366
+ return {
367
+ ...plan,
368
+ time: plan.index === id ? time : plan.time,
369
+ }
370
+ })
371
+ state.flag = Symbol()
372
+ }}
373
+ replaceStatus={devicesJudge}
374
+ gradient={state.gradient === BiorhythmGradientType.DirectGradient}
375
+ isSupportTemperature={!params.isSupportTemperature} />
376
+ <View
377
+ style={{
378
+ flexDirection: 'row',
379
+ justifyContent: 'space-between',
380
+ marginHorizontal: cx(24),
381
+ marginBottom: cx(-8),
382
+ marginTop: cx(26),
383
+ }}>
384
+ {state.planList.length === 8 && <View
385
+ style={{ marginVertical: cx(10), flexDirection: 'row', alignItems: 'center', width: width - cx(48) }}>
386
+ <Image style={{ width: cx(16), height: cx(16), tintColor: '#ff9500' }} source={res.ic_warning_amber} />
387
+ <Text
388
+ style={{
389
+ flexWrap: 'wrap',
390
+ fontSize: cx(12),
391
+ }}>{I18n.getLang('add_new_trigger_time_warning_max_number_text')}</Text>
392
+ </View>}
393
+ {state.planList.length < 8 &&
394
+ <>
395
+ <Text
396
+ style={{
397
+ fontSize: cx(16),
398
+ fontWeight: 'bold',
399
+ color: 'rgb(0,0,0)',
400
+ }}>{I18n.getLang('bio_ryhthm_default_subheadline_text')}</Text>
516
401
  <TouchableOpacity
517
- style={{ flex: 1 }}
518
402
  onPress={() => {
403
+ const ids: number[] = state.planList.map(p => p.id)
404
+ const newPlan: Plan = {
405
+ id: Math.max(...ids) + 1,
406
+ icon: res.rhythm_icon1,
407
+ time: 0,
408
+ name: '',
409
+ colorTemperature: 0,
410
+ brightness: 100,
411
+ action: [
412
+ {
413
+ uri: 'model/attribute/set/LightCtrl/ColorTemperature',
414
+ startValue: `${colorTemperatureValue(0)}`,
415
+ },
416
+ {
417
+ uri: 'model/attribute/set/LightCtrl/Brightness',
418
+ startValue: '100',
419
+ },
420
+ ],
421
+ enable: true,
422
+ iconId: randomIcon(),
423
+ }
519
424
  const editPageParams: BiorhythmEditPageParams = {
520
- planData: {
521
- ...item,
522
- name: setTimer(item?.name)
523
- },
524
- isAdd: false,
425
+ planData: newPlan,
426
+ isAdd: true,
525
427
  onPlanEdited,
526
428
  onPlanDelete,
527
429
  minimumEnable,
@@ -534,162 +436,213 @@ const BiorhythmPage = () => {
534
436
  showDeleteBtn
535
437
  }
536
438
  navigation.navigate(ui_biz_routerKey.group_ui_biz_biological_detail, editPageParams)
439
+ }}>
440
+ <Image source={BiologicalRes.biorhythom_add} style={{ height: cx(24), width: cx(24) }} />
441
+ </TouchableOpacity>
442
+ </>
443
+ }
444
+ </View>
445
+ <FlatList
446
+ data={state.planList}
447
+ style={{
448
+ flex: 1,
449
+ marginTop: cx(12),
450
+ }}
451
+ nestedScrollEnabled={true}
452
+ renderItem={({ item }) => {
453
+ const type = typeof item?.icon === 'string'
454
+ const bgColor = item?.brightness === 0 ? '#000' : !params.isSupportTemperature && cctToColor(1) || cctToColor(item.colorTemperature.toFixed(), item?.brightness)
455
+ return (
456
+ <View
457
+ style={{
458
+ height: cx(118),
459
+ backgroundColor: 'white',
460
+ elevation: cx(7),
461
+ shadowColor: '#000000',
462
+ shadowOpacity: 0.2,
463
+ shadowRadius: cx(7),
464
+ shadowOffset: {
465
+ width: 0,
466
+ height: cx(4),
467
+ },
468
+ borderRadius: cx(10),
469
+ marginHorizontal: cx(24),
470
+ marginVertical: cx(8),
537
471
  }}
538
472
  >
539
- <View
540
- style={{
541
- flex: 1,
542
- flexDirection: 'column',
473
+ <TouchableOpacity
474
+ style={{ flex: 1 }}
475
+ onPress={() => {
476
+ const editPageParams: BiorhythmEditPageParams = {
477
+ planData: {
478
+ ...item,
479
+ name: setTimer(item?.name)
480
+ },
481
+ isAdd: false,
482
+ onPlanEdited,
483
+ onPlanDelete,
484
+ minimumEnable,
485
+ iconIdList: state.planList?.map(item => {
486
+ return item.iconId
487
+ }),
488
+ isMixLight: params.isMixLight,
489
+ isSupportTemperature: params.isSupportTemperature,
490
+ isSupportBrightness: params.isSupportBrightness,
491
+ showDeleteBtn
492
+ }
493
+ navigation.navigate(ui_biz_routerKey.group_ui_biz_biological_detail, editPageParams)
543
494
  }}
544
495
  >
545
- <View style={{ flex: 1, flexDirection: 'row', justifyContent: 'space-between', marginTop: cx(16) }}>
546
- <View style={{ flexDirection: 'row', justifyContent: 'center', alignItems: 'center' }}>
547
- <Image
548
- source={setImg(item?.iconId) || type && { uri: item?.icon } || item?.icon}
549
- style={{
550
- width: cx(24),
551
- height: cx(24),
552
- marginStart: cx(10),
553
- marginRight: cx(6),
554
- tintColor: '#474e5d',
496
+ <View
497
+ style={{
498
+ flex: 1,
499
+ flexDirection: 'column',
500
+ }}
501
+ >
502
+ <View style={{ flex: 1, flexDirection: 'row', justifyContent: 'space-between', marginTop: cx(16) }}>
503
+ <View style={{ flexDirection: 'row', justifyContent: 'center', alignItems: 'center' }}>
504
+ <Image
505
+ source={setImg(item?.iconId) || type && { uri: item?.icon } || item?.icon}
506
+ style={{
507
+ width: cx(24),
508
+ height: cx(24),
509
+ marginStart: cx(10),
510
+ marginRight: cx(6),
511
+ tintColor: '#474e5d',
512
+ }}
513
+ />
514
+ <Text
515
+ style={{
516
+ fontSize: cx(16),
517
+ color: '#000',
518
+ fontFamily: 'helvetica_neue_lt_std_roman',
519
+ }}
520
+ >
521
+ {item.startTime}
522
+ </Text>
523
+ </View>
524
+ <Switch
525
+ value={item.enable}
526
+ thumbColor={'#f60'}
527
+ trackColor={{ false: '#00000026', true: '#ff660036' }}
528
+ onValueChange={e => {
529
+ item.enable = e
530
+ state.flag = Symbol()
555
531
  }}
532
+ style={{ marginRight: cx(10) }}
556
533
  />
534
+ </View>
535
+ <View style={{ flex: 1, flexDirection: 'row', justifyContent: 'space-between' }}>
557
536
  <Text
558
537
  style={{
559
- fontSize: cx(16),
560
- color: '#000',
538
+ fontSize: cx(12),
539
+ color: '#666',
561
540
  fontFamily: 'helvetica_neue_lt_std_roman',
541
+ paddingLeft: cx(20),
562
542
  }}
563
543
  >
564
- {item.startTime}
544
+ {setTimer(item?.name)}
565
545
  </Text>
566
546
  </View>
567
- <Switch
568
- value={item.enable}
569
- thumbColor={'#f60'}
570
- trackColor={{ false: '#00000026', true: '#ff660036' }}
571
- onValueChange={e => {
572
- item.enable = e
573
- state.flag = Symbol()
574
- }}
575
- style={{ marginRight: cx(10) }}
576
- />
577
- </View>
578
- <View style={{ flex: 1, flexDirection: 'row', justifyContent: 'space-between' }}>
579
- <Text
547
+ <View
580
548
  style={{
581
- fontSize: cx(12),
582
- color: '#666',
583
- fontFamily: 'helvetica_neue_lt_std_roman',
584
- paddingLeft: cx(20),
585
- }}
586
- >
587
- {setTimer(item?.name)}
588
- </Text>
549
+ width: cx(295),
550
+ height: cx(24),
551
+ backgroundColor: bgColor,
552
+ marginLeft: cx(20),
553
+ marginTop: cx(-5),
554
+ marginBottom: cx(24),
555
+ borderRadius: cx(8),
556
+ }} />
589
557
  </View>
590
- <View
591
- style={{
592
- width: cx(295),
593
- height: cx(24),
594
- backgroundColor: bgColor,
595
- marginLeft: cx(20),
596
- marginTop: cx(-5),
597
- marginBottom: cx(24),
598
- borderRadius: cx(8),
599
- }} />
600
- </View>
601
- </TouchableOpacity>
602
- </View>
603
- )
604
- }}
605
- keyExtractor={item => `${item.id}`}
606
- ListFooterComponent={() => {
607
- return (
608
- <View style={{marginHorizontal: cx(24)}}>
609
- <Spacer height={cx(16)}/>
610
- <ApplyForDeviceList
611
- devices={cloneDeep(groupDevices)}
612
- />
613
- <Spacer height={cx(5)}/>
614
- <InfoText
615
- icon={res.ic_info}
616
- text={I18n.getLang('group_feature_biological_rhythm_applyfor_information')}
617
- />
618
- <Spacer height={cx(16)}/>
619
- <DeleteButton
620
- text={I18n.getLang('bio_ryhthm_default_button_reset_text')}
621
- onPress={() => {
622
- showCommonDialog({
623
- method: 'confirm',
624
- title: I18n.getLang('bio_ryhthm_reset_description_text'),
625
- onConfirm: (_, { close }) => {
626
- const defBiorhythmUIState = getDefBiorhythmUIState()
627
- state.enable = defBiorhythmUIState.enable
628
- state.gradient = defBiorhythmUIState.gradient
629
- state.repeatPeriod = defBiorhythmUIState.repeatPeriod
630
- state.planList = defBiorhythmUIState.planList
631
- state.flag = Symbol()
632
- close()
633
- }
634
- })
635
- }}
636
- />
637
- <Spacer />
638
- </View>
639
- ) || <></>
640
- }}
641
- />
642
- {!state.enable && (
643
- <View
644
- style={{
645
- backgroundColor: 'rgba(0,0,0,.5)',
646
- width: '100%',
647
- height: '100%',
648
- position: 'absolute',
649
- top: cx(45),
650
- zIndex: 999,
558
+ </TouchableOpacity>
559
+ </View>
560
+ )
561
+ }}
562
+ keyExtractor={item => `${item.id}`}
563
+ ListFooterComponent={() => {
564
+ return (
565
+ <View style={{ marginHorizontal: cx(24) }}>
566
+ <Spacer height={cx(16)} />
567
+ <ApplyForDeviceList
568
+ devices={cloneDeep(groupDevices)}
569
+ />
570
+ <Spacer height={cx(5)} />
571
+ <InfoText
572
+ icon={res.ic_info}
573
+ text={I18n.getLang('group_feature_biological_rhythm_applyfor_information')}
574
+ />
575
+ <Spacer height={cx(16)} />
576
+ <DeleteButton
577
+ text={I18n.getLang('bio_ryhthm_default_button_reset_text')}
578
+ onPress={() => {
579
+ showCommonDialog({
580
+ method: 'confirm',
581
+ title: I18n.getLang('bio_ryhthm_reset_description_text'),
582
+ onConfirm: (_, { close }) => {
583
+ const defBiorhythmUIState = getDefBiorhythmUIState()
584
+ state.enable = defBiorhythmUIState.enable
585
+ state.gradient = defBiorhythmUIState.gradient
586
+ state.repeatPeriod = defBiorhythmUIState.repeatPeriod
587
+ state.planList = defBiorhythmUIState.planList
588
+ state.flag = Symbol()
589
+ close()
590
+ }
591
+ })
592
+ }}
593
+ />
594
+ <Spacer />
595
+ </View>
596
+ ) || <></>
651
597
  }}
652
598
  />
653
- )}
654
- </ScrollView>
655
- </View>
656
- <Modal.List
657
- type={'radio'}
658
- visible={state.showGradientTypeSelectModal}
659
- value={state.gradient}
660
- dataSource={[
661
- {
662
- title: I18n.getLang('add_new_dynamic_mood_color_changing_mode_value'),
663
- key: '0',
664
- value: BiorhythmGradientType.EntireGradient,
665
- },
666
- {
667
- title: I18n.getLang('add_new_dynamic_mood_color_changing_mode_value2'),
668
- key: '1',
669
- value: BiorhythmGradientType.DirectGradient,
670
- },
671
- ]}
672
- title={I18n.getLang('add_new_dynamic_mood_color_changing_mode_headline')}
673
- onMaskPress={() => {
674
- showGradientTypeSelectModal(false)
675
- }}
676
- onCancel={() => {
677
- showGradientTypeSelectModal(false)
678
- }}
679
- cancelText={I18n.getLang('auto_scan_system_cancel')}
680
- confirmText={I18n.getLang('auto_scan_system_wifi_confirm')}
681
- onConfirm={(item: BiorhythmGradientType) => {
682
- state.gradient = item
683
- state.flag = Symbol()
684
- showGradientTypeSelectModal(false)
685
- }}
686
- />
687
- <Toast.Loading
688
- show={!!state.loading}
689
- onFinish={() => {
690
-
691
- }} />
692
- </>
599
+ {!state.enable && (
600
+ <View
601
+ style={{
602
+ backgroundColor: 'rgba(0,0,0,.5)',
603
+ width: '100%',
604
+ height: '100%',
605
+ position: 'absolute',
606
+ top: cx(45),
607
+ zIndex: 999,
608
+ }}
609
+ />
610
+ )}
611
+ </ScrollView>
612
+ </View>
613
+ <Modal.List
614
+ type={'radio'}
615
+ visible={state.showGradientTypeSelectModal}
616
+ value={state.gradient}
617
+ dataSource={[
618
+ {
619
+ title: I18n.getLang('add_new_dynamic_mood_color_changing_mode_value'),
620
+ key: '0',
621
+ value: BiorhythmGradientType.EntireGradient,
622
+ },
623
+ {
624
+ title: I18n.getLang('add_new_dynamic_mood_color_changing_mode_value2'),
625
+ key: '1',
626
+ value: BiorhythmGradientType.DirectGradient,
627
+ },
628
+ ]}
629
+ title={I18n.getLang('add_new_dynamic_mood_color_changing_mode_headline')}
630
+ onMaskPress={() => {
631
+ showGradientTypeSelectModal(false)
632
+ }}
633
+ onCancel={() => {
634
+ showGradientTypeSelectModal(false)
635
+ }}
636
+ cancelText={I18n.getLang('auto_scan_system_cancel')}
637
+ confirmText={I18n.getLang('auto_scan_system_wifi_confirm')}
638
+ onConfirm={(item: BiorhythmGradientType) => {
639
+ state.gradient = item
640
+ state.flag = Symbol()
641
+ showGradientTypeSelectModal(false)
642
+ }}
643
+ />
644
+ </>
645
+ </Page>
693
646
  )
694
647
  }
695
648