@ledvance/ui-biz-bundle 1.1.90 → 1.1.92
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/FlagEditPage.tsx +180 -179
- package/src/modules/flags/FlagItem.tsx +26 -42
- package/src/modules/flags/FlagPage.tsx +27 -26
- package/src/modules/history/HistoryPage.tsx +111 -103
- package/src/modules/music/MusicPage.tsx +90 -88
- package/src/modules/timer/TimerPage.tsx +13 -9
- package/src/newModules/biorhythm/BiorhythmEditPage.tsx +54 -54
- package/src/newModules/biorhythm/BiorhythmPage.tsx +163 -162
- package/src/newModules/biorhythm/IconSelect.tsx +5 -4
- package/src/newModules/childLock/ChildLockPage.tsx +49 -47
- package/src/newModules/energyConsumption/component/EnergyModal.tsx +2 -2
- package/src/newModules/fixedTime/FixedTimeDetailPage.tsx +127 -124
- package/src/newModules/fixedTime/FixedTimePage.tsx +108 -104
- package/src/newModules/lightMode/LightModePage.tsx +74 -67
- package/src/newModules/mood/AddMoodPage.tsx +18 -15
- package/src/newModules/mood/DynamicMoodEditorPage.tsx +103 -100
- package/src/newModules/mood/MixDynamicMoodEditor.tsx +107 -104
- package/src/newModules/mood/MoodItem.tsx +59 -55
- package/src/newModules/mood/MoodPage.tsx +58 -57
- package/src/newModules/mood/RecommendMoodItem.tsx +27 -24
- package/src/newModules/mood/StaticMoodEditorPage.tsx +77 -85
- package/src/newModules/overchargeSwitch/OverchargeSwitchPage.tsx +36 -48
- package/src/newModules/powerOnBehavior/LightBehaviorPage.tsx +137 -135
- package/src/newModules/powerOnBehavior/PlugBehaviorPage.tsx +67 -61
- package/src/newModules/randomTime/RandomTimeDetailPage.tsx +114 -151
- package/src/newModules/randomTime/RandomTimePage.tsx +110 -105
- package/src/newModules/randomTime/Summary.tsx +61 -57
- package/src/newModules/remoteControl/RemoteControlPage.tsx +4 -3
- package/src/newModules/select/SelectPage.tsx +65 -62
- package/src/newModules/sleepWakeUp/SleepWakeUpActions.ts +16 -8
- package/src/newModules/sleepWakeUp/SleepWakeUpDetailPage.tsx +131 -123
- package/src/newModules/sleepWakeUp/SleepWakeUpPage.tsx +144 -140
- package/src/newModules/switchGradient/SwitchGradientPage.tsx +24 -25
- package/src/newModules/swithInching/SwithInching.tsx +154 -152
- package/src/newModules/timeSchedule/TimeScheduleDetailPage.tsx +83 -83
- package/src/newModules/timeSchedule/components/ManuaSettings.tsx +3 -2
- package/src/newModules/swithInching/pickerView.tsx +0 -91
package/package.json
CHANGED
|
@@ -23,6 +23,7 @@ import { showDialog } from '@ledvance/base/src/utils/common'
|
|
|
23
23
|
import { cctToColor } from '@ledvance/base/src/utils/cctUtils'
|
|
24
24
|
|
|
25
25
|
const cx = Utils.RatioUtils.convertX
|
|
26
|
+
const { withTheme } = Utils.ThemeUtils
|
|
26
27
|
|
|
27
28
|
export interface FlagEditParams {
|
|
28
29
|
mode: 'add' | 'edit'
|
|
@@ -32,7 +33,7 @@ export interface FlagEditParams {
|
|
|
32
33
|
modDeleteFlag: (mode: 'add' | 'edit' | 'del', currentMood: FlagUiInfo, options?: FlagOption) => Promise<Result<any>>
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
const FlagEditPage = () => {
|
|
36
|
+
const FlagEditPage = (props: { theme?: any }) => {
|
|
36
37
|
const navigation = useNavigation()
|
|
37
38
|
const params = cloneDeep(useRoute().params as FlagEditParams)
|
|
38
39
|
const state = useReactive({
|
|
@@ -46,7 +47,7 @@ const FlagEditPage = () => {
|
|
|
46
47
|
colorPaintBucketSelected: false,
|
|
47
48
|
loading: false
|
|
48
49
|
})
|
|
49
|
-
|
|
50
|
+
|
|
50
51
|
const getColorBlockColor = useCallback((isMainLight?: boolean) => {
|
|
51
52
|
if (isMainLight) {
|
|
52
53
|
return cctToColor(state.currentWhiteNode.colorTemp, Math.max(...[state.currentWhiteNode.brightness, 50]))
|
|
@@ -79,6 +80,100 @@ const FlagEditPage = () => {
|
|
|
79
80
|
return state.mood.name.length > 0 && state.mood.name.length < 33 && !nameRepeat && (params.mode === 'add' || !checkMoodDataChanged)
|
|
80
81
|
}, [nameRepeat, state.mood.name, checkMoodDataChanged, params.mode])
|
|
81
82
|
|
|
83
|
+
const styles = StyleSheet.create({
|
|
84
|
+
root: {
|
|
85
|
+
flex: 1,
|
|
86
|
+
flexDirection: 'column',
|
|
87
|
+
},
|
|
88
|
+
name: {
|
|
89
|
+
marginHorizontal: cx(24),
|
|
90
|
+
},
|
|
91
|
+
adjustCard: {
|
|
92
|
+
marginVertical: cx(12),
|
|
93
|
+
marginHorizontal: cx(24),
|
|
94
|
+
},
|
|
95
|
+
fanAdjustCard: {
|
|
96
|
+
marginHorizontal: cx(24),
|
|
97
|
+
},
|
|
98
|
+
lightLine: {
|
|
99
|
+
flexDirection: 'row',
|
|
100
|
+
marginHorizontal: cx(16),
|
|
101
|
+
},
|
|
102
|
+
light: {
|
|
103
|
+
color: props.theme.global.fontColor,
|
|
104
|
+
fontSize: cx(18),
|
|
105
|
+
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
106
|
+
},
|
|
107
|
+
transitionMode: {
|
|
108
|
+
marginHorizontal: cx(16),
|
|
109
|
+
},
|
|
110
|
+
preview: {
|
|
111
|
+
width: cx(20),
|
|
112
|
+
height: cx(20),
|
|
113
|
+
marginStart: cx(12),
|
|
114
|
+
borderRadius: cx(4),
|
|
115
|
+
},
|
|
116
|
+
nodesAdjust: {
|
|
117
|
+
flexDirection: 'row',
|
|
118
|
+
alignItems: 'center',
|
|
119
|
+
},
|
|
120
|
+
adjustButtons: {
|
|
121
|
+
width: cx(44),
|
|
122
|
+
marginStart: cx(16),
|
|
123
|
+
},
|
|
124
|
+
adjustButton: {
|
|
125
|
+
width: cx(44),
|
|
126
|
+
height: cx(44),
|
|
127
|
+
},
|
|
128
|
+
nodeList: {
|
|
129
|
+
flex: 1,
|
|
130
|
+
marginHorizontal: cx(16),
|
|
131
|
+
},
|
|
132
|
+
nodeItem: {
|
|
133
|
+
flexDirection: 'row',
|
|
134
|
+
alignItems: 'center',
|
|
135
|
+
},
|
|
136
|
+
nodeBlock: {
|
|
137
|
+
flex: 1,
|
|
138
|
+
height: cx(40),
|
|
139
|
+
borderRadius: cx(8),
|
|
140
|
+
borderWidth: 1,
|
|
141
|
+
borderColor: props.theme.card.border
|
|
142
|
+
},
|
|
143
|
+
nodeDeleteBtn: {
|
|
144
|
+
width: cx(24),
|
|
145
|
+
height: cx(30),
|
|
146
|
+
justifyContent: 'center',
|
|
147
|
+
alignItems: 'center',
|
|
148
|
+
},
|
|
149
|
+
nodeDeleteIcon: {
|
|
150
|
+
width: cx(16),
|
|
151
|
+
height: cx(16),
|
|
152
|
+
},
|
|
153
|
+
nodeAddBtn: {
|
|
154
|
+
height: cx(40),
|
|
155
|
+
justifyContent: 'center',
|
|
156
|
+
alignItems: 'center',
|
|
157
|
+
marginEnd: cx(26),
|
|
158
|
+
borderRadius: cx(8),
|
|
159
|
+
borderWidth: cx(1),
|
|
160
|
+
borderStyle: 'dashed',
|
|
161
|
+
borderColor: props.theme.addNode.border,
|
|
162
|
+
backgroundColor: props.theme.addNode.background,
|
|
163
|
+
},
|
|
164
|
+
deleteBtn: {
|
|
165
|
+
width: '100%',
|
|
166
|
+
height: cx(50),
|
|
167
|
+
backgroundColor: props.theme.button.delete,
|
|
168
|
+
borderRadius: cx(8),
|
|
169
|
+
},
|
|
170
|
+
deleteBtnText: {
|
|
171
|
+
color: props.theme.button.fontColor,
|
|
172
|
+
fontSize: cx(16),
|
|
173
|
+
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
174
|
+
},
|
|
175
|
+
})
|
|
176
|
+
|
|
82
177
|
return (
|
|
83
178
|
<Page
|
|
84
179
|
backText={I18n.getLang('Feature_devicepanel_flags')}
|
|
@@ -116,55 +211,55 @@ const FlagEditPage = () => {
|
|
|
116
211
|
}}
|
|
117
212
|
maxLength={33}
|
|
118
213
|
showError={state.mood.name.length > 32 || nameRepeat}
|
|
119
|
-
tipColor={nameRepeat ?
|
|
214
|
+
tipColor={nameRepeat ? props.theme.global.error : undefined}
|
|
120
215
|
tipIcon={nameRepeat ? res.ic_text_field_input_error : undefined}
|
|
121
216
|
errorText={I18n.getLang(nameRepeat ? 'string_light_pp_field_sm_add_error1' : 'add_new_dynamic_mood_alert_text')} />
|
|
122
217
|
{(params.moduleParams.isSupportMixScene || params.moduleParams.isCeilingLight) && <><Card style={styles.adjustCard}>
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
218
|
+
<Spacer height={cx(16)} />
|
|
219
|
+
<View style={styles.lightLine}>
|
|
220
|
+
<Text style={styles.light}>
|
|
221
|
+
{I18n.getLang('light_sources_tile_main_lighting_headline')}
|
|
222
|
+
</Text>
|
|
223
|
+
<View style={[styles.preview, { backgroundColor: getColorBlockColor(true) }]} />
|
|
224
|
+
</View>
|
|
225
|
+
<Spacer />
|
|
226
|
+
<ColorTempAdjustView
|
|
227
|
+
isSupportBrightness={!!params.moduleParams.isSupportTemperature}
|
|
228
|
+
isSupportTemperature={!!params.moduleParams.isSupportTemperature}
|
|
229
|
+
colorTemp={state.currentWhiteNode.colorTemp}
|
|
230
|
+
brightness={state.currentWhiteNode.brightness}
|
|
231
|
+
onCCTChange={(cct) => {
|
|
232
|
+
state.currentWhiteNode.colorTemp = cct
|
|
233
|
+
}}
|
|
234
|
+
onCCTChangeComplete={(cct) => {
|
|
235
|
+
state.currentWhiteNode.colorTemp = cct
|
|
236
|
+
state.mood.whiteColors = state.mood.whiteColors.map((item, idx) => {
|
|
237
|
+
if (idx === state.whitePaintBucketIdx) {
|
|
238
|
+
return {
|
|
239
|
+
...state.mood.whiteColors[idx],
|
|
240
|
+
colorTemp: cct
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return item
|
|
244
|
+
})
|
|
245
|
+
}}
|
|
246
|
+
onBrightnessChange={() => { }}
|
|
247
|
+
onBrightnessChangeComplete={(bright) => {
|
|
248
|
+
state.currentWhiteNode.brightness = bright
|
|
249
|
+
state.mood.whiteColors = state.mood.whiteColors.map((item, idx) => {
|
|
250
|
+
if (idx === state.whitePaintBucketIdx) {
|
|
251
|
+
return {
|
|
252
|
+
...state.mood.whiteColors[idx],
|
|
253
|
+
brightness: bright
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
return item
|
|
257
|
+
})
|
|
258
|
+
}}
|
|
259
|
+
/>
|
|
260
|
+
<Spacer height={cx(16)} />
|
|
166
261
|
</Card>
|
|
167
|
-
|
|
262
|
+
<Spacer />
|
|
168
263
|
</>}
|
|
169
264
|
<Card style={styles.adjustCard}>
|
|
170
265
|
<Spacer height={cx(16)} />
|
|
@@ -175,16 +270,16 @@ const FlagEditPage = () => {
|
|
|
175
270
|
</View>
|
|
176
271
|
<Spacer height={cx(10)} />
|
|
177
272
|
{(!params.moduleParams.isStripLight && !params.moduleParams.isCeilingLight) && <>
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
273
|
+
<LdvSlider
|
|
274
|
+
title={I18n.getLang('add_new_dynamic_mood_lights_field_speed_topic_text')}
|
|
275
|
+
value={state.mood.speed}
|
|
276
|
+
onValueChange={value => {
|
|
277
|
+
state.mood.speed = value
|
|
278
|
+
}}
|
|
279
|
+
onSlidingComplete={value => {
|
|
280
|
+
state.mood.speed = value
|
|
281
|
+
}} />
|
|
282
|
+
<Spacer height={cx(16)} />
|
|
188
283
|
</>}
|
|
189
284
|
<View style={styles.nodesAdjust}>
|
|
190
285
|
<View style={styles.adjustButtons}>
|
|
@@ -193,7 +288,7 @@ const FlagEditPage = () => {
|
|
|
193
288
|
state.colorPaintBucketSelected = true
|
|
194
289
|
}}>
|
|
195
290
|
<Image
|
|
196
|
-
style={[styles.adjustButton, { tintColor: state.colorPaintBucketSelected ?
|
|
291
|
+
style={[styles.adjustButton, { tintColor: state.colorPaintBucketSelected ? props.theme.icon.primary : props.theme.icon.normal }]}
|
|
197
292
|
source={res.ic_paint_bucket} />
|
|
198
293
|
</TouchableOpacity>
|
|
199
294
|
<TouchableOpacity
|
|
@@ -201,7 +296,7 @@ const FlagEditPage = () => {
|
|
|
201
296
|
state.colorPaintBucketSelected = false
|
|
202
297
|
}}>
|
|
203
298
|
<Image
|
|
204
|
-
style={[styles.adjustButton, { tintColor: state.colorPaintBucketSelected ?
|
|
299
|
+
style={[styles.adjustButton, { tintColor: state.colorPaintBucketSelected ? props.theme.icon.normal : props.theme.icon.primary }]}
|
|
205
300
|
source={res.ic_colorize} />
|
|
206
301
|
</TouchableOpacity>
|
|
207
302
|
</View>
|
|
@@ -233,7 +328,7 @@ const FlagEditPage = () => {
|
|
|
233
328
|
style={[
|
|
234
329
|
styles.nodeDeleteIcon,
|
|
235
330
|
{
|
|
236
|
-
tintColor: state.mood.colors.length < 3 ?
|
|
331
|
+
tintColor: state.mood.colors.length < 3 ? props.theme.icon.disable : props.theme.icon.normal,
|
|
237
332
|
},
|
|
238
333
|
]}
|
|
239
334
|
source={res.ic_mood_del} />
|
|
@@ -264,7 +359,7 @@ const FlagEditPage = () => {
|
|
|
264
359
|
style={{
|
|
265
360
|
width: cx(18),
|
|
266
361
|
height: cx(18),
|
|
267
|
-
tintColor:
|
|
362
|
+
tintColor: props.theme.global.fontColor,
|
|
268
363
|
}}
|
|
269
364
|
source={{ uri: res.add }} />
|
|
270
365
|
</TouchableOpacity>
|
|
@@ -319,29 +414,29 @@ const FlagEditPage = () => {
|
|
|
319
414
|
</Card>
|
|
320
415
|
<Spacer />
|
|
321
416
|
{params.mode === 'edit' &&
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
417
|
+
<View style={{ marginTop: cx(20), marginHorizontal: cx(24) }}>
|
|
418
|
+
<TextButton
|
|
419
|
+
style={styles.deleteBtn}
|
|
420
|
+
textStyle={styles.deleteBtnText}
|
|
421
|
+
text={I18n.getLang('flag_deleteflag')}
|
|
422
|
+
onPress={() => {
|
|
423
|
+
showDialog({
|
|
424
|
+
method: 'confirm',
|
|
425
|
+
title: I18n.getLang('flag_deletepopup'),
|
|
426
|
+
subTitle: I18n.getLang('strip_light_static_mood_edit_dialog_text'),
|
|
427
|
+
onConfirm: async (_, { close }) => {
|
|
428
|
+
close()
|
|
429
|
+
if (state.loading) return
|
|
430
|
+
state.loading = true
|
|
431
|
+
const res = await params.modDeleteFlag('del', state.mood)
|
|
432
|
+
if (res.success) {
|
|
433
|
+
state.loading = false
|
|
434
|
+
navigation.goBack()
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
})
|
|
438
|
+
}} />
|
|
439
|
+
</View>}
|
|
345
440
|
<Spacer />
|
|
346
441
|
</View>
|
|
347
442
|
</ScrollView>
|
|
@@ -349,98 +444,4 @@ const FlagEditPage = () => {
|
|
|
349
444
|
)
|
|
350
445
|
}
|
|
351
446
|
|
|
352
|
-
|
|
353
|
-
root: {
|
|
354
|
-
flex: 1,
|
|
355
|
-
flexDirection: 'column',
|
|
356
|
-
},
|
|
357
|
-
name: {
|
|
358
|
-
marginHorizontal: cx(24),
|
|
359
|
-
},
|
|
360
|
-
adjustCard: {
|
|
361
|
-
marginVertical: cx(12),
|
|
362
|
-
marginHorizontal: cx(24),
|
|
363
|
-
},
|
|
364
|
-
fanAdjustCard: {
|
|
365
|
-
marginHorizontal: cx(24),
|
|
366
|
-
},
|
|
367
|
-
lightLine: {
|
|
368
|
-
flexDirection: 'row',
|
|
369
|
-
marginHorizontal: cx(16),
|
|
370
|
-
},
|
|
371
|
-
light: {
|
|
372
|
-
color: '#000',
|
|
373
|
-
fontSize: cx(18),
|
|
374
|
-
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
375
|
-
},
|
|
376
|
-
transitionMode: {
|
|
377
|
-
marginHorizontal: cx(16),
|
|
378
|
-
},
|
|
379
|
-
preview: {
|
|
380
|
-
width: cx(20),
|
|
381
|
-
height: cx(20),
|
|
382
|
-
marginStart: cx(12),
|
|
383
|
-
borderRadius: cx(4),
|
|
384
|
-
},
|
|
385
|
-
nodesAdjust: {
|
|
386
|
-
flexDirection: 'row',
|
|
387
|
-
alignItems: 'center',
|
|
388
|
-
},
|
|
389
|
-
adjustButtons: {
|
|
390
|
-
width: cx(44),
|
|
391
|
-
marginStart: cx(16),
|
|
392
|
-
},
|
|
393
|
-
adjustButton: {
|
|
394
|
-
width: cx(44),
|
|
395
|
-
height: cx(44),
|
|
396
|
-
},
|
|
397
|
-
nodeList: {
|
|
398
|
-
flex: 1,
|
|
399
|
-
marginHorizontal: cx(16),
|
|
400
|
-
},
|
|
401
|
-
nodeItem: {
|
|
402
|
-
flexDirection: 'row',
|
|
403
|
-
alignItems: 'center',
|
|
404
|
-
},
|
|
405
|
-
nodeBlock: {
|
|
406
|
-
flex: 1,
|
|
407
|
-
height: cx(40),
|
|
408
|
-
borderRadius: cx(8),
|
|
409
|
-
borderWidth: 1,
|
|
410
|
-
borderColor: '#ccc'
|
|
411
|
-
},
|
|
412
|
-
nodeDeleteBtn: {
|
|
413
|
-
width: cx(24),
|
|
414
|
-
height: cx(30),
|
|
415
|
-
justifyContent: 'center',
|
|
416
|
-
alignItems: 'center',
|
|
417
|
-
},
|
|
418
|
-
nodeDeleteIcon: {
|
|
419
|
-
width: cx(16),
|
|
420
|
-
height: cx(16),
|
|
421
|
-
},
|
|
422
|
-
nodeAddBtn: {
|
|
423
|
-
height: cx(40),
|
|
424
|
-
justifyContent: 'center',
|
|
425
|
-
alignItems: 'center',
|
|
426
|
-
marginEnd: cx(26),
|
|
427
|
-
borderRadius: cx(8),
|
|
428
|
-
borderWidth: cx(1),
|
|
429
|
-
borderStyle: 'dashed',
|
|
430
|
-
borderColor: '#666',
|
|
431
|
-
backgroundColor: '#f6f6f6',
|
|
432
|
-
},
|
|
433
|
-
deleteBtn: {
|
|
434
|
-
width: '100%',
|
|
435
|
-
height: cx(50),
|
|
436
|
-
backgroundColor: '#666',
|
|
437
|
-
borderRadius: cx(8),
|
|
438
|
-
},
|
|
439
|
-
deleteBtnText: {
|
|
440
|
-
color: '#fff',
|
|
441
|
-
fontSize: cx(16),
|
|
442
|
-
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
443
|
-
},
|
|
444
|
-
})
|
|
445
|
-
|
|
446
|
-
export default FlagEditPage
|
|
447
|
+
export default withTheme(FlagEditPage)
|
|
@@ -6,8 +6,10 @@ import MoodColorsLine from '@ledvance/base/src/components/MoodColorsLine'
|
|
|
6
6
|
import Spacer from '@ledvance/base/src/components/Spacer'
|
|
7
7
|
|
|
8
8
|
const cx = Utils.RatioUtils.convertX
|
|
9
|
+
const { withTheme } = Utils.ThemeUtils
|
|
9
10
|
|
|
10
11
|
interface RecommendMoodItemProps {
|
|
12
|
+
theme?: any
|
|
11
13
|
enable: boolean
|
|
12
14
|
title: string
|
|
13
15
|
colors: string[]
|
|
@@ -17,9 +19,30 @@ interface RecommendMoodItemProps {
|
|
|
17
19
|
onSwitch: (enable: boolean) => void
|
|
18
20
|
}
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
function FlagItem(props: RecommendMoodItemProps) {
|
|
21
23
|
const icon = typeof props.icon === 'number' ? props.icon : { uri: props.icon }
|
|
22
24
|
|
|
25
|
+
const styles = StyleSheet.create({
|
|
26
|
+
card: {
|
|
27
|
+
marginHorizontal: cx(24),
|
|
28
|
+
},
|
|
29
|
+
headline: {
|
|
30
|
+
flexDirection: 'row',
|
|
31
|
+
marginHorizontal: cx(16),
|
|
32
|
+
justifyContent: 'space-between',
|
|
33
|
+
},
|
|
34
|
+
headText: {
|
|
35
|
+
color: props.theme.global.fontColor,
|
|
36
|
+
fontSize: cx(16),
|
|
37
|
+
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
38
|
+
lineHeight: cx(20),
|
|
39
|
+
flex: 1
|
|
40
|
+
},
|
|
41
|
+
gradientItem: {
|
|
42
|
+
alignItems: 'center',
|
|
43
|
+
},
|
|
44
|
+
})
|
|
45
|
+
|
|
23
46
|
return (
|
|
24
47
|
<Card
|
|
25
48
|
style={[styles.card, props.style]}
|
|
@@ -40,7 +63,7 @@ export default function FlagItem(props: RecommendMoodItemProps) {
|
|
|
40
63
|
<View style={styles.gradientItem}>
|
|
41
64
|
<MoodColorsLine
|
|
42
65
|
type={'separate'}
|
|
43
|
-
nodeStyle={{ borderColor:
|
|
66
|
+
nodeStyle={{ borderColor: props.theme.card.border, borderWidth: 1 }}
|
|
44
67
|
colors={props.colors} />
|
|
45
68
|
</View>
|
|
46
69
|
<Spacer height={cx(16)} />
|
|
@@ -49,43 +72,4 @@ export default function FlagItem(props: RecommendMoodItemProps) {
|
|
|
49
72
|
)
|
|
50
73
|
}
|
|
51
74
|
|
|
52
|
-
|
|
53
|
-
card: {
|
|
54
|
-
marginHorizontal: cx(24),
|
|
55
|
-
},
|
|
56
|
-
headline: {
|
|
57
|
-
flexDirection: 'row',
|
|
58
|
-
marginHorizontal: cx(16),
|
|
59
|
-
justifyContent: 'space-between',
|
|
60
|
-
},
|
|
61
|
-
headText: {
|
|
62
|
-
color: '#000',
|
|
63
|
-
fontSize: cx(16),
|
|
64
|
-
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
65
|
-
lineHeight: cx(20),
|
|
66
|
-
flex: 1
|
|
67
|
-
},
|
|
68
|
-
gradientItem: {
|
|
69
|
-
alignItems: 'center',
|
|
70
|
-
},
|
|
71
|
-
gradient: {
|
|
72
|
-
borderRadius: cx(8),
|
|
73
|
-
},
|
|
74
|
-
moodTypeItem: {
|
|
75
|
-
flexDirection: 'row',
|
|
76
|
-
},
|
|
77
|
-
moodTypeLabel: {
|
|
78
|
-
marginStart: cx(16),
|
|
79
|
-
paddingHorizontal: cx(12.5),
|
|
80
|
-
backgroundColor: '#E6E7E8',
|
|
81
|
-
borderRadius: cx(8),
|
|
82
|
-
},
|
|
83
|
-
moodTypeLabelText: {
|
|
84
|
-
height: cx(16),
|
|
85
|
-
color: '#000000DD',
|
|
86
|
-
fontSize: cx(10),
|
|
87
|
-
textAlignVertical: 'center',
|
|
88
|
-
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
89
|
-
lineHeight: cx(16),
|
|
90
|
-
},
|
|
91
|
-
})
|
|
75
|
+
export default withTheme(FlagItem)
|
|
@@ -23,6 +23,7 @@ import { showDialog } from "@ledvance/base/src/utils/common";
|
|
|
23
23
|
import { defFlagHash, fnv1aHash } from "@ledvance/ui-biz-bundle/src/modules/flags/FlagHash";
|
|
24
24
|
import { NativeApi } from "@ledvance/base/src/api/native";
|
|
25
25
|
const cx = Utils.RatioUtils.convertX
|
|
26
|
+
const { withTheme } = Utils.ThemeUtils
|
|
26
27
|
|
|
27
28
|
export interface FlagPageProps {
|
|
28
29
|
isSupportColor?: boolean
|
|
@@ -32,7 +33,7 @@ export interface FlagPageProps {
|
|
|
32
33
|
isStripLight?: boolean
|
|
33
34
|
isCeilingLight?: boolean
|
|
34
35
|
isSupportMixScene?: boolean
|
|
35
|
-
drawToolLight?: {
|
|
36
|
+
drawToolLight?: {
|
|
36
37
|
drawToolCode: string
|
|
37
38
|
drawToolObj2dp: (colors: any[]) => string[]
|
|
38
39
|
drawToolDp2Obj: (dp: string) => string[]
|
|
@@ -42,13 +43,13 @@ export interface FlagPageProps {
|
|
|
42
43
|
workModeCode: string
|
|
43
44
|
switchLedCode: string
|
|
44
45
|
whiteSwitchCode?:string
|
|
45
|
-
rgbcWorkModeCode?: string
|
|
46
|
-
rgbcSwitchLedCode?: string
|
|
47
|
-
brightValueCode?: string
|
|
48
|
-
temperatureCode?: string
|
|
46
|
+
rgbcWorkModeCode?: string
|
|
47
|
+
rgbcSwitchLedCode?: string
|
|
48
|
+
brightValueCode?: string
|
|
49
|
+
temperatureCode?: string
|
|
49
50
|
}
|
|
50
51
|
|
|
51
|
-
const FlagPage = () => {
|
|
52
|
+
const FlagPage = (props: { theme?: any }) => {
|
|
52
53
|
const params = useRoute().params as FlagPageProps
|
|
53
54
|
const devInfo = useDeviceInfo()
|
|
54
55
|
const devId = useDeviceId()
|
|
@@ -85,7 +86,7 @@ const FlagPage = () => {
|
|
|
85
86
|
}, [JSON.stringify(flagState), JSON.stringify(state.flags), flagMode])
|
|
86
87
|
|
|
87
88
|
useEffect(() => {
|
|
88
|
-
if(!devInfo.devId) return
|
|
89
|
+
if(!devInfo.devId) return
|
|
89
90
|
if(!flags?.length){
|
|
90
91
|
getRemoteFlagInfo().then()
|
|
91
92
|
}
|
|
@@ -160,7 +161,7 @@ const FlagPage = () => {
|
|
|
160
161
|
if (mood){
|
|
161
162
|
if (mode === 'del' && (!flagMode?.flagMode || currentMood.id !== flagId || !dps[params.switchLedCode])){
|
|
162
163
|
return {
|
|
163
|
-
success: true
|
|
164
|
+
success: true
|
|
164
165
|
}
|
|
165
166
|
}
|
|
166
167
|
updateFlagMode(true, mood)
|
|
@@ -205,7 +206,7 @@ const FlagPage = () => {
|
|
|
205
206
|
}}
|
|
206
207
|
>
|
|
207
208
|
<View style={{flexDirection: 'row', display: 'flex', alignItems: 'center'}}>
|
|
208
|
-
<TextField
|
|
209
|
+
<TextField
|
|
209
210
|
value={state.searchText}
|
|
210
211
|
onChangeText={text => {
|
|
211
212
|
state.searchText = text
|
|
@@ -214,21 +215,21 @@ const FlagPage = () => {
|
|
|
214
215
|
style={{ marginHorizontal: cx(24), flex: 1 }}
|
|
215
216
|
/>
|
|
216
217
|
<TouchableOpacity style={{paddingRight: cx(24)}}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
218
|
+
onPress={() =>{
|
|
219
|
+
showDialog({
|
|
220
|
+
method: 'confirm',
|
|
221
|
+
title: I18n.getLang('flag_resetbutton'),
|
|
222
|
+
subTitle: I18n.getLang('flag_resetdescription'),
|
|
223
|
+
onConfirm: async (_, {close}) =>{
|
|
224
|
+
close()
|
|
225
|
+
state.loading = true
|
|
226
|
+
await getRemoteFlagInfo(true)
|
|
227
|
+
state.loading = false
|
|
228
|
+
}
|
|
229
|
+
})
|
|
230
|
+
}}
|
|
230
231
|
>
|
|
231
|
-
<Image source={res.ic_refresh} style={{width: cx(24), height: cx(24)}}/>
|
|
232
|
+
<Image source={res.ic_refresh} style={{width: cx(24), height: cx(24), tintColor: props.theme.global.fontColor}}/>
|
|
232
233
|
</TouchableOpacity>
|
|
233
234
|
</View>
|
|
234
235
|
<FlatList
|
|
@@ -240,7 +241,7 @@ const FlagPage = () => {
|
|
|
240
241
|
colors={item.colors.map(item => hsv2Hex(item.h, item.s, item.v)).reverse()}
|
|
241
242
|
onSwitch={async (enable) => {
|
|
242
243
|
if (enable) {
|
|
243
|
-
state.loading = true
|
|
244
|
+
state.loading = true
|
|
244
245
|
await setFlag(item)
|
|
245
246
|
const flagHash = fnv1aHash(JSON.stringify(item.colors))
|
|
246
247
|
if (defFlagHash[flagHash]){
|
|
@@ -249,7 +250,7 @@ const FlagPage = () => {
|
|
|
249
250
|
id: defFlagHash[flagHash].id
|
|
250
251
|
}).then()
|
|
251
252
|
}
|
|
252
|
-
state.loading = false
|
|
253
|
+
state.loading = false
|
|
253
254
|
updateFlagMode(true, item)
|
|
254
255
|
}
|
|
255
256
|
}}
|
|
@@ -283,4 +284,4 @@ export const newFlag = (id: number) => {
|
|
|
283
284
|
}
|
|
284
285
|
}
|
|
285
286
|
|
|
286
|
-
export default FlagPage
|
|
287
|
+
export default withTheme(FlagPage)
|