@ledvance/group-ui-biz-bundle 1.0.47 → 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.
- package/package.json +1 -1
- package/src/modules/biorhythm/BiorhythmPage.tsx +366 -389
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
getDefBiorhythmUIState,
|
|
11
11
|
Plan,
|
|
12
12
|
} from './BiorhythmBean'
|
|
13
|
-
import { Modal, Utils
|
|
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,
|
|
@@ -89,7 +89,7 @@ const BiorhythmPage = () => {
|
|
|
89
89
|
}, [])
|
|
90
90
|
|
|
91
91
|
const requestSetBiorhythm = useCallback(async () => {
|
|
92
|
-
state.loading = true
|
|
92
|
+
state.loading = true
|
|
93
93
|
const planList = state.planList?.map(item => { return { ...item, icon: `${item.icon}` } })
|
|
94
94
|
.sort((a, b) => a.time - b.time);
|
|
95
95
|
const res = await setBiorhythm(cloneDeep({ ...state, planList }))
|
|
@@ -172,7 +172,7 @@ const BiorhythmPage = () => {
|
|
|
172
172
|
state.planList = planList
|
|
173
173
|
}, [JSON.stringify(biorhythm)])
|
|
174
174
|
|
|
175
|
-
useEffect(() =>{
|
|
175
|
+
useEffect(() => {
|
|
176
176
|
const weeks: string[] = setDataSource(
|
|
177
177
|
biorhythm.repeatPeriod.map(item => {
|
|
178
178
|
return item?.enabled ? 1 : 0
|
|
@@ -236,268 +236,194 @@ const BiorhythmPage = () => {
|
|
|
236
236
|
}
|
|
237
237
|
|
|
238
238
|
return (
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
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
|
|
258
276
|
style={{
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
277
|
+
flexDirection: 'row',
|
|
278
|
+
justifyContent: 'space-between',
|
|
279
|
+
marginHorizontal: cx(24),
|
|
262
280
|
}}
|
|
263
281
|
>
|
|
264
|
-
{
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
title: I18n.getLang('conflict_dialog_active_item_bio_rhythm_titel'),
|
|
274
|
-
subTitle: I18n.getLang('group_conflict_feature'),
|
|
275
|
-
confirmText: I18n.getLang('registration_dialog_button_yes'),
|
|
276
|
-
cancelText: I18n.getLang('registration_dialog_button_no'),
|
|
277
|
-
onConfirm: async (_, { close }) => {
|
|
278
|
-
state.loading = true
|
|
279
|
-
state.enable = enable
|
|
280
|
-
close()
|
|
281
|
-
state.flag = Symbol()
|
|
282
|
-
}
|
|
283
|
-
})
|
|
284
|
-
state.loading = true
|
|
285
|
-
state.enable = enable
|
|
286
|
-
state.flag = Symbol()
|
|
287
|
-
}}
|
|
288
|
-
/>
|
|
289
|
-
</View>
|
|
290
|
-
<View style={{ marginHorizontal: cx(24) }}>
|
|
291
|
-
{sunHomeText(I18n.getLang(devicesJudge ? 'bio_ryhthm_default_description_text' : 'bio_ryhthm_non_sun_home_products_description_text'))}
|
|
292
|
-
</View>
|
|
293
|
-
<View style={{ height: cx(10) }} />
|
|
294
|
-
<View
|
|
295
|
-
style={{
|
|
296
|
-
flexDirection: 'row',
|
|
297
|
-
justifyContent: 'space-between',
|
|
298
|
-
marginHorizontal: cx(24),
|
|
299
|
-
}}
|
|
300
|
-
>
|
|
301
|
-
{state.repeatPeriod.map((period) => {
|
|
302
|
-
return (
|
|
303
|
-
<TouchableOpacity
|
|
304
|
-
key={period.title}
|
|
305
|
-
onPress={() => {
|
|
306
|
-
const periodNum = state.repeatPeriod.filter(p => p.enabled)?.length
|
|
307
|
-
if (periodNum === 1 && period.enabled) return
|
|
308
|
-
period.enabled = !period.enabled
|
|
309
|
-
state.flag = Symbol()
|
|
310
|
-
}}
|
|
311
|
-
>
|
|
312
|
-
<View
|
|
313
|
-
style={{
|
|
314
|
-
width: cx(40),
|
|
315
|
-
height: cx(40),
|
|
316
|
-
justifyContent: 'center',
|
|
317
|
-
alignItems: 'center',
|
|
318
|
-
borderRadius: cx(20),
|
|
319
|
-
backgroundColor: period.enabled ? '#ffe0d4' : '#fff',
|
|
320
|
-
borderWidth: cx(1),
|
|
321
|
-
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()
|
|
322
291
|
}}
|
|
323
292
|
>
|
|
324
|
-
<
|
|
293
|
+
<View
|
|
325
294
|
style={{
|
|
326
|
-
|
|
327
|
-
|
|
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',
|
|
328
303
|
}}
|
|
329
304
|
>
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
backgroundColor: '#f6f6f6',
|
|
354
|
-
alignItems: 'center',
|
|
355
|
-
flex: 1,
|
|
356
|
-
height: cx(44),
|
|
357
|
-
borderBottomWidth: cx(1),
|
|
358
|
-
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)
|
|
359
328
|
}}
|
|
360
329
|
>
|
|
361
|
-
<Text style={{
|
|
362
|
-
fontSize: cx(16),
|
|
363
|
-
color: '#000',
|
|
364
|
-
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
365
|
-
paddingLeft: cx(16),
|
|
366
|
-
}}>
|
|
367
|
-
{
|
|
368
|
-
I18n.getLang(
|
|
369
|
-
state.gradient === BiorhythmGradientType.DirectGradient
|
|
370
|
-
? 'add_new_dynamic_mood_color_changing_mode_value2'
|
|
371
|
-
: 'add_new_dynamic_mood_color_changing_mode_value',
|
|
372
|
-
)
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
</Text>
|
|
376
|
-
</View>
|
|
377
|
-
</TouchableOpacity>
|
|
378
|
-
</View>
|
|
379
|
-
<View style={{ height: cx(20) }} />
|
|
380
|
-
<TimeCircular
|
|
381
|
-
planEdit={true}
|
|
382
|
-
planList={state.planList}
|
|
383
|
-
onPanMoved={(id, time) => {
|
|
384
|
-
state.planList = state.planList.map(plan => {
|
|
385
|
-
return {
|
|
386
|
-
...plan,
|
|
387
|
-
time: plan.index === id ? time : plan.time,
|
|
388
|
-
}
|
|
389
|
-
})
|
|
390
|
-
state.flag = Symbol()
|
|
391
|
-
}}
|
|
392
|
-
replaceStatus={devicesJudge}
|
|
393
|
-
gradient={state.gradient === BiorhythmGradientType.DirectGradient}
|
|
394
|
-
isSupportTemperature={!params.isSupportTemperature} />
|
|
395
|
-
<View
|
|
396
|
-
style={{
|
|
397
|
-
flexDirection: 'row',
|
|
398
|
-
justifyContent: 'space-between',
|
|
399
|
-
marginHorizontal: cx(24),
|
|
400
|
-
marginBottom: cx(-8),
|
|
401
|
-
marginTop: cx(26),
|
|
402
|
-
}}>
|
|
403
|
-
{state.planList.length === 8 && <View
|
|
404
|
-
style={{ marginVertical: cx(10), flexDirection: 'row', alignItems: 'center', width: width - cx(48) }}>
|
|
405
|
-
<Image style={{ width: cx(16), height: cx(16), tintColor: '#ff9500' }} source={res.ic_warning_amber} />
|
|
406
|
-
<Text
|
|
407
|
-
style={{
|
|
408
|
-
flexWrap: 'wrap',
|
|
409
|
-
fontSize: cx(12),
|
|
410
|
-
}}>{I18n.getLang('add_new_trigger_time_warning_max_number_text')}</Text>
|
|
411
|
-
</View>}
|
|
412
|
-
{state.planList.length < 8 &&
|
|
413
|
-
<>
|
|
414
|
-
<Text
|
|
415
|
-
style={{
|
|
416
|
-
fontSize: cx(16),
|
|
417
|
-
fontWeight: 'bold',
|
|
418
|
-
color: 'rgb(0,0,0)',
|
|
419
|
-
}}>{I18n.getLang('bio_ryhthm_default_subheadline_text')}</Text>
|
|
420
|
-
<TouchableOpacity
|
|
421
|
-
onPress={() => {
|
|
422
|
-
const ids: number[] = state.planList.map(p => p.id)
|
|
423
|
-
const newPlan: Plan = {
|
|
424
|
-
id: Math.max(...ids) + 1,
|
|
425
|
-
icon: res.rhythm_icon1,
|
|
426
|
-
time: 0,
|
|
427
|
-
name: '',
|
|
428
|
-
colorTemperature: 0,
|
|
429
|
-
brightness: 100,
|
|
430
|
-
action: [
|
|
431
|
-
{
|
|
432
|
-
uri: 'model/attribute/set/LightCtrl/ColorTemperature',
|
|
433
|
-
startValue: `${colorTemperatureValue(0)}`,
|
|
434
|
-
},
|
|
435
|
-
{
|
|
436
|
-
uri: 'model/attribute/set/LightCtrl/Brightness',
|
|
437
|
-
startValue: '100',
|
|
438
|
-
},
|
|
439
|
-
],
|
|
440
|
-
enable: true,
|
|
441
|
-
iconId: randomIcon(),
|
|
442
|
-
}
|
|
443
|
-
const editPageParams: BiorhythmEditPageParams = {
|
|
444
|
-
planData: newPlan,
|
|
445
|
-
isAdd: true,
|
|
446
|
-
onPlanEdited,
|
|
447
|
-
onPlanDelete,
|
|
448
|
-
minimumEnable,
|
|
449
|
-
iconIdList: state.planList?.map(item => {
|
|
450
|
-
return item.iconId
|
|
451
|
-
}),
|
|
452
|
-
isMixLight: params.isMixLight,
|
|
453
|
-
isSupportTemperature: params.isSupportTemperature,
|
|
454
|
-
isSupportBrightness: params.isSupportBrightness,
|
|
455
|
-
showDeleteBtn
|
|
456
|
-
}
|
|
457
|
-
navigation.navigate(ui_biz_routerKey.group_ui_biz_biological_detail, editPageParams)
|
|
458
|
-
}}>
|
|
459
|
-
<Image source={BiologicalRes.biorhythom_add} style={{ height: cx(24), width: cx(24) }} />
|
|
460
|
-
</TouchableOpacity>
|
|
461
|
-
</>
|
|
462
|
-
}
|
|
463
|
-
</View>
|
|
464
|
-
<FlatList
|
|
465
|
-
data={state.planList}
|
|
466
|
-
style={{
|
|
467
|
-
flex: 1,
|
|
468
|
-
marginTop: cx(12),
|
|
469
|
-
}}
|
|
470
|
-
nestedScrollEnabled={true}
|
|
471
|
-
renderItem={({ item }) => {
|
|
472
|
-
const type = typeof item?.icon === 'string'
|
|
473
|
-
const bgColor = item?.brightness === 0 ? '#000' : !params.isSupportTemperature && cctToColor(1) || cctToColor(item.colorTemperature.toFixed(), item?.brightness)
|
|
474
|
-
return (
|
|
475
330
|
<View
|
|
476
331
|
style={{
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
height: cx(4),
|
|
486
|
-
},
|
|
487
|
-
borderRadius: cx(10),
|
|
488
|
-
marginHorizontal: cx(24),
|
|
489
|
-
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',
|
|
490
340
|
}}
|
|
491
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>
|
|
492
401
|
<TouchableOpacity
|
|
493
|
-
style={{ flex: 1 }}
|
|
494
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
|
+
}
|
|
495
424
|
const editPageParams: BiorhythmEditPageParams = {
|
|
496
|
-
planData:
|
|
497
|
-
|
|
498
|
-
name: setTimer(item?.name)
|
|
499
|
-
},
|
|
500
|
-
isAdd: false,
|
|
425
|
+
planData: newPlan,
|
|
426
|
+
isAdd: true,
|
|
501
427
|
onPlanEdited,
|
|
502
428
|
onPlanDelete,
|
|
503
429
|
minimumEnable,
|
|
@@ -510,162 +436,213 @@ const BiorhythmPage = () => {
|
|
|
510
436
|
showDeleteBtn
|
|
511
437
|
}
|
|
512
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),
|
|
513
471
|
}}
|
|
514
472
|
>
|
|
515
|
-
<
|
|
516
|
-
style={{
|
|
517
|
-
|
|
518
|
-
|
|
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)
|
|
519
494
|
}}
|
|
520
495
|
>
|
|
521
|
-
<View
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
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()
|
|
531
531
|
}}
|
|
532
|
+
style={{ marginRight: cx(10) }}
|
|
532
533
|
/>
|
|
534
|
+
</View>
|
|
535
|
+
<View style={{ flex: 1, flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
533
536
|
<Text
|
|
534
537
|
style={{
|
|
535
|
-
fontSize: cx(
|
|
536
|
-
color: '#
|
|
538
|
+
fontSize: cx(12),
|
|
539
|
+
color: '#666',
|
|
537
540
|
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
541
|
+
paddingLeft: cx(20),
|
|
538
542
|
}}
|
|
539
543
|
>
|
|
540
|
-
{item
|
|
544
|
+
{setTimer(item?.name)}
|
|
541
545
|
</Text>
|
|
542
546
|
</View>
|
|
543
|
-
<
|
|
544
|
-
value={item.enable}
|
|
545
|
-
thumbColor={'#f60'}
|
|
546
|
-
trackColor={{ false: '#00000026', true: '#ff660036' }}
|
|
547
|
-
onValueChange={e => {
|
|
548
|
-
item.enable = e
|
|
549
|
-
state.flag = Symbol()
|
|
550
|
-
}}
|
|
551
|
-
style={{ marginRight: cx(10) }}
|
|
552
|
-
/>
|
|
553
|
-
</View>
|
|
554
|
-
<View style={{ flex: 1, flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
555
|
-
<Text
|
|
547
|
+
<View
|
|
556
548
|
style={{
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
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
|
+
}} />
|
|
565
557
|
</View>
|
|
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
|
-
state.repeatPeriod = defBiorhythmUIState.repeatPeriod
|
|
606
|
-
state.planList = defBiorhythmUIState.planList
|
|
607
|
-
state.flag = Symbol()
|
|
608
|
-
close()
|
|
609
|
-
}
|
|
610
|
-
})
|
|
611
|
-
}}
|
|
612
|
-
/>
|
|
613
|
-
<Spacer />
|
|
614
|
-
</View>
|
|
615
|
-
) || <></>
|
|
616
|
-
}}
|
|
617
|
-
/>
|
|
618
|
-
{!state.enable && (
|
|
619
|
-
<View
|
|
620
|
-
style={{
|
|
621
|
-
backgroundColor: 'rgba(0,0,0,.5)',
|
|
622
|
-
width: '100%',
|
|
623
|
-
height: '100%',
|
|
624
|
-
position: 'absolute',
|
|
625
|
-
top: cx(45),
|
|
626
|
-
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
|
+
) || <></>
|
|
627
597
|
}}
|
|
628
598
|
/>
|
|
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
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
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>
|
|
669
646
|
)
|
|
670
647
|
}
|
|
671
648
|
|