@ledvance/group-ui-biz-bundle 1.0.48 → 1.0.50
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/BiorhythmActions.ts +1 -1
- package/src/modules/biorhythm/BiorhythmDetailPage.tsx +27 -16
- package/src/modules/biorhythm/BiorhythmPage.tsx +15 -7
- package/src/modules/biorhythm/circular/Progress.tsx +320 -360
- package/src/modules/biorhythm/circular/TimeCircular.tsx +12 -18
- package/src/modules/flags/FlagActions.ts +151 -30
- package/src/modules/flags/FlagEditPage.tsx +26 -18
- package/src/modules/flags/FlagInfo.tsx +1188 -481
- package/src/modules/flags/FlagPage.tsx +68 -108
- package/src/modules/mood_new/MoodPage.tsx +3 -11
package/package.json
CHANGED
|
@@ -68,7 +68,7 @@ export function dp2Obj(dp: string): BiorhythmBean {
|
|
|
68
68
|
// 分钟
|
|
69
69
|
const minute = hex2Int(hex.slice(0, 2)).toString().padStart(2, '0')
|
|
70
70
|
hex = hex.slice(2)
|
|
71
|
-
const time = hour * 60 + minute
|
|
71
|
+
const time = Number(hour) * 60 + Number(minute)
|
|
72
72
|
// 色调 (色相)
|
|
73
73
|
hex2Int(hex.slice(0, 4))
|
|
74
74
|
hex = hex.slice(4)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useCallback } from 'react'
|
|
1
|
+
import React, { useCallback, useMemo } from 'react'
|
|
2
2
|
import { Image, ScrollView, StyleSheet, Text, TouchableOpacity, View } from 'react-native'
|
|
3
3
|
import { useNavigation } from '@react-navigation/native'
|
|
4
4
|
import { TimerPicker, Utils } from 'tuya-panel-kit'
|
|
@@ -29,6 +29,7 @@ export interface BiorhythmEditPageParams {
|
|
|
29
29
|
onPlanEdited: (isAdd: boolean, plan: Plan) => void
|
|
30
30
|
onPlanDelete: (id: number) => void
|
|
31
31
|
minimumEnable: (plan: Plan) => boolean
|
|
32
|
+
nameRepeat: (plan: Plan) => boolean
|
|
32
33
|
iconIdList?: any
|
|
33
34
|
isMixLight: boolean
|
|
34
35
|
isSupportTemperature: boolean
|
|
@@ -46,16 +47,15 @@ const BiorhythmEditPage = () => {
|
|
|
46
47
|
onPlanEdited,
|
|
47
48
|
onPlanDelete,
|
|
48
49
|
minimumEnable,
|
|
50
|
+
nameRepeat,
|
|
49
51
|
iconIdList,
|
|
50
52
|
isMixLight,
|
|
51
53
|
isSupportTemperature,
|
|
52
54
|
isSupportBrightness,
|
|
53
55
|
showDeleteBtn
|
|
54
56
|
} = params
|
|
55
|
-
|
|
57
|
+
|
|
56
58
|
const state = useReactive({
|
|
57
|
-
hour: Number(hour),
|
|
58
|
-
minute: Number(minute),
|
|
59
59
|
iconIdList,
|
|
60
60
|
planData: cloneDeep(planData),
|
|
61
61
|
backStatus: false,
|
|
@@ -92,15 +92,27 @@ const BiorhythmEditPage = () => {
|
|
|
92
92
|
return imgIcon
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
const nameRepeatFlag = useMemo(() =>{
|
|
96
|
+
return nameRepeat(state.planData)
|
|
97
|
+
}, [state.planData.name])
|
|
98
|
+
|
|
99
|
+
const checkBiorhythmDataChanged = useMemo(() =>{
|
|
100
|
+
return isEqual(state.planData, planData)
|
|
101
|
+
}, [JSON.stringify(state.planData), planData])
|
|
102
|
+
|
|
103
|
+
const canSaveMoodData = useMemo(() =>{
|
|
104
|
+
return state.planData.name.length > 0 && state.planData.name.length < 33 && !nameRepeatFlag && !checkBiorhythmDataChanged && !minimumTipEnable()
|
|
105
|
+
}, [nameRepeatFlag, state.planData.name, checkBiorhythmDataChanged])
|
|
106
|
+
|
|
95
107
|
return (
|
|
96
108
|
<Page
|
|
97
109
|
backText={I18n.getLang('add_new_trigger_time_system_back_text')}
|
|
98
110
|
headlineText={I18n.getLang(isAdd ? 'add_new_trigger_time_headline_text' : 'edit_trigger_time_headline_text')}
|
|
99
111
|
backDialogTitle={I18n.getLang('manage_user_unsaved_changes_dialog_headline')}
|
|
100
112
|
backDialogContent={I18n.getLang('cancel_dialog_leave_unsaved_bio_rhythm_note')}
|
|
101
|
-
showBackDialog={
|
|
102
|
-
rightButtonIcon={
|
|
103
|
-
rightButtonIconClick={onTopBarRightBtnClick}
|
|
113
|
+
showBackDialog={!checkBiorhythmDataChanged}
|
|
114
|
+
rightButtonIcon={canSaveMoodData ? res.ic_check : res.ic_uncheck}
|
|
115
|
+
rightButtonIconClick={canSaveMoodData ? onTopBarRightBtnClick : undefined}
|
|
104
116
|
>
|
|
105
117
|
<ScrollView>
|
|
106
118
|
<View
|
|
@@ -120,20 +132,19 @@ const BiorhythmEditPage = () => {
|
|
|
120
132
|
}} />
|
|
121
133
|
|
|
122
134
|
<Spacer />
|
|
123
|
-
<TimerPicker
|
|
135
|
+
<TimerPicker
|
|
124
136
|
itemTextColor='#aeadb5'
|
|
125
|
-
style={{paddingVertical: cx(0), marginVertical: cx(0)}}
|
|
137
|
+
style={{ paddingVertical: cx(0), marginVertical: cx(0) }}
|
|
126
138
|
is12Hours={!is24Hour}
|
|
127
139
|
singlePicker={true}
|
|
128
|
-
startTime={state.hour * 60 + state.minute}
|
|
129
140
|
amText={I18n.getLang('manage_user_calendar_label_am')}
|
|
130
141
|
pmText={I18n.getLang('manage_user_calendar_label_pm')}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
state.
|
|
135
|
-
|
|
136
|
-
|
|
142
|
+
startTime={state.planData.time}
|
|
143
|
+
symbol={''}
|
|
144
|
+
onTimerChange={(time) => {
|
|
145
|
+
state.planData.time = time
|
|
146
|
+
}}
|
|
147
|
+
/>
|
|
137
148
|
{minimumTipEnable() && <View style={{ flexDirection: 'row', marginVertical: cx(5) }}>
|
|
138
149
|
<Image style={{ width: cx(16), height: cx(16), tintColor: '#000' }} source={res.ic_info} />
|
|
139
150
|
<Text
|
|
@@ -17,6 +17,7 @@ import pIdList from './pIdList'
|
|
|
17
17
|
import {
|
|
18
18
|
useDeviceInfo,
|
|
19
19
|
useGroupDevices,
|
|
20
|
+
useSystemTimeFormate,
|
|
20
21
|
} from '@ledvance/base/src/models/modules/NativePropsSlice'
|
|
21
22
|
import I18n from '@ledvance/base/src/i18n'
|
|
22
23
|
import res from '@ledvance/base/src/res'
|
|
@@ -26,7 +27,7 @@ import { cctToColor } from '@ledvance/base/src/utils/cctUtils'
|
|
|
26
27
|
import { setDataSource } from '@ledvance/base/src/components/weekSelect'
|
|
27
28
|
import { BiorhythmEditPageParams } from './BiorhythmDetailPage'
|
|
28
29
|
import { useBiorhythm } from './BiorhythmActions'
|
|
29
|
-
import { showDialog as showCommonDialog, showDialog } from '@ledvance/base/src/utils/common'
|
|
30
|
+
import { convertMinutesTo12HourFormat, showDialog as showCommonDialog, showDialog } from '@ledvance/base/src/utils/common'
|
|
30
31
|
import { useParams } from '@ledvance/base/src/hooks/Hooks'
|
|
31
32
|
import Page from '@ledvance/base/src/components/Page'
|
|
32
33
|
import Spacer from '@ledvance/base/src/components/Spacer'
|
|
@@ -58,6 +59,7 @@ const BiorhythmPage = () => {
|
|
|
58
59
|
const [biorhythm, setBiorhythm] = useBiorhythm()
|
|
59
60
|
const deviceInfo = useDeviceInfo()
|
|
60
61
|
const [groupDevices] = useGroupDevices()
|
|
62
|
+
const is24Hour = useSystemTimeFormate()
|
|
61
63
|
const { productId } = deviceInfo
|
|
62
64
|
const devicesJudge = pIdList.some(val => val === productId)
|
|
63
65
|
|
|
@@ -76,7 +78,7 @@ const BiorhythmPage = () => {
|
|
|
76
78
|
const onPlanEdited = useCallback((isAdd: boolean, newPlan: Plan) => {
|
|
77
79
|
if (isAdd) {
|
|
78
80
|
state.planList.push(newPlan)
|
|
79
|
-
state.planList = sortBy(state.planList, p => p.
|
|
81
|
+
state.planList = sortBy(state.planList, p => p.time)
|
|
80
82
|
} else {
|
|
81
83
|
state.planList = state.planList.map(plan => (plan.id === newPlan.id ? newPlan : plan))
|
|
82
84
|
}
|
|
@@ -116,7 +118,7 @@ const BiorhythmPage = () => {
|
|
|
116
118
|
|
|
117
119
|
const minimumEnable = useCallback((plan: Plan) => {
|
|
118
120
|
let enable = false
|
|
119
|
-
state.planList.filter(p => p.
|
|
121
|
+
state.planList.filter(p => p.id !== plan.id).forEach(item => {
|
|
120
122
|
const diff = Math.abs(plan.time - item.time)
|
|
121
123
|
if (diff < 15) enable = true
|
|
122
124
|
})
|
|
@@ -235,6 +237,10 @@ const BiorhythmPage = () => {
|
|
|
235
237
|
return availableChart[randomIndex]
|
|
236
238
|
}
|
|
237
239
|
|
|
240
|
+
const nameRepeat = useCallback((plan: Plan) => {
|
|
241
|
+
return !!state.planList.filter(p => p.id !== plan.id).find(p => p.name === plan.name)
|
|
242
|
+
}, [state.planList])
|
|
243
|
+
|
|
238
244
|
return (
|
|
239
245
|
<Page
|
|
240
246
|
backText={deviceInfo.name}
|
|
@@ -365,7 +371,7 @@ const BiorhythmPage = () => {
|
|
|
365
371
|
state.planList = state.planList.map(plan => {
|
|
366
372
|
return {
|
|
367
373
|
...plan,
|
|
368
|
-
time: plan.
|
|
374
|
+
time: plan.id === id ? time : plan.time,
|
|
369
375
|
}
|
|
370
376
|
})
|
|
371
377
|
state.flag = Symbol()
|
|
@@ -426,6 +432,7 @@ const BiorhythmPage = () => {
|
|
|
426
432
|
isAdd: true,
|
|
427
433
|
onPlanEdited,
|
|
428
434
|
onPlanDelete,
|
|
435
|
+
nameRepeat,
|
|
429
436
|
minimumEnable,
|
|
430
437
|
iconIdList: state.planList?.map(item => {
|
|
431
438
|
return item.iconId
|
|
@@ -481,6 +488,7 @@ const BiorhythmPage = () => {
|
|
|
481
488
|
isAdd: false,
|
|
482
489
|
onPlanEdited,
|
|
483
490
|
onPlanDelete,
|
|
491
|
+
nameRepeat,
|
|
484
492
|
minimumEnable,
|
|
485
493
|
iconIdList: state.planList?.map(item => {
|
|
486
494
|
return item.iconId
|
|
@@ -518,7 +526,7 @@ const BiorhythmPage = () => {
|
|
|
518
526
|
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
519
527
|
}}
|
|
520
528
|
>
|
|
521
|
-
{item.
|
|
529
|
+
{convertMinutesTo12HourFormat(item.time, is24Hour)}
|
|
522
530
|
</Text>
|
|
523
531
|
</View>
|
|
524
532
|
<Switch
|
|
@@ -603,7 +611,7 @@ const BiorhythmPage = () => {
|
|
|
603
611
|
width: '100%',
|
|
604
612
|
height: '100%',
|
|
605
613
|
position: 'absolute',
|
|
606
|
-
top:
|
|
614
|
+
top: 0,
|
|
607
615
|
zIndex: 999,
|
|
608
616
|
}}
|
|
609
617
|
/>
|
|
@@ -637,8 +645,8 @@ const BiorhythmPage = () => {
|
|
|
637
645
|
confirmText={I18n.getLang('auto_scan_system_wifi_confirm')}
|
|
638
646
|
onConfirm={(item: BiorhythmGradientType) => {
|
|
639
647
|
state.gradient = item
|
|
640
|
-
state.flag = Symbol()
|
|
641
648
|
showGradientTypeSelectModal(false)
|
|
649
|
+
state.flag = Symbol()
|
|
642
650
|
}}
|
|
643
651
|
/>
|
|
644
652
|
</>
|