@ledvance/ui-biz-bundle 1.1.59 → 1.1.62

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 (122) hide show
  1. package/package.json +1 -1
  2. package/src/modules/biorhythm/BiorhythmPage.tsx +2 -0
  3. package/src/modules/flags/FlagActions.ts +1 -0
  4. package/src/modules/flags/FlagEditPage.tsx +22 -14
  5. package/src/modules/flags/FlagPage.tsx +9 -19
  6. package/src/modules/mood/DynamicMoodEditorPage.tsx +12 -14
  7. package/src/modules/mood/FantasyMoodEditPage.tsx +12 -14
  8. package/src/modules/mood/StaticMoodEditorPage.tsx +12 -13
  9. package/src/modules/timer/TimerPage.tsx +58 -56
  10. package/src/newModules/biorhythm/BiorhythmActions.ts +374 -0
  11. package/src/newModules/biorhythm/BiorhythmBean.ts +230 -0
  12. package/src/newModules/biorhythm/BiorhythmEditPage.tsx +267 -0
  13. package/src/newModules/biorhythm/BiorhythmPage.tsx +638 -0
  14. package/src/newModules/biorhythm/IconSelect.tsx +85 -0
  15. package/src/newModules/biorhythm/Router.ts +34 -0
  16. package/src/newModules/biorhythm/circular/ItemIcon.d.ts +22 -0
  17. package/src/newModules/biorhythm/circular/ItemIcon.tsx +173 -0
  18. package/src/newModules/biorhythm/circular/Progress.d.ts +24 -0
  19. package/src/newModules/biorhythm/circular/Progress.tsx +372 -0
  20. package/src/newModules/biorhythm/circular/TimeCircular.d.ts +11 -0
  21. package/src/newModules/biorhythm/circular/TimeCircular.tsx +64 -0
  22. package/src/newModules/biorhythm/circular/biorhythm_plantimer.png +0 -0
  23. package/src/newModules/biorhythm/circular/rhythm_icon.png +0 -0
  24. package/src/newModules/biorhythm/iconListData.ts +30 -0
  25. package/src/newModules/biorhythm/pIdList.ts +36 -0
  26. package/src/newModules/biorhythm/res/BiologicalRes.d.ts +43 -0
  27. package/src/newModules/biorhythm/res/BiologicalRes.ts +42 -0
  28. package/src/newModules/biorhythm/res/Biological_Rhythm.png +0 -0
  29. package/src/newModules/biorhythm/res/Biological_Rhythm_12.png +0 -0
  30. package/src/newModules/biorhythm/res/Biological_Rhythm_new.png +0 -0
  31. package/src/newModules/biorhythm/res/Biological_Rhythm_new_12.png +0 -0
  32. package/src/newModules/biorhythm/res/iconsMaterialOutlinedAccountGroups.png +0 -0
  33. package/src/newModules/biorhythm/res/iconsMaterialOutlinedAccountGroups@2x.png +0 -0
  34. package/src/newModules/biorhythm/res/iconsMaterialOutlinedAccountGroups@3x.png +0 -0
  35. package/src/newModules/biorhythm/res/iconsMaterialOutlinedArrowsNavAdd.png +0 -0
  36. package/src/newModules/biorhythm/res/iconsMaterialOutlinedArrowsNavAdd@2x.png +0 -0
  37. package/src/newModules/biorhythm/res/iconsMaterialOutlinedArrowsNavAdd@3x.png +0 -0
  38. package/src/newModules/biorhythm/res/iconsMaterialOutlinedArrowsNavArrowForwardIos.png +0 -0
  39. package/src/newModules/biorhythm/res/iconsMaterialOutlinedArrowsNavArrowForwardIos@2x.png +0 -0
  40. package/src/newModules/biorhythm/res/iconsMaterialOutlinedArrowsNavArrowForwardIos@3x.png +0 -0
  41. package/src/newModules/biorhythm/res/iconsMaterialOutlinedBuildingsHome.png +0 -0
  42. package/src/newModules/biorhythm/res/iconsMaterialOutlinedBuildingsHome@2x.png +0 -0
  43. package/src/newModules/biorhythm/res/iconsMaterialOutlinedBuildingsHome@3x.png +0 -0
  44. package/src/newModules/biorhythm/res/iconsMaterialOutlinedEditorFavoriteBorder.png +0 -0
  45. package/src/newModules/biorhythm/res/iconsMaterialOutlinedEditorFavoriteBorder@2x.png +0 -0
  46. package/src/newModules/biorhythm/res/iconsMaterialOutlinedEditorFavoriteBorder@3x.png +0 -0
  47. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherBed.png +0 -0
  48. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherBed@2x.png +0 -0
  49. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherBed@3x.png +0 -0
  50. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherBusinessCenter.png +0 -0
  51. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherBusinessCenter@2x.png +0 -0
  52. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherBusinessCenter@3x.png +0 -0
  53. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherChair.png +0 -0
  54. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherChair@2x.png +0 -0
  55. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherChair@3x.png +0 -0
  56. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherCoffee.png +0 -0
  57. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherCoffee@2x.png +0 -0
  58. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherCoffee@3x.png +0 -0
  59. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherDirectionsCar.png +0 -0
  60. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherDirectionsCar@2x.png +0 -0
  61. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherDirectionsCar@3x.png +0 -0
  62. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherFitnessCenter.png +0 -0
  63. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherFitnessCenter@2x.png +0 -0
  64. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherFitnessCenter@3x.png +0 -0
  65. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherHeadphones.png +0 -0
  66. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherHeadphones@2x.png +0 -0
  67. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherHeadphones@3x.png +0 -0
  68. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherMenuBook.png +0 -0
  69. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherMenuBook@2x.png +0 -0
  70. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherMenuBook@3x.png +0 -0
  71. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherMusicNote.png +0 -0
  72. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherMusicNote@2x.png +0 -0
  73. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherMusicNote@3x.png +0 -0
  74. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherNotificationsNone.png +0 -0
  75. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherNotificationsNone@2x.png +0 -0
  76. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherNotificationsNone@3x.png +0 -0
  77. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherPottedPlant.png +0 -0
  78. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherPottedPlant@2x.png +0 -0
  79. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherPottedPlant@3x.png +0 -0
  80. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherRestaurant.png +0 -0
  81. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherRestaurant@2x.png +0 -0
  82. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherRestaurant@3x.png +0 -0
  83. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherSentimentSatisfied.png +0 -0
  84. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherSentimentSatisfied@2x.png +0 -0
  85. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherSentimentSatisfied@3x.png +0 -0
  86. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherSportsEsports.png +0 -0
  87. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherSportsEsports@2x.png +0 -0
  88. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherSportsEsports@3x.png +0 -0
  89. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherTv.png +0 -0
  90. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherTv@2x.png +0 -0
  91. package/src/newModules/biorhythm/res/iconsMaterialOutlinedOtherTv@3x.png +0 -0
  92. package/src/newModules/biorhythm/res/iconsMaterialOutlinedTimeAccessAlarm.png +0 -0
  93. package/src/newModules/biorhythm/res/iconsMaterialOutlinedTimeAccessAlarm@2x.png +0 -0
  94. package/src/newModules/biorhythm/res/iconsMaterialOutlinedTimeAccessAlarm@3x.png +0 -0
  95. package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherBedtime.png +0 -0
  96. package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherBedtime@2x.png +0 -0
  97. package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherBedtime@3x.png +0 -0
  98. package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherPartlyCloudyDay.png +0 -0
  99. package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherPartlyCloudyDay@2x.png +0 -0
  100. package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherPartlyCloudyDay@3x.png +0 -0
  101. package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherStarOutline.png +0 -0
  102. package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherStarOutline@2x.png +0 -0
  103. package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherStarOutline@3x.png +0 -0
  104. package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherWbSunny.png +0 -0
  105. package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherWbSunny@2x.png +0 -0
  106. package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherWbSunny@3x.png +0 -0
  107. package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherWbTwilight.png +0 -0
  108. package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherWbTwilight@2x.png +0 -0
  109. package/src/newModules/biorhythm/res/iconsMaterialOutlinedWheatherWbTwilight@3x.png +0 -0
  110. package/src/newModules/energyConsumption/EnergyConsumptionDetail.tsx +84 -83
  111. package/src/newModules/energyConsumption/EnergyConsumptionPage.tsx +133 -132
  112. package/src/newModules/energyConsumption/component/EnergyModal.tsx +119 -117
  113. package/src/newModules/energyConsumption/component/Overview.tsx +38 -36
  114. package/src/newModules/mood/AddMoodPage.tsx +37 -21
  115. package/src/newModules/mood/DynamicMoodEditorPage.tsx +7 -2
  116. package/src/newModules/mood/MixDynamicMoodEditor.tsx +8 -2
  117. package/src/newModules/mood/StaticMoodEditorPage.tsx +9 -2
  118. package/src/newModules/timeSchedule/Interface.ts +1 -0
  119. package/src/newModules/timeSchedule/TimeScheduleDetailPage.tsx +203 -202
  120. package/src/newModules/timeSchedule/TimeSchedulePage.tsx +35 -34
  121. package/src/newModules/timeSchedule/components/ManuaSettings.tsx +11 -10
  122. package/src/newModules/timeSchedule/components/ScheduleCard.tsx +63 -60
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "@ledvance/ui-biz-bundle",
5
5
  "pid": [],
6
6
  "uiid": "",
7
- "version": "1.1.59",
7
+ "version": "1.1.62",
8
8
  "scripts": {},
9
9
  "dependencies": {
10
10
  "@ledvance/base": "^1.x",
@@ -412,6 +412,8 @@ const BiorhythmPage = () => {
412
412
  <TouchableOpacity
413
413
  key={period.title}
414
414
  onPress={() => {
415
+ const periodNum = state.repeatPeriod.filter(p => p.enabled)?.length
416
+ if (periodNum === 1 && period.enabled) return
415
417
  period.enabled = !period.enabled
416
418
  state.flag = Symbol()
417
419
  }}
@@ -59,6 +59,7 @@ export const useFlag: UseFlagType = (flagCode, extra) => {
59
59
  const extraDps = {}
60
60
  if(extra.isCeilingLight){
61
61
  extraDps[extra.switchLedCode] = true,
62
+ extraDps[extra.whiteSwitchCode!] = true
62
63
  extraDps[extra.rgbcSwitchLedCode!] = true
63
64
  extraDps[extra.rgbcWorkModeCode!] = WORK_MODE.COLOUR
64
65
  extraDps[extra.workModeCode] = WORK_MODE.WHITE
@@ -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.colors.length - 1,
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={true}
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={getButtonStatus() ? res.ic_uncheck : res.ic_check}
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) {
@@ -39,6 +39,7 @@ export interface FlagPageProps {
39
39
  sceneDataCode?: string
40
40
  workModeCode: string
41
41
  switchLedCode: string
42
+ whiteSwitchCode?:string
42
43
  rgbcWorkModeCode?: string
43
44
  rgbcSwitchLedCode?: string
44
45
  brightValueCode?: string
@@ -137,8 +138,8 @@ const FlagPage = () => {
137
138
  let newScene: FlagUiInfo[] = []
138
139
  if (mode === 'add') {
139
140
  newScene = [
140
- checkedMood,
141
141
  ...state.flags,
142
+ checkedMood
142
143
  ]
143
144
  } else if (mode === 'del') {
144
145
  newScene = state.flags.filter(item => item.id !== checkedMood.id)
@@ -153,30 +154,19 @@ const FlagPage = () => {
153
154
  const mood = mode === 'del' ? (newScene.length === 0 ? undefined : newScene[0]) : checkedMood
154
155
  const res = await saveFlag(devId, cloneDeep(newScene))
155
156
  if (res.success) {
156
- state.flags = cloneDeep(newScene)
157
157
  setFlags(cloneDeep(newScene))
158
- if(mode === 'del'){
159
- const isDrawTool = !!(params.isCeilingLight || params.isStripLight)
160
- if(!isDrawTool && (dps[params.workModeCode] !== WORK_MODE.SCENE || currentMood.id !== flagId)){
161
- return {
162
- success: true
163
- }
164
- }
165
- if(isDrawTool && !flagMode.flagMode){
158
+ state.flags = cloneDeep(newScene)
159
+ if (mood){
160
+ if (mode === 'del' && (!flagMode?.flagMode || currentMood.id !== flagId || !dps[params.switchLedCode])){
166
161
  return {
167
- success: true
162
+ success: true
168
163
  }
169
164
  }
170
- }
171
- if(mood){
172
- setFlag(mood).then()
173
165
  updateFlagMode(true, mood)
166
+ return setFlag(mood)
174
167
  }else{
175
- setDps({[params.workModeCode!!]: params.isSupportColor ? WORK_MODE.COLOUR : WORK_MODE.WHITE})
176
168
  updateFlagMode(false)
177
- }
178
- return {
179
- success: true
169
+ return setDps({[params.workModeCode!!]: params.isSupportColor ? WORK_MODE.COLOUR : WORK_MODE.WHITE})
180
170
  }
181
171
  }
182
172
  return {
@@ -243,7 +233,7 @@ const FlagPage = () => {
243
233
  <FlatList
244
234
  data={state.flags}
245
235
  renderItem={({ item }) => <FlagItem
246
- enable={flagMode?.flagMode && dps[params.workModeCode] === (params.isCeilingLight ? WORK_MODE.WHITE : params.isStripLight ? WORK_MODE.COLOUR : WORK_MODE.SCENE) && flagId === item.id}
236
+ enable={flagMode?.flagMode && dps[params.workModeCode] === (params.isCeilingLight ? WORK_MODE.WHITE : params.isStripLight ? WORK_MODE.COLOUR : WORK_MODE.SCENE) && flagId === item.id && dps[params.switchLedCode]}
247
237
  title={item.name}
248
238
  icon={item.icon}
249
239
  colors={item.colors.map(item => hsv2Hex(item.h, item.s, item.v)).reverse()}
@@ -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={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={getButtonStatus() ? res.ic_uncheck : res.ic_check}
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 showBackDialog = (): boolean => {
195
- return !isEqual(state.mood, routeParams.currentMood);
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={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={getButtonStatus() ? res.ic_uncheck : res.ic_check}
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 showBackDialog = (): boolean => {
158
- return !isEqual(state.mood, routeParams.currentMood);
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={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={getButtonStatus() ? res.ic_uncheck : res.ic_check}
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: '#fff',
144
+ backgroundColor: props.theme.global.background,
143
145
  marginBottom: cx(8)
144
146
  }}>
145
147
  <Text
146
148
  style={{
147
- color: '#000',
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: '#f6f6f6',
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: '#000' }}>{skill.label}</Text>
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 ? '#FFE0D4' : '#f60' }}
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: '#666' }}>
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
- const styles = StyleSheet.create({
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)