@ledvance/ui-biz-bundle 1.1.59 → 1.1.61
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/flags/FlagEditPage.tsx +22 -14
- package/src/modules/flags/FlagPage.tsx +7 -18
- package/src/modules/mood/DynamicMoodEditorPage.tsx +12 -14
- package/src/modules/mood/FantasyMoodEditPage.tsx +12 -14
- package/src/modules/mood/StaticMoodEditorPage.tsx +12 -13
- package/src/modules/timer/TimerPage.tsx +58 -56
- package/src/newModules/biorhythm/BiorhythmActions.ts +374 -0
- package/src/newModules/biorhythm/BiorhythmBean.ts +230 -0
- package/src/newModules/biorhythm/BiorhythmEditPage.tsx +267 -0
- package/src/newModules/biorhythm/BiorhythmPage.tsx +638 -0
- package/src/newModules/biorhythm/IconSelect.tsx +85 -0
- package/src/newModules/biorhythm/Router.ts +34 -0
- package/src/newModules/biorhythm/circular/ItemIcon.d.ts +22 -0
- package/src/newModules/biorhythm/circular/ItemIcon.tsx +173 -0
- package/src/newModules/biorhythm/circular/Progress.d.ts +24 -0
- package/src/newModules/biorhythm/circular/Progress.tsx +372 -0
- package/src/newModules/biorhythm/circular/TimeCircular.d.ts +11 -0
- package/src/newModules/biorhythm/circular/TimeCircular.tsx +64 -0
- package/src/newModules/biorhythm/circular/biorhythm_plantimer.png +0 -0
- package/src/newModules/biorhythm/circular/rhythm_icon.png +0 -0
- package/src/newModules/biorhythm/iconListData.ts +30 -0
- package/src/newModules/biorhythm/pIdList.ts +36 -0
- package/src/newModules/biorhythm/res/BiologicalRes.d.ts +43 -0
- package/src/newModules/biorhythm/res/BiologicalRes.ts +42 -0
- package/src/newModules/biorhythm/res/Biological_Rhythm.png +0 -0
- package/src/newModules/biorhythm/res/Biological_Rhythm_12.png +0 -0
- package/src/newModules/biorhythm/res/Biological_Rhythm_new.png +0 -0
- package/src/newModules/biorhythm/res/Biological_Rhythm_new_12.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedAccountGroups.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedAccountGroups@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedAccountGroups@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedArrowsNavAdd.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedArrowsNavAdd@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedArrowsNavAdd@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedArrowsNavArrowForwardIos.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedArrowsNavArrowForwardIos@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedArrowsNavArrowForwardIos@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedBuildingsHome.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedBuildingsHome@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedBuildingsHome@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedEditorFavoriteBorder.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedEditorFavoriteBorder@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedEditorFavoriteBorder@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherBed.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherBed@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherBed@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherBusinessCenter.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherBusinessCenter@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherBusinessCenter@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherChair.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherChair@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherChair@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherCoffee.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherCoffee@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherCoffee@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherDirectionsCar.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherDirectionsCar@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherDirectionsCar@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherFitnessCenter.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherFitnessCenter@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherFitnessCenter@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherHeadphones.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherHeadphones@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherHeadphones@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherMenuBook.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherMenuBook@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherMenuBook@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherMusicNote.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherMusicNote@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherMusicNote@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherNotificationsNone.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherNotificationsNone@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherNotificationsNone@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherPottedPlant.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherPottedPlant@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherPottedPlant@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherRestaurant.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherRestaurant@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherRestaurant@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherSentimentSatisfied.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherSentimentSatisfied@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherSentimentSatisfied@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherSportsEsports.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherSportsEsports@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherSportsEsports@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherTv.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherTv@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherTv@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedTimeAccessAlarm.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedTimeAccessAlarm@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedTimeAccessAlarm@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherBedtime.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherBedtime@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherBedtime@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherPartlyCloudyDay.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherPartlyCloudyDay@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherPartlyCloudyDay@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherStarOutline.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherStarOutline@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherStarOutline@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherWbSunny.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherWbSunny@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherWbSunny@3x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherWbTwilight.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherWbTwilight@2x.png +0 -0
- package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherWbTwilight@3x.png +0 -0
- package/src/newModules/energyConsumption/EnergyConsumptionDetail.tsx +84 -83
- package/src/newModules/energyConsumption/EnergyConsumptionPage.tsx +133 -132
- package/src/newModules/energyConsumption/component/EnergyModal.tsx +119 -117
- package/src/newModules/energyConsumption/component/Overview.tsx +38 -36
- package/src/newModules/mood/AddMoodPage.tsx +37 -21
- package/src/newModules/mood/DynamicMoodEditorPage.tsx +7 -2
- package/src/newModules/mood/MixDynamicMoodEditor.tsx +8 -2
- package/src/newModules/mood/StaticMoodEditorPage.tsx +9 -2
- package/src/newModules/timeSchedule/Interface.ts +1 -0
- package/src/newModules/timeSchedule/TimeScheduleDetailPage.tsx +203 -202
- package/src/newModules/timeSchedule/TimeSchedulePage.tsx +35 -34
- package/src/newModules/timeSchedule/components/ManuaSettings.tsx +11 -10
- package/src/newModules/timeSchedule/components/ScheduleCard.tsx +63 -60
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ import Page from '@ledvance/base/src/components/Page'
|
|
|
5
5
|
import res from '@ledvance/base/src/res'
|
|
6
6
|
import { ScrollView, View, FlatList, StyleSheet, Image, TouchableOpacity, Text } from 'react-native'
|
|
7
7
|
import Spacer from '@ledvance/base/src/components/Spacer'
|
|
8
|
-
import { useReactive } from 'ahooks'
|
|
8
|
+
import { useReactive, useUpdateEffect } from 'ahooks'
|
|
9
9
|
import { Utils } from 'tuya-panel-kit'
|
|
10
10
|
import TextField from '@ledvance/base/src/components/TextField'
|
|
11
11
|
import Card from '@ledvance/base/src/components/Card'
|
|
@@ -40,20 +40,13 @@ const FlagEditPage = () => {
|
|
|
40
40
|
mood: params.currentMood,
|
|
41
41
|
currentWhiteNode: params.currentMood.whiteColors[params.currentMood.whiteColors.length - 1]!,
|
|
42
42
|
currentNode: params.currentMood.colors[params.currentMood.colors.length - 1],
|
|
43
|
-
whitePaintBucketIdx: params.currentMood.
|
|
43
|
+
whitePaintBucketIdx: params.currentMood.whiteColors.length - 1,
|
|
44
44
|
colorPaintBucketIdx: params.currentMood.colors.length - 1,
|
|
45
45
|
whitePaintBucketSelected: true,
|
|
46
46
|
colorPaintBucketSelected: false,
|
|
47
47
|
loading: false
|
|
48
48
|
})
|
|
49
|
-
|
|
50
|
-
const getButtonStatus = () => {
|
|
51
|
-
return (params.mode === 'edit' && isEqual(state.mood, params.currentMood)) ||
|
|
52
|
-
!(!!state.mood.name) ||
|
|
53
|
-
nameRepeat ||
|
|
54
|
-
state.mood.name.length > 32
|
|
55
|
-
}
|
|
56
|
-
|
|
49
|
+
|
|
57
50
|
const getColorBlockColor = useCallback((isMainLight?: boolean) => {
|
|
58
51
|
if (isMainLight) {
|
|
59
52
|
return cctToColor(state.currentWhiteNode.colorTemp, Math.max(...[state.currentWhiteNode.brightness, 50]))
|
|
@@ -62,14 +55,30 @@ const FlagEditPage = () => {
|
|
|
62
55
|
return hsv2Hex(h, s, v)
|
|
63
56
|
}, [state.currentNode, state.currentWhiteNode])
|
|
64
57
|
|
|
58
|
+
useUpdateEffect(() =>{
|
|
59
|
+
state.currentNode = state.mood.colors[state.colorPaintBucketIdx]
|
|
60
|
+
}, [JSON.stringify(state.mood.colors), state.colorPaintBucketIdx])
|
|
61
|
+
|
|
62
|
+
useUpdateEffect(() =>{
|
|
63
|
+
state.currentWhiteNode = state.mood.whiteColors[state.whitePaintBucketIdx]
|
|
64
|
+
}, [JSON.stringify(state.mood.whiteColors), state.whitePaintBucketIdx])
|
|
65
|
+
|
|
66
|
+
const checkMoodDataChanged = useMemo(() =>{
|
|
67
|
+
return isEqual(state.mood, params.currentMood)
|
|
68
|
+
}, [params.currentMood, state.mood])
|
|
69
|
+
|
|
65
70
|
const nameRepeat = useMemo(() => {
|
|
66
71
|
return !!find(params.moods, m => (m.id !== state.mood.id && m.name === state.mood.name && state.mood.name !== ''))
|
|
67
72
|
}, [state.mood.name])
|
|
68
73
|
|
|
74
|
+
const canSaveMoodData = useMemo(() =>{
|
|
75
|
+
return state.mood.name.length > 0 && state.mood.name.length < 33 && !nameRepeat && (params.mode === 'add' || !checkMoodDataChanged)
|
|
76
|
+
}, [nameRepeat, state.mood.name, checkMoodDataChanged, params.mode])
|
|
77
|
+
|
|
69
78
|
return (
|
|
70
79
|
<Page
|
|
71
80
|
backText={I18n.getLang('Feature_devicepanel_flags')}
|
|
72
|
-
showBackDialog={
|
|
81
|
+
showBackDialog={!checkMoodDataChanged}
|
|
73
82
|
loading={state.loading}
|
|
74
83
|
backDialogTitle={
|
|
75
84
|
I18n.getLang(params.mode === 'add' ?
|
|
@@ -80,10 +89,9 @@ const FlagEditPage = () => {
|
|
|
80
89
|
I18n.getLang('flag_cancelinfo')
|
|
81
90
|
}
|
|
82
91
|
headlineText={I18n.getLang(params.mode === 'add' ? 'flag_addanewflag' : 'flag_edittheflag')}
|
|
83
|
-
rightButtonIcon={
|
|
84
|
-
rightButtonDisabled={getButtonStatus()}
|
|
92
|
+
rightButtonIcon={canSaveMoodData ? res.ic_check : res.ic_uncheck}
|
|
85
93
|
rightButtonIconClick={async () => {
|
|
86
|
-
if (state.loading) return
|
|
94
|
+
if (state.loading || !canSaveMoodData) return
|
|
87
95
|
state.loading = true
|
|
88
96
|
const res = await params.modDeleteFlag(params.mode, state.mood)
|
|
89
97
|
if (res.success) {
|
|
@@ -137,8 +137,8 @@ const FlagPage = () => {
|
|
|
137
137
|
let newScene: FlagUiInfo[] = []
|
|
138
138
|
if (mode === 'add') {
|
|
139
139
|
newScene = [
|
|
140
|
-
checkedMood,
|
|
141
140
|
...state.flags,
|
|
141
|
+
checkedMood
|
|
142
142
|
]
|
|
143
143
|
} else if (mode === 'del') {
|
|
144
144
|
newScene = state.flags.filter(item => item.id !== checkedMood.id)
|
|
@@ -153,30 +153,19 @@ const FlagPage = () => {
|
|
|
153
153
|
const mood = mode === 'del' ? (newScene.length === 0 ? undefined : newScene[0]) : checkedMood
|
|
154
154
|
const res = await saveFlag(devId, cloneDeep(newScene))
|
|
155
155
|
if (res.success) {
|
|
156
|
-
state.flags = cloneDeep(newScene)
|
|
157
156
|
setFlags(cloneDeep(newScene))
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
if(
|
|
161
|
-
return {
|
|
162
|
-
success: true
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
if(isDrawTool && !flagMode.flagMode){
|
|
157
|
+
state.flags = cloneDeep(newScene)
|
|
158
|
+
if (mood){
|
|
159
|
+
if (mode === 'del' && (!flagMode?.flagMode || currentMood.id !== flagId || !dps[params.switchLedCode])){
|
|
166
160
|
return {
|
|
167
|
-
success: true
|
|
161
|
+
success: true
|
|
168
162
|
}
|
|
169
163
|
}
|
|
170
|
-
}
|
|
171
|
-
if(mood){
|
|
172
|
-
setFlag(mood).then()
|
|
173
164
|
updateFlagMode(true, mood)
|
|
165
|
+
return setFlag(mood)
|
|
174
166
|
}else{
|
|
175
|
-
setDps({[params.workModeCode!!]: params.isSupportColor ? WORK_MODE.COLOUR : WORK_MODE.WHITE})
|
|
176
167
|
updateFlagMode(false)
|
|
177
|
-
|
|
178
|
-
return {
|
|
179
|
-
success: true
|
|
168
|
+
return setDps({[params.workModeCode!!]: params.isSupportColor ? WORK_MODE.COLOUR : WORK_MODE.WHITE})
|
|
180
169
|
}
|
|
181
170
|
}
|
|
182
171
|
return {
|
|
@@ -144,25 +144,23 @@ const DynamicMoodEditorPage = () => {
|
|
|
144
144
|
navigation.navigate(ui_biz_routerKey.ui_biz_mood)
|
|
145
145
|
routeParams.onSave()
|
|
146
146
|
}, [])
|
|
147
|
-
const getButtonStatus = () => {
|
|
148
|
-
return (params.mode === 'edit' && isEqual(state.mood, routeParams.currentMood)) ||
|
|
149
|
-
!(!!state.mood.name) ||
|
|
150
|
-
nameRepeat ||
|
|
151
|
-
state.mood.name.length > 32 ||
|
|
152
|
-
state.mood.nodes.length < 2
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
const showBackDialog = (): boolean => {
|
|
156
|
-
return !isEqual(state.mood, routeParams.currentMood);
|
|
157
|
-
}
|
|
158
147
|
|
|
159
148
|
const nameRepeat = useMemo(() => {
|
|
160
149
|
return !!find(params.moods, m => (m.id !== state.mood.id && m.name === state.mood.name))
|
|
161
150
|
}, [state.mood.name])
|
|
151
|
+
|
|
152
|
+
const checkMoodChanged = useMemo(() =>{
|
|
153
|
+
return isEqual(state.mood, params.currentMood)
|
|
154
|
+
}, [JSON.stringify(state.mood), params.currentMood])
|
|
155
|
+
|
|
156
|
+
const canSaveMoodData = useMemo(() =>{
|
|
157
|
+
return state.mood.name.length > 0 && state.mood.name.length < 33 && !nameRepeat && (params.mode === 'add' || !checkMoodChanged)
|
|
158
|
+
}, [nameRepeat, state.mood.name, checkMoodChanged, params.mode])
|
|
159
|
+
|
|
162
160
|
return (
|
|
163
161
|
<Page
|
|
164
162
|
backText={Strings.getLang('mesh_device_detail_mode')}
|
|
165
|
-
showBackDialog={
|
|
163
|
+
showBackDialog={!checkMoodChanged}
|
|
166
164
|
backDialogTitle={
|
|
167
165
|
Strings.getLang(params.mode === 'add' ?
|
|
168
166
|
'string_light_pp_dialog_sm_add_headline_c' :
|
|
@@ -174,9 +172,9 @@ const DynamicMoodEditorPage = () => {
|
|
|
174
172
|
'strip_light_static_mood_editor_step_2_dialog_text')
|
|
175
173
|
}
|
|
176
174
|
headlineText={state.headline}
|
|
177
|
-
rightButtonIcon={
|
|
178
|
-
rightButtonDisabled={getButtonStatus()}
|
|
175
|
+
rightButtonIcon={canSaveMoodData ? res.ic_check : res.ic_uncheck}
|
|
179
176
|
rightButtonIconClick={async () => {
|
|
177
|
+
if (!canSaveMoodData) return;
|
|
180
178
|
await onPost(false)
|
|
181
179
|
}}>
|
|
182
180
|
<ScrollView
|
|
@@ -179,26 +179,22 @@ const FantasyMoodEditPage = () => {
|
|
|
179
179
|
return currentOther.label
|
|
180
180
|
}, [state.mood.expand])
|
|
181
181
|
|
|
182
|
-
const getButtonStatus = () => {
|
|
183
|
-
return (params.mode === 'edit' && isEqual(state.mood, routeParams.currentMood)) ||
|
|
184
|
-
!(!!state.mood.name) ||
|
|
185
|
-
nameRepeat ||
|
|
186
|
-
state.mood.name.length > 32 ||
|
|
187
|
-
state.mood.nodes.length < 2
|
|
188
|
-
}
|
|
189
|
-
|
|
190
182
|
const nameRepeat = useMemo(() => {
|
|
191
183
|
return !!find(params.moods, m => (m.id !== state.mood.id && m.name === state.mood.name))
|
|
192
184
|
}, [state.mood.name])
|
|
193
185
|
|
|
194
|
-
const
|
|
195
|
-
return
|
|
196
|
-
}
|
|
186
|
+
const checkMoodChanged = useMemo(() =>{
|
|
187
|
+
return isEqual(state.mood, params.currentMood)
|
|
188
|
+
}, [JSON.stringify(state.mood), params.currentMood])
|
|
189
|
+
|
|
190
|
+
const canSaveMoodData = useMemo(() =>{
|
|
191
|
+
return state.mood.name.length > 0 && state.mood.name.length < 33 && !nameRepeat && (params.mode === 'add' || !checkMoodChanged)
|
|
192
|
+
}, [nameRepeat, state.mood.name, checkMoodChanged, params.mode])
|
|
197
193
|
|
|
198
194
|
return (
|
|
199
195
|
<Page
|
|
200
196
|
backText={I18n.getLang('mesh_device_detail_mode')}
|
|
201
|
-
showBackDialog={
|
|
197
|
+
showBackDialog={!checkMoodChanged}
|
|
202
198
|
backDialogTitle={
|
|
203
199
|
I18n.getLang(params.mode === 'add' ?
|
|
204
200
|
'string_light_pp_dialog_sm_add_headline_c' :
|
|
@@ -210,9 +206,11 @@ const FantasyMoodEditPage = () => {
|
|
|
210
206
|
'strip_light_static_mood_editor_step_2_dialog_text')
|
|
211
207
|
}
|
|
212
208
|
headlineText={state.headline}
|
|
213
|
-
rightButtonIcon={
|
|
214
|
-
rightButtonDisabled={getButtonStatus()}
|
|
209
|
+
rightButtonIcon={canSaveMoodData ? res.ic_check : res.ic_uncheck}
|
|
215
210
|
rightButtonIconClick={async () => {
|
|
211
|
+
if (!canSaveMoodData) {
|
|
212
|
+
return
|
|
213
|
+
}
|
|
216
214
|
await onPost(false)
|
|
217
215
|
}}>
|
|
218
216
|
<ScrollView
|
|
@@ -143,25 +143,22 @@ const StaticMoodEditorPage = () => {
|
|
|
143
143
|
routeParams.onSave()
|
|
144
144
|
}, [moodId])
|
|
145
145
|
|
|
146
|
-
const getButtonStatus = () => {
|
|
147
|
-
return (params.mode === 'edit' && isEqual(state.mood, routeParams.currentMood)) ||
|
|
148
|
-
!(!!state.mood.name) ||
|
|
149
|
-
nameRepeat ||
|
|
150
|
-
state.mood.name.length > 32
|
|
151
|
-
}
|
|
152
|
-
|
|
153
146
|
const nameRepeat = useMemo(() => {
|
|
154
147
|
return !!find(params.moods, m => (m.id !== state.mood.id && m.name === state.mood.name))
|
|
155
148
|
}, [state.mood.name])
|
|
156
149
|
|
|
157
|
-
const
|
|
158
|
-
return
|
|
159
|
-
}
|
|
150
|
+
const checkMoodChanged = useMemo(() =>{
|
|
151
|
+
return isEqual(state.mood, params.currentMood)
|
|
152
|
+
}, [JSON.stringify(state.mood), params.currentMood])
|
|
153
|
+
|
|
154
|
+
const canSaveMoodData = useMemo(() =>{
|
|
155
|
+
return state.mood.name.length > 0 && state.mood.name.length < 33 && !nameRepeat && (params.mode === 'add' || !checkMoodChanged)
|
|
156
|
+
}, [nameRepeat, state.mood.name, checkMoodChanged, params.mode])
|
|
160
157
|
|
|
161
158
|
return (
|
|
162
159
|
<Page
|
|
163
160
|
backText={Strings.getLang('mesh_device_detail_mode')}
|
|
164
|
-
showBackDialog={
|
|
161
|
+
showBackDialog={!checkMoodChanged}
|
|
165
162
|
backDialogTitle={
|
|
166
163
|
Strings.getLang(params.mode === 'add' ?
|
|
167
164
|
'string_light_pp_dialog_sm_add_headline_c' :
|
|
@@ -173,9 +170,11 @@ const StaticMoodEditorPage = () => {
|
|
|
173
170
|
'strip_light_static_mood_editor_step_2_dialog_text')
|
|
174
171
|
}
|
|
175
172
|
headlineText={state.headline}
|
|
176
|
-
rightButtonIcon={
|
|
177
|
-
rightButtonDisabled={getButtonStatus()}
|
|
173
|
+
rightButtonIcon={canSaveMoodData ? res.ic_check : res.ic_uncheck}
|
|
178
174
|
rightButtonIconClick={async () => {
|
|
175
|
+
if (!canSaveMoodData) {
|
|
176
|
+
return
|
|
177
|
+
}
|
|
179
178
|
await onPost(false)
|
|
180
179
|
}}>
|
|
181
180
|
<ScrollView
|
|
@@ -16,6 +16,8 @@ import { cloneDeep } from "lodash";
|
|
|
16
16
|
import dayjs from "dayjs";
|
|
17
17
|
import DeleteButton from "@ledvance/base/src/components/DeleteButton";
|
|
18
18
|
|
|
19
|
+
const { withTheme } = Utils.ThemeUtils
|
|
20
|
+
|
|
19
21
|
export type dpItem = {
|
|
20
22
|
label: string
|
|
21
23
|
value: string
|
|
@@ -35,7 +37,7 @@ type Props = {
|
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
const { convertX: cx } = Utils.RatioUtils
|
|
38
|
-
const TimerPage = () => {
|
|
40
|
+
const TimerPage = (props: {theme?: any}) => {
|
|
39
41
|
const devInfo = useDeviceInfo()
|
|
40
42
|
const navigation = useNavigation()
|
|
41
43
|
const { dps } = useRoute<Props['route']>().params
|
|
@@ -139,12 +141,12 @@ const TimerPage = () => {
|
|
|
139
141
|
flexDirection: 'row',
|
|
140
142
|
justifyContent: 'space-between',
|
|
141
143
|
alignItems: 'center',
|
|
142
|
-
backgroundColor:
|
|
144
|
+
backgroundColor: props.theme.global.background,
|
|
143
145
|
marginBottom: cx(8)
|
|
144
146
|
}}>
|
|
145
147
|
<Text
|
|
146
148
|
style={{
|
|
147
|
-
color:
|
|
149
|
+
color: props.theme.global.fontColor,
|
|
148
150
|
fontSize: 14,
|
|
149
151
|
marginHorizontal: cx(6),
|
|
150
152
|
marginVertical: cx(9),
|
|
@@ -159,6 +161,54 @@ const TimerPage = () => {
|
|
|
159
161
|
);
|
|
160
162
|
};
|
|
161
163
|
|
|
164
|
+
const styles = StyleSheet.create({
|
|
165
|
+
content: {
|
|
166
|
+
marginHorizontal: cx(24)
|
|
167
|
+
},
|
|
168
|
+
itemTitle: {
|
|
169
|
+
color: props.theme.global.fontColor,
|
|
170
|
+
fontSize: cx(16),
|
|
171
|
+
fontWeight: 'bold',
|
|
172
|
+
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
173
|
+
marginTop: cx(30),
|
|
174
|
+
marginBottom: cx(10)
|
|
175
|
+
},
|
|
176
|
+
skillListItem: {
|
|
177
|
+
flexDirection: 'row',
|
|
178
|
+
justifyContent: 'space-between',
|
|
179
|
+
height: cx(30),
|
|
180
|
+
alignItems: 'center',
|
|
181
|
+
marginVertical: cx(5)
|
|
182
|
+
},
|
|
183
|
+
activeTimer: {
|
|
184
|
+
marginHorizontal: cx(20),
|
|
185
|
+
marginVertical: cx(20),
|
|
186
|
+
},
|
|
187
|
+
activeTimerTitleBox: {
|
|
188
|
+
flexDirection: 'row',
|
|
189
|
+
justifyContent: 'space-between',
|
|
190
|
+
alignItems: 'center',
|
|
191
|
+
marginBottom: cx(20),
|
|
192
|
+
},
|
|
193
|
+
activeTimerTitle: {
|
|
194
|
+
fontSize: cx(20),
|
|
195
|
+
color: props.theme.global.fontColor,
|
|
196
|
+
},
|
|
197
|
+
activeTimerCancelBtn: {
|
|
198
|
+
paddingHorizontal: cx(8),
|
|
199
|
+
paddingVertical: cx(5),
|
|
200
|
+
alignItems: 'center',
|
|
201
|
+
justifyContent: 'center',
|
|
202
|
+
backgroundColor: '#666',
|
|
203
|
+
borderRadius: cx(5)
|
|
204
|
+
},
|
|
205
|
+
activeTimerTimeBox: {
|
|
206
|
+
flexDirection: 'row',
|
|
207
|
+
alignItems: 'center',
|
|
208
|
+
marginBottom: cx(20),
|
|
209
|
+
},
|
|
210
|
+
})
|
|
211
|
+
|
|
162
212
|
return (
|
|
163
213
|
<Page
|
|
164
214
|
backText={devInfo.name}
|
|
@@ -185,7 +235,7 @@ const TimerPage = () => {
|
|
|
185
235
|
<Text style={styles.itemTitle}>{I18n.getLang('timeschedule_add_schedule_subheadline_text')}</Text>
|
|
186
236
|
<View
|
|
187
237
|
style={{
|
|
188
|
-
backgroundColor:
|
|
238
|
+
backgroundColor: props.theme.card.background,
|
|
189
239
|
borderRadius: 4,
|
|
190
240
|
minHeight: cx(50),
|
|
191
241
|
flex: 1,
|
|
@@ -210,7 +260,7 @@ const TimerPage = () => {
|
|
|
210
260
|
{state.skillList.map((skill: dpItem) => {
|
|
211
261
|
return (
|
|
212
262
|
<TouchableOpacity style={styles.skillListItem} key={skill.dpId} onPress={() => handelTimer(skill, true)}>
|
|
213
|
-
<Text style={{ color:
|
|
263
|
+
<Text style={{ color: props.theme.global.fontColor }}>{skill.label}</Text>
|
|
214
264
|
<Image style={{ width: cx(16), height: cx(16) }} source={res.device_panel_timer_add} />
|
|
215
265
|
</TouchableOpacity>
|
|
216
266
|
)
|
|
@@ -223,7 +273,7 @@ const TimerPage = () => {
|
|
|
223
273
|
text={I18n.getLang('timer_sockets_button_text')}
|
|
224
274
|
onPress={onStartPress}
|
|
225
275
|
textStyle={{ fontSize: cx(14) }}
|
|
226
|
-
style={{ backgroundColor: !state.selectedSkill.length ?
|
|
276
|
+
style={{ backgroundColor: !state.selectedSkill.length ? props.theme.button.disabled : props.theme.button.active }}
|
|
227
277
|
/>
|
|
228
278
|
<Spacer />
|
|
229
279
|
</>}
|
|
@@ -300,7 +350,7 @@ const TimerPage = () => {
|
|
|
300
350
|
thumbStroke={'#f60'}
|
|
301
351
|
renderCenterView={
|
|
302
352
|
<View style={{ position: 'absolute' }}>
|
|
303
|
-
<Text style={{ fontSize: cx(22), fontWeight: 'bold', color:
|
|
353
|
+
<Text style={{ fontSize: cx(22), fontWeight: 'bold', color: props.theme.global.secondFontColor }}>
|
|
304
354
|
{getActiveTimeString(runningTimer()[0].progressHook.countdown)}
|
|
305
355
|
</Text>
|
|
306
356
|
</View>
|
|
@@ -331,52 +381,4 @@ const TimerPage = () => {
|
|
|
331
381
|
)
|
|
332
382
|
}
|
|
333
383
|
|
|
334
|
-
|
|
335
|
-
content: {
|
|
336
|
-
marginHorizontal: cx(24)
|
|
337
|
-
},
|
|
338
|
-
itemTitle: {
|
|
339
|
-
color: '#000',
|
|
340
|
-
fontSize: cx(16),
|
|
341
|
-
fontWeight: 'bold',
|
|
342
|
-
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
343
|
-
marginTop: cx(30),
|
|
344
|
-
marginBottom: cx(10)
|
|
345
|
-
},
|
|
346
|
-
skillListItem: {
|
|
347
|
-
flexDirection: 'row',
|
|
348
|
-
justifyContent: 'space-between',
|
|
349
|
-
height: cx(30),
|
|
350
|
-
alignItems: 'center',
|
|
351
|
-
marginVertical: cx(5)
|
|
352
|
-
},
|
|
353
|
-
activeTimer: {
|
|
354
|
-
marginHorizontal: cx(20),
|
|
355
|
-
marginVertical: cx(20),
|
|
356
|
-
},
|
|
357
|
-
activeTimerTitleBox: {
|
|
358
|
-
flexDirection: 'row',
|
|
359
|
-
justifyContent: 'space-between',
|
|
360
|
-
alignItems: 'center',
|
|
361
|
-
marginBottom: cx(20),
|
|
362
|
-
},
|
|
363
|
-
activeTimerTitle: {
|
|
364
|
-
fontSize: cx(20),
|
|
365
|
-
color: '#000',
|
|
366
|
-
},
|
|
367
|
-
activeTimerCancelBtn: {
|
|
368
|
-
paddingHorizontal: cx(8),
|
|
369
|
-
paddingVertical: cx(5),
|
|
370
|
-
alignItems: 'center',
|
|
371
|
-
justifyContent: 'center',
|
|
372
|
-
backgroundColor: '#666',
|
|
373
|
-
borderRadius: cx(5)
|
|
374
|
-
},
|
|
375
|
-
activeTimerTimeBox: {
|
|
376
|
-
flexDirection: 'row',
|
|
377
|
-
alignItems: 'center',
|
|
378
|
-
marginBottom: cx(20),
|
|
379
|
-
},
|
|
380
|
-
})
|
|
381
|
-
|
|
382
|
-
export default TimerPage
|
|
384
|
+
export default withTheme(TimerPage)
|