@ledvance/ui-biz-bundle 1.1.69 → 1.1.70

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 (226) hide show
  1. package/.babelrc +31 -31
  2. package/.eslintignore +5 -5
  3. package/.eslintrc.js +27 -27
  4. package/.prettierrc.js +1 -1
  5. package/.versionrc +5 -5
  6. package/package.json +74 -74
  7. package/rn-cli.config.js +8 -8
  8. package/src/hooks/DeviceDpStateHooks.d.ts +14 -14
  9. package/src/hooks/DeviceDpStateHooks.ts +50 -50
  10. package/src/modules/biorhythm/BiorhythmActions.d.ts +8 -8
  11. package/src/modules/biorhythm/BiorhythmActions.ts +324 -324
  12. package/src/modules/biorhythm/BiorhythmBean.d.ts +58 -58
  13. package/src/modules/biorhythm/BiorhythmBean.ts +230 -230
  14. package/src/modules/biorhythm/BiorhythmEditPage.d.ts +14 -14
  15. package/src/modules/biorhythm/BiorhythmEditPage.tsx +324 -324
  16. package/src/modules/biorhythm/BiorhythmPage.d.ts +10 -10
  17. package/src/modules/biorhythm/BiorhythmPage.tsx +796 -796
  18. package/src/modules/biorhythm/IconSelect.d.ts +2 -2
  19. package/src/modules/biorhythm/IconSelect.tsx +81 -81
  20. package/src/modules/biorhythm/Router.ts +34 -34
  21. package/src/modules/biorhythm/circular/ItemIcon.d.ts +22 -22
  22. package/src/modules/biorhythm/circular/ItemIcon.tsx +172 -172
  23. package/src/modules/biorhythm/circular/Progress.d.ts +24 -24
  24. package/src/modules/biorhythm/circular/Progress.tsx +411 -411
  25. package/src/modules/biorhythm/circular/TimeCircular.d.ts +11 -11
  26. package/src/modules/biorhythm/circular/TimeCircular.tsx +70 -70
  27. package/src/modules/biorhythm/iconListData.d.ts +7 -7
  28. package/src/modules/biorhythm/iconListData.ts +29 -29
  29. package/src/modules/biorhythm/pIdList.d.ts +2 -2
  30. package/src/modules/biorhythm/pIdList.ts +35 -35
  31. package/src/modules/biorhythm/res/BiologicalRes.d.ts +43 -43
  32. package/src/modules/biorhythm/res/BiologicalRes.ts +41 -41
  33. package/src/modules/config/ldvConfig.d.ts +2 -2
  34. package/src/modules/config/ldvConfig.tsx +18 -18
  35. package/src/modules/fixedTime/FixedTimeActions.ts +173 -173
  36. package/src/modules/fixedTime/FixedTimeDetailPage.tsx +372 -372
  37. package/src/modules/fixedTime/FixedTimePage.tsx +213 -213
  38. package/src/modules/fixedTime/Router.ts +26 -26
  39. package/src/modules/flags/FlagActions.ts +267 -267
  40. package/src/modules/flags/FlagEditPage.tsx +441 -441
  41. package/src/modules/flags/FlagInfo.tsx +563 -563
  42. package/src/modules/flags/FlagItem.tsx +90 -90
  43. package/src/modules/flags/FlagPage.tsx +277 -277
  44. package/src/modules/flags/Router.ts +25 -25
  45. package/src/modules/history/HistoryPage.d.ts +2 -2
  46. package/src/modules/history/HistoryPage.tsx +261 -261
  47. package/src/modules/history/Router.ts +16 -16
  48. package/src/modules/history/SwitchHistoryPageActions.d.ts +14 -14
  49. package/src/modules/history/SwitchHistoryPageActions.ts +76 -76
  50. package/src/modules/mood/AddMoodPage.d.ts +10 -10
  51. package/src/modules/mood/AddMoodPage.tsx +792 -792
  52. package/src/modules/mood/DynamicMoodEditorPage.d.ts +6 -6
  53. package/src/modules/mood/DynamicMoodEditorPage.tsx +561 -561
  54. package/src/modules/mood/FantasyMood.tsx +176 -176
  55. package/src/modules/mood/FantasyMoodEditPage.tsx +582 -582
  56. package/src/modules/mood/FantasyMoodItem.tsx +104 -104
  57. package/src/modules/mood/FantasyRouter.ts +35 -35
  58. package/src/modules/mood/MixMood/AddMixMoodPage.tsx +247 -247
  59. package/src/modules/mood/MixMood/MixMoodActions.ts +128 -128
  60. package/src/modules/mood/MixMood/MixMoodEditPage.tsx +721 -721
  61. package/src/modules/mood/MixMood/MixMoodItem.tsx +134 -134
  62. package/src/modules/mood/MixMood/MixMoodPage.tsx +326 -326
  63. package/src/modules/mood/MixMood/MixSceneBeans.ts +364 -364
  64. package/src/modules/mood/MixMood/RecommendMixMoodItem.tsx +69 -69
  65. package/src/modules/mood/MixMood/Router.ts +44 -44
  66. package/src/modules/mood/MoodItem.d.ts +11 -11
  67. package/src/modules/mood/MoodItem.tsx +114 -114
  68. package/src/modules/mood/MoodPage.d.ts +16 -16
  69. package/src/modules/mood/MoodPage.tsx +296 -296
  70. package/src/modules/mood/RecommendMoodItem.d.ts +13 -13
  71. package/src/modules/mood/RecommendMoodItem.tsx +74 -74
  72. package/src/modules/mood/Router.ts +53 -53
  73. package/src/modules/mood/StaticMoodEditorPage.d.ts +16 -16
  74. package/src/modules/mood/StaticMoodEditorPage.tsx +320 -320
  75. package/src/modules/mood/tools.d.ts +3 -3
  76. package/src/modules/mood/tools.ts +11 -11
  77. package/src/modules/music/MusicDataBean.d.ts +47 -47
  78. package/src/modules/music/MusicDataBean.ts +167 -167
  79. package/src/modules/music/MusicManager.d.ts +27 -27
  80. package/src/modules/music/MusicManager.ts +207 -207
  81. package/src/modules/music/MusicPage.d.ts +10 -10
  82. package/src/modules/music/MusicPage.tsx +347 -347
  83. package/src/modules/music/MusicPageActions.d.ts +35 -35
  84. package/src/modules/music/MusicPageActions.ts +317 -317
  85. package/src/modules/music/Router.ts +16 -16
  86. package/src/modules/music/SelecetGenre.d.ts +7 -7
  87. package/src/modules/music/SelecetGenre.tsx +63 -63
  88. package/src/modules/music/color.d.ts +2 -2
  89. package/src/modules/music/color.ts +73 -73
  90. package/src/modules/music/res/index.d.ts +10 -10
  91. package/src/modules/music/res/index.ts +9 -9
  92. package/src/modules/powerOnBehavior/PowerOnBehaviorActions.ts +11 -11
  93. package/src/modules/powerOnBehavior/PowerOnBehaviorPage.tsx +173 -173
  94. package/src/modules/powerOnBehavior/Router.ts +16 -16
  95. package/src/modules/randomTime/RandomTimeActions.ts +160 -160
  96. package/src/modules/randomTime/RandomTimeDetailPage.tsx +337 -337
  97. package/src/modules/randomTime/RandomTimePage.tsx +214 -214
  98. package/src/modules/randomTime/Router.ts +25 -25
  99. package/src/modules/randomTime/Summary.tsx +122 -122
  100. package/src/modules/scene/SceneAction.d.ts +13 -13
  101. package/src/modules/scene/SceneAction.ts +473 -473
  102. package/src/modules/scene/SceneDetailPage.d.ts +1 -1
  103. package/src/modules/scene/SceneDetailPage.tsx +421 -421
  104. package/src/modules/scene/SceneInfo.d.ts +72 -72
  105. package/src/modules/scene/SceneInfo.ts +1059 -1059
  106. package/src/modules/scene/ScenePage.d.ts +7 -7
  107. package/src/modules/scene/ScenePage.tsx +147 -147
  108. package/src/modules/select/SelectPage.d.ts +12 -12
  109. package/src/modules/select/SelectPage.tsx +137 -137
  110. package/src/modules/sleepWakeup/DeviceState.d.ts +9 -9
  111. package/src/modules/sleepWakeup/DeviceState.tsx +99 -99
  112. package/src/modules/sleepWakeup/LdvScheduleItem.d.ts +15 -15
  113. package/src/modules/sleepWakeup/LdvScheduleItem.tsx +176 -176
  114. package/src/modules/sleepWakeup/Router.ts +25 -25
  115. package/src/modules/sleepWakeup/SleepWakeUpActions.d.ts +2 -2
  116. package/src/modules/sleepWakeup/SleepWakeUpActions.ts +180 -180
  117. package/src/modules/sleepWakeup/SleepWakeUpDetailPage.d.ts +2 -2
  118. package/src/modules/sleepWakeup/SleepWakeUpDetailPage.tsx +616 -616
  119. package/src/modules/sleepWakeup/SleepWakeUpPage.d.ts +13 -13
  120. package/src/modules/sleepWakeup/SleepWakeUpPage.tsx +424 -424
  121. package/src/modules/sleepWakeup/utils.d.ts +44 -44
  122. package/src/modules/sleepWakeup/utils.ts +253 -253
  123. package/src/modules/timeSchedule/DeviceState.d.ts +17 -17
  124. package/src/modules/timeSchedule/DeviceState.tsx +94 -94
  125. package/src/modules/timeSchedule/LdvScheduleItem.d.ts +15 -15
  126. package/src/modules/timeSchedule/LdvScheduleItem.tsx +130 -130
  127. package/src/modules/timeSchedule/ManualSetting.d.ts +14 -14
  128. package/src/modules/timeSchedule/ManualSetting.tsx +219 -219
  129. package/src/modules/timeSchedule/MoodSetting.d.ts +11 -11
  130. package/src/modules/timeSchedule/MoodSetting.tsx +228 -228
  131. package/src/modules/timeSchedule/Router.ts +25 -25
  132. package/src/modules/timeSchedule/ScheduleScene.d.ts +6 -6
  133. package/src/modules/timeSchedule/ScheduleScene.tsx +144 -144
  134. package/src/modules/timeSchedule/SingleLightView.d.ts +12 -12
  135. package/src/modules/timeSchedule/SingleLightView.tsx +175 -175
  136. package/src/modules/timeSchedule/TimeScheduleBean.d.ts +14 -14
  137. package/src/modules/timeSchedule/TimeScheduleBean.ts +18 -18
  138. package/src/modules/timeSchedule/TimeScheduleEditpage.d.ts +6 -6
  139. package/src/modules/timeSchedule/TimeScheduleEditpage.tsx +765 -765
  140. package/src/modules/timeSchedule/TimeSchedulePage.d.ts +13 -13
  141. package/src/modules/timeSchedule/TimeSchedulePage.tsx +358 -358
  142. package/src/modules/timeSchedule/components/ColorList.ts +23 -23
  143. package/src/modules/timeSchedule/components/LampSwitchCard.tsx +106 -106
  144. package/src/modules/timeSchedule/mix/MixLightActions.d.ts +3 -3
  145. package/src/modules/timeSchedule/mix/MixLightActions.ts +49 -49
  146. package/src/modules/timeSchedule/mix/MixLightBean.d.ts +10 -10
  147. package/src/modules/timeSchedule/mix/MixLightBean.ts +9 -9
  148. package/src/modules/timeSchedule/mix/MixLightView.d.ts +7 -7
  149. package/src/modules/timeSchedule/mix/MixLightView.tsx +197 -197
  150. package/src/modules/timeSchedule/utils.d.ts +1 -1
  151. package/src/modules/timeSchedule/utils.ts +6 -6
  152. package/src/modules/timer/Router.ts +16 -16
  153. package/src/modules/timer/TimerPage.d.ts +11 -11
  154. package/src/modules/timer/TimerPage.tsx +384 -384
  155. package/src/modules/timer/TimerPageAction.d.ts +22 -22
  156. package/src/modules/timer/TimerPageAction.ts +131 -131
  157. package/src/navigation/Routers.d.ts +15 -15
  158. package/src/navigation/Routers.ts +46 -46
  159. package/src/navigation/tools.d.ts +9 -9
  160. package/src/navigation/tools.ts +21 -21
  161. package/src/newModules/biorhythm/BiorhythmActions.ts +62 -11
  162. package/src/newModules/biorhythm/BiorhythmPage.tsx +1 -4
  163. package/src/newModules/childLock/ChildLockPage.tsx +97 -97
  164. package/src/newModules/childLock/Router.ts +16 -16
  165. package/src/newModules/energyConsumption/EnergyConsumptionActions.ts +23 -23
  166. package/src/newModules/energyConsumption/EnergyConsumptionChart.tsx +84 -84
  167. package/src/newModules/energyConsumption/EnergyConsumptionDetail.tsx +322 -322
  168. package/src/newModules/energyConsumption/EnergyConsumptionPage.tsx +393 -393
  169. package/src/newModules/energyConsumption/Router.ts +34 -34
  170. package/src/newModules/energyConsumption/co2Data.ts +23655 -23655
  171. package/src/newModules/energyConsumption/component/BarChart.tsx +93 -93
  172. package/src/newModules/energyConsumption/component/EnergyModal.tsx +284 -284
  173. package/src/newModules/energyConsumption/component/Overview.tsx +118 -118
  174. package/src/newModules/fixedTime/FixedTimeActions.ts +241 -241
  175. package/src/newModules/fixedTime/FixedTimeDetailPage.tsx +345 -345
  176. package/src/newModules/fixedTime/FixedTimePage.tsx +302 -302
  177. package/src/newModules/fixedTime/Router.ts +25 -25
  178. package/src/newModules/lightMode/LightModePage.tsx +204 -204
  179. package/src/newModules/lightMode/Router.ts +16 -16
  180. package/src/newModules/mood/AddMoodPage.tsx +194 -194
  181. package/src/newModules/mood/DynamicMoodEditorPage.tsx +650 -650
  182. package/src/newModules/mood/Interface.ts +220 -220
  183. package/src/newModules/mood/MixDynamicMoodEditor.tsx +786 -786
  184. package/src/newModules/mood/MoodActions.ts +232 -232
  185. package/src/newModules/mood/MoodInfo.ts +2151 -2151
  186. package/src/newModules/mood/MoodItem.tsx +160 -160
  187. package/src/newModules/mood/MoodPage.tsx +386 -386
  188. package/src/newModules/mood/MoodParse.ts +443 -443
  189. package/src/newModules/mood/RecommendMoodItem.tsx +81 -81
  190. package/src/newModules/mood/Router.ts +43 -43
  191. package/src/newModules/mood/StaticMoodEditorPage.tsx +290 -290
  192. package/src/newModules/overchargeSwitch/OverchargeSwitchPage.tsx +96 -96
  193. package/src/newModules/overchargeSwitch/Router.ts +16 -16
  194. package/src/newModules/powerOnBehavior/LightBehaviorPage.tsx +266 -266
  195. package/src/newModules/powerOnBehavior/PlugBehaviorPage.tsx +173 -173
  196. package/src/newModules/powerOnBehavior/PowerOnBehaviorActions.ts +106 -106
  197. package/src/newModules/powerOnBehavior/Router.ts +27 -27
  198. package/src/newModules/randomTime/RandomTimeActions.ts +238 -238
  199. package/src/newModules/randomTime/RandomTimeDetailPage.tsx +325 -325
  200. package/src/newModules/randomTime/RandomTimePage.tsx +299 -299
  201. package/src/newModules/randomTime/Router.ts +25 -25
  202. package/src/newModules/randomTime/Summary.tsx +116 -116
  203. package/src/newModules/remoteControl/RemoteControlActions.ts +5 -5
  204. package/src/newModules/remoteControl/RemoteControlPage.tsx +51 -51
  205. package/src/newModules/remoteControl/Router.ts +15 -15
  206. package/src/newModules/select/Route.ts +16 -16
  207. package/src/newModules/select/SelectPage.d.ts +12 -12
  208. package/src/newModules/select/SelectPage.tsx +137 -137
  209. package/src/newModules/sleepWakeUp/Interface.ts +69 -69
  210. package/src/newModules/sleepWakeUp/Router.ts +24 -24
  211. package/src/newModules/sleepWakeUp/SleepWakeUpActions.ts +317 -317
  212. package/src/newModules/sleepWakeUp/SleepWakeUpDetailPage.tsx +661 -661
  213. package/src/newModules/sleepWakeUp/SleepWakeUpPage.tsx +455 -455
  214. package/src/newModules/sleepWakeUp/utils.ts +253 -253
  215. package/src/newModules/swithInching/Router.ts +16 -16
  216. package/src/newModules/swithInching/SwithInching.tsx +231 -231
  217. package/src/newModules/swithInching/SwithInchingAction.ts +55 -55
  218. package/src/newModules/swithInching/pickerView.tsx +91 -91
  219. package/src/newModules/timeSchedule/Interface.ts +142 -142
  220. package/src/newModules/timeSchedule/Router.ts +25 -25
  221. package/src/newModules/timeSchedule/TimeScheduleActions.ts +53 -53
  222. package/src/newModules/timeSchedule/TimeScheduleDetailPage.tsx +648 -648
  223. package/src/newModules/timeSchedule/TimeSchedulePage.tsx +253 -253
  224. package/src/newModules/timeSchedule/components/ManuaSettings.tsx +460 -460
  225. package/src/newModules/timeSchedule/components/ScheduleCard.tsx +125 -125
  226. package/tsconfig.json +50 -50
@@ -1,786 +1,786 @@
1
- import React, { useCallback, useEffect, useMemo } from 'react';
2
- import {
3
- FlatList,
4
- Image,
5
- ScrollView,
6
- StyleSheet,
7
- Text,
8
- TouchableOpacity,
9
- View,
10
- } from 'react-native';
11
- import { Utils } from 'tuya-panel-kit';
12
- import { useReactive } from 'ahooks';
13
- import { cloneDeep, find, isEqual } from 'lodash';
14
- import Page from '@ledvance/base/src/components/Page';
15
- import Strings from '@ledvance/base/src/i18n';
16
- import { StaticMoodEditorPageParams, StaticMoodEditorPageState } from './StaticMoodEditorPage';
17
- import { useNavigation, useRoute } from '@react-navigation/native';
18
- import { hsv2Hex, mapFloatToRange } from '@ledvance/base/src/utils';
19
- import { cctToColor } from '@ledvance/base/src/utils/cctUtils';
20
- import res from '@ledvance/base/src/res';
21
- import TextField from '@ledvance/base/src/components/TextField';
22
- import Card from '@ledvance/base/src/components/Card';
23
- import Spacer from '@ledvance/base/src/components/Spacer';
24
- import LdvSlider from '@ledvance/base/src/components/ldvSlider';
25
- import TextButton from '@ledvance/base/src/components/TextButton';
26
- import {
27
- MoodNodeTransitionMode,
28
- stripLightMoodMode,
29
- lightMoodMode,
30
- StripLightMoodMode,
31
- } from './Interface';
32
- import TextFieldStyleButton from '@ledvance/base/src/components/TextFieldStyleButton';
33
- import {ui_biz_routerKey} from '../../navigation/Routers'
34
- import { SelectPageParams } from '@ledvance/ui-biz-bundle/src/modules/select/SelectPage';
35
- import I18n from '@ledvance/base/src/i18n';
36
- import Segmented from '@ledvance/base/src/components/Segmented';
37
- import { MoodNodeInfo } from './Interface';
38
- import ColorAdjustView from '@ledvance/base/src/components/ColorAdjustView';
39
- import LdvSwitch from '@ledvance/base/src/components/ldvSwitch';
40
- import ColorTempAdjustView from '@ledvance/base/src/components/ColorTempAdjustView';
41
- import { showDialog } from '@ledvance/base/src/utils/common';
42
-
43
- const cx = Utils.RatioUtils.convertX;
44
- interface MixDynamicMoodEditorPageState extends StaticMoodEditorPageState {
45
- mainBucketSelected: boolean;
46
- secondaryBucketSelected: boolean;
47
- mainNodeIdx: number;
48
- secondaryIdx: number;
49
- sceneMode: StripLightMoodMode;
50
- }
51
- const MixDynamicMoodEditorPage = () => {
52
- const navigation = useNavigation();
53
- const routeParams = useRoute().params as StaticMoodEditorPageParams;
54
- const params = cloneDeep(routeParams);
55
- const moduleParams = params.moduleParams;
56
- const state = useReactive<MixDynamicMoodEditorPageState>({
57
- headline: '',
58
- mood: params.currentMood,
59
- mainNode: params.currentMood.mainLamp.nodes[params.currentMood.mainLamp.nodes.length - 1],
60
- secondaryNode:
61
- params.currentMood.secondaryLamp.nodes[params.currentMood.secondaryLamp.nodes.length - 1],
62
- mainNodeIdx: params.currentMood.mainLamp.nodes.length - 1,
63
- secondaryIdx: params.currentMood.secondaryLamp.nodes.length - 1,
64
- mainBucketSelected: false,
65
- secondaryBucketSelected: false,
66
- loading: false,
67
- sceneMode: moduleParams.isCeilingLight ? stripLightMoodMode : lightMoodMode,
68
- });
69
- useEffect(() => {
70
- state.headline = Strings.getLang(
71
- params.mode === 'add'
72
- ? 'add_new_dynamic_mood_headline_text'
73
- : 'edit_static_mood_headline_text'
74
- );
75
- }, [params.mode]);
76
-
77
- const getColorBlockColor = useCallback((node: MoodNodeInfo) => {
78
- const s = Math.round(mapFloatToRange(node.s / 100, 30, 100));
79
- if (node.isColorNode) {
80
- return hsv2Hex(node.h, s, 100);
81
- } else {
82
- return cctToColor(node.colorTemp.toFixed());
83
- }
84
- }, []);
85
-
86
- const getNodeColor = useCallback((node: MoodNodeInfo) => {
87
- if (node.isColorNode) {
88
- const s = Math.round(mapFloatToRange(node.s / 100, 30, 100));
89
- return hsv2Hex(node.h, s, 100);
90
- }
91
- return cctToColor(node.colorTemp.toFixed());
92
- }, []);
93
-
94
- const createSelectModeData = useCallback(
95
- (mode: number, moodMode: StripLightMoodMode) => {
96
- return Object.values(moodMode).map(scene => {
97
- return {
98
- text: scene.title,
99
- selected: scene.mode === mode,
100
- value: scene.mode,
101
- };
102
- });
103
- },
104
- []
105
- );
106
-
107
- const createSelectOtherData = useCallback((otherData, expand) => {
108
- return otherData.map(other => {
109
- return {
110
- text: other.label,
111
- selected: other.value === expand,
112
- value: other.value,
113
- };
114
- });
115
- }, []);
116
-
117
- const getSelectOther = useCallback((otherData, expand) => {
118
- const currentOther = otherData.find(other => other.value === expand);
119
- return currentOther.label;
120
- }, []);
121
-
122
- const nameRepeat = useMemo(() => {
123
- return params.nameRepeat(state.mood)
124
- }, [state.mood.name]);
125
-
126
- const checkMoodChanged = useMemo(() =>{
127
- return isEqual(state.mood, params.currentMood)
128
- }, [JSON.stringify(state.mood), params.currentMood])
129
-
130
- const canSaveMoodData = useMemo(() =>{
131
- return state.mood.name.length > 0 && state.mood.name.length < 33 && !nameRepeat && (params.mode === 'add' || !checkMoodChanged)
132
- }, [nameRepeat, state.mood.name, checkMoodChanged, params.mode])
133
-
134
- return (
135
- <Page
136
- backText={Strings.getLang('mesh_device_detail_mode')}
137
- showBackDialog={!checkMoodChanged}
138
- backDialogTitle={Strings.getLang(
139
- params.mode === 'add'
140
- ? 'string_light_pp_dialog_sm_add_headline_c'
141
- : 'manage_user_unsaved_changes_dialog_headline'
142
- )}
143
- backDialogContent={Strings.getLang(
144
- params.mode === 'add'
145
- ? 'strip_light_static_mood_add_step_2_dialog_text'
146
- : 'strip_light_static_mood_editor_step_2_dialog_text'
147
- )}
148
- headlineText={state.headline}
149
- rightButtonIcon={canSaveMoodData ? res.ic_check : res.ic_uncheck}
150
- rightButtonIconClick={async () => {
151
- if (state.loading || !canSaveMoodData) return;
152
- state.loading = true;
153
- const newMood = cloneDeep(state.mood)
154
- if(moduleParams.isMixLight){
155
- if(moduleParams.isSupportBrightness){
156
- newMood.mainLamp.type = 1
157
- }
158
- if(moduleParams.isSupportBrightness && moduleParams.isSupportTemperature){
159
- newMood.mainLamp.type = 2
160
- }
161
- if(moduleParams.isSupportColor){
162
- newMood.secondaryLamp.type = 3
163
- }
164
- }
165
- const res = await params.modDeleteMood(params.mode, newMood);
166
- if (res.success) {
167
- navigation.navigate(ui_biz_routerKey.ui_biz_mood);
168
- }
169
- state.loading = false;
170
- }}
171
- loading={state.loading}
172
- >
173
- <ScrollView style={{ flex: 1 }} nestedScrollEnabled={true}>
174
- <View style={styles.root}>
175
- <TextField
176
- style={styles.name}
177
- value={state.mood.name}
178
- placeholder={Strings.getLang('edit_static_mood_inputfield_topic_text')}
179
- onChangeText={text => {
180
- state.mood.name = text;
181
- }}
182
- maxLength={33}
183
- showError={state.mood.name.length > 32 || nameRepeat}
184
- tipColor={nameRepeat ? '#f00' : undefined}
185
- tipIcon={nameRepeat ? res.ic_text_field_input_error : undefined}
186
- errorText={Strings.getLang(
187
- nameRepeat ? 'string_light_pp_field_sm_add_error1' : 'add_new_dynamic_mood_alert_text'
188
- )}
189
- />
190
- <Card style={styles.adjustCard}>
191
- <LdvSwitch
192
- title={I18n.getLang('light_sources_tile_main_lighting_headline')}
193
- color="#fff"
194
- colorAlpha={1}
195
- enable={!!state.mood.mainLamp.enable}
196
- setEnable={v => {
197
- if (v && !state.mood.mainLamp.nodes.length) {
198
- state.mood.mainLamp.nodes.push(
199
- {
200
- h: 0,
201
- s: 0,
202
- v: 0,
203
- brightness: 100,
204
- colorTemp: 0,
205
- isColorNode: false,
206
- },
207
- {
208
- h: 0,
209
- s: 0,
210
- v: 0,
211
- brightness: 100,
212
- colorTemp: 0,
213
- isColorNode: false,
214
- }
215
- );
216
- state.mood.mainLamp.mode = MoodNodeTransitionMode.Gradient;
217
- state.mood.mainLamp.speed = 75;
218
- state.mainNodeIdx = 1;
219
- state.mainNode = state.mood.mainLamp.nodes[1];
220
- }
221
-
222
- state.mood.mainLamp.enable = v;
223
- }}
224
- showSwitch={!!moduleParams.isMixLight}
225
- />
226
- {(!moduleParams.isMixLight || state.mood.mainLamp.enable) && (
227
- <>
228
- <TextFieldStyleButton
229
- style={styles.transitionMode}
230
- text={lightMoodMode[state.mood.mainLamp.mode]?.title}
231
- placeholder={I18n.getLang('add_new_dynamic_mood_color_changing_mode_headline')}
232
- onPress={() => {
233
- const paramsSelect: SelectPageParams<number> = {
234
- title: I18n.getLang('add_new_dynamic_mood_color_changing_mode_headline'),
235
- data: createSelectModeData(state.mood.mainLamp.mode, lightMoodMode),
236
- onSelect: selectPageData => {
237
- state.mood.mainLamp.mode = selectPageData.value;
238
- },
239
- };
240
- navigation.navigate(ui_biz_routerKey.ui_biz_select_page, paramsSelect);
241
- }}
242
- />
243
- <Spacer height={cx(10)} />
244
- <LdvSlider
245
- title={I18n.getLang('add_new_dynamic_mood_lights_field_speed_topic_text')}
246
- value={state.mood.mainLamp.speed}
247
- onValueChange={() => {}}
248
- onSlidingComplete={value => {
249
- state.mood.mainLamp.speed = value;
250
- }}
251
- />
252
- <Spacer height={cx(16)} />
253
- <View style={styles.nodesAdjust}>
254
- <View style={styles.adjustButtons}>
255
- <TouchableOpacity
256
- onPress={() => {
257
- state.mainBucketSelected = true;
258
- }}
259
- >
260
- <Image
261
- style={[
262
- styles.adjustButton,
263
- { tintColor: state.mainBucketSelected ? '#f60' : '#666' },
264
- ]}
265
- source={res.ic_paint_bucket}
266
- />
267
- </TouchableOpacity>
268
- <TouchableOpacity
269
- onPress={() => {
270
- state.mainBucketSelected = false;
271
- }}
272
- >
273
- <Image
274
- style={[
275
- styles.adjustButton,
276
- { tintColor: state.mainBucketSelected ? '#666' : '#f60' },
277
- ]}
278
- source={res.ic_colorize}
279
- />
280
- </TouchableOpacity>
281
- </View>
282
- <FlatList
283
- data={state.mood.mainLamp.nodes}
284
- style={styles.nodeList}
285
- renderItem={({ item, index }) => {
286
- return (
287
- <View style={styles.nodeItem}>
288
- <TouchableOpacity
289
- style={[
290
- styles.nodeBlock,
291
- {
292
- backgroundColor: getNodeColor(item),
293
- },
294
- ]}
295
- onPress={() => {
296
- state.mainNodeIdx = index;
297
- state.mainNode = state.mood.mainLamp.nodes[index];
298
- }}
299
- />
300
- <TouchableOpacity
301
- style={styles.nodeDeleteBtn}
302
- disabled={state.mood.mainLamp.nodes.length < 3}
303
- onPress={() => {
304
- state.mood.mainLamp.nodes.splice(index, 1);
305
- state.mainNodeIdx = state.mood.mainLamp.nodes.length - 1;
306
- }}
307
- >
308
- <Image
309
- style={[
310
- styles.nodeDeleteIcon,
311
- {
312
- tintColor: state.mood.mainLamp.nodes.length < 3 ? '#ccc' : '#666',
313
- },
314
- ]}
315
- source={res.ic_mood_del}
316
- />
317
- </TouchableOpacity>
318
- </View>
319
- );
320
- }}
321
- keyExtractor={(_, index) => `${index}`}
322
- ItemSeparatorComponent={() => <Spacer height={cx(12)} />}
323
- ListFooterComponent={() => {
324
- if (state.mood.mainLamp.nodes.length >= 8) {
325
- return <></>;
326
- }
327
- return (
328
- <View>
329
- <Spacer height={cx(12)} />
330
- <TouchableOpacity
331
- style={styles.nodeAddBtn}
332
- onPress={() => {
333
- const node = {
334
- ...state.mood.mainLamp.nodes[state.mainNodeIdx],
335
- };
336
- state.mood.mainLamp.nodes.push(node);
337
- state.mainNodeIdx = state.mood.mainLamp.nodes.length - 1;
338
- }}
339
- >
340
- <Image
341
- style={{
342
- width: cx(18),
343
- height: cx(18),
344
- tintColor: '#000',
345
- }}
346
- source={{ uri: res.add }}
347
- />
348
- </TouchableOpacity>
349
- </View>
350
- );
351
- }}
352
- />
353
- </View>
354
- <Spacer />
355
- <ColorTempAdjustView
356
- isSupportBrightness={moduleParams.isSupportBrightness}
357
- isSupportTemperature={moduleParams.isSupportTemperature}
358
- colorTemp={state.mood.mainLamp.nodes[state.mainNodeIdx].colorTemp}
359
- brightness={state.mood.mainLamp.nodes[state.mainNodeIdx].brightness}
360
- onBrightnessChangeComplete={bright => {
361
- state.mood.mainLamp.nodes.forEach((node, idx) => {
362
- if (state.mainBucketSelected) {
363
- node.brightness = bright;
364
- }
365
- if (state.mainNodeIdx === idx) {
366
- node.brightness = bright;
367
- }
368
- });
369
- }}
370
- onCCTChangeComplete={cct => {
371
- state.mood.mainLamp.nodes.forEach((node, idx) => {
372
- if (state.mainBucketSelected) {
373
- node.colorTemp = cct;
374
- }
375
- if (state.mainNodeIdx === idx) {
376
- node.colorTemp = cct;
377
- }
378
- });
379
- }}
380
- />
381
- <Spacer height={cx(10)} />
382
- </>
383
- )}
384
- </Card>
385
- <Card style={styles.adjustCard}>
386
- <LdvSwitch
387
- title={I18n.getLang('light_sources_tile_sec_lighting_headline')}
388
- color={'#fff'}
389
- colorAlpha={1}
390
- enable={!!state.mood.secondaryLamp.enable}
391
- setEnable={v => {
392
- state.mood.secondaryLamp.enable = v;
393
- if (v && !state.mood.secondaryLamp.nodes.length) {
394
- state.mood.secondaryLamp.nodes.push(
395
- {
396
- h: 0,
397
- s: 100,
398
- v: 100,
399
- brightness: 0,
400
- colorTemp: 0,
401
- isColorNode: true,
402
- },
403
- {
404
- h: 0,
405
- s: 100,
406
- v: 100,
407
- brightness: 0,
408
- colorTemp: 0,
409
- isColorNode: true,
410
- }
411
- );
412
- state.mood.secondaryLamp.mode = MoodNodeTransitionMode.Gradient;
413
- state.mood.secondaryLamp.speed = 75;
414
- state.secondaryIdx = 1;
415
- state.secondaryNode = state.mood.secondaryLamp.nodes[1];
416
- }
417
- }}
418
- showSwitch={!!moduleParams.isMixLight}
419
- />
420
- {(!moduleParams.isMixLight || state.mood.secondaryLamp.enable) && (
421
- <>
422
- <TextFieldStyleButton
423
- style={styles.transitionMode}
424
- text={state.sceneMode[state.mood.secondaryLamp.mode]?.title}
425
- placeholder={I18n.getLang('add_new_dynamic_mood_color_changing_mode_headline')}
426
- onPress={() => {
427
- const paramsSelect: SelectPageParams<number> = {
428
- title: I18n.getLang('add_new_dynamic_mood_color_changing_mode_headline'),
429
- data: createSelectModeData(
430
- state.mood.secondaryLamp.mode,
431
- state.sceneMode
432
- ),
433
- onSelect: selectPageData => {
434
- state.mood.secondaryLamp.mode = selectPageData.value;
435
- },
436
- };
437
- navigation.navigate(ui_biz_routerKey.ui_biz_select_page, paramsSelect);
438
- }}
439
- />
440
- <Spacer height={cx(10)} />
441
- <LdvSlider
442
- title={I18n.getLang('add_new_dynamic_mood_lights_field_speed_topic_text')}
443
- value={state.mood.secondaryLamp.speed}
444
- onValueChange={() => {}}
445
- onSlidingComplete={value => {
446
- state.mood.secondaryLamp.speed = value;
447
- }}
448
- />
449
- <Spacer height={cx(16)} />
450
- {state.sceneMode[state.mood.secondaryLamp.mode]?.turnOn && (
451
- <View style={styles.transitionMode}>
452
- <Segmented
453
- value={state.mood.secondaryLamp.direction}
454
- options={[
455
- {
456
- label: I18n.getLang('add_new_dynamic_mood_strip_lights_switch_tab_text1'),
457
- value: 0,
458
- },
459
- {
460
- label: I18n.getLang('add_new_dynamic_mood_strip_lights_switch_tab_text2'),
461
- value: 1,
462
- },
463
- ]}
464
- onChange={v => (state.mood.secondaryLamp.direction = Number(v))}
465
- />
466
- <Spacer />
467
- </View>
468
- )}
469
- {state.sceneMode[state.mood.secondaryLamp.mode]?.paragraph && (
470
- <View style={styles.transitionMode}>
471
- <Segmented
472
- value={state.mood.secondaryLamp.segmented}
473
- options={[
474
- {
475
- label: I18n.getLang('add_new_dynamic_mood_strip_lights_switch_tab_text3'),
476
- value: 0,
477
- },
478
- {
479
- label: I18n.getLang('add_new_dynamic_mood_strip_lights_switch_tab_text4'),
480
- value: 1,
481
- },
482
- ]}
483
- onChange={v => (state.mood.secondaryLamp.segmented = Number(v))}
484
- />
485
- <Spacer />
486
- </View>
487
- )}
488
- {state.sceneMode[state.mood.secondaryLamp.mode]?.other && (
489
- <>
490
- <TextFieldStyleButton
491
- style={styles.transitionMode}
492
- text={getSelectOther(
493
- state.sceneMode[state.mood.secondaryLamp.mode]?.other,
494
- state.mood.secondaryLamp.expand
495
- )}
496
- placeholder={I18n.getLang(
497
- 'add_new_dynamic_mood_strip_lights_selectionfield2_topic_text'
498
- )}
499
- onPress={() => {
500
- const paramsSelect: SelectPageParams<number> = {
501
- title: I18n.getLang(
502
- 'add_new_dynamic_mood_strip_lights_selectionfield2_topic_text'
503
- ),
504
- data: createSelectOtherData(
505
- state.sceneMode[state.mood.secondaryLamp.mode]?.other,
506
- state.mood.secondaryLamp.expand
507
- ),
508
- onSelect: selectPageData => {
509
- state.mood.secondaryLamp.expand = selectPageData.value;
510
- },
511
- };
512
- navigation.navigate(ui_biz_routerKey.ui_biz_select_page, paramsSelect);
513
- }}
514
- />
515
- <Spacer />
516
- </>
517
- )}
518
- <View style={styles.nodesAdjust}>
519
- <View style={styles.adjustButtons}>
520
- <TouchableOpacity
521
- onPress={() => {
522
- state.secondaryBucketSelected = true;
523
- }}
524
- >
525
- <Image
526
- style={[
527
- styles.adjustButton,
528
- { tintColor: state.secondaryBucketSelected ? '#f60' : '#666' },
529
- ]}
530
- source={res.ic_paint_bucket}
531
- />
532
- </TouchableOpacity>
533
- <TouchableOpacity
534
- onPress={() => {
535
- state.secondaryBucketSelected = false;
536
- }}
537
- >
538
- <Image
539
- style={[
540
- styles.adjustButton,
541
- { tintColor: state.secondaryBucketSelected ? '#666' : '#f60' },
542
- ]}
543
- source={res.ic_colorize}
544
- />
545
- </TouchableOpacity>
546
- </View>
547
- <FlatList
548
- data={state.mood.secondaryLamp.nodes}
549
- style={styles.nodeList}
550
- renderItem={({ item, index }) => {
551
- return (
552
- <View style={styles.nodeItem}>
553
- <TouchableOpacity
554
- style={[
555
- styles.nodeBlock,
556
- {
557
- backgroundColor: getNodeColor(item),
558
- },
559
- ]}
560
- onPress={() => {
561
- state.secondaryIdx = index;
562
- }}
563
- />
564
- <TouchableOpacity
565
- style={styles.nodeDeleteBtn}
566
- disabled={state.mood.secondaryLamp.nodes.length < 3}
567
- onPress={() => {
568
- state.mood.secondaryLamp.nodes.splice(index, 1);
569
- state.secondaryIdx = state.mood.secondaryLamp.nodes.length - 1;
570
- }}
571
- >
572
- <Image
573
- style={[
574
- styles.nodeDeleteIcon,
575
- {
576
- tintColor:
577
- state.mood.secondaryLamp.nodes.length < 3 ? '#ccc' : '#666',
578
- },
579
- ]}
580
- source={res.ic_mood_del}
581
- />
582
- </TouchableOpacity>
583
- </View>
584
- );
585
- }}
586
- keyExtractor={(_, index) => `${index}`}
587
- ItemSeparatorComponent={() => <Spacer height={cx(12)} />}
588
- ListFooterComponent={() => {
589
- if (state.mood.secondaryLamp.nodes.length >= 8) {
590
- return <></>;
591
- }
592
- return (
593
- <View>
594
- <Spacer height={cx(12)} />
595
- <TouchableOpacity
596
- style={styles.nodeAddBtn}
597
- onPress={() => {
598
- const node = {
599
- ...state.mood.secondaryLamp.nodes[state.secondaryIdx],
600
- };
601
- state.mood.secondaryLamp.nodes.push(node);
602
- state.secondaryIdx = state.mood.secondaryLamp.nodes.length - 1;
603
- }}
604
- >
605
- <Image
606
- style={{
607
- width: cx(18),
608
- height: cx(18),
609
- tintColor: '#000',
610
- }}
611
- source={{ uri: res.add }}
612
- />
613
- </TouchableOpacity>
614
- </View>
615
- );
616
- }}
617
- />
618
- </View>
619
- <Spacer />
620
- <View style={styles.lightLine}>
621
- <Text style={styles.light}>
622
- {I18n.getLang('add_new_dynamic_mood_lights_field_headline2_text')}
623
- </Text>
624
- <View
625
- style={[
626
- styles.preview,
627
- { backgroundColor: getColorBlockColor(state.secondaryNode) },
628
- ]}
629
- />
630
- </View>
631
- <Spacer />
632
- <ColorAdjustView
633
- h={state.secondaryNode.h}
634
- s={state.secondaryNode.s}
635
- v={state.secondaryNode.v}
636
- reserveSV={true}
637
- onHSVChange={() => {}}
638
- onHSVChangeComplete={(h, s, v) => {
639
- state.mood.secondaryLamp.nodes.forEach((node, idx) => {
640
- if (state.secondaryBucketSelected) {
641
- node.h = h;
642
- node.s = s;
643
- node.v = v;
644
- }
645
- if (state.secondaryIdx === idx) {
646
- node.h = h;
647
- node.s = s;
648
- node.v = v;
649
- }
650
- });
651
- }}
652
- />
653
- <Spacer height={cx(10)} />
654
- </>
655
- )}
656
- </Card>
657
-
658
- {params.mode === 'edit' && (
659
- <View style={{ marginTop: cx(20), marginHorizontal: cx(24) }}>
660
- <TextButton
661
- style={styles.deleteBtn}
662
- textStyle={styles.deleteBtnText}
663
- text={Strings.getLang('edit_static_mood_button_delete_text')}
664
- onPress={() => {
665
- showDialog({
666
- method: 'confirm',
667
- title: I18n.getLang('string_light_pp_dialog_sm_ed_headline_d'),
668
- subTitle: I18n.getLang(`strip_light_static_mood_edit_dialog_text`),
669
- onConfirm: async (_, {close})=>{
670
- close();
671
- state.loading = true;
672
- const res = await params.modDeleteMood('del', state.mood);
673
- state.loading = false;
674
- if (res.success) {
675
- navigation.navigate(ui_biz_routerKey.ui_biz_mood);
676
- }
677
- }
678
- })
679
- }}
680
- />
681
- </View>
682
- )}
683
- <Spacer />
684
- </View>
685
- </ScrollView>
686
- </Page>
687
- );
688
- };
689
- const styles = StyleSheet.create({
690
- root: {
691
- flex: 1,
692
- flexDirection: 'column',
693
- },
694
- name: {
695
- marginHorizontal: cx(24),
696
- },
697
- adjustCard: {
698
- marginVertical: cx(12),
699
- marginHorizontal: cx(24),
700
- },
701
- fanAdjustCard: {
702
- marginHorizontal: cx(24),
703
- },
704
- lightLine: {
705
- flexDirection: 'row',
706
- marginHorizontal: cx(16),
707
- },
708
- light: {
709
- color: '#000',
710
- fontSize: cx(18),
711
- fontFamily: 'helvetica_neue_lt_std_bd',
712
- },
713
- transitionMode: {
714
- marginHorizontal: cx(16),
715
- },
716
- preview: {
717
- width: cx(20),
718
- height: cx(20),
719
- marginStart: cx(12),
720
- borderRadius: cx(4),
721
- },
722
- nodesAdjust: {
723
- flexDirection: 'row',
724
- alignItems: 'center',
725
- },
726
- adjustButtons: {
727
- width: cx(44),
728
- marginStart: cx(16),
729
- },
730
- adjustButton: {
731
- width: cx(44),
732
- height: cx(44),
733
- },
734
- nodeList: {
735
- flex: 1,
736
- marginHorizontal: cx(16),
737
- },
738
- nodeItem: {
739
- flexDirection: 'row',
740
- alignItems: 'center',
741
- },
742
- nodeBlock: {
743
- flex: 1,
744
- height: cx(40),
745
- borderRadius: cx(8),
746
- },
747
- nodeDeleteBtn: {
748
- width: cx(24),
749
- height: cx(30),
750
- justifyContent: 'center',
751
- alignItems: 'center',
752
- },
753
- nodeDeleteIcon: {
754
- width: cx(16),
755
- height: cx(16),
756
- },
757
- nodeAddBtn: {
758
- height: cx(40),
759
- justifyContent: 'center',
760
- alignItems: 'center',
761
- marginEnd: cx(26),
762
- borderRadius: cx(8),
763
- borderWidth: cx(1),
764
- borderStyle: 'dashed',
765
- borderColor: '#666',
766
- backgroundColor: '#f6f6f6',
767
- },
768
- deleteBtn: {
769
- width: '100%',
770
- height: cx(50),
771
- backgroundColor: '#666',
772
- borderRadius: cx(8),
773
- },
774
- deleteBtnText: {
775
- color: '#fff',
776
- fontSize: cx(16),
777
- fontFamily: 'helvetica_neue_lt_std_bd',
778
- },
779
- });
780
- export default MixDynamicMoodEditorPage;
781
- export function getTransitionModeString(transitionMode: MoodNodeTransitionMode): string {
782
- if (transitionMode === MoodNodeTransitionMode.Jump) {
783
- return Strings.getLang('other_lights_modes_jump_text');
784
- }
785
- return Strings.getLang('other_lights_modes_gradient_text');
786
- }
1
+ import React, { useCallback, useEffect, useMemo } from 'react';
2
+ import {
3
+ FlatList,
4
+ Image,
5
+ ScrollView,
6
+ StyleSheet,
7
+ Text,
8
+ TouchableOpacity,
9
+ View,
10
+ } from 'react-native';
11
+ import { Utils } from 'tuya-panel-kit';
12
+ import { useReactive } from 'ahooks';
13
+ import { cloneDeep, find, isEqual } from 'lodash';
14
+ import Page from '@ledvance/base/src/components/Page';
15
+ import Strings from '@ledvance/base/src/i18n';
16
+ import { StaticMoodEditorPageParams, StaticMoodEditorPageState } from './StaticMoodEditorPage';
17
+ import { useNavigation, useRoute } from '@react-navigation/native';
18
+ import { hsv2Hex, mapFloatToRange } from '@ledvance/base/src/utils';
19
+ import { cctToColor } from '@ledvance/base/src/utils/cctUtils';
20
+ import res from '@ledvance/base/src/res';
21
+ import TextField from '@ledvance/base/src/components/TextField';
22
+ import Card from '@ledvance/base/src/components/Card';
23
+ import Spacer from '@ledvance/base/src/components/Spacer';
24
+ import LdvSlider from '@ledvance/base/src/components/ldvSlider';
25
+ import TextButton from '@ledvance/base/src/components/TextButton';
26
+ import {
27
+ MoodNodeTransitionMode,
28
+ stripLightMoodMode,
29
+ lightMoodMode,
30
+ StripLightMoodMode,
31
+ } from './Interface';
32
+ import TextFieldStyleButton from '@ledvance/base/src/components/TextFieldStyleButton';
33
+ import {ui_biz_routerKey} from '../../navigation/Routers'
34
+ import { SelectPageParams } from '@ledvance/ui-biz-bundle/src/modules/select/SelectPage';
35
+ import I18n from '@ledvance/base/src/i18n';
36
+ import Segmented from '@ledvance/base/src/components/Segmented';
37
+ import { MoodNodeInfo } from './Interface';
38
+ import ColorAdjustView from '@ledvance/base/src/components/ColorAdjustView';
39
+ import LdvSwitch from '@ledvance/base/src/components/ldvSwitch';
40
+ import ColorTempAdjustView from '@ledvance/base/src/components/ColorTempAdjustView';
41
+ import { showDialog } from '@ledvance/base/src/utils/common';
42
+
43
+ const cx = Utils.RatioUtils.convertX;
44
+ interface MixDynamicMoodEditorPageState extends StaticMoodEditorPageState {
45
+ mainBucketSelected: boolean;
46
+ secondaryBucketSelected: boolean;
47
+ mainNodeIdx: number;
48
+ secondaryIdx: number;
49
+ sceneMode: StripLightMoodMode;
50
+ }
51
+ const MixDynamicMoodEditorPage = () => {
52
+ const navigation = useNavigation();
53
+ const routeParams = useRoute().params as StaticMoodEditorPageParams;
54
+ const params = cloneDeep(routeParams);
55
+ const moduleParams = params.moduleParams;
56
+ const state = useReactive<MixDynamicMoodEditorPageState>({
57
+ headline: '',
58
+ mood: params.currentMood,
59
+ mainNode: params.currentMood.mainLamp.nodes[params.currentMood.mainLamp.nodes.length - 1],
60
+ secondaryNode:
61
+ params.currentMood.secondaryLamp.nodes[params.currentMood.secondaryLamp.nodes.length - 1],
62
+ mainNodeIdx: params.currentMood.mainLamp.nodes.length - 1,
63
+ secondaryIdx: params.currentMood.secondaryLamp.nodes.length - 1,
64
+ mainBucketSelected: false,
65
+ secondaryBucketSelected: false,
66
+ loading: false,
67
+ sceneMode: moduleParams.isCeilingLight ? stripLightMoodMode : lightMoodMode,
68
+ });
69
+ useEffect(() => {
70
+ state.headline = Strings.getLang(
71
+ params.mode === 'add'
72
+ ? 'add_new_dynamic_mood_headline_text'
73
+ : 'edit_static_mood_headline_text'
74
+ );
75
+ }, [params.mode]);
76
+
77
+ const getColorBlockColor = useCallback((node: MoodNodeInfo) => {
78
+ const s = Math.round(mapFloatToRange(node.s / 100, 30, 100));
79
+ if (node.isColorNode) {
80
+ return hsv2Hex(node.h, s, 100);
81
+ } else {
82
+ return cctToColor(node.colorTemp.toFixed());
83
+ }
84
+ }, []);
85
+
86
+ const getNodeColor = useCallback((node: MoodNodeInfo) => {
87
+ if (node.isColorNode) {
88
+ const s = Math.round(mapFloatToRange(node.s / 100, 30, 100));
89
+ return hsv2Hex(node.h, s, 100);
90
+ }
91
+ return cctToColor(node.colorTemp.toFixed());
92
+ }, []);
93
+
94
+ const createSelectModeData = useCallback(
95
+ (mode: number, moodMode: StripLightMoodMode) => {
96
+ return Object.values(moodMode).map(scene => {
97
+ return {
98
+ text: scene.title,
99
+ selected: scene.mode === mode,
100
+ value: scene.mode,
101
+ };
102
+ });
103
+ },
104
+ []
105
+ );
106
+
107
+ const createSelectOtherData = useCallback((otherData, expand) => {
108
+ return otherData.map(other => {
109
+ return {
110
+ text: other.label,
111
+ selected: other.value === expand,
112
+ value: other.value,
113
+ };
114
+ });
115
+ }, []);
116
+
117
+ const getSelectOther = useCallback((otherData, expand) => {
118
+ const currentOther = otherData.find(other => other.value === expand);
119
+ return currentOther.label;
120
+ }, []);
121
+
122
+ const nameRepeat = useMemo(() => {
123
+ return params.nameRepeat(state.mood)
124
+ }, [state.mood.name]);
125
+
126
+ const checkMoodChanged = useMemo(() =>{
127
+ return isEqual(state.mood, params.currentMood)
128
+ }, [JSON.stringify(state.mood), params.currentMood])
129
+
130
+ const canSaveMoodData = useMemo(() =>{
131
+ return state.mood.name.length > 0 && state.mood.name.length < 33 && !nameRepeat && (params.mode === 'add' || !checkMoodChanged)
132
+ }, [nameRepeat, state.mood.name, checkMoodChanged, params.mode])
133
+
134
+ return (
135
+ <Page
136
+ backText={Strings.getLang('mesh_device_detail_mode')}
137
+ showBackDialog={!checkMoodChanged}
138
+ backDialogTitle={Strings.getLang(
139
+ params.mode === 'add'
140
+ ? 'string_light_pp_dialog_sm_add_headline_c'
141
+ : 'manage_user_unsaved_changes_dialog_headline'
142
+ )}
143
+ backDialogContent={Strings.getLang(
144
+ params.mode === 'add'
145
+ ? 'strip_light_static_mood_add_step_2_dialog_text'
146
+ : 'strip_light_static_mood_editor_step_2_dialog_text'
147
+ )}
148
+ headlineText={state.headline}
149
+ rightButtonIcon={canSaveMoodData ? res.ic_check : res.ic_uncheck}
150
+ rightButtonIconClick={async () => {
151
+ if (state.loading || !canSaveMoodData) return;
152
+ state.loading = true;
153
+ const newMood = cloneDeep(state.mood)
154
+ if(moduleParams.isMixLight){
155
+ if(moduleParams.isSupportBrightness){
156
+ newMood.mainLamp.type = 1
157
+ }
158
+ if(moduleParams.isSupportBrightness && moduleParams.isSupportTemperature){
159
+ newMood.mainLamp.type = 2
160
+ }
161
+ if(moduleParams.isSupportColor){
162
+ newMood.secondaryLamp.type = 3
163
+ }
164
+ }
165
+ const res = await params.modDeleteMood(params.mode, newMood);
166
+ if (res.success) {
167
+ navigation.navigate(ui_biz_routerKey.ui_biz_mood);
168
+ }
169
+ state.loading = false;
170
+ }}
171
+ loading={state.loading}
172
+ >
173
+ <ScrollView style={{ flex: 1 }} nestedScrollEnabled={true}>
174
+ <View style={styles.root}>
175
+ <TextField
176
+ style={styles.name}
177
+ value={state.mood.name}
178
+ placeholder={Strings.getLang('edit_static_mood_inputfield_topic_text')}
179
+ onChangeText={text => {
180
+ state.mood.name = text;
181
+ }}
182
+ maxLength={33}
183
+ showError={state.mood.name.length > 32 || nameRepeat}
184
+ tipColor={nameRepeat ? '#f00' : undefined}
185
+ tipIcon={nameRepeat ? res.ic_text_field_input_error : undefined}
186
+ errorText={Strings.getLang(
187
+ nameRepeat ? 'string_light_pp_field_sm_add_error1' : 'add_new_dynamic_mood_alert_text'
188
+ )}
189
+ />
190
+ <Card style={styles.adjustCard}>
191
+ <LdvSwitch
192
+ title={I18n.getLang('light_sources_tile_main_lighting_headline')}
193
+ color="#fff"
194
+ colorAlpha={1}
195
+ enable={!!state.mood.mainLamp.enable}
196
+ setEnable={v => {
197
+ if (v && !state.mood.mainLamp.nodes.length) {
198
+ state.mood.mainLamp.nodes.push(
199
+ {
200
+ h: 0,
201
+ s: 0,
202
+ v: 0,
203
+ brightness: 100,
204
+ colorTemp: 0,
205
+ isColorNode: false,
206
+ },
207
+ {
208
+ h: 0,
209
+ s: 0,
210
+ v: 0,
211
+ brightness: 100,
212
+ colorTemp: 0,
213
+ isColorNode: false,
214
+ }
215
+ );
216
+ state.mood.mainLamp.mode = MoodNodeTransitionMode.Gradient;
217
+ state.mood.mainLamp.speed = 75;
218
+ state.mainNodeIdx = 1;
219
+ state.mainNode = state.mood.mainLamp.nodes[1];
220
+ }
221
+
222
+ state.mood.mainLamp.enable = v;
223
+ }}
224
+ showSwitch={!!moduleParams.isMixLight}
225
+ />
226
+ {(!moduleParams.isMixLight || state.mood.mainLamp.enable) && (
227
+ <>
228
+ <TextFieldStyleButton
229
+ style={styles.transitionMode}
230
+ text={lightMoodMode[state.mood.mainLamp.mode]?.title}
231
+ placeholder={I18n.getLang('add_new_dynamic_mood_color_changing_mode_headline')}
232
+ onPress={() => {
233
+ const paramsSelect: SelectPageParams<number> = {
234
+ title: I18n.getLang('add_new_dynamic_mood_color_changing_mode_headline'),
235
+ data: createSelectModeData(state.mood.mainLamp.mode, lightMoodMode),
236
+ onSelect: selectPageData => {
237
+ state.mood.mainLamp.mode = selectPageData.value;
238
+ },
239
+ };
240
+ navigation.navigate(ui_biz_routerKey.ui_biz_select_page, paramsSelect);
241
+ }}
242
+ />
243
+ <Spacer height={cx(10)} />
244
+ <LdvSlider
245
+ title={I18n.getLang('add_new_dynamic_mood_lights_field_speed_topic_text')}
246
+ value={state.mood.mainLamp.speed}
247
+ onValueChange={() => {}}
248
+ onSlidingComplete={value => {
249
+ state.mood.mainLamp.speed = value;
250
+ }}
251
+ />
252
+ <Spacer height={cx(16)} />
253
+ <View style={styles.nodesAdjust}>
254
+ <View style={styles.adjustButtons}>
255
+ <TouchableOpacity
256
+ onPress={() => {
257
+ state.mainBucketSelected = true;
258
+ }}
259
+ >
260
+ <Image
261
+ style={[
262
+ styles.adjustButton,
263
+ { tintColor: state.mainBucketSelected ? '#f60' : '#666' },
264
+ ]}
265
+ source={res.ic_paint_bucket}
266
+ />
267
+ </TouchableOpacity>
268
+ <TouchableOpacity
269
+ onPress={() => {
270
+ state.mainBucketSelected = false;
271
+ }}
272
+ >
273
+ <Image
274
+ style={[
275
+ styles.adjustButton,
276
+ { tintColor: state.mainBucketSelected ? '#666' : '#f60' },
277
+ ]}
278
+ source={res.ic_colorize}
279
+ />
280
+ </TouchableOpacity>
281
+ </View>
282
+ <FlatList
283
+ data={state.mood.mainLamp.nodes}
284
+ style={styles.nodeList}
285
+ renderItem={({ item, index }) => {
286
+ return (
287
+ <View style={styles.nodeItem}>
288
+ <TouchableOpacity
289
+ style={[
290
+ styles.nodeBlock,
291
+ {
292
+ backgroundColor: getNodeColor(item),
293
+ },
294
+ ]}
295
+ onPress={() => {
296
+ state.mainNodeIdx = index;
297
+ state.mainNode = state.mood.mainLamp.nodes[index];
298
+ }}
299
+ />
300
+ <TouchableOpacity
301
+ style={styles.nodeDeleteBtn}
302
+ disabled={state.mood.mainLamp.nodes.length < 3}
303
+ onPress={() => {
304
+ state.mood.mainLamp.nodes.splice(index, 1);
305
+ state.mainNodeIdx = state.mood.mainLamp.nodes.length - 1;
306
+ }}
307
+ >
308
+ <Image
309
+ style={[
310
+ styles.nodeDeleteIcon,
311
+ {
312
+ tintColor: state.mood.mainLamp.nodes.length < 3 ? '#ccc' : '#666',
313
+ },
314
+ ]}
315
+ source={res.ic_mood_del}
316
+ />
317
+ </TouchableOpacity>
318
+ </View>
319
+ );
320
+ }}
321
+ keyExtractor={(_, index) => `${index}`}
322
+ ItemSeparatorComponent={() => <Spacer height={cx(12)} />}
323
+ ListFooterComponent={() => {
324
+ if (state.mood.mainLamp.nodes.length >= 8) {
325
+ return <></>;
326
+ }
327
+ return (
328
+ <View>
329
+ <Spacer height={cx(12)} />
330
+ <TouchableOpacity
331
+ style={styles.nodeAddBtn}
332
+ onPress={() => {
333
+ const node = {
334
+ ...state.mood.mainLamp.nodes[state.mainNodeIdx],
335
+ };
336
+ state.mood.mainLamp.nodes.push(node);
337
+ state.mainNodeIdx = state.mood.mainLamp.nodes.length - 1;
338
+ }}
339
+ >
340
+ <Image
341
+ style={{
342
+ width: cx(18),
343
+ height: cx(18),
344
+ tintColor: '#000',
345
+ }}
346
+ source={{ uri: res.add }}
347
+ />
348
+ </TouchableOpacity>
349
+ </View>
350
+ );
351
+ }}
352
+ />
353
+ </View>
354
+ <Spacer />
355
+ <ColorTempAdjustView
356
+ isSupportBrightness={moduleParams.isSupportBrightness}
357
+ isSupportTemperature={moduleParams.isSupportTemperature}
358
+ colorTemp={state.mood.mainLamp.nodes[state.mainNodeIdx].colorTemp}
359
+ brightness={state.mood.mainLamp.nodes[state.mainNodeIdx].brightness}
360
+ onBrightnessChangeComplete={bright => {
361
+ state.mood.mainLamp.nodes.forEach((node, idx) => {
362
+ if (state.mainBucketSelected) {
363
+ node.brightness = bright;
364
+ }
365
+ if (state.mainNodeIdx === idx) {
366
+ node.brightness = bright;
367
+ }
368
+ });
369
+ }}
370
+ onCCTChangeComplete={cct => {
371
+ state.mood.mainLamp.nodes.forEach((node, idx) => {
372
+ if (state.mainBucketSelected) {
373
+ node.colorTemp = cct;
374
+ }
375
+ if (state.mainNodeIdx === idx) {
376
+ node.colorTemp = cct;
377
+ }
378
+ });
379
+ }}
380
+ />
381
+ <Spacer height={cx(10)} />
382
+ </>
383
+ )}
384
+ </Card>
385
+ <Card style={styles.adjustCard}>
386
+ <LdvSwitch
387
+ title={I18n.getLang('light_sources_tile_sec_lighting_headline')}
388
+ color={'#fff'}
389
+ colorAlpha={1}
390
+ enable={!!state.mood.secondaryLamp.enable}
391
+ setEnable={v => {
392
+ state.mood.secondaryLamp.enable = v;
393
+ if (v && !state.mood.secondaryLamp.nodes.length) {
394
+ state.mood.secondaryLamp.nodes.push(
395
+ {
396
+ h: 0,
397
+ s: 100,
398
+ v: 100,
399
+ brightness: 0,
400
+ colorTemp: 0,
401
+ isColorNode: true,
402
+ },
403
+ {
404
+ h: 0,
405
+ s: 100,
406
+ v: 100,
407
+ brightness: 0,
408
+ colorTemp: 0,
409
+ isColorNode: true,
410
+ }
411
+ );
412
+ state.mood.secondaryLamp.mode = MoodNodeTransitionMode.Gradient;
413
+ state.mood.secondaryLamp.speed = 75;
414
+ state.secondaryIdx = 1;
415
+ state.secondaryNode = state.mood.secondaryLamp.nodes[1];
416
+ }
417
+ }}
418
+ showSwitch={!!moduleParams.isMixLight}
419
+ />
420
+ {(!moduleParams.isMixLight || state.mood.secondaryLamp.enable) && (
421
+ <>
422
+ <TextFieldStyleButton
423
+ style={styles.transitionMode}
424
+ text={state.sceneMode[state.mood.secondaryLamp.mode]?.title}
425
+ placeholder={I18n.getLang('add_new_dynamic_mood_color_changing_mode_headline')}
426
+ onPress={() => {
427
+ const paramsSelect: SelectPageParams<number> = {
428
+ title: I18n.getLang('add_new_dynamic_mood_color_changing_mode_headline'),
429
+ data: createSelectModeData(
430
+ state.mood.secondaryLamp.mode,
431
+ state.sceneMode
432
+ ),
433
+ onSelect: selectPageData => {
434
+ state.mood.secondaryLamp.mode = selectPageData.value;
435
+ },
436
+ };
437
+ navigation.navigate(ui_biz_routerKey.ui_biz_select_page, paramsSelect);
438
+ }}
439
+ />
440
+ <Spacer height={cx(10)} />
441
+ <LdvSlider
442
+ title={I18n.getLang('add_new_dynamic_mood_lights_field_speed_topic_text')}
443
+ value={state.mood.secondaryLamp.speed}
444
+ onValueChange={() => {}}
445
+ onSlidingComplete={value => {
446
+ state.mood.secondaryLamp.speed = value;
447
+ }}
448
+ />
449
+ <Spacer height={cx(16)} />
450
+ {state.sceneMode[state.mood.secondaryLamp.mode]?.turnOn && (
451
+ <View style={styles.transitionMode}>
452
+ <Segmented
453
+ value={state.mood.secondaryLamp.direction}
454
+ options={[
455
+ {
456
+ label: I18n.getLang('add_new_dynamic_mood_strip_lights_switch_tab_text1'),
457
+ value: 0,
458
+ },
459
+ {
460
+ label: I18n.getLang('add_new_dynamic_mood_strip_lights_switch_tab_text2'),
461
+ value: 1,
462
+ },
463
+ ]}
464
+ onChange={v => (state.mood.secondaryLamp.direction = Number(v))}
465
+ />
466
+ <Spacer />
467
+ </View>
468
+ )}
469
+ {state.sceneMode[state.mood.secondaryLamp.mode]?.paragraph && (
470
+ <View style={styles.transitionMode}>
471
+ <Segmented
472
+ value={state.mood.secondaryLamp.segmented}
473
+ options={[
474
+ {
475
+ label: I18n.getLang('add_new_dynamic_mood_strip_lights_switch_tab_text3'),
476
+ value: 0,
477
+ },
478
+ {
479
+ label: I18n.getLang('add_new_dynamic_mood_strip_lights_switch_tab_text4'),
480
+ value: 1,
481
+ },
482
+ ]}
483
+ onChange={v => (state.mood.secondaryLamp.segmented = Number(v))}
484
+ />
485
+ <Spacer />
486
+ </View>
487
+ )}
488
+ {state.sceneMode[state.mood.secondaryLamp.mode]?.other && (
489
+ <>
490
+ <TextFieldStyleButton
491
+ style={styles.transitionMode}
492
+ text={getSelectOther(
493
+ state.sceneMode[state.mood.secondaryLamp.mode]?.other,
494
+ state.mood.secondaryLamp.expand
495
+ )}
496
+ placeholder={I18n.getLang(
497
+ 'add_new_dynamic_mood_strip_lights_selectionfield2_topic_text'
498
+ )}
499
+ onPress={() => {
500
+ const paramsSelect: SelectPageParams<number> = {
501
+ title: I18n.getLang(
502
+ 'add_new_dynamic_mood_strip_lights_selectionfield2_topic_text'
503
+ ),
504
+ data: createSelectOtherData(
505
+ state.sceneMode[state.mood.secondaryLamp.mode]?.other,
506
+ state.mood.secondaryLamp.expand
507
+ ),
508
+ onSelect: selectPageData => {
509
+ state.mood.secondaryLamp.expand = selectPageData.value;
510
+ },
511
+ };
512
+ navigation.navigate(ui_biz_routerKey.ui_biz_select_page, paramsSelect);
513
+ }}
514
+ />
515
+ <Spacer />
516
+ </>
517
+ )}
518
+ <View style={styles.nodesAdjust}>
519
+ <View style={styles.adjustButtons}>
520
+ <TouchableOpacity
521
+ onPress={() => {
522
+ state.secondaryBucketSelected = true;
523
+ }}
524
+ >
525
+ <Image
526
+ style={[
527
+ styles.adjustButton,
528
+ { tintColor: state.secondaryBucketSelected ? '#f60' : '#666' },
529
+ ]}
530
+ source={res.ic_paint_bucket}
531
+ />
532
+ </TouchableOpacity>
533
+ <TouchableOpacity
534
+ onPress={() => {
535
+ state.secondaryBucketSelected = false;
536
+ }}
537
+ >
538
+ <Image
539
+ style={[
540
+ styles.adjustButton,
541
+ { tintColor: state.secondaryBucketSelected ? '#666' : '#f60' },
542
+ ]}
543
+ source={res.ic_colorize}
544
+ />
545
+ </TouchableOpacity>
546
+ </View>
547
+ <FlatList
548
+ data={state.mood.secondaryLamp.nodes}
549
+ style={styles.nodeList}
550
+ renderItem={({ item, index }) => {
551
+ return (
552
+ <View style={styles.nodeItem}>
553
+ <TouchableOpacity
554
+ style={[
555
+ styles.nodeBlock,
556
+ {
557
+ backgroundColor: getNodeColor(item),
558
+ },
559
+ ]}
560
+ onPress={() => {
561
+ state.secondaryIdx = index;
562
+ }}
563
+ />
564
+ <TouchableOpacity
565
+ style={styles.nodeDeleteBtn}
566
+ disabled={state.mood.secondaryLamp.nodes.length < 3}
567
+ onPress={() => {
568
+ state.mood.secondaryLamp.nodes.splice(index, 1);
569
+ state.secondaryIdx = state.mood.secondaryLamp.nodes.length - 1;
570
+ }}
571
+ >
572
+ <Image
573
+ style={[
574
+ styles.nodeDeleteIcon,
575
+ {
576
+ tintColor:
577
+ state.mood.secondaryLamp.nodes.length < 3 ? '#ccc' : '#666',
578
+ },
579
+ ]}
580
+ source={res.ic_mood_del}
581
+ />
582
+ </TouchableOpacity>
583
+ </View>
584
+ );
585
+ }}
586
+ keyExtractor={(_, index) => `${index}`}
587
+ ItemSeparatorComponent={() => <Spacer height={cx(12)} />}
588
+ ListFooterComponent={() => {
589
+ if (state.mood.secondaryLamp.nodes.length >= 8) {
590
+ return <></>;
591
+ }
592
+ return (
593
+ <View>
594
+ <Spacer height={cx(12)} />
595
+ <TouchableOpacity
596
+ style={styles.nodeAddBtn}
597
+ onPress={() => {
598
+ const node = {
599
+ ...state.mood.secondaryLamp.nodes[state.secondaryIdx],
600
+ };
601
+ state.mood.secondaryLamp.nodes.push(node);
602
+ state.secondaryIdx = state.mood.secondaryLamp.nodes.length - 1;
603
+ }}
604
+ >
605
+ <Image
606
+ style={{
607
+ width: cx(18),
608
+ height: cx(18),
609
+ tintColor: '#000',
610
+ }}
611
+ source={{ uri: res.add }}
612
+ />
613
+ </TouchableOpacity>
614
+ </View>
615
+ );
616
+ }}
617
+ />
618
+ </View>
619
+ <Spacer />
620
+ <View style={styles.lightLine}>
621
+ <Text style={styles.light}>
622
+ {I18n.getLang('add_new_dynamic_mood_lights_field_headline2_text')}
623
+ </Text>
624
+ <View
625
+ style={[
626
+ styles.preview,
627
+ { backgroundColor: getColorBlockColor(state.secondaryNode) },
628
+ ]}
629
+ />
630
+ </View>
631
+ <Spacer />
632
+ <ColorAdjustView
633
+ h={state.secondaryNode.h}
634
+ s={state.secondaryNode.s}
635
+ v={state.secondaryNode.v}
636
+ reserveSV={true}
637
+ onHSVChange={() => {}}
638
+ onHSVChangeComplete={(h, s, v) => {
639
+ state.mood.secondaryLamp.nodes.forEach((node, idx) => {
640
+ if (state.secondaryBucketSelected) {
641
+ node.h = h;
642
+ node.s = s;
643
+ node.v = v;
644
+ }
645
+ if (state.secondaryIdx === idx) {
646
+ node.h = h;
647
+ node.s = s;
648
+ node.v = v;
649
+ }
650
+ });
651
+ }}
652
+ />
653
+ <Spacer height={cx(10)} />
654
+ </>
655
+ )}
656
+ </Card>
657
+
658
+ {params.mode === 'edit' && (
659
+ <View style={{ marginTop: cx(20), marginHorizontal: cx(24) }}>
660
+ <TextButton
661
+ style={styles.deleteBtn}
662
+ textStyle={styles.deleteBtnText}
663
+ text={Strings.getLang('edit_static_mood_button_delete_text')}
664
+ onPress={() => {
665
+ showDialog({
666
+ method: 'confirm',
667
+ title: I18n.getLang('string_light_pp_dialog_sm_ed_headline_d'),
668
+ subTitle: I18n.getLang(`strip_light_static_mood_edit_dialog_text`),
669
+ onConfirm: async (_, {close})=>{
670
+ close();
671
+ state.loading = true;
672
+ const res = await params.modDeleteMood('del', state.mood);
673
+ state.loading = false;
674
+ if (res.success) {
675
+ navigation.navigate(ui_biz_routerKey.ui_biz_mood);
676
+ }
677
+ }
678
+ })
679
+ }}
680
+ />
681
+ </View>
682
+ )}
683
+ <Spacer />
684
+ </View>
685
+ </ScrollView>
686
+ </Page>
687
+ );
688
+ };
689
+ const styles = StyleSheet.create({
690
+ root: {
691
+ flex: 1,
692
+ flexDirection: 'column',
693
+ },
694
+ name: {
695
+ marginHorizontal: cx(24),
696
+ },
697
+ adjustCard: {
698
+ marginVertical: cx(12),
699
+ marginHorizontal: cx(24),
700
+ },
701
+ fanAdjustCard: {
702
+ marginHorizontal: cx(24),
703
+ },
704
+ lightLine: {
705
+ flexDirection: 'row',
706
+ marginHorizontal: cx(16),
707
+ },
708
+ light: {
709
+ color: '#000',
710
+ fontSize: cx(18),
711
+ fontFamily: 'helvetica_neue_lt_std_bd',
712
+ },
713
+ transitionMode: {
714
+ marginHorizontal: cx(16),
715
+ },
716
+ preview: {
717
+ width: cx(20),
718
+ height: cx(20),
719
+ marginStart: cx(12),
720
+ borderRadius: cx(4),
721
+ },
722
+ nodesAdjust: {
723
+ flexDirection: 'row',
724
+ alignItems: 'center',
725
+ },
726
+ adjustButtons: {
727
+ width: cx(44),
728
+ marginStart: cx(16),
729
+ },
730
+ adjustButton: {
731
+ width: cx(44),
732
+ height: cx(44),
733
+ },
734
+ nodeList: {
735
+ flex: 1,
736
+ marginHorizontal: cx(16),
737
+ },
738
+ nodeItem: {
739
+ flexDirection: 'row',
740
+ alignItems: 'center',
741
+ },
742
+ nodeBlock: {
743
+ flex: 1,
744
+ height: cx(40),
745
+ borderRadius: cx(8),
746
+ },
747
+ nodeDeleteBtn: {
748
+ width: cx(24),
749
+ height: cx(30),
750
+ justifyContent: 'center',
751
+ alignItems: 'center',
752
+ },
753
+ nodeDeleteIcon: {
754
+ width: cx(16),
755
+ height: cx(16),
756
+ },
757
+ nodeAddBtn: {
758
+ height: cx(40),
759
+ justifyContent: 'center',
760
+ alignItems: 'center',
761
+ marginEnd: cx(26),
762
+ borderRadius: cx(8),
763
+ borderWidth: cx(1),
764
+ borderStyle: 'dashed',
765
+ borderColor: '#666',
766
+ backgroundColor: '#f6f6f6',
767
+ },
768
+ deleteBtn: {
769
+ width: '100%',
770
+ height: cx(50),
771
+ backgroundColor: '#666',
772
+ borderRadius: cx(8),
773
+ },
774
+ deleteBtnText: {
775
+ color: '#fff',
776
+ fontSize: cx(16),
777
+ fontFamily: 'helvetica_neue_lt_std_bd',
778
+ },
779
+ });
780
+ export default MixDynamicMoodEditorPage;
781
+ export function getTransitionModeString(transitionMode: MoodNodeTransitionMode): string {
782
+ if (transitionMode === MoodNodeTransitionMode.Jump) {
783
+ return Strings.getLang('other_lights_modes_jump_text');
784
+ }
785
+ return Strings.getLang('other_lights_modes_gradient_text');
786
+ }