@ledvance/group-ui-biz-bundle 1.0.46 → 1.0.47

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 (37) hide show
  1. package/package.json +1 -1
  2. package/src/modules/biorhythm/BiorhythmActions.ts +5 -13
  3. package/src/modules/biorhythm/BiorhythmBean.ts +6 -6
  4. package/src/modules/biorhythm/BiorhythmPage.tsx +14 -38
  5. package/src/modules/biorhythm/Router.ts +34 -0
  6. package/src/modules/fixedTimeForPlug/Router.ts +25 -0
  7. package/src/modules/fixedTimingForLight/Router.ts +25 -0
  8. package/src/modules/flags/Router.ts +25 -0
  9. package/src/modules/mood/AddMoodPage.tsx +2 -2
  10. package/src/modules/mood_new/AddMoodPage.tsx +197 -0
  11. package/src/modules/mood_new/DynamicMoodEditorPage.tsx +654 -0
  12. package/src/modules/mood_new/Interface.ts +219 -0
  13. package/src/modules/mood_new/MixDynamicMoodEditor.tsx +788 -0
  14. package/src/modules/mood_new/MoodActions.ts +227 -0
  15. package/src/modules/mood_new/MoodInfo.ts +2151 -0
  16. package/src/modules/mood_new/MoodItem.tsx +148 -0
  17. package/src/modules/mood_new/MoodPage.tsx +374 -0
  18. package/src/modules/mood_new/MoodParse.ts +442 -0
  19. package/src/modules/mood_new/RecommendMoodItem.tsx +69 -0
  20. package/src/modules/mood_new/Router.ts +43 -0
  21. package/src/modules/mood_new/StaticMoodEditorPage.tsx +293 -0
  22. package/src/modules/music/Router.ts +16 -0
  23. package/src/modules/randomTimeForPlug/Router.ts +25 -0
  24. package/src/modules/randomTimingForLight/Router.ts +25 -0
  25. package/src/modules/remoteSwitch/Router.ts +16 -0
  26. package/src/modules/select/Router.ts +16 -0
  27. package/src/modules/switchGradient/Router.ts +16 -0
  28. package/src/modules/timeSchedule/Interface.ts +150 -0
  29. package/src/modules/timeSchedule/Router.ts +25 -0
  30. package/src/modules/timeSchedule/TimeScheduleActions.ts +140 -0
  31. package/src/modules/timeSchedule/TimeScheduleDetailPage.tsx +625 -0
  32. package/src/modules/timeSchedule/TimeSchedulePage.tsx +220 -0
  33. package/src/modules/timeSchedule/components/ManuaSettings.tsx +376 -0
  34. package/src/modules/timeSchedule/components/ScheduleCard.tsx +109 -0
  35. package/src/modules/timeSchedule/components/Summary.tsx +124 -0
  36. package/src/modules/timer/Router.ts +16 -0
  37. package/src/navigation/Routers.ts +1 -0
@@ -0,0 +1,220 @@
1
+ import React, { useCallback, useEffect, useMemo } from 'react';
2
+ import { ScrollView, Text, StyleSheet, FlatList, View, Image } from 'react-native';
3
+ import { useNavigation } from '@react-navigation/core';
4
+ import { Utils } from 'tuya-panel-kit';
5
+ import Page from '@ledvance/base/src/components/Page';
6
+ import I18n from '@ledvance/base/src/i18n';
7
+ import {
8
+ useDeviceInfo,
9
+ useTimeSchedule,
10
+ useUAGroupInfo,
11
+ } from '@ledvance/base/src/models/modules/NativePropsSlice';
12
+ import res from '@ledvance/base/src/res';
13
+ import Spacer from '@ledvance/base/src/components/Spacer';
14
+ import InfoText from '@ledvance/base/src/components/InfoText';
15
+ import DeleteButton from '@ledvance/base/src/components/DeleteButton';
16
+ import { useReactive, useUpdateEffect } from 'ahooks';
17
+ import { addTimeSchedule, modDelTimeSchedule, getTimeSchedule, modifyTimeSchedule } from "@ledvance/group-ui-biz-bundle/src/modules/timeSchedule/TimeScheduleActions";
18
+ import { ApplyForItem, DeviceStateType, Timer } from '@ledvance/group-ui-biz-bundle/src/modules/timeSchedule/Interface';
19
+ import { useParams } from '@ledvance/base/src/hooks/Hooks';
20
+ import ScheduleCard from '@ledvance/group-ui-biz-bundle/src/modules/timeSchedule/components/ScheduleCard';
21
+ import { ui_biz_routerKey } from "@ledvance/group-ui-biz-bundle/src/navigation/Routers";
22
+
23
+ const { convertX: cx } = Utils.RatioUtils;
24
+ const MAX_NUM = 30;
25
+
26
+ export interface TimeSchedulePageParams {
27
+ isSupportColor: boolean;
28
+ isSupportTemperature: boolean;
29
+ isSupportBrightness: boolean;
30
+ isSupportMood?: boolean;
31
+ isStringLight?: boolean;
32
+ isStripLight?: boolean;
33
+ isMatterLight?: boolean;
34
+ isCeilingLight?: boolean;
35
+ isMixLight?: boolean;
36
+ isSupportFan?: boolean;
37
+ isSupportUVC?: boolean;
38
+ applyForList: ApplyForItem[];
39
+ applyForDisabled: boolean; // 是否可以选择apply for
40
+ manualDataDp2Obj: (dps: Record<string, any>) => DeviceStateType;
41
+ manualDataObj2Dp: (deviceState: DeviceStateType, applyForList: ApplyForItem[]) => Record<string, any>;
42
+ }
43
+
44
+ const TimeSchedulePage = () => {
45
+ const deviceInfo = useDeviceInfo();
46
+ const navigation = useNavigation();
47
+ const uaGroupInfo = useUAGroupInfo()
48
+ const [timeScheduleStatus, setTimeScheduleStatus] = useTimeSchedule();
49
+ const params = useParams<TimeSchedulePageParams>();
50
+ const state = useReactive({
51
+ timeScheduleList: [] as Timer[],
52
+ flag: Symbol(),
53
+ loading: false,
54
+ });
55
+
56
+ const isMaxSchedule = useMemo(() => state.timeScheduleList.length >= MAX_NUM, [
57
+ state.timeScheduleList,
58
+ ]);
59
+
60
+ useUpdateEffect(() => {
61
+ const status = state.timeScheduleList.some(item => item.status);
62
+ if (status !== timeScheduleStatus) {
63
+ setTimeScheduleStatus(status);
64
+ }
65
+ }, [JSON.stringify(state.timeScheduleList)]);
66
+
67
+ useEffect(() => {
68
+ getTimeScheduleList().then()
69
+ }, [state.flag]);
70
+
71
+ const modDeleteTimeSchedule = async (mode: 'add' | 'edit' | 'del', timeSchedule: Timer, ids: string) => {
72
+ if (mode === 'add') {
73
+ return addTimeSchedule({
74
+ ...timeSchedule,
75
+ bizId: uaGroupInfo.tyGroupId.toString(),
76
+ actions: JSON.stringify({dps: timeSchedule.dps, time: timeSchedule.time})
77
+ })
78
+ } else if (mode === 'edit') {
79
+ return modifyTimeSchedule({
80
+ ...timeSchedule,
81
+ bizId: uaGroupInfo.tyGroupId.toString(),
82
+ actions: JSON.stringify({dps: timeSchedule.dps, time: timeSchedule.time})
83
+ })
84
+ } else {
85
+ return modDelTimeSchedule({
86
+ bizId: uaGroupInfo.tyGroupId.toString(),
87
+ ids,
88
+ })
89
+ }
90
+ }
91
+
92
+ const navigateToEdit = useCallback((mode: 'add' | 'edit', timeSchedule?: Timer) => {
93
+ const path = ui_biz_routerKey.group_ui_biz_time_schedule_edit;
94
+ navigation.navigate(path, {
95
+ mode,
96
+ name: path,
97
+ timeSchedule,
98
+ modDeleteTimeSchedule,
99
+ refreshFn: () => {
100
+ state.flag = Symbol();
101
+ },
102
+ ...params,
103
+ });
104
+ }, []);
105
+
106
+ const getTimeScheduleList = async () => {
107
+ const res = await getTimeSchedule({
108
+ bizId: uaGroupInfo.tyGroupId.toString()
109
+ })
110
+ console.log(res, '< --- res --- >')
111
+ if (res.success) {
112
+ state.timeScheduleList = res.data || []
113
+ } else {
114
+ state.timeScheduleList = []
115
+ }
116
+ }
117
+
118
+ return (
119
+ <Page
120
+ backText={deviceInfo.name}
121
+ onBackClick={navigation.goBack}
122
+ headlineText={I18n.getLang('timeschedule_overview_headline_text')}
123
+ headlineIcon={isMaxSchedule ? undefined : res.device_panel_schedule_add}
124
+ onHeadlineIconClick={() => {
125
+ navigateToEdit('add');
126
+ }}
127
+ loading={state.loading}
128
+ >
129
+ <ScrollView nestedScrollEnabled={true}>
130
+ <Text style={styles.overviewDescription}>
131
+ {I18n.getLang('timeschedule_overview_description_text')}
132
+ </Text>
133
+ <Spacer height={cx(10)} />
134
+ {isMaxSchedule && (
135
+ <InfoText
136
+ text={I18n.getLang('motion_detection_time_schedule_notifications_warning_text')}
137
+ icon={res.ic_warning_amber}
138
+ style={{ marginHorizontal: cx(24) }}
139
+ textStyle={{ color: '#000', fontSize: cx(12) }}
140
+ iconStyle={{ tintColor: '#ff9500' }}
141
+ />
142
+ )}
143
+ <FlatList
144
+ data={state.timeScheduleList}
145
+ renderItem={({ item }) => (
146
+ <ScheduleCard
147
+ item={item}
148
+ onEnableChange={async enable => {
149
+ state.loading = true;
150
+ await modDeleteTimeSchedule('del', {
151
+ ...item,
152
+ status: enable ? 1 : 0,
153
+ }, item.id.toString());
154
+ state.loading = false;
155
+ }}
156
+ onPress={() => {
157
+ navigateToEdit('edit', item);
158
+ }}
159
+ />
160
+ )}
161
+ keyExtractor={item => item.id.toString()}
162
+ ListEmptyComponent={() => (
163
+ <View style={styles.emptyContainer}>
164
+ <Spacer height={cx(60)} />
165
+ <Image
166
+ style={styles.emptyImage}
167
+ source={{ uri: res.ldv_timer_empty }}
168
+ resizeMode="contain"
169
+ />
170
+ <InfoText
171
+ icon={res.device_panel_schedule_alert}
172
+ text={I18n.getLang('timeschedule_overview_empty_information_text')}
173
+ style={{ width: 'auto', alignItems: 'center' }}
174
+ textStyle={{ color: '#000', fontSize: cx(12), flex: undefined }}
175
+ iconStyle={{ tintColor: '#000' }}
176
+ />
177
+ <Spacer height={cx(16)} />
178
+ <DeleteButton
179
+ style={styles.addBtn}
180
+ text={`${I18n.getLang('timeschedule_overview_empty_button_add_text')}`}
181
+ textStyle={{ fontSize: cx(12) }}
182
+ onPress={() => {
183
+ navigateToEdit('add');
184
+ }}
185
+ />
186
+ </View>
187
+ )}
188
+ ListHeaderComponent={() => <Spacer height={cx(10)} />}
189
+ ItemSeparatorComponent={() => <Spacer />}
190
+ ListFooterComponent={() => <Spacer height={cx(30)} />}
191
+ />
192
+ </ScrollView>
193
+ </Page>
194
+ );
195
+ };
196
+
197
+ const styles = StyleSheet.create({
198
+ overviewDescription: {
199
+ color: '#000',
200
+ marginHorizontal: cx(24),
201
+ fontSize: cx(12)
202
+ },
203
+ emptyImage: {
204
+ width: cx(225),
205
+ height: cx(198),
206
+ },
207
+ emptyContainer: {
208
+ marginHorizontal: cx(24),
209
+ alignItems: 'center',
210
+ },
211
+ addBtn: {
212
+ height: cx(40),
213
+ width: 'auto',
214
+ minWidth: cx(150),
215
+ paddingHorizontal: cx(16),
216
+ backgroundColor: '#f60',
217
+ },
218
+ });
219
+
220
+ export default TimeSchedulePage;
@@ -0,0 +1,376 @@
1
+ import React, { memo, useMemo } from 'react';
2
+ import { CeilingLightData, DeviceType, ManualSettingProps } from '../Interface';
3
+ import { View } from 'react-native';
4
+ import Card from '@ledvance/base/src/components/Card';
5
+ import LampAdjustView from '@ledvance/base/src/components/LampAdjustView';
6
+ import { Utils } from 'tuya-panel-kit';
7
+ import { useCreation, useReactive, useUpdateEffect } from 'ahooks';
8
+ import LdvSwitch from '@ledvance/base/src/components/ldvSwitch';
9
+ import ColorTempAdjustView from '@ledvance/base/src/components/ColorTempAdjustView';
10
+ import ColorAdjustView from '@ledvance/base/src/components/ColorAdjustView';
11
+ import I18n from '@ledvance/base/src/i18n';
12
+ import StripAdjustView from '@ledvance/base/src/components/StripAdjustView';
13
+ import Spacer from '@ledvance/base/src/components/Spacer';
14
+ import { useGroupDevices } from '@ledvance/base/src/models/modules/NativePropsSlice';
15
+ import ApplyForDeviceList from '@ledvance/base/src/components/ApplyForDeviceList';
16
+ import { cloneDeep } from 'lodash';
17
+ const { convertX: cx } = Utils.RatioUtils;
18
+
19
+ function ManualSettings(props: ManualSettingProps) {
20
+ const [groupDevices] = useGroupDevices()
21
+ const state = useReactive({
22
+ deviceData: props.manualData.deviceData,
23
+ applyForList: props.applyForList,
24
+ applyFlag: Symbol(),
25
+ manualFlag: Symbol()
26
+ });
27
+
28
+ useUpdateEffect(() => {
29
+ state.applyForList = props.applyForList;
30
+ state.deviceData = props.manualData.deviceData;
31
+ }, [props.applyForList, props.manualData]);
32
+
33
+ useUpdateEffect(() => {
34
+ props.onApplyChange && props.onApplyChange(state.applyForList)
35
+ }, [state.applyFlag])
36
+
37
+ useUpdateEffect(() => {
38
+ props.onManualChange && props.onManualChange(state.deviceData)
39
+ }, [state.manualFlag])
40
+
41
+ const tabList = useCreation(() => {
42
+ const isSupportWhite = props.isSupportBrightness || props.isSupportTemperature;
43
+ const tabs = [
44
+ { key: 1, title: I18n.getLang('add_new_static_mood_lights_schedule_switch_tab_color_text') },
45
+ { key: 0, title: I18n.getLang('add_new_static_mood_lights_schedule_switch_tab_white_text') },
46
+ {
47
+ key: 3,
48
+ title: I18n.getLang(
49
+ 'add_new_dynamic_mood_strip_lights_schedule_switch_tab_combination_text'
50
+ ),
51
+ },
52
+ ];
53
+ if(props.isCeilingLight){
54
+ return tabs.filter(tab => tab.key !== 0)
55
+ }
56
+ if (!isSupportWhite) {
57
+ return tabs.filter(tab => tab.key !== 0);
58
+ }
59
+ if (!props.isSupportColor) {
60
+ return tabs.filter(tab => tab.key === 0);
61
+ }
62
+ return tabs;
63
+ }, []);
64
+
65
+ const lightSourceCard = useMemo(() => {
66
+ const { deviceData } = state;
67
+ return (
68
+ <View>
69
+ {state.applyForList.map((item, idx) => (
70
+ <View key={item.dp}>
71
+ <Card style={{ marginHorizontal: cx(24) }}>
72
+ <LdvSwitch
73
+ title={item.key}
74
+ color={'#fff'}
75
+ colorAlpha={1}
76
+ enable={item.enable}
77
+ setEnable={(enable: boolean) => {
78
+ state.applyForList = state.applyForList.map((apply, index) => {
79
+ if (idx === index) {
80
+ return {
81
+ ...apply,
82
+ enable,
83
+ };
84
+ }
85
+ return apply;
86
+ });
87
+ state.applyFlag = Symbol()
88
+ }}
89
+ />
90
+ {item.enable && item.type !== 'socket' && (
91
+ <LampAdjustView
92
+ isSupportColor={props.isSupportColor}
93
+ isSupportBrightness={props.isSupportBrightness}
94
+ isSupportTemperature={props.isSupportTemperature}
95
+ isColorMode={deviceData.isColorMode}
96
+ setIsColorMode={mode => {
97
+ state.deviceData = {
98
+ ...state.deviceData,
99
+ isColorMode: mode,
100
+ };
101
+ state.manualFlag = Symbol()
102
+ }}
103
+ reserveSV={true}
104
+ h={deviceData.h}
105
+ s={deviceData.s}
106
+ v={deviceData.v}
107
+ brightness={deviceData.brightness}
108
+ colorTemp={deviceData.temperature}
109
+ onHSVChangeComplete={(h, s, v) => {
110
+ state.deviceData = {
111
+ ...state.deviceData,
112
+ h,
113
+ s,
114
+ v,
115
+ };
116
+ state.manualFlag = Symbol()
117
+ }}
118
+ onBrightnessChangeComplete={bright => {
119
+ state.deviceData = {
120
+ ...state.deviceData,
121
+ brightness: bright
122
+ }
123
+ state.manualFlag = Symbol()
124
+ }}
125
+ onCCTChangeComplete={cct => {
126
+ state.deviceData = {
127
+ ...state.deviceData,
128
+ temperature: cct
129
+ }
130
+ state.manualFlag = Symbol()
131
+ }}
132
+ />
133
+ )}
134
+ <ApplyForDeviceList
135
+ devices={cloneDeep(groupDevices)}
136
+ />
137
+ <Spacer height={cx(16)} />
138
+ </Card>
139
+ <Spacer />
140
+ </View>
141
+ ))}
142
+ </View>
143
+ );
144
+ }, [state.deviceData, state.applyForList]);
145
+
146
+ const mixLightCard = useMemo(() => {
147
+ return (
148
+ <View>
149
+ {state.applyForList.map((item, idx) => (
150
+ <View key={item.dp}>
151
+ <Card style={{ marginHorizontal: cx(24) }}>
152
+ <LdvSwitch
153
+ title={item.key}
154
+ color={'#fff'}
155
+ colorAlpha={1}
156
+ enable={item.enable}
157
+ setEnable={(enable: boolean) => {
158
+ state.applyForList[idx].enable = enable;
159
+ state.applyFlag = Symbol()
160
+ }}
161
+ />
162
+ {item.enable &&
163
+ (item.type === 'mainLight' ? (
164
+ <View>
165
+ <ColorTempAdjustView
166
+ isSupportBrightness={props.isSupportBrightness}
167
+ isSupportTemperature={props.isSupportTemperature}
168
+ colorTemp={state.deviceData.temperature}
169
+ brightness={state.deviceData.brightness}
170
+ onBrightnessChangeComplete={bright => {
171
+ state.deviceData.brightness = bright;
172
+ state.manualFlag = Symbol()
173
+ }}
174
+ onCCTChangeComplete={cct => {
175
+ state.deviceData.temperature = cct;
176
+ state.manualFlag = Symbol()
177
+ }}
178
+ />
179
+ <Spacer height={cx(16)} />
180
+ </View>
181
+ ) : (
182
+ <View>
183
+ <ColorAdjustView
184
+ h={state.deviceData.h}
185
+ s={state.deviceData.s}
186
+ v={state.deviceData.v}
187
+ reserveSV={true}
188
+ minSaturation={1}
189
+ onHSVChangeComplete={(h, s, v) => {
190
+ state.deviceData.h = h;
191
+ state.deviceData.s = s;
192
+ state.deviceData.v = v;
193
+ state.manualFlag = Symbol()
194
+ }}
195
+ />
196
+ <Spacer />
197
+ </View>
198
+ ))}
199
+ <ApplyForDeviceList
200
+ devices={cloneDeep(groupDevices)}
201
+ />
202
+ <Spacer height={cx(16)} />
203
+ </Card>
204
+ <Spacer />
205
+ </View>
206
+ ))}
207
+ </View>
208
+ );
209
+ }, [state.deviceData, state.applyForList]);
210
+
211
+ const stripLightCard = useMemo(() => {
212
+ return (
213
+ <View>
214
+ <Card>
215
+ <LdvSwitch
216
+ title={I18n.getLang('light_sources_tile_tw_lighting_headline')}
217
+ color={'#fff'}
218
+ colorAlpha={1}
219
+ enable={state.applyForList[0]?.enable}
220
+ setEnable={(enable: boolean) => {
221
+ state.applyForList[0].enable = enable;
222
+ state.applyFlag = Symbol()
223
+ }}
224
+ />
225
+ {state.applyForList[0]?.enable && (
226
+ <StripAdjustView
227
+ isSupportBrightness={props.isSupportBrightness}
228
+ isSupportTemperature={props.isSupportTemperature}
229
+ lampTabs={tabList}
230
+ reserveSV={true}
231
+ activeKey={0}
232
+ onActiveKeyChange={() => { }}
233
+ h={state.deviceData.h}
234
+ s={state.deviceData.s}
235
+ v={state.deviceData.v}
236
+ brightness={state.deviceData.brightness}
237
+ colorTemp={state.deviceData.temperature}
238
+ onHSVChangeComplete={(h, s, v) => {
239
+ state.deviceData.h = h;
240
+ state.deviceData.s = s;
241
+ state.deviceData.v = v;
242
+ state.manualFlag = Symbol()
243
+ }}
244
+ onBrightnessChangeComplete={bright => {
245
+ state.deviceData.brightness = bright;
246
+ state.manualFlag = Symbol()
247
+ }}
248
+ onCCTChangeComplete={cct => {
249
+ state.deviceData.temperature = cct;
250
+ state.manualFlag = Symbol()
251
+ }}
252
+ />
253
+ )}
254
+ <ApplyForDeviceList
255
+ devices={cloneDeep(groupDevices)}
256
+ />
257
+ <Spacer height={cx(16)} />
258
+ </Card>
259
+ <Spacer />
260
+ </View>
261
+ );
262
+ }, [state.deviceData, state.applyForList]);
263
+
264
+ const ceilingLightCard = useMemo(() => {
265
+ const deviceData = state.deviceData as CeilingLightData
266
+ return (
267
+ <View>
268
+ {state.applyForList.map((item, idx) => (
269
+ <View key={item.dp}>
270
+ <Card style={{ marginHorizontal: cx(24) }}>
271
+ <LdvSwitch
272
+ title={item.key}
273
+ color={'#fff'}
274
+ colorAlpha={1}
275
+ enable={item.enable}
276
+ setEnable={(enable: boolean) => {
277
+ state.applyForList[idx].enable = enable;
278
+ state.applyFlag = Symbol()
279
+ }}
280
+ />
281
+ {item.enable &&
282
+ (item.type === 'mainLight' ? (
283
+ <View>
284
+ <ColorTempAdjustView
285
+ isSupportBrightness={props.isSupportBrightness}
286
+ isSupportTemperature={props.isSupportTemperature}
287
+ colorTemp={deviceData.temperature}
288
+ brightness={deviceData.brightness}
289
+ onBrightnessChangeComplete={bright => {
290
+ state.deviceData.brightness = bright;
291
+ state.manualFlag = Symbol()
292
+ }}
293
+ onCCTChangeComplete={cct => {
294
+ state.deviceData.temperature = cct;
295
+ state.manualFlag = Symbol()
296
+ }}
297
+ />
298
+ <Spacer height={cx(16)} />
299
+ </View>
300
+ ) : (
301
+ <View>
302
+ <StripAdjustView
303
+ isSupportBrightness={false}
304
+ isSupportTemperature={false}
305
+ lampTabs={tabList}
306
+ reserveSV={true}
307
+ activeKey={deviceData.activeKey}
308
+ colorDiskActiveKey={deviceData.colorDiskActiveKey}
309
+ onActiveKeyChange={(activekey) => {
310
+ console.log(activekey, '< -- activeKey')
311
+ state.deviceData = {
312
+ ...state.deviceData,
313
+ activeKey: Number(activekey)
314
+ }
315
+ state.manualFlag = Symbol()
316
+ }}
317
+ onColorDiskChange={(colors, idx) => {
318
+ state.deviceData = {
319
+ ...state.deviceData,
320
+ colors,
321
+ colorDiskActiveKey: idx
322
+ }
323
+ state.manualFlag = Symbol()
324
+ }}
325
+ h={deviceData.h}
326
+ s={deviceData.s}
327
+ v={deviceData.v}
328
+ brightness={deviceData.brightness}
329
+ colorTemp={deviceData.temperature}
330
+ onHSVChangeComplete={(h, s, v) => {
331
+ state.deviceData.h = h;
332
+ state.deviceData.s = s;
333
+ state.deviceData.v = v;
334
+ state.manualFlag = Symbol()
335
+ }}
336
+ onBrightnessChangeComplete={bright => {
337
+ state.deviceData.brightness = bright;
338
+ state.manualFlag = Symbol()
339
+ }}
340
+ onCCTChangeComplete={cct => {
341
+ state.deviceData.temperature = cct;
342
+ state.manualFlag = Symbol()
343
+ }}
344
+ />
345
+ <Spacer />
346
+ </View>
347
+ ))}
348
+ <ApplyForDeviceList
349
+ devices={cloneDeep(groupDevices)}
350
+ />
351
+ <Spacer height={cx(16)} />
352
+ </Card>
353
+ <Spacer />
354
+ </View>
355
+ ))}
356
+ </View>
357
+ )
358
+ }, [state.deviceData, state.applyForList])
359
+
360
+ const componentRender = useMemo(() => {
361
+ const component =
362
+ props.manualData.type === DeviceType.MixLight
363
+ ? mixLightCard
364
+ : props.manualData.type === DeviceType.StripLight
365
+ ? stripLightCard
366
+ : props.manualData.type === DeviceType.CeilingLight
367
+ ? ceilingLightCard
368
+ : lightSourceCard;
369
+ return component;
370
+ }, [props.manualData.type, state.applyForList, state.deviceData]);
371
+
372
+
373
+ return <View>{componentRender}</View>;
374
+ }
375
+
376
+ export default memo(ManualSettings);
@@ -0,0 +1,109 @@
1
+ import React from "react";
2
+ import { ViewStyle, View, Text, StyleSheet } from "react-native";
3
+ import Card from "@ledvance/base/src/components/Card";
4
+ import { SwitchButton, Utils } from 'tuya-panel-kit';
5
+ import { convertTo12HourFormat, loopText } from '@ledvance/base/src/utils/common';
6
+ import { Timer } from "@ledvance/group-ui-biz-bundle/src/modules/timeSchedule/Interface";
7
+ import { useSystemTimeFormate } from "@ledvance/base/src/models/modules/NativePropsSlice";
8
+ const { convertX: cx } = Utils.RatioUtils;
9
+
10
+ interface ScheduleCardProps {
11
+ item: Timer
12
+ style?: ViewStyle
13
+ onEnableChange: (enable: boolean) => void
14
+ onPress: (item: any) => void
15
+ }
16
+
17
+ const ScheduleCard = (props: ScheduleCardProps) => {
18
+ const { item, style, onEnableChange, onPress } = props;
19
+ const is24HourClock = useSystemTimeFormate()
20
+ return (
21
+ <Card
22
+ style={styles.card}
23
+ containerStyle={[styles.container, style]}
24
+ onPress={() => {
25
+ onPress(item);
26
+ }}
27
+ >
28
+ <View style={styles.infoContainer}>
29
+ <Text style={styles.time}>{is24HourClock ? item.time : convertTo12HourFormat(item.time)}</Text>
30
+ <Text style={styles.loop}>
31
+ {loopText(item.loops.split('').map(loop => parseInt(loop)), item.time)}
32
+ </Text>
33
+ <Text style={styles.name}>{item.aliasName}</Text>
34
+ {/* {showTags() && <View style={styles.typeContainer}>
35
+ {renderTag()}
36
+ </View>} */}
37
+ </View>
38
+ <View style={styles.switchContainer}>
39
+ <SwitchButton
40
+ value={!!item.status}
41
+ thumbStyle={{ elevation: 0 }}
42
+ onValueChange={() => {
43
+ onEnableChange(!item.status);
44
+ }}
45
+ />
46
+ </View>
47
+ </Card>
48
+ )
49
+
50
+ }
51
+
52
+ const styles = StyleSheet.create({
53
+ card: {
54
+ marginHorizontal: cx(24),
55
+ borderRadius: cx(8),
56
+ },
57
+ container: {
58
+ flexDirection: 'row',
59
+ justifyContent: 'space-between',
60
+ },
61
+ infoContainer: {
62
+ flex: 1,
63
+ marginTop: cx(16),
64
+ marginBottom: cx(16),
65
+ flexDirection: 'column',
66
+ marginLeft: cx(16),
67
+ },
68
+ time: {
69
+ marginBottom: cx(5),
70
+ fontSize: 16,
71
+ fontFamily: 'helvetica_neue_lt_std_bd',
72
+ fontWeight: 'bold',
73
+ },
74
+ loop: {
75
+ color: '#000',
76
+ fontSize: cx(14),
77
+ fontFamily: 'helvetica_neue_lt_std_bd',
78
+ marginTop: cx(8),
79
+ },
80
+ name: {
81
+ color: '#000',
82
+ fontSize: cx(14),
83
+ fontFamily: 'helvetica_neue_lt_std_bd',
84
+ marginTop: cx(8),
85
+ },
86
+ switchContainer: {
87
+ marginRight: cx(16),
88
+ // backgroundColor: 'red',
89
+ marginTop: cx(16),
90
+ },
91
+ switch: {},
92
+ typeContainer: {
93
+ flexDirection: 'row',
94
+ marginTop: cx(8),
95
+ },
96
+ typeWrap: {
97
+ backgroundColor: '#E6E7E8',
98
+ marginRight: cx(10),
99
+ borderRadius: cx(10),
100
+ },
101
+ typeText: {
102
+ fontSize: cx(12),
103
+ color: '#000',
104
+ paddingHorizontal: cx(8),
105
+ paddingVertical: cx(2)
106
+ }
107
+ });
108
+
109
+ export default ScheduleCard