@ledvance/base 1.2.86 → 1.2.88
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/localazy.json
CHANGED
|
@@ -838,7 +838,19 @@
|
|
|
838
838
|
"MATCH:fixedTimeCycle_empty_filtering_information_text",
|
|
839
839
|
"MATCH:camera_settings_sd_storage_used_storage_percent",
|
|
840
840
|
"MATCH:camera_status_indicator",
|
|
841
|
-
"MATCH:camera_local_recording"
|
|
841
|
+
"MATCH:camera_local_recording",
|
|
842
|
+
"MATCH:Remotecontrol_Title",
|
|
843
|
+
"MATCH:Remotecontrol_description",
|
|
844
|
+
"MATCH:camera_settings_night_vision_mode_firstbox_topic1",
|
|
845
|
+
"MATCH:camera_settings_night_vision_mode_firstbox_topic2",
|
|
846
|
+
"MATCH:camera_settings_night_vision_mode_firstbox_topic3",
|
|
847
|
+
"MATCH:camera_settings_night_vision_mode_topic",
|
|
848
|
+
"MATCH:camera_settings_night_vision_mode_description",
|
|
849
|
+
"MATCH:privatemode_description",
|
|
850
|
+
"MATCH:groups_settings_optionbox_option3",
|
|
851
|
+
"MATCH:groups_settings_synchronize_solar_secondtopic",
|
|
852
|
+
"MATCH:btsolar_groups_inductionsync",
|
|
853
|
+
"MATCH:btsolar_groups_inductionsync_description"
|
|
842
854
|
],
|
|
843
855
|
"replacements": {
|
|
844
856
|
"REGEX:% %1\\$s.*?\\)%": "{0}",
|
package/package.json
CHANGED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Card from '@ledvance/base/src/components/Card';
|
|
3
|
+
import { Battery, Utils } from 'tuya-panel-kit';
|
|
4
|
+
import { View, Text, StyleSheet } from 'react-native';
|
|
5
|
+
import I18n from '@ledvance/base/src/i18n';
|
|
6
|
+
import Spacer from '@ledvance/base/src/components/Spacer';
|
|
7
|
+
|
|
8
|
+
const cx = Utils.RatioUtils.convertX;
|
|
9
|
+
type BatteryProps = {
|
|
10
|
+
batteryState: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
enum BatteryState {
|
|
14
|
+
Low = 'low',
|
|
15
|
+
Middle = 'middle',
|
|
16
|
+
High = 'high',
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const batteryLevels = {
|
|
20
|
+
[BatteryState.High]: 100,
|
|
21
|
+
[BatteryState.Middle]: 60,
|
|
22
|
+
[BatteryState.Low]: 30,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const getBatteryDisplayName = (value: string): string => {
|
|
26
|
+
switch (value) {
|
|
27
|
+
case BatteryState.High:
|
|
28
|
+
return I18n.getLang('contact_sensor_battery_state1');
|
|
29
|
+
case BatteryState.Middle:
|
|
30
|
+
return I18n.getLang('contact_sensor_battery_state2');
|
|
31
|
+
case BatteryState.Low:
|
|
32
|
+
default:
|
|
33
|
+
return I18n.getLang('contact_sensor_battery_state3');
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default function BatteryStateView(props: BatteryProps) {
|
|
38
|
+
const { batteryState } = props;
|
|
39
|
+
const calcColor = (_, highColor, middleColor, lowColor) => {
|
|
40
|
+
switch (batteryState) {
|
|
41
|
+
case BatteryState.High:
|
|
42
|
+
return highColor;
|
|
43
|
+
case BatteryState.Middle:
|
|
44
|
+
return middleColor;
|
|
45
|
+
default:
|
|
46
|
+
return lowColor;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const battery = batteryLevels[batteryState];
|
|
51
|
+
return (
|
|
52
|
+
<Card
|
|
53
|
+
style={{ marginHorizontal: cx(24) }}
|
|
54
|
+
containerStyle={{ flexDirection: 'row', alignItems: 'center' }}
|
|
55
|
+
>
|
|
56
|
+
<Text style={styles.title}>{I18n.getLang('motion_detector_battery__state4')}</Text>
|
|
57
|
+
<Spacer height={0} style={{ flex: 1 }} />
|
|
58
|
+
<View style={styles.batteryRotate}>
|
|
59
|
+
<Battery value={battery} onCalcColor={calcColor} size={cx(30)} middleColor="#999999" />
|
|
60
|
+
</View>
|
|
61
|
+
<Text style={styles.content}>{getBatteryDisplayName(batteryState)}</Text>
|
|
62
|
+
</Card>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const styles = StyleSheet.create({
|
|
67
|
+
title: {
|
|
68
|
+
marginStart: cx(16),
|
|
69
|
+
marginVertical: cx(18),
|
|
70
|
+
color: '#000',
|
|
71
|
+
fontSize: cx(16),
|
|
72
|
+
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
batteryRotate: {
|
|
76
|
+
transform: [{ rotate: '90deg' }],
|
|
77
|
+
position: 'relative',
|
|
78
|
+
right: cx(30),
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
content: {
|
|
82
|
+
marginEnd: cx(16),
|
|
83
|
+
color: '#000',
|
|
84
|
+
fontSize: cx(14),
|
|
85
|
+
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
86
|
+
},
|
|
87
|
+
});
|
|
@@ -14,17 +14,22 @@ interface Prop {
|
|
|
14
14
|
enable: boolean
|
|
15
15
|
setEnable: (enable: boolean) => void
|
|
16
16
|
showSwitch?:boolean
|
|
17
|
+
description?: string
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
const LdvSwitch = (props: Prop) => {
|
|
20
|
-
const {title, color, colorAlpha, enable, setEnable, showSwitch = true} = props
|
|
21
|
+
const {title, color, colorAlpha, enable, description, setEnable, showSwitch = true} = props
|
|
21
22
|
return (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
<View style={styles.titleBGView}>
|
|
24
|
+
<View style={{flexDirection: 'column', flex: 1}}>
|
|
25
|
+
<View style={{flexDirection: 'row', alignItems: 'center'}}>
|
|
26
|
+
<Text style={{...styles.title, color: props.theme.global.fontColor}}>{title}</Text>
|
|
27
|
+
<View style={[styles.colorBlock, {backgroundColor: color, opacity: colorAlpha}]}/>
|
|
28
|
+
</View>
|
|
29
|
+
{description && <Text style={{color: props.theme.global.fontColor}}>{description}</Text>}
|
|
30
|
+
</View>
|
|
31
|
+
{showSwitch && <SwitchButton value={enable} onValueChange={setEnable}/>}
|
|
32
|
+
</View>
|
|
28
33
|
)
|
|
29
34
|
}
|
|
30
35
|
|
|
@@ -33,6 +38,7 @@ const styles = StyleSheet.create({
|
|
|
33
38
|
flexDirection: 'row',
|
|
34
39
|
alignItems: 'center',
|
|
35
40
|
paddingHorizontal: cx(16),
|
|
41
|
+
paddingVertical: cx(16),
|
|
36
42
|
},
|
|
37
43
|
colorBlock: {
|
|
38
44
|
width: cx(20),
|
|
@@ -44,8 +50,7 @@ const styles = StyleSheet.create({
|
|
|
44
50
|
fontSize: cx(16),
|
|
45
51
|
// fontFamily: 'helvetica_neue_lt_std_bd',
|
|
46
52
|
fontWeight: 'bold',
|
|
47
|
-
|
|
48
|
-
maxWidth: cx(220)
|
|
53
|
+
maxWidth: cx(220),
|
|
49
54
|
},
|
|
50
55
|
})
|
|
51
56
|
|
package/src/composeLayout.tsx
CHANGED