@ledvance/group-ui-biz-bundle 1.0.73 → 1.0.76
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/modules/biorhythm/BiorhythmDetailPage.tsx +1 -1
- package/src/modules/biorhythm/circular/Progress.tsx +2 -2
- package/src/modules/energyConsumption/EnergyConsumptionChart.tsx +22 -30
- package/src/modules/energyConsumption/EnergyConsumptionDetail.tsx +2 -2
- package/src/modules/energyConsumption/EnergyConsumptionPage.tsx +1 -1
- package/src/modules/energyConsumption/component/Overview.tsx +1 -1
- package/src/modules/fixedTimeForPlug/FixedTimeForPlugDetailPage.tsx +68 -87
- package/src/modules/fixedTimeForPlug/FixedTimeForPlugPage.tsx +44 -58
- package/src/modules/fixedTimeForPlug/ItemCard.tsx +29 -26
- package/src/modules/fixedTimeForPlug/Summary.tsx +62 -58
- package/src/modules/fixedTimingForLight/FixedTimingForLightDetailPage.tsx +2 -2
- package/src/modules/lightMode/LightModePage.tsx +2 -2
- package/src/modules/mood_new/MoodInfo.ts +170 -18
- package/src/modules/mood_new/StaticMoodEditorPage.tsx +8 -0
- package/src/modules/overchargeSwitch/OverchargeSwitchPage.tsx +5 -2
- package/src/modules/randomTimeForPlug/ItemCard.tsx +29 -26
- package/src/modules/randomTimeForPlug/RandomTimeForPlugDetailPage.tsx +47 -82
- package/src/modules/randomTimeForPlug/RandomTimeForPlugPage.tsx +58 -67
- package/src/modules/randomTimeForPlug/Summary.tsx +62 -58
- package/src/modules/randomTimingForLight/RandomTimingForLightDetailPage.tsx +2 -2
- package/src/modules/sleepWakeUp/SleepWakeUpDetailPage.tsx +35 -28
- package/src/modules/sleepWakeUp/SleepWakeUpPage.tsx +1 -1
- package/src/modules/swithInching/SwithInching.tsx +3 -2
- package/src/modules/timeSchedule/Interface.ts +3 -1
- package/src/modules/timeSchedule/TimeScheduleDetailPage.tsx +175 -190
- package/src/modules/timeSchedule/TimeSchedulePage.tsx +55 -54
- package/src/modules/timeSchedule/components/ManuaSettings.tsx +11 -10
- package/src/modules/timeSchedule/components/ScheduleCard.tsx +47 -63
- package/src/modules/timeSchedule/components/Summary.tsx +63 -59
- package/src/modules/timer/TimerAction.ts +22 -3
- package/src/modules/timer/TimerPage.tsx +120 -117
- package/src/modules/swithInching/pickerView.tsx +0 -91
|
@@ -22,6 +22,7 @@ import { ui_biz_routerKey } from "../../navigation/Routers";
|
|
|
22
22
|
import { ApplyForItem } from '@ledvance/base/src/utils/interface';
|
|
23
23
|
|
|
24
24
|
const { convertX: cx } = Utils.RatioUtils;
|
|
25
|
+
const { withTheme } = Utils.ThemeUtils
|
|
25
26
|
const MAX_NUM = 30;
|
|
26
27
|
|
|
27
28
|
export interface TimeSchedulePageParams {
|
|
@@ -42,7 +43,7 @@ export interface TimeSchedulePageParams {
|
|
|
42
43
|
manualDataObj2Dp: (deviceState: DeviceStateType, applyForList: ApplyForItem[]) => Record<string, any>;
|
|
43
44
|
}
|
|
44
45
|
|
|
45
|
-
const TimeSchedulePage = () => {
|
|
46
|
+
const TimeSchedulePage = (props: { theme?: any }) => {
|
|
46
47
|
const deviceInfo = useDeviceInfo();
|
|
47
48
|
const navigation = useNavigation();
|
|
48
49
|
const uaGroupInfo = useUAGroupInfo()
|
|
@@ -117,6 +118,29 @@ const TimeSchedulePage = () => {
|
|
|
117
118
|
}
|
|
118
119
|
}
|
|
119
120
|
|
|
121
|
+
const styles = StyleSheet.create({
|
|
122
|
+
overviewDescription: {
|
|
123
|
+
color: props.theme.global.fontColor,
|
|
124
|
+
marginHorizontal: cx(24),
|
|
125
|
+
fontSize: cx(12)
|
|
126
|
+
},
|
|
127
|
+
emptyImage: {
|
|
128
|
+
width: cx(225),
|
|
129
|
+
height: cx(198),
|
|
130
|
+
},
|
|
131
|
+
emptyContainer: {
|
|
132
|
+
marginHorizontal: cx(24),
|
|
133
|
+
alignItems: 'center',
|
|
134
|
+
},
|
|
135
|
+
addBtn: {
|
|
136
|
+
height: cx(40),
|
|
137
|
+
width: 'auto',
|
|
138
|
+
minWidth: cx(150),
|
|
139
|
+
paddingHorizontal: cx(16),
|
|
140
|
+
backgroundColor: props.theme.button.primary,
|
|
141
|
+
},
|
|
142
|
+
})
|
|
143
|
+
|
|
120
144
|
return (
|
|
121
145
|
<Page
|
|
122
146
|
backText={deviceInfo.name}
|
|
@@ -138,36 +162,36 @@ const TimeSchedulePage = () => {
|
|
|
138
162
|
text={I18n.getLang('motion_detection_time_schedule_notifications_warning_text')}
|
|
139
163
|
icon={res.ic_warning_amber}
|
|
140
164
|
style={{ marginHorizontal: cx(24) }}
|
|
141
|
-
textStyle={{ color:
|
|
142
|
-
iconStyle={{ tintColor:
|
|
165
|
+
textStyle={{ color: props.theme.global.secondFontColor, fontSize: cx(12) }}
|
|
166
|
+
iconStyle={{ tintColor: props.theme.global.warning }}
|
|
143
167
|
/>
|
|
144
168
|
)}
|
|
145
169
|
{ state.timeScheduleList.length > 0 ?
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
170
|
+
<FlatList
|
|
171
|
+
data={state.timeScheduleList}
|
|
172
|
+
renderItem={({ item }) => (
|
|
173
|
+
<ScheduleCard
|
|
174
|
+
item={item}
|
|
175
|
+
onEnableChange={async enable => {
|
|
176
|
+
state.loading = true;
|
|
177
|
+
await modDeleteTimeSchedule('del', {
|
|
178
|
+
...item,
|
|
179
|
+
status: enable ? 1 : 0,
|
|
180
|
+
}, item.id.toString());
|
|
181
|
+
item.status = enable ? 1 : 0
|
|
182
|
+
state.loading = false;
|
|
183
|
+
}}
|
|
184
|
+
onPress={() => {
|
|
185
|
+
navigateToEdit('edit', item);
|
|
186
|
+
}}
|
|
187
|
+
/>
|
|
188
|
+
)}
|
|
189
|
+
keyExtractor={item => item.id.toString()}
|
|
190
|
+
ListEmptyComponent={<Spacer />}
|
|
191
|
+
ListHeaderComponent={() => <Spacer height={cx(10)} />}
|
|
192
|
+
ItemSeparatorComponent={() => <Spacer />}
|
|
193
|
+
ListFooterComponent={() => <Spacer height={cx(30)} />}
|
|
194
|
+
/> :
|
|
171
195
|
<View style={styles.emptyContainer}>
|
|
172
196
|
<Spacer height={cx(60)}/>
|
|
173
197
|
<Image
|
|
@@ -179,8 +203,8 @@ const TimeSchedulePage = () => {
|
|
|
179
203
|
icon={res.device_panel_schedule_alert}
|
|
180
204
|
text={I18n.getLang('timeschedule_overview_empty_information_text')}
|
|
181
205
|
style={{width: 'auto', alignItems: 'center'}}
|
|
182
|
-
textStyle={{color:
|
|
183
|
-
iconStyle={{tintColor:
|
|
206
|
+
textStyle={{color: props.theme.global.secondFontColor, fontSize: cx(12), flex: undefined}}
|
|
207
|
+
iconStyle={{tintColor: props.theme.global.secondFontColor}}
|
|
184
208
|
/>
|
|
185
209
|
<Spacer height={cx(16)}/>
|
|
186
210
|
<DeleteButton
|
|
@@ -198,27 +222,4 @@ const TimeSchedulePage = () => {
|
|
|
198
222
|
);
|
|
199
223
|
};
|
|
200
224
|
|
|
201
|
-
|
|
202
|
-
overviewDescription: {
|
|
203
|
-
color: '#000',
|
|
204
|
-
marginHorizontal: cx(24),
|
|
205
|
-
fontSize: cx(12)
|
|
206
|
-
},
|
|
207
|
-
emptyImage: {
|
|
208
|
-
width: cx(225),
|
|
209
|
-
height: cx(198),
|
|
210
|
-
},
|
|
211
|
-
emptyContainer: {
|
|
212
|
-
marginHorizontal: cx(24),
|
|
213
|
-
alignItems: 'center',
|
|
214
|
-
},
|
|
215
|
-
addBtn: {
|
|
216
|
-
height: cx(40),
|
|
217
|
-
width: 'auto',
|
|
218
|
-
minWidth: cx(150),
|
|
219
|
-
paddingHorizontal: cx(16),
|
|
220
|
-
backgroundColor: '#f60',
|
|
221
|
-
},
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
export default TimeSchedulePage;
|
|
225
|
+
export default withTheme(TimeSchedulePage)
|
|
@@ -16,6 +16,7 @@ import ApplyForDeviceList from '@ledvance/base/src/components/ApplyForDeviceList
|
|
|
16
16
|
import { cloneDeep } from 'lodash';
|
|
17
17
|
import { FanAdjustViewContent } from '@ledvance/base/src/components/FanAdjustView';
|
|
18
18
|
const { convertX: cx } = Utils.RatioUtils;
|
|
19
|
+
const { withTheme } = Utils.ThemeUtils
|
|
19
20
|
|
|
20
21
|
function ManualSettings(props: ManualSettingProps) {
|
|
21
22
|
const [groupDevices] = useGroupDevices()
|
|
@@ -72,7 +73,7 @@ function ManualSettings(props: ManualSettingProps) {
|
|
|
72
73
|
<Card style={{ marginHorizontal: cx(24) }}>
|
|
73
74
|
<LdvSwitch
|
|
74
75
|
title={item.name || item.key}
|
|
75
|
-
color={
|
|
76
|
+
color={props.theme.card.background}
|
|
76
77
|
colorAlpha={1}
|
|
77
78
|
enable={item.enable}
|
|
78
79
|
setEnable={(enable: boolean) => {
|
|
@@ -190,7 +191,7 @@ function ManualSettings(props: ManualSettingProps) {
|
|
|
190
191
|
))}
|
|
191
192
|
</View>
|
|
192
193
|
);
|
|
193
|
-
}, [state.deviceData, state.applyForList]);
|
|
194
|
+
}, [state.deviceData, state.applyForList, props.theme.card.background]);
|
|
194
195
|
|
|
195
196
|
const mixLightCard = useMemo(() => {
|
|
196
197
|
return (
|
|
@@ -200,7 +201,7 @@ function ManualSettings(props: ManualSettingProps) {
|
|
|
200
201
|
<Card style={{ marginHorizontal: cx(24) }}>
|
|
201
202
|
<LdvSwitch
|
|
202
203
|
title={item.key}
|
|
203
|
-
color={
|
|
204
|
+
color={props.theme.card.background}
|
|
204
205
|
colorAlpha={1}
|
|
205
206
|
enable={item.enable}
|
|
206
207
|
setEnable={(enable: boolean) => {
|
|
@@ -255,7 +256,7 @@ function ManualSettings(props: ManualSettingProps) {
|
|
|
255
256
|
))}
|
|
256
257
|
</View>
|
|
257
258
|
);
|
|
258
|
-
}, [state.deviceData, state.applyForList]);
|
|
259
|
+
}, [state.deviceData, state.applyForList, props.theme.card.background]);
|
|
259
260
|
|
|
260
261
|
const stripLightCard = useMemo(() => {
|
|
261
262
|
const deviceData = state.deviceData as StripLightData
|
|
@@ -264,7 +265,7 @@ function ManualSettings(props: ManualSettingProps) {
|
|
|
264
265
|
<Card style={{ marginHorizontal: cx(24) }}>
|
|
265
266
|
<LdvSwitch
|
|
266
267
|
title={I18n.getLang('light_sources_tile_tw_lighting_headline')}
|
|
267
|
-
color={
|
|
268
|
+
color={props.theme.card.background}
|
|
268
269
|
colorAlpha={1}
|
|
269
270
|
enable={state.applyForList[0]?.enable}
|
|
270
271
|
setEnable={(enable: boolean) => {
|
|
@@ -325,7 +326,7 @@ function ManualSettings(props: ManualSettingProps) {
|
|
|
325
326
|
<Spacer />
|
|
326
327
|
</View>
|
|
327
328
|
);
|
|
328
|
-
}, [state.deviceData, state.applyForList]);
|
|
329
|
+
}, [state.deviceData, state.applyForList, props.theme.card.background]);
|
|
329
330
|
|
|
330
331
|
const ceilingLightCard = useMemo(() => {
|
|
331
332
|
const deviceData = state.deviceData as CeilingLightData
|
|
@@ -336,7 +337,7 @@ function ManualSettings(props: ManualSettingProps) {
|
|
|
336
337
|
<Card style={{ marginHorizontal: cx(24) }}>
|
|
337
338
|
<LdvSwitch
|
|
338
339
|
title={item.key}
|
|
339
|
-
color={
|
|
340
|
+
color={props.theme.card.background}
|
|
340
341
|
colorAlpha={1}
|
|
341
342
|
enable={item.enable}
|
|
342
343
|
setEnable={(enable: boolean) => {
|
|
@@ -420,7 +421,7 @@ function ManualSettings(props: ManualSettingProps) {
|
|
|
420
421
|
))}
|
|
421
422
|
</View>
|
|
422
423
|
)
|
|
423
|
-
}, [state.deviceData, state.applyForList])
|
|
424
|
+
}, [state.deviceData, state.applyForList, props.theme.card.background])
|
|
424
425
|
|
|
425
426
|
const componentRender = useMemo(() => {
|
|
426
427
|
const component =
|
|
@@ -432,10 +433,10 @@ function ManualSettings(props: ManualSettingProps) {
|
|
|
432
433
|
? ceilingLightCard
|
|
433
434
|
: lightSourceCard;
|
|
434
435
|
return component;
|
|
435
|
-
}, [props.manualData.type, state.applyForList, state.deviceData]);
|
|
436
|
+
}, [props.manualData.type, state.applyForList, state.deviceData, props.theme.card.background]);
|
|
436
437
|
|
|
437
438
|
|
|
438
439
|
return <View>{componentRender}</View>;
|
|
439
440
|
}
|
|
440
441
|
|
|
441
|
-
export default memo(ManualSettings)
|
|
442
|
+
export default memo(withTheme(ManualSettings))
|
|
@@ -3,11 +3,13 @@ import { ViewStyle, View, Text, StyleSheet } from "react-native";
|
|
|
3
3
|
import Card from "@ledvance/base/src/components/Card";
|
|
4
4
|
import { SwitchButton, Utils } from 'tuya-panel-kit';
|
|
5
5
|
import { convertTo12HourFormat, loopText } from '@ledvance/base/src/utils/common';
|
|
6
|
-
import { Timer } from "
|
|
6
|
+
import { Timer } from "../Interface";
|
|
7
7
|
import { useSystemTimeFormate } from "@ledvance/base/src/models/modules/NativePropsSlice";
|
|
8
8
|
const { convertX: cx } = Utils.RatioUtils;
|
|
9
|
+
const { withTheme } = Utils.ThemeUtils
|
|
9
10
|
|
|
10
11
|
interface ScheduleCardProps {
|
|
12
|
+
theme?: any
|
|
11
13
|
item: Timer
|
|
12
14
|
style?: ViewStyle
|
|
13
15
|
onEnableChange: (enable: boolean) => void
|
|
@@ -17,6 +19,48 @@ interface ScheduleCardProps {
|
|
|
17
19
|
const ScheduleCard = (props: ScheduleCardProps) => {
|
|
18
20
|
const { item, style, onEnableChange, onPress } = props;
|
|
19
21
|
const is24HourClock = useSystemTimeFormate()
|
|
22
|
+
|
|
23
|
+
const styles = StyleSheet.create({
|
|
24
|
+
card: {
|
|
25
|
+
marginHorizontal: cx(24),
|
|
26
|
+
borderRadius: cx(8),
|
|
27
|
+
},
|
|
28
|
+
container: {
|
|
29
|
+
flexDirection: 'row',
|
|
30
|
+
justifyContent: 'space-between',
|
|
31
|
+
},
|
|
32
|
+
infoContainer: {
|
|
33
|
+
flex: 1,
|
|
34
|
+
marginTop: cx(16),
|
|
35
|
+
marginBottom: cx(16),
|
|
36
|
+
flexDirection: 'column',
|
|
37
|
+
marginLeft: cx(16),
|
|
38
|
+
},
|
|
39
|
+
time: {
|
|
40
|
+
color: props.theme.global.fontColor,
|
|
41
|
+
marginBottom: cx(5),
|
|
42
|
+
fontSize: 16,
|
|
43
|
+
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
44
|
+
fontWeight: 'bold',
|
|
45
|
+
},
|
|
46
|
+
loop: {
|
|
47
|
+
color: props.theme.global.fontColor,
|
|
48
|
+
fontSize: cx(14),
|
|
49
|
+
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
50
|
+
marginTop: cx(8),
|
|
51
|
+
},
|
|
52
|
+
name: {
|
|
53
|
+
color: props.theme.global.fontColor,
|
|
54
|
+
fontSize: cx(14),
|
|
55
|
+
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
56
|
+
marginTop: cx(8),
|
|
57
|
+
},
|
|
58
|
+
switchContainer: {
|
|
59
|
+
marginRight: cx(16),
|
|
60
|
+
marginTop: cx(16),
|
|
61
|
+
},
|
|
62
|
+
})
|
|
63
|
+
|
|
20
64
|
return (
|
|
21
65
|
<Card
|
|
22
66
|
style={styles.card}
|
|
@@ -24,16 +68,13 @@ const ScheduleCard = (props: ScheduleCardProps) => {
|
|
|
24
68
|
onPress={() => {
|
|
25
69
|
onPress(item);
|
|
26
70
|
}}
|
|
27
|
-
|
|
71
|
+
>
|
|
28
72
|
<View style={styles.infoContainer}>
|
|
29
73
|
<Text style={styles.time}>{is24HourClock ? item.time : convertTo12HourFormat(item.time)}</Text>
|
|
30
74
|
<Text style={styles.loop}>
|
|
31
75
|
{loopText(item.loops.split('').map(loop => parseInt(loop)), item.time)}
|
|
32
76
|
</Text>
|
|
33
77
|
<Text style={styles.name}>{item.aliasName}</Text>
|
|
34
|
-
{/* {showTags() && <View style={styles.typeContainer}>
|
|
35
|
-
{renderTag()}
|
|
36
|
-
</View>} */}
|
|
37
78
|
</View>
|
|
38
79
|
<View style={styles.switchContainer}>
|
|
39
80
|
<SwitchButton
|
|
@@ -49,61 +90,4 @@ const ScheduleCard = (props: ScheduleCardProps) => {
|
|
|
49
90
|
|
|
50
91
|
}
|
|
51
92
|
|
|
52
|
-
|
|
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
|
|
93
|
+
export default withTheme(ScheduleCard)
|
|
@@ -6,8 +6,10 @@ import { Utils } from "tuya-panel-kit";
|
|
|
6
6
|
import Spacer from "@ledvance/base/src/components/Spacer";
|
|
7
7
|
|
|
8
8
|
const { convertX: cx } = Utils.RatioUtils;
|
|
9
|
+
const { withTheme } = Utils.ThemeUtils
|
|
9
10
|
|
|
10
11
|
interface SummaryProps {
|
|
12
|
+
theme?: any
|
|
11
13
|
style?: ViewStyle
|
|
12
14
|
frequency?: string | ReactElement
|
|
13
15
|
time?: string | ReactElement
|
|
@@ -16,6 +18,54 @@ interface SummaryProps {
|
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
const Summary = (props: SummaryProps) => {
|
|
21
|
+
|
|
22
|
+
const styles = StyleSheet.create({
|
|
23
|
+
cardContainer: {
|
|
24
|
+
marginHorizontal: cx(24),
|
|
25
|
+
},
|
|
26
|
+
itemTitle: {
|
|
27
|
+
color: props.theme.global.fontColor,
|
|
28
|
+
fontSize: cx(16),
|
|
29
|
+
fontWeight: 'bold',
|
|
30
|
+
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
31
|
+
},
|
|
32
|
+
summaryContainer: {
|
|
33
|
+
flex: 1,
|
|
34
|
+
flexDirection: 'row',
|
|
35
|
+
marginBottom: cx(10),
|
|
36
|
+
},
|
|
37
|
+
summaryLeft: {
|
|
38
|
+
flexDirection: 'row',
|
|
39
|
+
alignItems: 'center',
|
|
40
|
+
minWidth: cx(100)
|
|
41
|
+
},
|
|
42
|
+
summaryImg: {
|
|
43
|
+
tintColor: props.theme.global.fontColor,
|
|
44
|
+
width: cx(12),
|
|
45
|
+
height: cx(12),
|
|
46
|
+
marginRight: cx(6)
|
|
47
|
+
},
|
|
48
|
+
leftTitle: {
|
|
49
|
+
fontSize: cx(14),
|
|
50
|
+
color: props.theme.global.fontColor
|
|
51
|
+
},
|
|
52
|
+
summaryRight: {
|
|
53
|
+
flex: 1,
|
|
54
|
+
flexDirection: 'column',
|
|
55
|
+
marginLeft: cx(15),
|
|
56
|
+
},
|
|
57
|
+
rightWrap: {
|
|
58
|
+
borderRadius: cx(16),
|
|
59
|
+
paddingHorizontal: cx(12),
|
|
60
|
+
alignSelf: 'flex-start',
|
|
61
|
+
backgroundColor: props.theme.tag.background,
|
|
62
|
+
},
|
|
63
|
+
rightItem: {
|
|
64
|
+
color: props.theme.tag.fontColor,
|
|
65
|
+
fontSize: cx(14)
|
|
66
|
+
},
|
|
67
|
+
})
|
|
68
|
+
|
|
19
69
|
return (
|
|
20
70
|
<View style={styles.cardContainer}>
|
|
21
71
|
<Text style={styles.itemTitle}>{I18n.getLang('add_randomtimecycle_subheadline_text')}</Text>
|
|
@@ -56,69 +106,23 @@ const Summary = (props: SummaryProps) => {
|
|
|
56
106
|
</View>
|
|
57
107
|
</View>
|
|
58
108
|
{!props.hideActions && <View style={[styles.summaryContainer, { alignItems: 'flex-start' }]}>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
109
|
+
<View style={styles.summaryLeft}>
|
|
110
|
+
<Image
|
|
111
|
+
source={res.summary_icon3}
|
|
112
|
+
resizeMode="contain"
|
|
113
|
+
style={styles.summaryImg}
|
|
114
|
+
/>
|
|
115
|
+
<View>
|
|
116
|
+
<Text style={styles.leftTitle}>{I18n.getLang('motion_detection_add_time_schedule_actions_text1')}</Text>
|
|
117
|
+
</View>
|
|
118
|
+
</View>
|
|
119
|
+
<View style={styles.summaryRight}>
|
|
120
|
+
{props.actions}
|
|
67
121
|
</View>
|
|
68
|
-
</View>
|
|
69
|
-
<View style={styles.summaryRight}>
|
|
70
|
-
{props.actions}
|
|
71
|
-
</View>
|
|
72
122
|
</View>}
|
|
73
123
|
</View>
|
|
74
124
|
</View>
|
|
75
125
|
)
|
|
76
126
|
}
|
|
77
127
|
|
|
78
|
-
|
|
79
|
-
cardContainer: {
|
|
80
|
-
marginHorizontal: cx(24),
|
|
81
|
-
},
|
|
82
|
-
itemTitle: {
|
|
83
|
-
color: '#000',
|
|
84
|
-
fontSize: cx(16),
|
|
85
|
-
fontWeight: 'bold',
|
|
86
|
-
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
87
|
-
},
|
|
88
|
-
summaryContainer: {
|
|
89
|
-
flex: 1,
|
|
90
|
-
flexDirection: 'row',
|
|
91
|
-
marginBottom: cx(10),
|
|
92
|
-
},
|
|
93
|
-
summaryLeft: {
|
|
94
|
-
flexDirection: 'row',
|
|
95
|
-
alignItems: 'center',
|
|
96
|
-
minWidth: cx(100)
|
|
97
|
-
},
|
|
98
|
-
summaryImg: {
|
|
99
|
-
width: cx(12),
|
|
100
|
-
height: cx(12),
|
|
101
|
-
marginRight: cx(6)
|
|
102
|
-
},
|
|
103
|
-
leftTitle: {
|
|
104
|
-
fontSize: cx(14),
|
|
105
|
-
color: '#000'
|
|
106
|
-
},
|
|
107
|
-
summaryRight: {
|
|
108
|
-
flex: 1,
|
|
109
|
-
flexDirection: 'column',
|
|
110
|
-
marginLeft: cx(15),
|
|
111
|
-
},
|
|
112
|
-
rightWrap: {
|
|
113
|
-
borderRadius: cx(16),
|
|
114
|
-
paddingHorizontal: cx(12),
|
|
115
|
-
alignSelf: 'flex-start',
|
|
116
|
-
backgroundColor: '#cbcbcb',
|
|
117
|
-
},
|
|
118
|
-
rightItem: {
|
|
119
|
-
color: '#000',
|
|
120
|
-
fontSize: cx(14)
|
|
121
|
-
},
|
|
122
|
-
})
|
|
123
|
-
|
|
124
|
-
export default memo(Summary)
|
|
128
|
+
export default memo(withTheme(Summary))
|
|
@@ -4,6 +4,7 @@ import dayjs from 'dayjs'
|
|
|
4
4
|
import {useCountDown, useReactive} from 'ahooks'
|
|
5
5
|
import {useEffect, useMemo} from 'react'
|
|
6
6
|
import {I18nKey} from "@ledvance/base/src/i18n/index";
|
|
7
|
+
import { NativeApi } from '@ledvance/base/src/api/native'
|
|
7
8
|
|
|
8
9
|
export interface TimerTask {
|
|
9
10
|
name: string
|
|
@@ -18,6 +19,9 @@ export interface TimerTask {
|
|
|
18
19
|
status: TaskStatus
|
|
19
20
|
stringOn: I18nKey
|
|
20
21
|
stringOff: I18nKey
|
|
22
|
+
stringOnMin: I18nKey
|
|
23
|
+
stringOffMin: I18nKey
|
|
24
|
+
cloudKey: 'lightingInfo' | 'socketInfo' | 'fanInfo' | 'plugCountDownInfo'
|
|
21
25
|
}
|
|
22
26
|
|
|
23
27
|
export enum TaskStatus {
|
|
@@ -30,7 +34,12 @@ export interface TimerConfig {
|
|
|
30
34
|
timerTasks: TimerTask[]
|
|
31
35
|
}
|
|
32
36
|
|
|
33
|
-
|
|
37
|
+
const getKey = (suffix: string, dpId: string) => {
|
|
38
|
+
const key = dpId + suffix
|
|
39
|
+
return key
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function useTimerTasks(timerSettableDps: TimerSettableDp[], devIdGroup: string[]):
|
|
34
43
|
[TimerTask[], (value: TimerTask[]) => Promise<Result<any>>, (tasks: TimerTask[]) => void] {
|
|
35
44
|
const countdowns = timerSettableDps.map(dps => {
|
|
36
45
|
const [countdown, setTargetDate] = useCountDown({ interval: 1000 })
|
|
@@ -53,6 +62,9 @@ export function useTimerTasks(timerSettableDps: TimerSettableDp[]):
|
|
|
53
62
|
status: TaskStatus.NoSelected,
|
|
54
63
|
stringOn: timerSettableDp.stringOn,
|
|
55
64
|
stringOff: timerSettableDp.stringOff,
|
|
65
|
+
stringOnMin: timerSettableDp.stringOnMin,
|
|
66
|
+
stringOffMin: timerSettableDp.stringOffMin,
|
|
67
|
+
cloudKey: timerSettableDp.cloudKey,
|
|
56
68
|
}))
|
|
57
69
|
}, [JSON.stringify(timerSettableDps)])
|
|
58
70
|
|
|
@@ -64,6 +76,9 @@ export function useTimerTasks(timerSettableDps: TimerSettableDp[]):
|
|
|
64
76
|
const dps = {}
|
|
65
77
|
timerTasks.forEach(task => {
|
|
66
78
|
dps[task.dp.code] = task.duration
|
|
79
|
+
devIdGroup.forEach(devId => {
|
|
80
|
+
NativeApi.putJson(devId, task.cloudKey, JSON.stringify({ [getKey('Status', task.dp.code)]: !!task.duration, [getKey('StartTime', task.dp.code)]: task.startTime, progressAllNumber: task.duration }))
|
|
81
|
+
})
|
|
67
82
|
})
|
|
68
83
|
return dps
|
|
69
84
|
},
|
|
@@ -157,10 +172,14 @@ export interface TimerSettableDp {
|
|
|
157
172
|
}
|
|
158
173
|
stringOn: I18nKey
|
|
159
174
|
stringOff: I18nKey
|
|
175
|
+
stringOnMin: I18nKey
|
|
176
|
+
stringOffMin: I18nKey
|
|
177
|
+
cloudKey: 'lightingInfo' | 'socketInfo' | 'fanInfo' | 'plugCountDownInfo'
|
|
160
178
|
}
|
|
161
179
|
|
|
162
180
|
export interface TimerPageParams {
|
|
163
181
|
timerSettableDps: TimerSettableDp[]
|
|
182
|
+
devIdGroup: string[]
|
|
164
183
|
}
|
|
165
184
|
|
|
166
185
|
export function timeFormatToRealTime(mCountdown: number) {
|
|
@@ -170,7 +189,7 @@ export function timeFormatToRealTime(mCountdown: number) {
|
|
|
170
189
|
return `${after.getHours()}:${after.getMinutes().toString().padStart(2, '0')}`
|
|
171
190
|
}
|
|
172
191
|
|
|
173
|
-
export function timeFormat(time: number): string {
|
|
192
|
+
export function timeFormat(time: number, hideUnit?: boolean): string {
|
|
174
193
|
let hour = Math.trunc(time / 3600)
|
|
175
194
|
const beforeMin = (time % 3600) / 60
|
|
176
195
|
let min = Math.ceil(beforeMin)
|
|
@@ -178,5 +197,5 @@ export function timeFormat(time: number): string {
|
|
|
178
197
|
hour += 1
|
|
179
198
|
min = 0
|
|
180
199
|
}
|
|
181
|
-
return `${hour > 0 ? `${hour} h ` : ''}${min > 0 ? `${min} min` : ''}`
|
|
200
|
+
return `${hour > 0 ? `${hour} h ` : ''}${min > 0 ? `${min} ${hideUnit ? '' : 'min'}` : ''}`
|
|
182
201
|
}
|