@ledvance/ui-biz-bundle 1.1.65 → 1.1.66

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.
@@ -7,27 +7,39 @@ import { mapFloatToRange } from '@ledvance/base/src/utils';
7
7
  import Card from '@ledvance/base/src/components/Card';
8
8
  import Spacer from '@ledvance/base/src/components/Spacer';
9
9
  import MoodColorsLine from '@ledvance/base/src/components/MoodColorsLine';
10
- import { MoodLampInfo, MoodUIInfo } from './Interface';
10
+ import { MoodJumpGradientMode, MoodLampInfo, MoodUIInfo } from './Interface';
11
11
  import I18n from '@ledvance/base/src/i18n';
12
12
  import res from '@ledvance/base/src/res';
13
13
 
14
14
  const cx = Utils.RatioUtils.convertX;
15
15
 
16
+ interface LightCategory {
17
+ isMixLight?: boolean
18
+ isStripLight?: boolean
19
+ isStringLight?: boolean
20
+ isCeilingLight?: boolean
21
+ }
22
+
16
23
  interface MoodItemProps extends ViewProps {
17
24
  enable: boolean;
18
25
  isMix: boolean;
19
26
  mood: MoodUIInfo;
20
27
  style?: ViewStyle;
28
+ deviceTypeOption?: LightCategory
21
29
  onPress?: () => void;
22
30
  onSwitch: (enable: boolean) => void;
23
31
  }
24
32
 
25
33
  const MoodItem = (props: MoodItemProps) => {
26
- const { mood, isMix } = props;
34
+ const { mood, isMix, deviceTypeOption } = props;
27
35
  const isDynamic = useMemo(() => {
28
36
  return mood.mainLamp.nodes?.length > 1 || mood.secondaryLamp.nodes?.length > 1;
29
37
  }, [mood.mainLamp.nodes, mood.secondaryLamp.nodes]);
30
38
 
39
+ const gradientMode = useMemo(() => (
40
+ deviceTypeOption?.isStringLight ? MoodJumpGradientMode.StringGradient : (deviceTypeOption?.isStripLight || deviceTypeOption?.isCeilingLight) ? MoodJumpGradientMode.StripGradient : MoodJumpGradientMode.SourceGradient
41
+ ), [MoodJumpGradientMode, deviceTypeOption])
42
+
31
43
  return (
32
44
  <Card style={[styles.card, props.style]} onPress={props.onPress}>
33
45
  <View>
@@ -41,11 +53,11 @@ const MoodItem = (props: MoodItemProps) => {
41
53
  />
42
54
  </View>
43
55
  <Spacer />
44
- <MixMoodColorsLine mixSubLight={mood.mainLamp} isMix={isMix} />
45
- {isMix && (
56
+ <MixMoodColorsLine mixSubLight={mood.mainLamp} isMix={isMix} type={mood.mainLamp.mode === gradientMode ? 'gradient' : 'separate'}/>
57
+ {(isMix && !!mood.secondaryLamp.nodes.length) && (
46
58
  <>
47
59
  <Spacer height={cx(7)} />
48
- <MixMoodColorsLine mixSubLight={mood.secondaryLamp} isMix={isMix} />
60
+ <MixMoodColorsLine mixSubLight={mood.secondaryLamp} isMix={isMix} type={mood.secondaryLamp.mode === gradientMode ? 'gradient' : 'separate'}/>
49
61
  </>
50
62
  )}
51
63
  <Spacer height={cx(12)} />
@@ -66,7 +78,7 @@ const MoodItem = (props: MoodItemProps) => {
66
78
 
67
79
  export default MoodItem;
68
80
 
69
- export function MixMoodColorsLine(props: { mixSubLight: MoodLampInfo; isMix: boolean }) {
81
+ export function MixMoodColorsLine(props: { mixSubLight: MoodLampInfo; isMix: boolean, type: 'gradient' | 'separate' }) {
70
82
  const { mixSubLight, isMix } = props;
71
83
  const lightColors = !!(mixSubLight.enable && mixSubLight.nodes.length) ? mixSubLight.nodes?.map(n => {
72
84
  return n.isColorNode
@@ -79,7 +91,7 @@ export function MixMoodColorsLine(props: { mixSubLight: MoodLampInfo; isMix: boo
79
91
  <MoodColorsLine
80
92
  nodeStyle={{ borderColor: '#ccc', borderWidth: 1 }}
81
93
  width={isMix ? cx(264) : undefined}
82
- type={'separate'}
94
+ type={props.type}
83
95
  colors={lightColors}
84
96
  />
85
97
  {isMix && (
@@ -1,4 +1,4 @@
1
- import React, { useCallback, useEffect } from 'react';
1
+ import React, { useCallback, useEffect, useMemo } from 'react';
2
2
  import Page from '@ledvance/base/src/components/Page';
3
3
  import { Utils } from 'tuya-panel-kit';
4
4
  import { saveMoodList, useWorkMode } from './MoodActions';
@@ -21,8 +21,8 @@ import { useNavigation } from '@react-navigation/core';
21
21
  import { MoodPageParams, MoodPageState, MoodUIInfo } from './Interface';
22
22
  import { getRemoteMoodList, useMoodScene } from './MoodActions';
23
23
  import { useParams } from '@ledvance/base/src/hooks/Hooks';
24
- import { RouterKey } from 'navigation/Router';
25
- import { cloneDeep } from 'lodash';
24
+ import { ui_biz_routerKey } from '../../navigation/Routers'
25
+ import { cloneDeep, filter, map } from 'lodash';
26
26
  import { saveFlagMode } from '@ledvance/ui-biz-bundle/src/modules/flags/FlagActions';
27
27
  import { WorkMode } from '@ledvance/base/src/utils/interface';
28
28
 
@@ -35,16 +35,7 @@ const MoodPage = () => {
35
35
  const deviceInfo = useDeviceInfo();
36
36
  const devId = useDeviceId();
37
37
  const navigation = useNavigation();
38
- const option = {
39
- isCeilingLight: params.isCeilingLight,
40
- isStripLight: params.isStripLight,
41
- isStringLight: params.isStringLight,
42
- isFanLight: params.isFanLight,
43
- isMixLight: params.isMixLight,
44
- isUVCFan: params.isUVCFan,
45
- isMatterLight: params.isMatterLight,
46
- };
47
- const [moodInfo, setMoodInfo] = useMoodScene(params.mainDp, option, params.secondaryDp);
38
+ const [moodInfo, setMoodInfo] = useMoodScene(params);
48
39
  const [moods, setMoods] = useMoods();
49
40
  const [mainWork, setMainWork] = useWorkMode(params.mainWorkMode);
50
41
  const [secondaryWork, setSecondaryWork] = useWorkMode(params.secondaryWorkMode!);
@@ -60,23 +51,28 @@ const MoodPage = () => {
60
51
  timerId: undefined as any,
61
52
  flag: Symbol(),
62
53
  });
54
+
55
+ const moodIds = useMemo(() => {
56
+ const mainIds = map(state.originMoods, 'id').filter(v => v !== undefined)
57
+ const secondaryIds = map(state.originMoods.map(m => m.secondaryLamp) || [], 'id')
58
+ return filter([...mainIds, ...secondaryIds], v => v !== undefined) as number[]
59
+ }, [JSON.stringify(state.originMoods)])
60
+
63
61
  useEffect(() => {
62
+ state.loading = true
64
63
  state.timerId = setTimeout(() => {
65
64
  getRemoteMoodList(
66
65
  devId,
67
- {
68
- ...option,
69
- isSupportBrightness: params.isSupportBrightness,
70
- isSupportColor: params.isSupportColor,
71
- isSupportTemperature: params.isSupportTemperature,
72
- },
66
+ params,
73
67
  params.featureId
74
68
  ).then(res => {
69
+ state.loading = false
75
70
  if (res.success && Array.isArray(res.data)) {
71
+ console.log(res.data, '< --- res.data')
76
72
  state.originMoods = cloneDeep(res.data);
77
73
  }
78
74
  });
79
- }, 400);
75
+ }, 250);
80
76
 
81
77
  return () => {
82
78
  clearTimeout(state.timerId);
@@ -98,18 +94,19 @@ const MoodPage = () => {
98
94
  const navigationRoute = (isStatic: boolean, mode: 'add' | 'edit', currentMood?: MoodUIInfo) => {
99
95
  const path =
100
96
  mode === 'add'
101
- ? RouterKey.ui_biz_mood_add
97
+ ? ui_biz_routerKey.ui_biz_mood_add
102
98
  : isStatic
103
- ? RouterKey.ui_biz_static_mood_edit
99
+ ? ui_biz_routerKey.ui_biz_static_mood_edit
104
100
  : !!(params.isMixLight || params.isCeilingLight)
105
- ? RouterKey.ui_biz_dynamic_mix_mood_edit
106
- : RouterKey.ui_biz_dynamic_mood_edit;
101
+ ? ui_biz_routerKey.ui_biz_dynamic_mix_mood_edit
102
+ : ui_biz_routerKey.ui_biz_dynamic_mood_edit;
107
103
  navigation.navigate(path, {
108
104
  mode,
109
105
  isStatic,
110
- moods: state.originMoods,
111
106
  currentMood,
112
107
  moduleParams: params,
108
+ moodIds,
109
+ nameRepeat,
113
110
  modDeleteMood,
114
111
  });
115
112
  };
@@ -139,7 +136,7 @@ const MoodPage = () => {
139
136
  },
140
137
  secondaryLamp: {
141
138
  ...currentMood.secondaryLamp,
142
- nodes: currentMood.secondaryLamp
139
+ nodes: currentMood.secondaryLamp && currentMood.secondaryLamp.nodes?.length
143
140
  ? currentMood.secondaryLamp.nodes.map(node => {
144
141
  if (mode !== 'del') {
145
142
  if (node.isColorNode) {
@@ -161,7 +158,7 @@ const MoodPage = () => {
161
158
  },
162
159
  };
163
160
  if (mode === 'set') {
164
- return setMoodInfo(checkedMood, params);
161
+ return setMoodInfo(checkedMood);
165
162
  }
166
163
  let newScene: MoodUIInfo[] = [];
167
164
  if (mode === 'add') {
@@ -177,7 +174,7 @@ const MoodPage = () => {
177
174
  });
178
175
  }
179
176
  const mood = mode === 'del' ? (newScene.length === 0 ? undefined : newScene[0]) : checkedMood;
180
- const res = await saveMoodList(devId, newScene, option, params.featureId);
177
+ const res = await saveMoodList(devId, newScene, params, params.featureId);
181
178
  if (res.success) {
182
179
  state.originMoods = cloneDeep(newScene);
183
180
  setMoods(cloneDeep(newScene));
@@ -196,7 +193,7 @@ const MoodPage = () => {
196
193
  };
197
194
  }
198
195
  }
199
- setMoodInfo(mood, params).then();
196
+ setMoodInfo(mood).then();
200
197
  } else {
201
198
  if (mainWork === WorkMode.Scene) {
202
199
  if (params.isCeilingLight) {
@@ -255,7 +252,7 @@ const MoodPage = () => {
255
252
 
256
253
  const getItemEnable = useCallback(
257
254
  (moodItem: MoodUIInfo) => {
258
- if (option.isCeilingLight) {
255
+ if (params.isCeilingLight) {
259
256
  return (
260
257
  moodInfo.mainLamp.id === moodItem.mainLamp.id &&
261
258
  moodInfo.secondaryLamp.id === moodItem.secondaryLamp.id &&
@@ -268,6 +265,10 @@ const MoodPage = () => {
268
265
  [moodInfo, mainWork]
269
266
  );
270
267
 
268
+ const nameRepeat = useCallback((mood: MoodUIInfo) => {
269
+ return !!state.originMoods.filter(m => !(params.isCeilingLight ? (m.mainLamp.id === mood.mainLamp.id && m.secondaryLamp.id === mood.secondaryLamp.id) : (m.id === mood.id))).find(m => m.name === mood.name)
270
+ }, [state.originMoods, params.isCeilingLight])
271
+
271
272
  return (
272
273
  <>
273
274
  <Page
@@ -6,7 +6,8 @@ const { nToHS, toFixed, sToN } = Utils;
6
6
 
7
7
  // light source
8
8
  export function dp2Obj(dp: string, isFan: boolean = false, isUVCFan?: boolean): MoodInfo {
9
- if (!dp) return getDefaultMood();
9
+ console.log(dp, '< ---- dppppp')
10
+ if (!dp || dp?.length <= 8) return getDefaultMood();
10
11
  let dpCopy = dp;
11
12
  let fanEnable: undefined | boolean = undefined;
12
13
  let fanSpeed: undefined | number = undefined;
@@ -1,23 +1,35 @@
1
- import React from 'react';
1
+ import React, { useMemo } from 'react';
2
2
  import { Utils } from 'tuya-panel-kit';
3
3
  import Card from '@ledvance/base/src/components/Card';
4
4
  import { CellContent } from '@ledvance/base/src/components/Cell';
5
5
  import { StyleSheet, View } from 'react-native';
6
6
  import Spacer from '@ledvance/base/src/components/Spacer';
7
- import { MoodUIInfo } from './Interface';
7
+ import { MoodJumpGradientMode, MoodUIInfo } from './Interface';
8
8
  import { MixMoodColorsLine } from './MoodItem';
9
9
 
10
10
  const cx = Utils.RatioUtils.convertX;
11
11
 
12
+ interface LightCategory {
13
+ isMixLight?: boolean
14
+ isStripLight?: boolean
15
+ isStringLight?: boolean
16
+ isCeilingLight?: boolean
17
+ }
18
+
12
19
  interface RecommendMixMoodItemProps {
13
20
  title: string;
14
21
  isMix: boolean;
15
22
  mood: MoodUIInfo;
23
+ deviceTypeOption?: LightCategory
16
24
  onPress: () => void;
17
25
  }
18
26
 
19
27
  const RecommendMixMoodItem = (props: RecommendMixMoodItemProps) => {
20
- const { mood, isMix } = props;
28
+ const { mood, isMix, deviceTypeOption } = props;
29
+
30
+ const gradientMode = useMemo(() => (
31
+ deviceTypeOption?.isStringLight ? MoodJumpGradientMode.StringGradient : (deviceTypeOption?.isStripLight || deviceTypeOption?.isCeilingLight) ? MoodJumpGradientMode.StripGradient : MoodJumpGradientMode.SourceGradient
32
+ ), [MoodJumpGradientMode, deviceTypeOption])
21
33
 
22
34
  return (
23
35
  <Card style={styles.root} onPress={props.onPress}>
@@ -34,9 +46,9 @@ const RecommendMixMoodItem = (props: RecommendMixMoodItemProps) => {
34
46
  {!!(mood.mainLamp) && (
35
47
  <>
36
48
  <View style={styles.lineStyle}>
37
- <MixMoodColorsLine mixSubLight={mood?.mainLamp} isMix={isMix} />
49
+ <MixMoodColorsLine mixSubLight={mood?.mainLamp} isMix={isMix} type={mood.mainLamp.mode === gradientMode ? 'gradient' : 'separate'}/>
38
50
  <Spacer height={cx(7)} />
39
- {isMix && <MixMoodColorsLine mixSubLight={mood.secondaryLamp} isMix={isMix} />}
51
+ {(isMix && !!mood.secondaryLamp.nodes.length) && <MixMoodColorsLine mixSubLight={mood.secondaryLamp} isMix={isMix} type={mood.secondaryLamp.mode === gradientMode ? 'gradient' : 'separate'}/>}
40
52
  </View>
41
53
  <Spacer height={cx(24)} />
42
54
  </>
@@ -54,6 +66,7 @@ const styles = StyleSheet.create({
54
66
  content: {
55
67
  height: cx(56),
56
68
  marginHorizontal: cx(16),
69
+ width: cx(295)
57
70
  },
58
71
  title: {
59
72
  color: '#000',
@@ -1,9 +1,8 @@
1
- import {NavigationRoute, TransitionPresets} from "tuya-panel-kit";
2
- import DynamicMoodEditorPage from "../../modules/mood/DynamicMoodEditorPage";
3
- import StaticMoodEditorPage from "../../modules/mood/StaticMoodEditorPage";
4
- import AddMoodPage from "../../modules/mood/AddMoodPage";
5
- import MoodPage from "../../modules/mood/MoodPage";
6
- import SelectPage from "../../modules/select/SelectPage";
1
+ import {NavigationRoute} from "tuya-panel-kit";
2
+ import DynamicMoodEditorPage from "./DynamicMoodEditorPage";
3
+ import StaticMoodEditorPage from "./StaticMoodEditorPage";
4
+ import AddMoodPage from "./AddMoodPage";
5
+ import MoodPage from "./MoodPage";
7
6
  import {ui_biz_routerKey} from "../../navigation/Routers";
8
7
 
9
8
  const MoodPageRouters: NavigationRoute[] = [
@@ -38,16 +37,7 @@ const MoodPageRouters: NavigationRoute[] = [
38
37
  hideTopbar: true,
39
38
  showOfflineView: false,
40
39
  },
41
- },
42
- {
43
- name: ui_biz_routerKey.ui_biz_select_page,
44
- component: SelectPage,
45
- options: {
46
- gesture: true,
47
- hideTopbar: true,
48
- ...TransitionPresets.ModalPresentationIOS,
49
- },
50
- },
40
+ }
51
41
  ]
52
42
 
53
43
  export default MoodPageRouters
@@ -1,6 +1,6 @@
1
1
  import React, { useCallback, useEffect, useMemo } from 'react';
2
2
  import { ScrollView, StyleSheet, View } from 'react-native';
3
- import { cloneDeep, find, isEqual } from 'lodash';
3
+ import { cloneDeep, isEqual } from 'lodash';
4
4
  import { useReactive } from 'ahooks';
5
5
  import Page from '@ledvance/base/src/components/Page';
6
6
  import I18n from '@ledvance/base/src/i18n';
@@ -12,26 +12,24 @@ import Spacer from '@ledvance/base/src/components/Spacer';
12
12
  import res from '@ledvance/base/src/res';
13
13
  import TextButton from '@ledvance/base/src/components/TextButton';
14
14
  import { useFanMaxSpeed } from '@ledvance/base/src/models/modules/NativePropsSlice';
15
- import LampAdjustView from '@ledvance/base/src/components/LampAdjustView';
16
15
  import FanAdjustView from '@ledvance/base/src/components/FanAdjustView';
17
- import { showDeleteMoodDialog } from './tools';
18
16
  import { MoodNodeInfo, MoodPageParams, MoodUIInfo } from './Interface';
19
17
  import { Result } from '@ledvance/base/src/models/modules/Result';
20
18
  import { hsv2Hex, mapFloatToRange } from '@ledvance/base/src/utils';
21
19
  import { cctToColor } from '@ledvance/base/src/utils/cctUtils';
22
20
  import { useParams } from '@ledvance/base/src/hooks/Hooks';
23
- import ColorAdjustView from '@ledvance/base/src/components/ColorAdjustView';
24
- import { RouterKey } from 'navigation/Router';
21
+ import LampAdjustView2 from '@ledvance/base/src/components/LampAdjustView2';
22
+ import { ui_biz_routerKey } from '../../navigation/Routers'
25
23
  import LdvSwitch from '@ledvance/base/src/components/ldvSwitch';
24
+ import { showDialog } from '@ledvance/base/src/utils/common';
26
25
 
27
26
  const cx = Utils.RatioUtils.convertX;
28
27
 
29
28
  export interface StaticMoodEditorPageParams {
30
29
  mode: 'add' | 'edit';
31
- moods: MoodUIInfo[];
32
30
  currentMood: MoodUIInfo;
33
- onSave: () => void;
34
31
  moduleParams: MoodPageParams;
32
+ nameRepeat: (mood: MoodUIInfo) => boolean
35
33
  modDeleteMood: (mode: 'add' | 'edit' | 'del', currentMood: MoodUIInfo) => Promise<Result<any>>;
36
34
  }
37
35
 
@@ -53,7 +51,7 @@ const StaticMoodEditorPage = () => {
53
51
  headline: '',
54
52
  mood: params.currentMood,
55
53
  mainNode: params.currentMood.mainLamp.nodes[0],
56
- secondaryNode: params.currentMood?.secondaryLamp?.nodes[0],
54
+ secondaryNode: params.currentMood?.secondaryLamp?.nodes?.[0],
57
55
  loading: false,
58
56
  });
59
57
 
@@ -73,10 +71,7 @@ const StaticMoodEditorPage = () => {
73
71
  }, []);
74
72
 
75
73
  const onRightClick = async () => {
76
- if (getButtonStatus()) {
77
- return
78
- }
79
- if (state.loading) return;
74
+ if (state.loading || !canSaveMoodData) return;
80
75
  state.loading = true;
81
76
  const newMood: MoodUIInfo = {
82
77
  ...state.mood,
@@ -84,8 +79,12 @@ const StaticMoodEditorPage = () => {
84
79
  ...state.mood.mainLamp,
85
80
  nodes: [cloneDeep(state.mainNode)],
86
81
  },
82
+ secondaryLamp: {
83
+ ...state.mood.secondaryLamp,
84
+ id: undefined
85
+ }
87
86
  };
88
- if (isMix) {
87
+ if (isMix && moduleParams.isMixLight) {
89
88
  newMood.secondaryLamp = {
90
89
  ...newMood.secondaryLamp,
91
90
  nodes: [cloneDeep(state.secondaryNode)],
@@ -101,37 +100,26 @@ const StaticMoodEditorPage = () => {
101
100
  const res = await params.modDeleteMood(params.mode, newMood);
102
101
  state.loading = false;
103
102
  if (res.success) {
104
- navigation.navigate(RouterKey.ui_biz_mood);
103
+ navigation.navigate(ui_biz_routerKey.ui_biz_mood);
105
104
  }
106
105
  };
107
106
 
108
- const getButtonStatus = () => {
109
- return (
110
- (params.mode === 'edit' && isEqual(state.mood, params.currentMood)) ||
111
- !state.mood.name ||
112
- nameRepeat ||
113
- state.mood.name.length > 32
114
- );
115
- };
116
-
117
107
  const nameRepeat = useMemo(() => {
118
- return !!find(params.moods, m => m.id !== state.mood.id && m.name === state.mood.name);
108
+ return params.nameRepeat(state.mood)
119
109
  }, [state.mood.name]);
120
110
 
121
- useEffect(() =>{
122
- console.log(state.mood, '< --- state mood --- >')
123
- console.log(params.currentMood, '< --- currentMood --- >')
124
- }, [JSON.stringify(state.mood)])
125
-
111
+ const checkMoodChanged = useMemo(() =>{
112
+ return isEqual(state.mood, params.currentMood)
113
+ }, [JSON.stringify(state.mood), params.currentMood])
126
114
 
127
- const showBackDialog = (): boolean => {
128
- return !isEqual(state.mood, routeParams.currentMood);
129
- }
115
+ const canSaveMoodData = useMemo(() =>{
116
+ return state.mood.name.length > 0 && state.mood.name.length < 33 && !nameRepeat && (params.mode === 'add' || !checkMoodChanged)
117
+ }, [nameRepeat, state.mood.name, checkMoodChanged, params.mode])
130
118
 
131
119
  return (
132
120
  <Page
133
121
  backText={I18n.getLang('mesh_device_detail_mode')}
134
- showBackDialog={showBackDialog()}
122
+ showBackDialog={!checkMoodChanged}
135
123
  backDialogTitle={I18n.getLang(
136
124
  params.mode === 'add'
137
125
  ? 'string_light_pp_dialog_sm_add_headline_c'
@@ -143,7 +131,7 @@ const StaticMoodEditorPage = () => {
143
131
  : 'strip_light_static_mood_editor_step_2_dialog_text'
144
132
  )}
145
133
  headlineText={state.headline}
146
- rightButtonIcon={getButtonStatus() ? res.ic_uncheck : res.ic_check}
134
+ rightButtonIcon={canSaveMoodData ? res.ic_check : res.ic_uncheck}
147
135
  rightButtonIconClick={onRightClick}
148
136
  loading={state.loading}
149
137
  >
@@ -180,86 +168,33 @@ const StaticMoodEditorPage = () => {
180
168
  showSwitch={!!moduleParams.isMixLight}
181
169
  />
182
170
  {(!moduleParams.isMixLight || state.mood.mainLamp.enable) && (
183
- <LampAdjustView
171
+ <LampAdjustView2
184
172
  isSupportColor={isMix ? false : moduleParams.isSupportColor}
185
173
  isSupportBrightness={moduleParams.isSupportBrightness}
186
- isSupportTemperature={moduleParams.isSupportTemperature}
174
+ isSupportCCT={moduleParams.isSupportTemperature}
187
175
  isColorMode={state.mainNode.isColorNode}
188
176
  reserveSV={true}
189
177
  setIsColorMode={isColorMode => {
190
178
  state.mainNode.isColorNode = isColorMode;
191
179
  }}
192
- h={state.mainNode.h}
193
- s={state.mainNode.s}
194
- v={state.mainNode.v}
195
- onHSVChange={(h, s, v) => {
196
- state.mainNode.h = h
197
- state.mainNode.s = s
198
- state.mainNode.v = v
180
+ hsv={state.mainNode}
181
+ onHSVChange={(hsv) => {
182
+ state.mainNode.h = hsv.h
183
+ state.mainNode.s = hsv.s
184
+ state.mainNode.v = hsv.v
199
185
  }}
200
- onHSVChangeComplete={(h, s, v) => {
201
- state.mainNode.h = h
202
- state.mainNode.s = s
203
- state.mainNode.v = v
204
- }}
205
- colorTemp={state.mainNode.colorTemp}
186
+ cct={state.mainNode.colorTemp}
206
187
  brightness={state.mainNode.brightness}
207
- onCCTChange={() => {}}
208
- onCCTChangeComplete={cct => {
188
+ onCCTChange={(cct) => {
209
189
  state.mainNode.colorTemp = cct;
210
190
  }}
211
- onBrightnessChange={() => {}}
212
- onBrightnessChangeComplete={brightness => {
191
+ onBrightnessChange={(brightness) => {
213
192
  state.mainNode.brightness = brightness;
214
193
  }}
215
194
  />
216
195
  )}
217
196
  </Card>
218
197
  <Spacer />
219
- {isMix && (
220
- <Card style={styles.fanAdjustCard}>
221
- <LdvSwitch
222
- title={I18n.getLang('light_sources_tile_sec_lighting_headline')}
223
- color={'#fff'}
224
- colorAlpha={1}
225
- enable={!!state.mood.secondaryLamp.enable}
226
- setEnable={v => {
227
- if(v && !state.mood.secondaryLamp.nodes.length){
228
- state.mood.secondaryLamp.nodes.push(
229
- {
230
- h: 0,
231
- s: 100,
232
- v: 100,
233
- brightness: 0,
234
- colorTemp: 0,
235
- isColorNode: true,
236
- },
237
- )
238
- state.secondaryNode = state.mood.secondaryLamp.nodes[0]
239
- }
240
- state.mood.secondaryLamp.enable = v;
241
- }}
242
- showSwitch={!!moduleParams.isMixLight}
243
- />
244
- {(!moduleParams.isMixLight || state.mood.secondaryLamp.enable) && (
245
- <>
246
- <ColorAdjustView
247
- h={state.secondaryNode.h}
248
- s={state.secondaryNode.s}
249
- v={state.secondaryNode.v}
250
- reserveSV={true}
251
- onHSVChange={() => {}}
252
- onHSVChangeComplete={(h, s, v) => {
253
- state.secondaryNode.h = h
254
- state.secondaryNode.s = s
255
- state.secondaryNode.v = v
256
- }}
257
- />
258
- <Spacer height={cx(16)}/>
259
- </>
260
- )}
261
- </Card>
262
- )}
263
198
  {!!(moduleParams.isFanLight || moduleParams.isUVCFan) && (
264
199
  <FanAdjustView
265
200
  fanEnable={!!state.mood.mainLamp.fanEnable}
@@ -284,15 +219,20 @@ const StaticMoodEditorPage = () => {
284
219
  textStyle={styles.deleteBtnText}
285
220
  text={I18n.getLang('edit_static_mood_button_delete_text')}
286
221
  onPress={() => {
287
- showDeleteMoodDialog(async (_, { close }) => {
288
- state.loading = true;
289
- close();
290
- const res = await params.modDeleteMood('del', state.mood);
291
- if (res.success) {
292
- navigation.navigate(RouterKey.ui_biz_mood);
222
+ showDialog({
223
+ method: 'confirm',
224
+ title: I18n.getLang('string_light_pp_dialog_sm_ed_headline_d'),
225
+ subTitle: I18n.getLang(`strip_light_static_mood_edit_dialog_text`),
226
+ onConfirm: async (_, {close})=>{
227
+ close();
228
+ state.loading = true;
229
+ const res = await params.modDeleteMood('del', state.mood);
230
+ state.loading = false;
231
+ if (res.success) {
232
+ navigation.navigate(ui_biz_routerKey.ui_biz_mood);
233
+ }
293
234
  }
294
- state.loading = false;
295
- });
235
+ })
296
236
  }}
297
237
  />
298
238
  </View>
@@ -0,0 +1,17 @@
1
+ import {NavigationRoute, TransitionPresets} from "tuya-panel-kit";
2
+ import SelectPage from "./SelectPage";
3
+ import {ui_biz_routerKey} from "../../navigation/Routers";
4
+
5
+ const SelectPagePageRouters: NavigationRoute[] = [
6
+ {
7
+ name: ui_biz_routerKey.ui_biz_select_page,
8
+ component: SelectPage,
9
+ options: {
10
+ hideTopbar: true,
11
+ showOfflineView: false,
12
+ ...TransitionPresets.ModalPresentationIOS,
13
+ },
14
+ }
15
+ ]
16
+
17
+ export default SelectPagePageRouters
@@ -0,0 +1,12 @@
1
+ export interface SelectPageData<T> {
2
+ text: string;
3
+ selected: boolean;
4
+ value: T;
5
+ }
6
+ export interface SelectPageParams<T> {
7
+ title: string;
8
+ data: SelectPageData<T>[];
9
+ onSelect: (selectPageData: SelectPageData<T>) => void;
10
+ }
11
+ declare const SelectPage: () => any;
12
+ export default SelectPage;