@ledvance/ui-biz-bundle 1.0.84 → 1.0.86
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
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useDp } from "@ledvance/base/src/models/modules/NativePropsSlice"
|
|
2
|
+
import { Result } from "@ledvance/base/src/models/modules/Result"
|
|
3
|
+
|
|
4
|
+
export interface PowerBehaviorPageParams {
|
|
5
|
+
powerBehaviorCode: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
type PowerBehaviorType = 'off' | 'on' | 'memory'
|
|
9
|
+
|
|
10
|
+
export const usePowerBehavior = (code: string): [PowerBehaviorType, (v: PowerBehaviorType) => Promise<Result<any>>] => {
|
|
11
|
+
return useDp(code)
|
|
12
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from 'react'
|
|
2
|
+
import { Image, ScrollView, StyleSheet, Text, TouchableOpacity, View, ViewProps } from 'react-native'
|
|
3
|
+
import Page from '@ledvance/base/src/components/Page'
|
|
4
|
+
import { useDeviceInfo } from '@ledvance/base/src/models/modules/NativePropsSlice'
|
|
5
|
+
import I18n from '@ledvance/base/src/i18n'
|
|
6
|
+
import { PowerBehaviorPageParams, usePowerBehavior } from './powerOnBehaviorActions'
|
|
7
|
+
import { Utils } from 'tuya-panel-kit'
|
|
8
|
+
import Spacer from '@ledvance/base/src/components/Spacer'
|
|
9
|
+
import Card from '@ledvance/base/src/components/Card'
|
|
10
|
+
import res from '@ledvance/base/src/res'
|
|
11
|
+
import { useReactive, useUpdateEffect } from 'ahooks'
|
|
12
|
+
|
|
13
|
+
const { convertX: cx } = Utils.RatioUtils
|
|
14
|
+
|
|
15
|
+
const RELAY_STATUS_OFF = 'off'
|
|
16
|
+
const RELAY_STATUS_ON = 'on'
|
|
17
|
+
const RELAY_STATUS_MEMORY = 'memory'
|
|
18
|
+
|
|
19
|
+
const PowerOnBehaviorPage = (props: PowerBehaviorPageParams) => {
|
|
20
|
+
const deviceInfo = useDeviceInfo()
|
|
21
|
+
const [powerMemory, setPowerMemory] = usePowerBehavior(props.powerBehaviorCode)
|
|
22
|
+
|
|
23
|
+
const state = useReactive({
|
|
24
|
+
powerMemory,
|
|
25
|
+
loading: false,
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
useUpdateEffect(() => {
|
|
29
|
+
state.powerMemory = powerMemory
|
|
30
|
+
}, [powerMemory])
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<Page
|
|
34
|
+
backText={deviceInfo.name}
|
|
35
|
+
headlineText={I18n.getLang('light_sources_specific_settings_power_off')}
|
|
36
|
+
loading={state.loading}>
|
|
37
|
+
<ScrollView style={styles.root} nestedScrollEnabled={true}>
|
|
38
|
+
<Spacer />
|
|
39
|
+
<View style={styles.modeSelectGroup}>
|
|
40
|
+
<Spacer height={cx(8)} />
|
|
41
|
+
<Text style={styles.modeTip}>
|
|
42
|
+
{I18n.getLang('socket_settings_firstbox_topic')}
|
|
43
|
+
</Text>
|
|
44
|
+
<Spacer height={cx(8)} />
|
|
45
|
+
<Card style={styles.modeSelectCard}>
|
|
46
|
+
<Spacer height={cx(12)} />
|
|
47
|
+
<PowerOnBehaviorModeItem
|
|
48
|
+
enable={state.powerMemory === RELAY_STATUS_OFF}
|
|
49
|
+
title={I18n.getLang('feature_summary_action_txt_2')}
|
|
50
|
+
content={I18n.getLang('socket_settings_firstbox_status1_description')}
|
|
51
|
+
onPress={async () => {
|
|
52
|
+
state.powerMemory = RELAY_STATUS_OFF
|
|
53
|
+
await setPowerMemory(state.powerMemory)
|
|
54
|
+
}} />
|
|
55
|
+
<View style={styles.line} />
|
|
56
|
+
<Spacer height={cx(8)} />
|
|
57
|
+
<PowerOnBehaviorModeItem
|
|
58
|
+
enable={state.powerMemory === RELAY_STATUS_ON}
|
|
59
|
+
title={I18n.getLang('feature_summary_action_txt_1')}
|
|
60
|
+
content={I18n.getLang('socket_settings_firstbox_status2_description')}
|
|
61
|
+
onPress={async () => {
|
|
62
|
+
state.powerMemory = RELAY_STATUS_ON
|
|
63
|
+
await setPowerMemory(state.powerMemory)
|
|
64
|
+
}} />
|
|
65
|
+
<View style={styles.line} />
|
|
66
|
+
<Spacer height={cx(8)} />
|
|
67
|
+
<PowerOnBehaviorModeItem
|
|
68
|
+
enable={state.powerMemory === RELAY_STATUS_MEMORY}
|
|
69
|
+
title={I18n.getLang('sockets_specific_settings_relay_status_remember')}
|
|
70
|
+
content={I18n.getLang('socket_settings_firstbox_status3_description')}
|
|
71
|
+
onPress={async () => {
|
|
72
|
+
state.powerMemory = RELAY_STATUS_MEMORY
|
|
73
|
+
await setPowerMemory(state.powerMemory)
|
|
74
|
+
}} />
|
|
75
|
+
<Spacer height={cx(4)} />
|
|
76
|
+
</Card>
|
|
77
|
+
<Spacer height={cx(8)} />
|
|
78
|
+
</View>
|
|
79
|
+
</ScrollView>
|
|
80
|
+
</Page>
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
interface PowerOnBehaviorModeItemProps extends PropsWithChildren<ViewProps> {
|
|
85
|
+
onPress: () => void
|
|
86
|
+
title: string
|
|
87
|
+
content: string
|
|
88
|
+
enable: boolean
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function PowerOnBehaviorModeItem(props: PowerOnBehaviorModeItemProps) {
|
|
92
|
+
return (
|
|
93
|
+
<TouchableOpacity onPress={props.onPress}>
|
|
94
|
+
<View style={styles.itemRoot}>
|
|
95
|
+
<View style={styles.itemTextGroup}>
|
|
96
|
+
<Text style={styles.itemTitle}>{props.title}</Text>
|
|
97
|
+
<Spacer height={cx(4)} />
|
|
98
|
+
<Text style={styles.itemContent}>{props.content}</Text>
|
|
99
|
+
</View>
|
|
100
|
+
<Image
|
|
101
|
+
source={{ uri: res.ic_check }}
|
|
102
|
+
style={[
|
|
103
|
+
styles.itemCheckedIcon,
|
|
104
|
+
{
|
|
105
|
+
display: props.enable ? 'flex' : 'none',
|
|
106
|
+
},
|
|
107
|
+
]} />
|
|
108
|
+
</View>
|
|
109
|
+
</TouchableOpacity>
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const styles = StyleSheet.create({
|
|
114
|
+
root: {
|
|
115
|
+
flex: 1,
|
|
116
|
+
},
|
|
117
|
+
tipText: {
|
|
118
|
+
marginHorizontal: cx(24),
|
|
119
|
+
color: '#000',
|
|
120
|
+
fontSize: cx(14),
|
|
121
|
+
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
122
|
+
},
|
|
123
|
+
modeSelectGroup: {
|
|
124
|
+
marginHorizontal: cx(24),
|
|
125
|
+
backgroundColor: '#f6f6f6',
|
|
126
|
+
borderRadius: cx(4),
|
|
127
|
+
},
|
|
128
|
+
modeTip: {
|
|
129
|
+
marginHorizontal: cx(8),
|
|
130
|
+
color: '#000',
|
|
131
|
+
fontSize: cx(14),
|
|
132
|
+
fontWeight: 'bold',
|
|
133
|
+
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
134
|
+
},
|
|
135
|
+
modeSelectCard: {
|
|
136
|
+
marginHorizontal: cx(8),
|
|
137
|
+
},
|
|
138
|
+
line: {
|
|
139
|
+
height: cx(1),
|
|
140
|
+
marginHorizontal: cx(12),
|
|
141
|
+
backgroundColor: '#3C3C435B',
|
|
142
|
+
},
|
|
143
|
+
itemRoot: {
|
|
144
|
+
flexDirection: 'row',
|
|
145
|
+
alignItems: 'center',
|
|
146
|
+
paddingHorizontal: cx(12),
|
|
147
|
+
paddingBottom: cx(8),
|
|
148
|
+
},
|
|
149
|
+
itemTextGroup: {
|
|
150
|
+
flex: 1,
|
|
151
|
+
marginEnd: cx(12),
|
|
152
|
+
justifyContent: 'center',
|
|
153
|
+
},
|
|
154
|
+
itemTitle: {
|
|
155
|
+
color: '#000',
|
|
156
|
+
fontSize: cx(14),
|
|
157
|
+
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
158
|
+
},
|
|
159
|
+
itemContent: {
|
|
160
|
+
color: '#666',
|
|
161
|
+
fontSize: cx(14),
|
|
162
|
+
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
163
|
+
},
|
|
164
|
+
itemCheckedIcon: {
|
|
165
|
+
width: cx(32),
|
|
166
|
+
height: cx(32),
|
|
167
|
+
marginEnd: cx(4),
|
|
168
|
+
},
|
|
169
|
+
})
|
|
170
|
+
|
|
171
|
+
export default PowerOnBehaviorPage
|
|
@@ -29,9 +29,9 @@ const MoodSetting = (props: MoodSettingProps) => {
|
|
|
29
29
|
const isUVCFan = isUVCFanDevice()
|
|
30
30
|
const state = useReactive({
|
|
31
31
|
scenes: moods,
|
|
32
|
-
staticTagChecked:
|
|
33
|
-
dynamicTagChecked:
|
|
34
|
-
filteredMoods: moods,
|
|
32
|
+
staticTagChecked: true,
|
|
33
|
+
dynamicTagChecked: true,
|
|
34
|
+
filteredMoods: cloneDeep(moods),
|
|
35
35
|
currentScene: !isEmpty(actionScene) ? actionScene : moods[0]
|
|
36
36
|
})
|
|
37
37
|
|
|
@@ -61,8 +61,7 @@ const MoodSetting = (props: MoodSettingProps) => {
|
|
|
61
61
|
}, isUVCFan).then(res => {
|
|
62
62
|
if (res.success && res.data) {
|
|
63
63
|
state.scenes = cloneDeep(res.data)
|
|
64
|
-
|
|
65
|
-
setMoods(res.data)
|
|
64
|
+
setMoods(cloneDeep(res.data))
|
|
66
65
|
if(isEmpty(actionScene)) state.currentScene = cloneDeep(res.data[0])
|
|
67
66
|
setSendDps(state.currentScene, 'actionScene')
|
|
68
67
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {NavigationRoute, TransitionPresets} from 'tuya-panel-kit'
|
|
1
|
+
import { NavigationRoute, TransitionPresets } from 'tuya-panel-kit'
|
|
2
2
|
import TimeSchedulePage from '../modules/timeSchedule/TimeSchedulePage'
|
|
3
3
|
import TimeScheduleEditPage from '../modules/timeSchedule/TimeScheduleEditpage'
|
|
4
4
|
import DynamicMoodEditorPage from '../modules/mood/DynamicMoodEditorPage'
|
|
@@ -19,6 +19,8 @@ import FixedTimePage from '../modules/fixedTime/FixedTimePage'
|
|
|
19
19
|
import FixedTimeDetailPage from '../modules/fixedTime/FixedTimeDetailPage'
|
|
20
20
|
import RandomTimePage from 'modules/randomTime/RandomTimePage'
|
|
21
21
|
import RandomTimeDetailPage from '../modules/randomTime/RandomTimeDetailPage'
|
|
22
|
+
import HistoryPage from '../modules/history/HistoryPage'
|
|
23
|
+
import PowerOnBehaviorPage from '../modules/powerOnBehavior/PowerOnBehaviorPage'
|
|
22
24
|
|
|
23
25
|
export const ui_biz_routerKey = {
|
|
24
26
|
'ui_biz_time_schedule': 'ui_biz_time_schedule',
|
|
@@ -40,7 +42,9 @@ export const ui_biz_routerKey = {
|
|
|
40
42
|
'ui_biz_fixed_time': 'ui_biz_fixed_time',
|
|
41
43
|
'ui_biz_fixed_time_edit': 'ui_biz_fixed_time_edit',
|
|
42
44
|
'ui_biz_random_time': 'ui_biz_random_time',
|
|
43
|
-
'ui_biz_random_time_edit': 'ui_biz_random_time_edit'
|
|
45
|
+
'ui_biz_random_time_edit': 'ui_biz_random_time_edit',
|
|
46
|
+
'ui_biz_history': 'ui_biz_history',
|
|
47
|
+
'ui_biz_power_behavior': 'ui_biz_power_behavior'
|
|
44
48
|
}
|
|
45
49
|
|
|
46
50
|
export const BiologicalRouters: NavigationRoute[] = [
|
|
@@ -238,4 +242,26 @@ export const RandomTimePageRouters: NavigationRoute[] = [
|
|
|
238
242
|
showOfflineView: false,
|
|
239
243
|
},
|
|
240
244
|
}
|
|
245
|
+
]
|
|
246
|
+
|
|
247
|
+
export const HistoryPageRouters: NavigationRoute[] = [
|
|
248
|
+
{
|
|
249
|
+
name: ui_biz_routerKey.ui_biz_history,
|
|
250
|
+
component: HistoryPage,
|
|
251
|
+
options: {
|
|
252
|
+
hideTopbar: true,
|
|
253
|
+
showOfflineView: false,
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
]
|
|
257
|
+
|
|
258
|
+
export const PowerOnBehaviorPageRouters: NavigationRoute[] = [
|
|
259
|
+
{
|
|
260
|
+
name: ui_biz_routerKey.ui_biz_power_behavior,
|
|
261
|
+
component: PowerOnBehaviorPage,
|
|
262
|
+
options: {
|
|
263
|
+
hideTopbar: true,
|
|
264
|
+
showOfflineView: false,
|
|
265
|
+
}
|
|
266
|
+
}
|
|
241
267
|
]
|