@ledvance/group-ui-biz-bundle 1.0.26 → 1.0.27

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
@@ -4,7 +4,7 @@
4
4
  "name": "@ledvance/group-ui-biz-bundle",
5
5
  "pid": [],
6
6
  "uiid": "",
7
- "version": "1.0.26",
7
+ "version": "1.0.27",
8
8
  "scripts": {},
9
9
  "dependencies": {
10
10
  "@ledvance/base": "^1.x",
@@ -70,7 +70,7 @@ const FlagEditPage = () => {
70
70
 
71
71
  return (
72
72
  <Page
73
- backText={I18n.getLang('mesh_device_detail_mode')}
73
+ backText={I18n.getLang('Feature_devicepanel_flags')}
74
74
  showBackDialog={true}
75
75
  loading={state.loading}
76
76
  backDialogTitle={
@@ -272,6 +272,7 @@ const FlagEditPage = () => {
272
272
  h={state.currentNode.h}
273
273
  s={state.currentNode.s}
274
274
  v={state.currentNode.v}
275
+ minBrightness={0}
275
276
  reserveSV={true}
276
277
  onHSVChange={(h, s, v) => {
277
278
  if (state.colorPaintBucketSelected) {
@@ -0,0 +1,10 @@
1
+ import {useFeatureHook} from "@ledvance/base/src/models/modules/NativePropsSlice";
2
+ import {Result} from "@ledvance/base/src/models/modules/Result";
3
+
4
+ interface RemoteSwitchConfig {
5
+ remoteSwitch: boolean
6
+ }
7
+
8
+ export function useRemoteSwitch(): [boolean, (v: boolean) => Promise<Result<any>>] {
9
+ return useFeatureHook<RemoteSwitchConfig, boolean>('remoteSwitch', false)
10
+ }
@@ -0,0 +1,69 @@
1
+ import React from 'react'
2
+ import {SwitchButton, Utils} from "tuya-panel-kit";
3
+ import Page from "@ledvance/base/src/components/Page";
4
+ import I18n from "@ledvance/base/src/i18n/index";
5
+ import {useDeviceInfo} from "@ledvance/base/src/models/modules/NativePropsSlice";
6
+ import {useReactive} from "ahooks";
7
+ import Spacer from "@ledvance/base/src/components/Spacer";
8
+ import {useRemoteSwitch} from "./RemoteSwitchAction";
9
+ import {View, Text, StyleSheet} from "react-native";
10
+
11
+ const { convertX: cx } = Utils.RatioUtils
12
+
13
+ const RemoteSwitchPage = () => {
14
+ const devInfo = useDeviceInfo()
15
+ const [remoteSwitch, setRemoteSwitch] = useRemoteSwitch()
16
+ const state = useReactive({
17
+ loading: false
18
+ })
19
+ return (<Page
20
+ backText={devInfo.name}
21
+ loading={state.loading}>
22
+ <View style={[styles.titleBGView, styles.shadow]}>
23
+ <Text style={styles.title}>{I18n.getLang('light_sources_specific_settings_remote_control')}</Text>
24
+ <View style={[styles.colorBlock, { backgroundColor: 'red', opacity: 0 }]} />
25
+ <Spacer style={{ flex: 1 }} height={0} width={0} />
26
+ <SwitchButton value={remoteSwitch} onValueChange={async v => {
27
+ state.loading = true
28
+ await setRemoteSwitch(v)
29
+ state.loading = false
30
+ } } />
31
+ </View>
32
+ </Page>)
33
+ }
34
+
35
+ const styles = StyleSheet.create({
36
+ titleBGView: {
37
+ flexDirection: 'row',
38
+ alignItems: 'center',
39
+ paddingHorizontal: cx(16),
40
+ marginHorizontal: cx(24),
41
+ marginTop: cx(30),
42
+ },
43
+ colorBlock: {
44
+ width: cx(20),
45
+ height: cx(20),
46
+ marginStart: cx(12),
47
+ borderRadius: cx(4),
48
+ },
49
+ title: {
50
+ color: '#000',
51
+ fontSize: cx(14),
52
+ fontFamily: 'helvetica_neue_lt_std_bd',
53
+ paddingVertical: cx(16),
54
+ },
55
+ shadow: {
56
+ shadowColor: '#000000',
57
+ shadowOpacity: 0.2,
58
+ shadowRadius: 8,
59
+ elevation:8,
60
+ shadowOffset: {
61
+ width: 0,
62
+ height: 4,
63
+ },
64
+ backgroundColor: '#fff',
65
+ borderRadius: 8,
66
+ },
67
+ })
68
+
69
+ export default RemoteSwitchPage
@@ -0,0 +1,27 @@
1
+ import {useFeatureHook} from "@ledvance/base/src/models/modules/NativePropsSlice";
2
+ import {Result} from "@ledvance/base/src/models/modules/Result";
3
+ import {useCallback} from "react";
4
+
5
+ interface SwitchGradientConfig {
6
+ switchGradient: string
7
+ }
8
+
9
+ export function useSwitchGradient(): [number, number, (onDuration: number, offDuration: number) => Promise<Result<any>>] {
10
+ const [config, setConfig] = useFeatureHook<SwitchGradientConfig, string>('switchGradient', '00000000000000')
11
+ const sgHexFixed = !!config && config.length == 14 ? config : '00000000000000'
12
+ const versionHex = sgHexFixed.substring(0, 2)
13
+ const switchOnDuration = parseInt(sgHexFixed.substring(2, 8), 16)
14
+ const switchOffDuration = parseInt(sgHexFixed.substring(8), 16)
15
+ const setSwitchGradient = useCallback(async (onDuration: number, offDuration: number) => {
16
+ const switchOnDurationHex = (onDuration * 1000).toString(16).padStart(6, '0')
17
+ const switchOffDurationHex = (offDuration * 1000).toString(16).padStart(6, '0')
18
+ const sgHex = `${versionHex}${switchOnDurationHex}${switchOffDurationHex}`
19
+ return await setConfig(sgHex)
20
+ }, [setConfig])
21
+
22
+ return [
23
+ switchOnDuration <= 0 ? 0 : switchOnDuration / 1000,
24
+ switchOffDuration <= 0 ? 0 : switchOffDuration / 1000,
25
+ setSwitchGradient,
26
+ ]
27
+ }
@@ -0,0 +1,115 @@
1
+ import {useReactive, useUpdateEffect} from "ahooks";
2
+ import {useSwitchGradient} from "./SwitchGradientAction";
3
+ import { useNavigation } from '@react-navigation/native'
4
+ import {useDeviceInfo} from "@ledvance/base/src/models/modules/NativePropsSlice";
5
+ import {Utils} from "tuya-panel-kit";
6
+ import Page from "@ledvance/base/src/components/Page";
7
+ import I18n from "@ledvance/base/src/i18n";
8
+ import res from "@ledvance/base/src/res";
9
+ import React from "react";
10
+ import {View, Text, StyleSheet} from "react-native";
11
+ import Card from "@ledvance/base/src/components/Card";
12
+ import Spacer from "@ledvance/base/src/components/Spacer";
13
+ import Stepper from '@ledvance/base/src/components/Stepper'
14
+
15
+ const {convertX: cx} = Utils.RatioUtils
16
+
17
+ const SwitchGradientPage = () => {
18
+ const devInfo = useDeviceInfo()
19
+ const navigation = useNavigation()
20
+ const [
21
+ switchOnDuration,
22
+ switchOffDuration,
23
+ setSwitchGradient,
24
+ ] = useSwitchGradient()
25
+
26
+ const state = useReactive({
27
+ loading: false,
28
+ switchOnDuration,
29
+ switchOffDuration,
30
+ })
31
+
32
+ useUpdateEffect(() => {
33
+ state.switchOnDuration = switchOnDuration
34
+ state.switchOffDuration = switchOffDuration
35
+ }, [switchOnDuration, switchOffDuration])
36
+
37
+ return (
38
+ <Page
39
+ backText={devInfo.name}
40
+ headlineText={I18n.getLang('matter_gradient_overview_headline_text')}
41
+ rightButtonIcon={res.ic_check}
42
+ rightButtonIconClick={async () => {
43
+ state.loading = true
44
+ const res = await setSwitchGradient(state.switchOnDuration, state.switchOffDuration)
45
+ state.loading = false
46
+ console.log(res)
47
+ navigation.goBack()
48
+ }}
49
+ loading={state.loading}>
50
+ <View>
51
+ <Card style={styles.stepCard}>
52
+ <Spacer height={cx(16)}/>
53
+ <Text style={styles.stepTitle}>{I18n.getLang('matter_gradient_light_on_description_text')}</Text>
54
+ <Spacer height={cx(10)}/>
55
+ <View style={styles.stepGroup}>
56
+ <Text style={styles.stepText}>{I18n.getLang('matter_gradient_light_on_title')}</Text>
57
+ <Stepper
58
+ value={state.switchOnDuration}
59
+ min={0}
60
+ max={60}
61
+ stepValue={0.2}
62
+ editable={true}
63
+ isRealTime={true}
64
+ onValueChange={v => {
65
+ state.switchOnDuration = v
66
+ }}/>
67
+ </View>
68
+ <Spacer height={cx(16)}/>
69
+ </Card>
70
+ <Spacer/>
71
+ <Card style={styles.stepCard}>
72
+ <Spacer height={cx(16)}/>
73
+ <Text style={styles.stepTitle}>{I18n.getLang('matter_gradient_light_off_description_text')}</Text>
74
+ <Spacer height={cx(10)}/>
75
+ <View style={styles.stepGroup}>
76
+ <Text style={styles.stepText}>{I18n.getLang('matter_gradient_light_off_title')}</Text>
77
+ <Stepper
78
+ value={state.switchOffDuration}
79
+ min={0}
80
+ max={60}
81
+ stepValue={0.2}
82
+ editable={true}
83
+ isRealTime={true}
84
+ onValueChange={v => {
85
+ state.switchOffDuration = v
86
+ }}/>
87
+ </View>
88
+ <Spacer height={cx(16)}/>
89
+ </Card>
90
+ </View>
91
+ </Page>
92
+ )
93
+ }
94
+
95
+ const styles = StyleSheet.create({
96
+ stepCard: {
97
+ marginHorizontal: cx(24),
98
+ paddingHorizontal: cx(16),
99
+ },
100
+ stepTitle: {
101
+ color: '#000',
102
+ fontSize: cx(14),
103
+ },
104
+ stepGroup: {
105
+ flexDirection: 'row',
106
+ alignItems: 'center',
107
+ },
108
+ stepText: {
109
+ flex: 1,
110
+ color: '#000',
111
+ fontSize: cx(16),
112
+ },
113
+ })
114
+
115
+ export default SwitchGradientPage
@@ -1,4 +1,4 @@
1
- import { NavigationRoute, TransitionPresets } from 'tuya-panel-kit'
1
+ import {NavigationRoute, TransitionPresets} from 'tuya-panel-kit'
2
2
  import TimerPage from '../modules/timer/TimerPage'
3
3
  import TimeSchedulePage from '../modules/time_schedule/TimeSchedulePage'
4
4
  import TimeScheduleDetailPage from '../modules/time_schedule/TimeScheduleDetailPage'
@@ -9,6 +9,8 @@ import StaticMoodEditorPage from '../modules/mood/StaticMoodEditorPage'
9
9
  import SelectPage from '../modules/select/SelectPage'
10
10
  import FlagPage from '../modules/flags/FlagPage'
11
11
  import FlagEditPage from '../modules/flags/FlagEditPage'
12
+ import RemoteSwitchPage from "../modules/remoteSwitch/RemoteSwitchPage";
13
+ import SwitchGradientPage from "../modules/switchGradient/SwitchGradientPage";
12
14
 
13
15
  export const ui_biz_routerKey = {
14
16
  'group_ui_biz_timer': 'group_ui_biz_timer',
@@ -20,7 +22,9 @@ export const ui_biz_routerKey = {
20
22
  'group_ui_biz_dynamic_mood_edit': 'group_ui_biz_dynamic_mood_edit',
21
23
  'group_ui_biz_select_page': 'group_ui_biz_select_page',
22
24
  'group_ui_biz_flag_page': 'group_ui_biz_flag_page',
23
- 'group_ui_biz_flag_page_edit': 'group_ui_biz_flag_page_edit'
25
+ 'group_ui_biz_flag_page_edit': 'group_ui_biz_flag_page_edit',
26
+ 'group_ui_biz_remote_switch': 'group_ui_biz_remote_switch',
27
+ 'group_ui_biz_switch_gradient': 'group_ui_biz_switch_gradient',
24
28
  }
25
29
 
26
30
  export const TimerRouters: NavigationRoute[] = [
@@ -78,7 +82,7 @@ export const MoodRouters: NavigationRoute[] = [
78
82
  showOfflineView: false,
79
83
  },
80
84
  },
81
- {
85
+ {
82
86
  name: ui_biz_routerKey.group_ui_biz_dynamic_mood_edit,
83
87
  component: DynamicMoodEditorPage,
84
88
  options: {
@@ -117,4 +121,26 @@ export const FlagPageRouters: NavigationRoute[] = [
117
121
  showOfflineView: false,
118
122
  }
119
123
  },
120
- ]
124
+ ]
125
+
126
+ export const RemoteSwitchRouters: NavigationRoute[] = [
127
+ {
128
+ name: ui_biz_routerKey.group_ui_biz_remote_switch,
129
+ component: RemoteSwitchPage,
130
+ options: {
131
+ hideTopbar: true,
132
+ showOfflineView: false,
133
+ },
134
+ }
135
+ ]
136
+
137
+ export const SwitchGradientRouters: NavigationRoute[] = [
138
+ {
139
+ name: ui_biz_routerKey.group_ui_biz_switch_gradient,
140
+ component: SwitchGradientPage,
141
+ options: {
142
+ hideTopbar: true,
143
+ showOfflineView: false,
144
+ },
145
+ }
146
+ ]