@ledvance/ui-biz-bundle 1.1.87 → 1.1.89
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/flags/FlagHash.ts +346 -0
- package/src/modules/flags/FlagPage.tsx +10 -2
- package/src/modules/history/HistoryPage.tsx +233 -223
- package/src/modules/history/SwitchHistoryPageActions.ts +5 -5
- package/src/modules/timer/TimerPage.tsx +2 -2
- package/src/modules/timer/TimerPageAction.ts +2 -2
- package/src/newModules/biorhythm/BiorhythmEditPage.tsx +1 -1
- package/src/newModules/biorhythm/BiorhythmPage.tsx +1 -1
- package/src/newModules/energyConsumption/EnergyConsumptionChart.tsx +22 -30
- package/src/newModules/energyConsumption/EnergyConsumptionDetail.tsx +5 -5
- package/src/newModules/energyConsumption/EnergyConsumptionPage.tsx +4 -4
- package/src/newModules/energyConsumption/component/EnergyModal.tsx +1 -1
- package/src/newModules/energyConsumption/component/Overview.tsx +1 -1
- package/src/newModules/fixedTime/FixedTimeDetailPage.tsx +9 -11
- package/src/newModules/mood/MoodActions.ts +13 -6
- package/src/newModules/mood/MoodInfo.ts +170 -18
- package/src/newModules/mood/MoodPage.tsx +69 -53
- package/src/newModules/mood/StaticMoodEditorPage.tsx +8 -0
- package/src/newModules/randomTime/RandomTimeDetailPage.tsx +2 -1
- package/src/newModules/randomTime/RandomTimePage.tsx +1 -1
- package/src/newModules/sleepWakeUp/Interface.ts +2 -0
- package/src/newModules/sleepWakeUp/SleepWakeUpActions.ts +21 -6
- package/src/newModules/sleepWakeUp/SleepWakeUpDetailPage.tsx +10 -33
- package/src/newModules/sleepWakeUp/SleepWakeUpPage.tsx +4 -3
- package/src/newModules/swithInching/SwithInching.tsx +4 -4
- package/src/newModules/timeSchedule/TimeScheduleDetailPage.tsx +1 -1
- package/src/newModules/timeSchedule/TimeSchedulePage.tsx +1 -1
|
@@ -1,249 +1,259 @@
|
|
|
1
1
|
import Page from '@ledvance/base/src/components/Page'
|
|
2
|
-
import {useDeviceInfo} from '@ledvance/base/src/models/modules/NativePropsSlice'
|
|
3
|
-
import React, {useCallback, useEffect} from 'react'
|
|
4
|
-
import I18n from '@ledvance/base/src/i18n'
|
|
5
|
-
import {getSwitchHistoryData, SwitchHistoryUIItemData} from './SwitchHistoryPageActions'
|
|
2
|
+
import { useDeviceInfo } from '@ledvance/base/src/models/modules/NativePropsSlice'
|
|
3
|
+
import React, { useCallback, useEffect } from 'react'
|
|
4
|
+
import I18n, { I18nKey } from '@ledvance/base/src/i18n'
|
|
5
|
+
import { getSwitchHistoryData, SwitchHistoryUIItemData } from './SwitchHistoryPageActions'
|
|
6
6
|
import res from '@ledvance/base/src/res'
|
|
7
|
-
import {Utils} from 'tuya-panel-kit'
|
|
8
|
-
import {useReactive} from 'ahooks'
|
|
9
|
-
import {FlatList, Image, StyleSheet, Text, View} from 'react-native'
|
|
7
|
+
import { Utils } from 'tuya-panel-kit'
|
|
8
|
+
import { useReactive } from 'ahooks'
|
|
9
|
+
import { FlatList, Image, StyleSheet, Text, View } from 'react-native'
|
|
10
10
|
import Spacer from '@ledvance/base/src/components/Spacer'
|
|
11
|
-
import {RouteProp, useRoute} from '@react-navigation/core'
|
|
12
11
|
import { isEmpty } from 'lodash'
|
|
13
12
|
import Tag from "@ledvance/base/src/components/Tag"
|
|
14
13
|
import { exportHistoryFile } from '@ledvance/base/src/utils/common'
|
|
14
|
+
import { useParams } from '@ledvance/base/src/hooks/Hooks'
|
|
15
15
|
|
|
16
16
|
const cx = Utils.RatioUtils.convertX
|
|
17
17
|
|
|
18
|
-
type SwitchHistoryPageRouteParams = {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
export type SwitchHistoryPageRouteParams = {
|
|
19
|
+
dpIds: string[],
|
|
20
|
+
tags?: object,
|
|
21
|
+
headlineText?: string,
|
|
22
|
+
backText?: string,
|
|
23
|
+
showLimit?: boolean,
|
|
24
|
+
getActionsText: (dpData: any) => I18nKey
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
const SwitchHistoryPage = () => {
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
const deviceInfo = useDeviceInfo()
|
|
29
|
+
const { dpIds, tags, headlineText, backText, showLimit, getActionsText } = useParams<SwitchHistoryPageRouteParams>()
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
31
|
+
const state = useReactive<SwitchHistoryPageState>({
|
|
32
|
+
refreshing: true,
|
|
33
|
+
refreshType: 'refresh',
|
|
34
|
+
onRefresh: Symbol(),
|
|
35
|
+
data: [],
|
|
36
|
+
dataOffset: 0,
|
|
37
|
+
hasNext: true,
|
|
38
|
+
filterTags: tags ? Object.keys(tags).reduce((pre, cur) => {
|
|
39
|
+
pre[cur] = false
|
|
40
|
+
return pre
|
|
41
|
+
}, {}) : {}
|
|
42
|
+
})
|
|
42
43
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
const loadData: (refreshType: RefreshType) => void = useCallback(async refreshType => {
|
|
45
|
+
state.refreshType = refreshType
|
|
46
|
+
if (state.refreshType === 'refresh') {
|
|
47
|
+
state.dataOffset = 0
|
|
48
|
+
state.onRefresh = Symbol()
|
|
49
|
+
} else if (state.hasNext) {
|
|
50
|
+
state.onRefresh = Symbol()
|
|
51
|
+
}
|
|
52
|
+
}, [])
|
|
52
53
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
const changeFilter = useCallback((v: boolean, tag: string) => {
|
|
55
|
+
state.filterTags = {
|
|
56
|
+
...state.filterTags,
|
|
57
|
+
[tag]: v
|
|
58
|
+
}
|
|
59
|
+
}, [])
|
|
59
60
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
61
|
+
const getRequestIds = useCallback(() => {
|
|
62
|
+
const tagValue = Object.values(state.filterTags)
|
|
63
|
+
const isAllData = tagValue.every(tag => tag) || tagValue.every(tag => !tag)
|
|
64
|
+
const checkedTags = Object.keys(state.filterTags).reduce((pre: string[], cur) => {
|
|
65
|
+
if (state.filterTags[cur]) pre.push(cur)
|
|
66
|
+
return pre
|
|
67
|
+
}, [])
|
|
68
|
+
return isAllData ? dpIds : checkedTags
|
|
69
|
+
}, [state.filterTags])
|
|
69
70
|
|
|
70
71
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
getSwitchHistoryData(deviceInfo.devId, getRequestIds(), state.dataOffset, getActionsText, 100, showLimit)
|
|
74
|
+
.then(res => {
|
|
75
|
+
state.refreshing = false
|
|
76
|
+
state.data = res.data
|
|
77
|
+
state.dataOffset = res.currentOffset
|
|
78
|
+
state.hasNext = res.hasNext
|
|
79
|
+
})
|
|
80
|
+
}, [state.onRefresh, state.filterTags])
|
|
80
81
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
const downFile = () => {
|
|
83
|
+
exportHistoryFile(state.data)
|
|
84
|
+
}
|
|
84
85
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
</View>
|
|
136
|
-
)}
|
|
137
|
-
refreshing={state.refreshing}
|
|
138
|
-
onEndReachedThreshold={.1}
|
|
139
|
-
onRefresh={async () => {
|
|
140
|
-
await loadData('refresh')
|
|
141
|
-
}}
|
|
142
|
-
onEndReached={async () => {
|
|
143
|
-
await loadData('loadMore')
|
|
144
|
-
}}/>
|
|
86
|
+
return (
|
|
87
|
+
<Page
|
|
88
|
+
backText={backText || deviceInfo.name}
|
|
89
|
+
headlineText={headlineText || I18n.getLang('history_socket_headline_text')}
|
|
90
|
+
headlineIcon={res.download_icon}
|
|
91
|
+
onHeadlineIconClick={downFile}
|
|
92
|
+
>
|
|
93
|
+
<View style={styles.content}>
|
|
94
|
+
<Text style={styles.titleText}>{I18n.getLang('history_contact_sensor_description_text')}</Text>
|
|
95
|
+
<Spacer />
|
|
96
|
+
{!isEmpty(state.filterTags) && !!state.data.length &&
|
|
97
|
+
<View style={{
|
|
98
|
+
display: 'flex',
|
|
99
|
+
flexDirection: 'row',
|
|
100
|
+
flexWrap: 'wrap',
|
|
101
|
+
marginHorizontal: cx(24),
|
|
102
|
+
marginBottom: cx(12),
|
|
103
|
+
alignSelf: 'flex-start'
|
|
104
|
+
}}>
|
|
105
|
+
{
|
|
106
|
+
Object.keys(state.filterTags)?.map((tag) => {
|
|
107
|
+
return <Tag
|
|
108
|
+
key={tag}
|
|
109
|
+
text={tags && tags[tag]}
|
|
110
|
+
checked={state.filterTags[tag]}
|
|
111
|
+
onCheckedChange={(v) => changeFilter(v, tag)}
|
|
112
|
+
style={{ marginTop: cx(5), marginHorizontal: cx(5) }}
|
|
113
|
+
/>
|
|
114
|
+
})
|
|
115
|
+
}
|
|
116
|
+
</View>
|
|
117
|
+
}
|
|
118
|
+
<FlatList
|
|
119
|
+
data={state.data}
|
|
120
|
+
style={styles.list}
|
|
121
|
+
renderItem={({ item }) => <SwitchHistoryItem {...{ itemData: item, tags }} />}
|
|
122
|
+
keyExtractor={(_, index) => `${index}`}
|
|
123
|
+
ListFooterComponent={<Spacer />}
|
|
124
|
+
ListEmptyComponent={(
|
|
125
|
+
<View style={styles.listEmptyView}>
|
|
126
|
+
<Spacer height={cx(26)} />
|
|
127
|
+
<Image
|
|
128
|
+
style={styles.listEmptyImage}
|
|
129
|
+
source={{ uri: res.ldv_timer_empty }} />
|
|
130
|
+
<Spacer height={cx(14)} />
|
|
131
|
+
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
|
132
|
+
<Image style={styles.listEmptyTextIcon} source={res.ic_info} />
|
|
133
|
+
<Spacer width={cx(4)} height={0} />
|
|
134
|
+
<Text style={styles.listEmptyText}>{I18n.getLang('history_overview_empty_information_text')}</Text>
|
|
135
|
+
</View>
|
|
145
136
|
</View>
|
|
146
|
-
|
|
147
|
-
|
|
137
|
+
)}
|
|
138
|
+
refreshing={state.refreshing}
|
|
139
|
+
onEndReachedThreshold={.1}
|
|
140
|
+
onRefresh={async () => {
|
|
141
|
+
await loadData('refresh')
|
|
142
|
+
}}
|
|
143
|
+
onEndReached={async () => {
|
|
144
|
+
await loadData('loadMore')
|
|
145
|
+
}} />
|
|
146
|
+
</View>
|
|
147
|
+
</Page>
|
|
148
|
+
)
|
|
148
149
|
}
|
|
149
150
|
|
|
150
151
|
interface SwitchHistoryItemBean {
|
|
151
|
-
|
|
152
|
-
|
|
152
|
+
itemData: SwitchHistoryUIItemData
|
|
153
|
+
tags?: object
|
|
153
154
|
}
|
|
154
155
|
|
|
155
|
-
const SwitchHistoryItem = (props: SwitchHistoryItemBean)
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
<Spacer/>
|
|
156
|
+
const SwitchHistoryItem = (props: SwitchHistoryItemBean) => {
|
|
157
|
+
const { itemData, tags } = props
|
|
158
|
+
return (
|
|
159
|
+
<View style={styles.switchHistoryItem}>
|
|
160
|
+
<Text style={styles.switchHistoryItemTitle}>{itemData.title}</Text>
|
|
161
|
+
<Spacer height={cx(10)} />
|
|
162
|
+
{itemData.actions.map((actionData, index) => (
|
|
163
|
+
<View style={styles.switchHistoryItemActionItem} key={`${index}`}>
|
|
164
|
+
<View style={styles.switchHistoryItemActionItemLineGroup}>
|
|
165
|
+
<View style={styles.switchHistoryItemActionItemLine} />
|
|
166
|
+
<View style={styles.switchHistoryItemActionItemPoint} />
|
|
167
|
+
</View>
|
|
168
|
+
<Spacer width={cx(15)} height={0} />
|
|
169
|
+
<Text style={styles.switchHistoryItemActionItemText}>{`${actionData.time}`}</Text>
|
|
170
|
+
<Spacer width={cx(10)} height={0} />
|
|
171
|
+
<View style={{ flex: 1, display: 'flex', flexDirection: 'row', flexWrap: 'wrap',alignItems: 'baseline'
|
|
172
|
+
}}>
|
|
173
|
+
<Text style={styles.switchHistoryItemActionItemText}>{`${actionData.action}`}</Text>
|
|
174
|
+
{!!tags && <View style={styles.switchHistoryItemTag}><Text style={{ fontSize: cx(14), color: '#000' }}>{tags[actionData.dpId]}</Text></View>}
|
|
175
|
+
</View>
|
|
176
176
|
</View>
|
|
177
|
-
|
|
177
|
+
))}
|
|
178
|
+
<Spacer />
|
|
179
|
+
</View>
|
|
180
|
+
)
|
|
178
181
|
}
|
|
179
182
|
|
|
180
183
|
const styles = StyleSheet.create({
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
184
|
+
content: {
|
|
185
|
+
flex: 1,
|
|
186
|
+
},
|
|
187
|
+
list: {
|
|
188
|
+
flex: 1,
|
|
189
|
+
},
|
|
190
|
+
listEmptyView: {
|
|
191
|
+
alignItems: 'center',
|
|
192
|
+
},
|
|
193
|
+
listEmptyImage: {
|
|
194
|
+
width: cx(200),
|
|
195
|
+
height: cx(200),
|
|
196
|
+
},
|
|
197
|
+
listEmptyTextIcon: {
|
|
198
|
+
width: cx(16),
|
|
199
|
+
height: cx(16),
|
|
200
|
+
tintColor: '#000',
|
|
201
|
+
},
|
|
202
|
+
listEmptyText: {
|
|
203
|
+
color: '#000',
|
|
204
|
+
fontSize: cx(12),
|
|
205
|
+
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
206
|
+
},
|
|
207
|
+
titleText: {
|
|
208
|
+
marginHorizontal: cx(24),
|
|
209
|
+
color: '#000',
|
|
210
|
+
fontSize: cx(16),
|
|
211
|
+
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
212
|
+
},
|
|
213
|
+
switchHistoryItem: {
|
|
214
|
+
marginHorizontal: cx(24),
|
|
215
|
+
},
|
|
216
|
+
switchHistoryItemTitle: {
|
|
217
|
+
color: '#000',
|
|
218
|
+
fontSize: cx(18),
|
|
219
|
+
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
220
|
+
},
|
|
221
|
+
switchHistoryItemActionItem: {
|
|
222
|
+
flexDirection: 'row',
|
|
223
|
+
alignItems: 'center',
|
|
224
|
+
flex: 1
|
|
225
|
+
},
|
|
226
|
+
switchHistoryItemActionItemLineGroup: {
|
|
227
|
+
width: cx(7),
|
|
228
|
+
minHeight: cx(30),
|
|
229
|
+
height: '100%',
|
|
230
|
+
alignItems: 'center',
|
|
231
|
+
},
|
|
232
|
+
switchHistoryItemActionItemLine: {
|
|
233
|
+
width: cx(1),
|
|
234
|
+
flex: 1,
|
|
235
|
+
backgroundColor: '#E6E7E8',
|
|
236
|
+
},
|
|
237
|
+
switchHistoryItemActionItemPoint: {
|
|
238
|
+
width: cx(7),
|
|
239
|
+
height: cx(7),
|
|
240
|
+
backgroundColor: '#f60',
|
|
241
|
+
borderRadius: cx(4),
|
|
242
|
+
position: 'absolute',
|
|
243
|
+
top: '50%',
|
|
244
|
+
transform: [{ translateY: cx(-3) }]
|
|
245
|
+
},
|
|
246
|
+
switchHistoryItemActionItemText: {
|
|
247
|
+
color: '#000',
|
|
248
|
+
fontSize: cx(16),
|
|
249
|
+
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
250
|
+
},
|
|
251
|
+
switchHistoryItemTag: {
|
|
252
|
+
paddingHorizontal: cx(10),
|
|
253
|
+
borderRadius: cx(10),
|
|
254
|
+
backgroundColor: '#cbcbcb',
|
|
255
|
+
marginLeft: cx(5),
|
|
256
|
+
}
|
|
247
257
|
})
|
|
248
258
|
|
|
249
259
|
export default SwitchHistoryPage
|
|
@@ -252,11 +262,11 @@ type RefreshType = 'refresh' | 'loadMore'
|
|
|
252
262
|
|
|
253
263
|
|
|
254
264
|
interface SwitchHistoryPageState {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
265
|
+
refreshing: boolean
|
|
266
|
+
refreshType: RefreshType
|
|
267
|
+
onRefresh: symbol
|
|
268
|
+
data: SwitchHistoryUIItemData[]
|
|
269
|
+
hasNext: boolean
|
|
270
|
+
dataOffset: number
|
|
271
|
+
filterTags: object
|
|
262
272
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getDpReportSataData, PagingResult } from '@ledvance/base/src/models/TuyaApi'
|
|
2
2
|
import { cloneDeep, groupBy, isEqual, uniqWith } from 'lodash'
|
|
3
3
|
import dayjs from 'dayjs'
|
|
4
|
-
import I18n from '@ledvance/base/src/i18n'
|
|
4
|
+
import I18n, { I18nKey } from '@ledvance/base/src/i18n'
|
|
5
5
|
import duration from 'dayjs/plugin/duration'
|
|
6
6
|
dayjs.extend(duration)
|
|
7
7
|
export interface SwitchHistoryUIItemData {
|
|
@@ -39,9 +39,9 @@ const formateLimitTime = (time: number) =>{
|
|
|
39
39
|
// return ` ${hours > 0 ? hours + 'h' : ''} ${(minutes > 0 || hours > 0) ? minutes + 'min' : ''} ${seconds}sec`
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
type getSwitchHistoryDataFunType = (deviceId: string, dpIds: string[], offset: number,
|
|
42
|
+
type getSwitchHistoryDataFunType = (deviceId: string, dpIds: string[], offset: number, getActionsText: (dpData: any) => I18nKey, limit?: number, showLimit?:boolean) => Promise<PagingResult<SwitchHistoryUIItemData[]>>
|
|
43
43
|
|
|
44
|
-
export const getSwitchHistoryData: getSwitchHistoryDataFunType = async (deviceId: string, dpIds: string[], offset: number, limit: number = 100,
|
|
44
|
+
export const getSwitchHistoryData: getSwitchHistoryDataFunType = async (deviceId: string, dpIds: string[], offset: number, getActionsText, limit: number = 100, showLimit) => {
|
|
45
45
|
const res = await getDpReportSataData(deviceId, dpIds, 0, offset + limit)
|
|
46
46
|
const uniqData = uniqWith(res.dps, isEqual)
|
|
47
47
|
const reverseData = cloneDeep(uniqData).reverse()
|
|
@@ -51,13 +51,13 @@ export const getSwitchHistoryData: getSwitchHistoryDataFunType = async (deviceId
|
|
|
51
51
|
limitTime: reverseData[idx + 1] ? formateLimitTime(reverseData[idx + 1].timeStamp - item.timeStamp) : ''
|
|
52
52
|
}
|
|
53
53
|
})
|
|
54
|
-
const key = actionKey || 'true'
|
|
55
54
|
const dateActionsMap = groupBy(limitTimeData.reverse().map(dpData => {
|
|
55
|
+
const key = getActionsText(dpData)
|
|
56
56
|
const dayjsDate = dayjs(dpData.timeStr)
|
|
57
57
|
return {
|
|
58
58
|
date: `${dayjsDate.format('DD/MM/YYYY')} (${weekList[dayjsDate.format('ddd')]})`,
|
|
59
59
|
time: dayjsDate.format('HH:mm:ss'),
|
|
60
|
-
action: I18n.formatValue(
|
|
60
|
+
action: I18n.formatValue(key, '', showLimit ? dpData.limitTime : ''),
|
|
61
61
|
dpId: dpData.dpId,
|
|
62
62
|
}
|
|
63
63
|
}), 'date')
|
|
@@ -229,7 +229,7 @@ const TimerPage = (props: {theme?: any}) => {
|
|
|
229
229
|
<Text style={styles.itemTitle}>{I18n.getLang('timeschedule_add_schedule_subheadline_text')}</Text>
|
|
230
230
|
<View
|
|
231
231
|
style={{
|
|
232
|
-
backgroundColor: props.theme.card.
|
|
232
|
+
backgroundColor: props.theme.card.border,
|
|
233
233
|
borderRadius: 4,
|
|
234
234
|
minHeight: cx(50),
|
|
235
235
|
flex: 1,
|
|
@@ -267,7 +267,7 @@ const TimerPage = (props: {theme?: any}) => {
|
|
|
267
267
|
text={I18n.getLang('timer_sockets_button_text')}
|
|
268
268
|
onPress={onStartPress}
|
|
269
269
|
textStyle={{ fontSize: cx(14) }}
|
|
270
|
-
style={{ backgroundColor: !state.selectedSkill.length ? props.theme.button.disabled : props.theme.button.
|
|
270
|
+
style={{ backgroundColor: !state.selectedSkill.length ? props.theme.button.disabled : props.theme.button.primary }}
|
|
271
271
|
/>
|
|
272
272
|
<Spacer />
|
|
273
273
|
</>}
|
|
@@ -137,7 +137,7 @@ export function timeFormatToRealTime(mCountdown: number) {
|
|
|
137
137
|
return `${after.getHours()}:${after.getMinutes().toString().padStart(2, '0')}`
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
export function timeFormat(time: number): string {
|
|
140
|
+
export function timeFormat(time: number, hideUnit?: boolean): string {
|
|
141
141
|
let hour = Math.trunc(time / 3600)
|
|
142
142
|
const beforeMin = (time % 3600) / 60
|
|
143
143
|
let min = Math.ceil(beforeMin)
|
|
@@ -145,5 +145,5 @@ export function timeFormat(time: number): string {
|
|
|
145
145
|
hour += 1
|
|
146
146
|
min = 0
|
|
147
147
|
}
|
|
148
|
-
return `${hour > 0 ? `${hour} h ` : ''}${min > 0 ? `${min}` : ''}`
|
|
148
|
+
return `${hour > 0 ? `${hour} h ` : ''}${min > 0 ? `${min} ${hideUnit ? '' : 'min'}` : ''}`
|
|
149
149
|
}
|
|
@@ -96,7 +96,7 @@ const BiorhythmEditPage = () => {
|
|
|
96
96
|
|
|
97
97
|
const canSaveMoodData = useMemo(() =>{
|
|
98
98
|
return state.planData.name.length > 0 && state.planData.name.length < 33 && !nameRepeatFlag && !checkBiorhythmDataChanged && !minimumTipEnable()
|
|
99
|
-
}, [nameRepeatFlag, state.planData.name, checkBiorhythmDataChanged])
|
|
99
|
+
}, [nameRepeatFlag, state.planData.name, checkBiorhythmDataChanged, minimumTipEnable()])
|
|
100
100
|
|
|
101
101
|
return (
|
|
102
102
|
<Page
|
|
@@ -262,7 +262,7 @@ const BiorhythmPage = () => {
|
|
|
262
262
|
backText={deviceInfo.name}
|
|
263
263
|
onBackClick={navigation.goBack}
|
|
264
264
|
headlineText={I18n.getLang('add_new_trigger_time_system_back_text')}
|
|
265
|
-
|
|
265
|
+
headlineIconContent={<Switch
|
|
266
266
|
value={state.enable}
|
|
267
267
|
thumbColor={'#f60'}
|
|
268
268
|
trackColor={{ false: '#00000026', true: '#ff660036' }}
|