@ledvance/group-ui-biz-bundle 1.0.39 → 1.0.40
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/fixedTimeForPlug/FixedTimeForPlugActon.ts +114 -0
- package/src/modules/fixedTimeForPlug/FixedTimeForPlugDetailPage.tsx +350 -0
- package/src/modules/fixedTimeForPlug/FixedTimeForPlugPage.tsx +194 -0
- package/src/modules/fixedTimeForPlug/ItemCard.tsx +71 -0
- package/src/modules/fixedTimeForPlug/Summary.tsx +123 -0
- package/src/modules/fixedTimingForLight/FixedTimingForLightAction.ts +45 -0
- package/src/modules/fixedTimingForLight/FixedTimingForLightDetailPage.tsx +426 -0
- package/src/modules/fixedTimingForLight/FixedTimingForLightPage.tsx +192 -0
- package/src/modules/fixedTimingForLight/ItemCard.tsx +71 -0
- package/src/modules/fixedTimingForLight/Summary.tsx +123 -0
- package/src/modules/mood/MoodPage.tsx +33 -15
- package/src/modules/mood/SceneAction.ts +22 -3
- package/src/navigation/Routers.ts +47 -1
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import Card from "@ledvance/base/src/components/Card";
|
|
3
|
+
import Spacer from "@ledvance/base/src/components/Spacer";
|
|
4
|
+
import {StyleSheet, Text, View} from "react-native";
|
|
5
|
+
import {SwitchButton, Utils} from "tuya-panel-kit";
|
|
6
|
+
import {loopText} from "@ledvance/base/src/utils/common";
|
|
7
|
+
import {parseHour12} from "@tuya/tuya-panel-lamp-sdk/lib/utils";
|
|
8
|
+
import {FixedTimeItem} from "./FixedTimeForPlugActon";
|
|
9
|
+
|
|
10
|
+
const {convertX: cx} = Utils.RatioUtils
|
|
11
|
+
const {parseTimer} = Utils.TimeUtils
|
|
12
|
+
|
|
13
|
+
export interface ItemCardProps {
|
|
14
|
+
item: FixedTimeItem,
|
|
15
|
+
is24Hour?: boolean,
|
|
16
|
+
onSwitch: (enable: boolean) => void
|
|
17
|
+
onPress: () => void
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const ItemCard = (props: ItemCardProps) => {
|
|
21
|
+
const {item, is24Hour, onSwitch, onPress} = props
|
|
22
|
+
return (
|
|
23
|
+
<Card style={styles.itemCard} onPress={onPress}>
|
|
24
|
+
<Spacer height={cx(16)}/>
|
|
25
|
+
<View style={styles.switchLine}>
|
|
26
|
+
<Text style={styles.time}>
|
|
27
|
+
{is24Hour ?
|
|
28
|
+
`${parseTimer(item.startTime * 60)} - ${parseTimer(item.endTime * 60)}`
|
|
29
|
+
:
|
|
30
|
+
`${parseHour12(item.startTime * 60)} - ${parseHour12(item.endTime * 60)}`
|
|
31
|
+
}
|
|
32
|
+
</Text>
|
|
33
|
+
<SwitchButton
|
|
34
|
+
style={styles.switchBtn}
|
|
35
|
+
value={item.enable}
|
|
36
|
+
thumbStyle={{elevation: 0}}
|
|
37
|
+
onValueChange={onSwitch}/>
|
|
38
|
+
</View>
|
|
39
|
+
<Text style={styles.loopText}>{loopText(item.weeks, parseTimer(item.startTime * 60))}</Text>
|
|
40
|
+
<Spacer height={cx(5)}/>
|
|
41
|
+
<Text style={styles.loopText}>{item.name}</Text>
|
|
42
|
+
<Spacer/>
|
|
43
|
+
</Card>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const styles = StyleSheet.create({
|
|
48
|
+
itemCard: {
|
|
49
|
+
marginHorizontal: cx(24),
|
|
50
|
+
paddingHorizontal: cx(16),
|
|
51
|
+
},
|
|
52
|
+
switchLine: {
|
|
53
|
+
flexDirection: 'row',
|
|
54
|
+
alignItems: 'center',
|
|
55
|
+
},
|
|
56
|
+
time: {
|
|
57
|
+
flex: 1,
|
|
58
|
+
color: '#000',
|
|
59
|
+
fontSize: cx(16),
|
|
60
|
+
fontWeight: 'bold',
|
|
61
|
+
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
62
|
+
},
|
|
63
|
+
switchBtn: {},
|
|
64
|
+
loopText: {
|
|
65
|
+
color: '#000',
|
|
66
|
+
fontSize: cx(14),
|
|
67
|
+
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
68
|
+
},
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
export default ItemCard
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import React, { ReactElement, memo } from "react";
|
|
2
|
+
import { Text, Image, ViewStyle, View, StyleSheet } from 'react-native'
|
|
3
|
+
import res from "@ledvance/base/src/res"
|
|
4
|
+
import I18n from "@ledvance/base/src/i18n";
|
|
5
|
+
import { Utils } from "tuya-panel-kit";
|
|
6
|
+
import Spacer from "@ledvance/base/src/components/Spacer";
|
|
7
|
+
|
|
8
|
+
const { convertX: cx } = Utils.RatioUtils;
|
|
9
|
+
|
|
10
|
+
interface SummaryProps {
|
|
11
|
+
style?: ViewStyle
|
|
12
|
+
frequency?: string | ReactElement
|
|
13
|
+
time?: string | ReactElement
|
|
14
|
+
actions?: ReactElement
|
|
15
|
+
hideActions?: boolean
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const Summary = (props: SummaryProps) => {
|
|
19
|
+
return (
|
|
20
|
+
<View style={styles.cardContainer}>
|
|
21
|
+
<Text style={styles.itemTitle}>{I18n.getLang('add_randomtimecycle_subheadline_text')}</Text>
|
|
22
|
+
<Spacer height={cx(10)} />
|
|
23
|
+
<View style={{}}>
|
|
24
|
+
<View style={styles.summaryContainer}>
|
|
25
|
+
<View style={styles.summaryLeft}>
|
|
26
|
+
<Image
|
|
27
|
+
source={res.summary_icon1}
|
|
28
|
+
resizeMode="contain"
|
|
29
|
+
style={styles.summaryImg}
|
|
30
|
+
/>
|
|
31
|
+
<View>
|
|
32
|
+
<Text style={styles.leftTitle}>{I18n.getLang('feature_summary_frequency_headline')}</Text>
|
|
33
|
+
</View>
|
|
34
|
+
</View>
|
|
35
|
+
<View style={styles.summaryRight}>
|
|
36
|
+
<View style={styles.rightWrap}>
|
|
37
|
+
<Text style={styles.rightItem}>{props.frequency}</Text>
|
|
38
|
+
</View>
|
|
39
|
+
</View>
|
|
40
|
+
</View>
|
|
41
|
+
<View style={styles.summaryContainer}>
|
|
42
|
+
<View style={styles.summaryLeft}>
|
|
43
|
+
<Image
|
|
44
|
+
source={res.summary_icon2}
|
|
45
|
+
resizeMode="contain"
|
|
46
|
+
style={styles.summaryImg}
|
|
47
|
+
/>
|
|
48
|
+
<View>
|
|
49
|
+
<Text style={styles.leftTitle}>{I18n.getLang('feature_summary_time_headline')}</Text>
|
|
50
|
+
</View>
|
|
51
|
+
</View>
|
|
52
|
+
<View style={styles.summaryRight}>
|
|
53
|
+
<View style={styles.rightWrap}>
|
|
54
|
+
<Text style={styles.rightItem}>{props.time}</Text>
|
|
55
|
+
</View>
|
|
56
|
+
</View>
|
|
57
|
+
</View>
|
|
58
|
+
{!props.hideActions && <View style={[styles.summaryContainer, { alignItems: 'flex-start' }]}>
|
|
59
|
+
<View style={styles.summaryLeft}>
|
|
60
|
+
<Image
|
|
61
|
+
source={res.summary_icon3}
|
|
62
|
+
resizeMode="contain"
|
|
63
|
+
style={styles.summaryImg}
|
|
64
|
+
/>
|
|
65
|
+
<View>
|
|
66
|
+
<Text style={styles.leftTitle}>{I18n.getLang('motion_detection_add_time_schedule_actions_text1')}</Text>
|
|
67
|
+
</View>
|
|
68
|
+
</View>
|
|
69
|
+
<View style={styles.summaryRight}>
|
|
70
|
+
{props.actions}
|
|
71
|
+
</View>
|
|
72
|
+
</View>}
|
|
73
|
+
</View>
|
|
74
|
+
</View>
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const styles = StyleSheet.create({
|
|
79
|
+
cardContainer: {
|
|
80
|
+
marginHorizontal: cx(24),
|
|
81
|
+
},
|
|
82
|
+
itemTitle: {
|
|
83
|
+
color: '#000',
|
|
84
|
+
fontSize: cx(16),
|
|
85
|
+
fontWeight: 'bold',
|
|
86
|
+
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
87
|
+
},
|
|
88
|
+
summaryContainer: {
|
|
89
|
+
flex: 1,
|
|
90
|
+
flexDirection: 'row',
|
|
91
|
+
marginBottom: cx(10),
|
|
92
|
+
},
|
|
93
|
+
summaryLeft: {
|
|
94
|
+
flexDirection: 'row',
|
|
95
|
+
alignItems: 'center',
|
|
96
|
+
minWidth: cx(100)
|
|
97
|
+
},
|
|
98
|
+
summaryImg: {
|
|
99
|
+
width: cx(12),
|
|
100
|
+
height: cx(12),
|
|
101
|
+
marginRight: cx(6)
|
|
102
|
+
},
|
|
103
|
+
leftTitle: {
|
|
104
|
+
fontSize: cx(14),
|
|
105
|
+
color: '#000'
|
|
106
|
+
},
|
|
107
|
+
summaryRight: {
|
|
108
|
+
flex: 1,
|
|
109
|
+
flexDirection: 'column',
|
|
110
|
+
marginLeft: cx(15),
|
|
111
|
+
},
|
|
112
|
+
rightWrap: {
|
|
113
|
+
borderRadius: cx(16),
|
|
114
|
+
paddingHorizontal: cx(12),
|
|
115
|
+
alignSelf: 'flex-start',
|
|
116
|
+
backgroundColor: '#cbcbcb',
|
|
117
|
+
},
|
|
118
|
+
rightItem: {
|
|
119
|
+
color: '#000',
|
|
120
|
+
},
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
export default memo(Summary)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {useFeatureHook} from "@ledvance/base/src/models/modules/NativePropsSlice";
|
|
2
|
+
import {Formatter} from "@tuya/tuya-panel-lamp-sdk";
|
|
3
|
+
const FixedTimerFormatter = new Formatter.CycleTimerFormatter()
|
|
4
|
+
|
|
5
|
+
export interface FixedTimingParam {
|
|
6
|
+
channels: string[]
|
|
7
|
+
is24Hour?: boolean
|
|
8
|
+
isSupportColor: boolean
|
|
9
|
+
isSupportTemperature: boolean
|
|
10
|
+
isSupportBrightness: boolean
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface FixedTimingItem {
|
|
14
|
+
power: boolean
|
|
15
|
+
channel?: number
|
|
16
|
+
weeks: number[]
|
|
17
|
+
startTime: number
|
|
18
|
+
endTime: number
|
|
19
|
+
openTime: number
|
|
20
|
+
closeTime: number
|
|
21
|
+
color: {
|
|
22
|
+
hue: number
|
|
23
|
+
saturation: number
|
|
24
|
+
value: number
|
|
25
|
+
brightness: number
|
|
26
|
+
temperature: number
|
|
27
|
+
}
|
|
28
|
+
index?: number
|
|
29
|
+
name?: string
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface LightConfig {
|
|
33
|
+
cycleTiming: FixedTimingItem[]
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function useFixedTiming() {
|
|
37
|
+
return useFeatureHook<LightConfig, FixedTimingItem[]>('cycleTiming', [], (val) => {
|
|
38
|
+
const data = {
|
|
39
|
+
version: 0,
|
|
40
|
+
length: 16,
|
|
41
|
+
nodes: val
|
|
42
|
+
}
|
|
43
|
+
return FixedTimerFormatter.format(data)
|
|
44
|
+
})
|
|
45
|
+
}
|
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
import React, {useEffect, useMemo} from 'react'
|
|
2
|
+
import Page from "@ledvance/base/src/components/Page";
|
|
3
|
+
import I18n from "@ledvance/base/src/i18n";
|
|
4
|
+
import {Image, ScrollView, StyleSheet, Text, TouchableOpacity, View} from "react-native";
|
|
5
|
+
import {TimerPicker, Utils} from "tuya-panel-kit";
|
|
6
|
+
import {FixedTimingItem, FixedTimingParam} from "./FixedTimingForLightAction";
|
|
7
|
+
import res from "@ledvance/base/src/res/index";
|
|
8
|
+
import {useReactive, useUpdateEffect} from "ahooks";
|
|
9
|
+
import {useNavigation, useRoute} from '@react-navigation/core';
|
|
10
|
+
import LdvTopName from "@ledvance/base/src/components/ldvTopName";
|
|
11
|
+
import TextField from "@ledvance/base/src/components/TextField";
|
|
12
|
+
import LdvWeekView from "@ledvance/base/src/components/weekSelect";
|
|
13
|
+
import Spacer from "@ledvance/base/src/components/Spacer";
|
|
14
|
+
import {loopText, showDialog} from "@ledvance/base/src/utils/common";
|
|
15
|
+
import DeleteButton from "@ledvance/base/src/components/DeleteButton";
|
|
16
|
+
import dayjs from "dayjs";
|
|
17
|
+
import {cloneDeep, isEqual} from "lodash";
|
|
18
|
+
import Summary from "./Summary";
|
|
19
|
+
import Card from "@ledvance/base/src/components/Card";
|
|
20
|
+
import LdvSwitch from "@ledvance/base/src/components/ldvSwitch";
|
|
21
|
+
import LampAdjustView from "@ledvance/base/src/components/LampAdjustView";
|
|
22
|
+
import {parseHour12} from "@tuya/tuya-panel-lamp-sdk/lib/utils";
|
|
23
|
+
import LdvPickerView from "@ledvance/base/src/components/ldvPickerView";
|
|
24
|
+
|
|
25
|
+
const {parseTimer} = Utils.TimeUtils
|
|
26
|
+
const {convertX: cx} = Utils.RatioUtils;
|
|
27
|
+
|
|
28
|
+
interface FixedTimeDetailParam extends FixedTimingParam {
|
|
29
|
+
mode: 'add' | 'edit',
|
|
30
|
+
item: FixedTimingItem,
|
|
31
|
+
onPost: (mode: 'add' | 'edit' | 'del', item: FixedTimingItem, goBack?: boolean) => Promise<void>
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const newFixedTimingItem = (): FixedTimingItem => {
|
|
35
|
+
const startTime = dayjs().hour() * 60 + dayjs().minute()
|
|
36
|
+
return {
|
|
37
|
+
power: true,
|
|
38
|
+
channel: 0,
|
|
39
|
+
weeks: [0, 0, 0, 0, 0, 0, 0],
|
|
40
|
+
startTime: startTime,
|
|
41
|
+
endTime: startTime + 60,
|
|
42
|
+
openTime: 1,
|
|
43
|
+
closeTime: 1,
|
|
44
|
+
color: {
|
|
45
|
+
hue: 0,
|
|
46
|
+
saturation: 100,
|
|
47
|
+
value: 100,
|
|
48
|
+
brightness: 100,
|
|
49
|
+
temperature: 0,
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const FixedTimingForLightDetailPage = () => {
|
|
55
|
+
const navigation = useNavigation()
|
|
56
|
+
const params = useRoute().params as FixedTimeDetailParam
|
|
57
|
+
const state = useReactive({
|
|
58
|
+
item: params.mode === 'add' ? newFixedTimingItem() : cloneDeep(params.item),
|
|
59
|
+
onHour: '00',
|
|
60
|
+
onMinute: '01',
|
|
61
|
+
offHour: '00',
|
|
62
|
+
offMinute: '01',
|
|
63
|
+
loading: false,
|
|
64
|
+
isColorMode: false
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
const { brightness, temperature, hue, saturation, value } = state.item.color
|
|
69
|
+
state.isColorMode = brightness === 0 && temperature === 0 && (hue !== 0 || saturation !== 0 || value !== 0)
|
|
70
|
+
}, [])
|
|
71
|
+
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
const { openTime, closeTime } = state.item
|
|
74
|
+
state.onHour = formatTime(Math.floor(openTime / 60))
|
|
75
|
+
state.onMinute = formatTime(openTime % 60)
|
|
76
|
+
state.offHour = formatTime(Math.floor(closeTime / 60))
|
|
77
|
+
state.offMinute = formatTime(closeTime % 60)
|
|
78
|
+
}, []);
|
|
79
|
+
|
|
80
|
+
useUpdateEffect(() => {
|
|
81
|
+
if (state.onHour === '00' && state.onMinute === '00') {
|
|
82
|
+
state.onMinute = '01'
|
|
83
|
+
}
|
|
84
|
+
if (state.offHour === '00' && state.offMinute === '00') {
|
|
85
|
+
state.offMinute = '01'
|
|
86
|
+
}
|
|
87
|
+
}, [state.onHour, state.onMinute, state.offHour, state.offMinute])
|
|
88
|
+
|
|
89
|
+
const formatTime = (v: number) => {
|
|
90
|
+
return v.toString().padStart(2, '0')
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const parseTime = (h: string, m: string) => {
|
|
94
|
+
return Number(h) * 60 + Number(m)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const isTimeEffective = useMemo(() => {
|
|
98
|
+
const { startTime, endTime } = state.item
|
|
99
|
+
const timeInterval = endTime - startTime + ((startTime > endTime) ? 1440 : 0) // 跨天要加1440
|
|
100
|
+
const workTime = parseTime(state.onHour, state.onMinute) + parseTime(state.offHour, state.offMinute)
|
|
101
|
+
return timeInterval >= workTime
|
|
102
|
+
}, [state.item.startTime, state.item.endTime, state.onHour, state.onMinute, state.offHour, state.offMinute])
|
|
103
|
+
|
|
104
|
+
const canSave = useMemo(() => {
|
|
105
|
+
return state.item.name && state.item.name.length < 33 && state.item.channel !== undefined && isTimeEffective
|
|
106
|
+
}, [state.item.name, state.item.channel, isTimeEffective])
|
|
107
|
+
|
|
108
|
+
const showConfirm = useMemo(() => {
|
|
109
|
+
return params.mode === 'edit' && !isEqual(state.item, params.item)
|
|
110
|
+
}, [JSON.stringify(state.item), JSON.stringify(params.item)])
|
|
111
|
+
|
|
112
|
+
const onSave = async () => {
|
|
113
|
+
if (!canSave) {
|
|
114
|
+
return
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const item: FixedTimingItem = {
|
|
118
|
+
...state.item,
|
|
119
|
+
power: true,
|
|
120
|
+
color: {
|
|
121
|
+
hue: state.isColorMode ? state.item.color.hue : 0,
|
|
122
|
+
saturation: state.isColorMode ? state.item.color.saturation : 0,
|
|
123
|
+
value: state.isColorMode ? state.item.color.value : 0,
|
|
124
|
+
temperature: state.isColorMode ? 0 : state.item.color.temperature,
|
|
125
|
+
brightness: state.isColorMode ? 0 : state.item.color.brightness
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
item.openTime = parseTime(state.onHour, state.onMinute)
|
|
129
|
+
item.closeTime = parseTime(state.offHour, state.offMinute)
|
|
130
|
+
await params.onPost(params.mode, item, true);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const onDelete = () => {
|
|
134
|
+
return showDialog({
|
|
135
|
+
method: 'confirm',
|
|
136
|
+
title: I18n.getLang('cancel_dialog_delete_item_fixedtimecycle_titel'),
|
|
137
|
+
subTitle: I18n.getLang('cancel_dialog_delete_item_fixedtimecycle_description'),
|
|
138
|
+
onConfirm: async (_, {close}) => {
|
|
139
|
+
close()
|
|
140
|
+
await params.onPost('del', state.item, true)
|
|
141
|
+
}
|
|
142
|
+
})
|
|
143
|
+
}
|
|
144
|
+
return (
|
|
145
|
+
<Page
|
|
146
|
+
backText={I18n.getLang('fixedTimeCycle_socket_headline')}
|
|
147
|
+
onBackClick={!showConfirm ? navigation.goBack : undefined}
|
|
148
|
+
rightButtonIcon={canSave ? res.ic_check : res.ic_uncheck}
|
|
149
|
+
rightButtonDisabled={state.loading}
|
|
150
|
+
loading={state.loading}
|
|
151
|
+
showBackDialog={showConfirm}
|
|
152
|
+
backDialogTitle={I18n.getLang('cancel_dialog_leave_unsaved_titel')}
|
|
153
|
+
backDialogContent={I18n.getLang('cancel_dialog_delete_item_fixedtimecycle_description')}
|
|
154
|
+
rightButtonIconClick={onSave}
|
|
155
|
+
>
|
|
156
|
+
<ScrollView nestedScrollEnabled={true}>
|
|
157
|
+
<LdvTopName
|
|
158
|
+
title={I18n.getLang(params.mode === 'add' ? 'add_fixedtimecycle_headline_text' : 'edit_fixedtimecycle_headline_text')}/>
|
|
159
|
+
<TextField
|
|
160
|
+
style={styles.cardContainer}
|
|
161
|
+
value={state.item.name}
|
|
162
|
+
showError={(state.item.name?.length || 0) > 32}
|
|
163
|
+
maxLength={33}
|
|
164
|
+
errorText={I18n.getLang('add_new_dynamic_mood_alert_text')}
|
|
165
|
+
placeholder={I18n.getLang('add_new_trigger_time_inputfield_value_text')}
|
|
166
|
+
onChangeText={(t: string) => {
|
|
167
|
+
state.item.name = t;
|
|
168
|
+
}}
|
|
169
|
+
/>
|
|
170
|
+
{/* pick */}
|
|
171
|
+
<TimerPicker
|
|
172
|
+
itemTextColor='#aeadb5'
|
|
173
|
+
style={{paddingVertical: cx(0), marginVertical: cx(0)}}
|
|
174
|
+
is12Hours={!params.is24Hour}
|
|
175
|
+
startTime={state.item.startTime}
|
|
176
|
+
endTime={state.item.endTime}
|
|
177
|
+
onTimerChange={(startTime, endTime) => {
|
|
178
|
+
state.item.startTime = startTime
|
|
179
|
+
state.item.endTime = endTime
|
|
180
|
+
}}/>
|
|
181
|
+
<LdvWeekView
|
|
182
|
+
value={state.item.weeks}
|
|
183
|
+
style={styles.cardContainer}
|
|
184
|
+
onSelect={(index: number) => {
|
|
185
|
+
const rawIndex = index - 1
|
|
186
|
+
state.item.weeks[rawIndex] = state.item.weeks[rawIndex] === 1 ? 0 : 1
|
|
187
|
+
}}/>
|
|
188
|
+
<Spacer/>
|
|
189
|
+
<Text style={styles.cardContainer}>{loopText(state.item.weeks, parseTimer(state.item.startTime * 60))}</Text>
|
|
190
|
+
<Spacer/>
|
|
191
|
+
{/*Apply for */}
|
|
192
|
+
<View style={styles.cardContainer}>
|
|
193
|
+
<Text style={styles.itemTitle}>{I18n.getLang('timeschedule_add_schedule_subheadline_text')}</Text>
|
|
194
|
+
<Spacer height={cx(10)}/>
|
|
195
|
+
<View style={styles.applyContent}>
|
|
196
|
+
{state.item.channel === undefined ?
|
|
197
|
+
<Text>{I18n.getLang('timer_ceiling_fan_selectionfield_no_components_text')}</Text> :
|
|
198
|
+
<View style={[styles.applyItem, {marginBottom: cx(10), borderRadius: 4}]}>
|
|
199
|
+
<Text style={{color: '#000'}}>{params.channels[state.item.channel]}</Text>
|
|
200
|
+
{params.channels.length > 1 && <TouchableOpacity
|
|
201
|
+
onPress={() => {
|
|
202
|
+
state.item.channel = undefined
|
|
203
|
+
}}
|
|
204
|
+
style={{paddingHorizontal: cx(5)}}>
|
|
205
|
+
<Image style={{width: cx(16), height: cx(16)}} source={res.ic_arrows_nav_clear}/>
|
|
206
|
+
</TouchableOpacity>}
|
|
207
|
+
</View>
|
|
208
|
+
}
|
|
209
|
+
</View>
|
|
210
|
+
{params.channels.map((item: string, index: number) => {
|
|
211
|
+
if (state.item.channel === index) {
|
|
212
|
+
return null
|
|
213
|
+
}
|
|
214
|
+
return (
|
|
215
|
+
<TouchableOpacity
|
|
216
|
+
style={styles.applyItem}
|
|
217
|
+
key={item}
|
|
218
|
+
onPress={() => {
|
|
219
|
+
state.item.channel = index
|
|
220
|
+
}}
|
|
221
|
+
>
|
|
222
|
+
<Text style={{color: '#000'}}>{item}</Text>
|
|
223
|
+
<Image style={{width: cx(16), height: cx(16)}} source={res.device_panel_timer_add}/>
|
|
224
|
+
</TouchableOpacity>
|
|
225
|
+
)
|
|
226
|
+
})}
|
|
227
|
+
</View>
|
|
228
|
+
<Spacer/>
|
|
229
|
+
{/* Devices */}
|
|
230
|
+
<View style={styles.cardContainer}>
|
|
231
|
+
<Text style={styles.itemTitle}>{I18n.getLang('timeschedule_add_schedule_subheadline2_text')}</Text>
|
|
232
|
+
<Spacer height={cx(10)} />
|
|
233
|
+
<Card>
|
|
234
|
+
<LdvSwitch
|
|
235
|
+
title={I18n.getLang('light_sources_tile_tw_lighting_headline')}
|
|
236
|
+
color={'#fff'}
|
|
237
|
+
colorAlpha={1}
|
|
238
|
+
enable={true}
|
|
239
|
+
setEnable={() => { }}
|
|
240
|
+
showSwitch={false}
|
|
241
|
+
/>
|
|
242
|
+
<LampAdjustView
|
|
243
|
+
isSupportColor={params.isSupportColor}
|
|
244
|
+
isSupportBrightness={params.isSupportBrightness}
|
|
245
|
+
isSupportTemperature={params.isSupportTemperature}
|
|
246
|
+
isColorMode={state.isColorMode}
|
|
247
|
+
reserveSV={true}
|
|
248
|
+
setIsColorMode={(v) => state.isColorMode = v}
|
|
249
|
+
h={state.item.color.hue}
|
|
250
|
+
s={state.item.color.saturation}
|
|
251
|
+
v={state.item.color.value}
|
|
252
|
+
colorTemp={state.item.color.temperature}
|
|
253
|
+
brightness={state.item.color.brightness}
|
|
254
|
+
onHSVChangeComplete={(h, s, v) => {
|
|
255
|
+
state.item.color = {
|
|
256
|
+
...state.item.color,
|
|
257
|
+
hue: h,
|
|
258
|
+
saturation: s,
|
|
259
|
+
value: v
|
|
260
|
+
}
|
|
261
|
+
}}
|
|
262
|
+
onCCTChangeComplete={(v) => {
|
|
263
|
+
state.item.color = {
|
|
264
|
+
...state.item.color,
|
|
265
|
+
temperature: v
|
|
266
|
+
}
|
|
267
|
+
}}
|
|
268
|
+
onBrightnessChangeComplete={(v) => {
|
|
269
|
+
state.item.color = {
|
|
270
|
+
...state.item.color,
|
|
271
|
+
brightness: v
|
|
272
|
+
}
|
|
273
|
+
}}
|
|
274
|
+
/>
|
|
275
|
+
</Card>
|
|
276
|
+
<Spacer />
|
|
277
|
+
</View>
|
|
278
|
+
<View style={styles.cardContainer}>
|
|
279
|
+
<Text style={styles.itemTitle}>{I18n.getLang('timeschedule_add_schedule_subheadline4_text')}</Text>
|
|
280
|
+
{!isTimeEffective && <View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
|
281
|
+
<Image style={{ width: cx(16), height: cx(16), tintColor: 'rgb(255,149,0)' }} source={res.ic_warning_amber} />
|
|
282
|
+
<Text style={{ fontSize: cx(12), color: 'rgb(255,149,0)' }}>{I18n.getLang('addTimeCycle_warning_text')}</Text>
|
|
283
|
+
</View>}
|
|
284
|
+
<View >
|
|
285
|
+
<Text style={{ color: '#000', marginVertical: cx(10) }}>{I18n.getLang('addTimeCycle_settings_sec_text')}</Text>
|
|
286
|
+
<LdvPickerView
|
|
287
|
+
hour={state.onHour}
|
|
288
|
+
minute={state.onMinute}
|
|
289
|
+
unit={['h', 'min']}
|
|
290
|
+
setHour={(h: string) => state.onHour = h}
|
|
291
|
+
setMinute={(m: string) => state.onMinute = m}
|
|
292
|
+
/>
|
|
293
|
+
</View>
|
|
294
|
+
<View>
|
|
295
|
+
<Text style={{ color: '#000', marginVertical: cx(10) }}>{I18n.getLang('addTimeCycle_settings_sec_text2')}</Text>
|
|
296
|
+
<LdvPickerView
|
|
297
|
+
hour={state.offHour}
|
|
298
|
+
minute={state.offMinute}
|
|
299
|
+
unit={['h', 'min']}
|
|
300
|
+
setHour={(h: string) => state.offHour = h}
|
|
301
|
+
setMinute={(m: string) => state.offMinute = m}
|
|
302
|
+
/>
|
|
303
|
+
</View>
|
|
304
|
+
</View>
|
|
305
|
+
<Spacer />
|
|
306
|
+
{/* summary */}
|
|
307
|
+
<Summary
|
|
308
|
+
frequency={loopText(state.item.weeks)}
|
|
309
|
+
time={params.is24Hour ?
|
|
310
|
+
`${parseTimer(state.item.startTime * 60)} - ${parseTimer(state.item.endTime * 60)}`
|
|
311
|
+
:
|
|
312
|
+
`${parseHour12(state.item.startTime * 60)} - ${parseHour12(state.item.endTime * 60)}`
|
|
313
|
+
}
|
|
314
|
+
actions={<View style={{ flex: 1 }}>
|
|
315
|
+
<>
|
|
316
|
+
<View>
|
|
317
|
+
<Text style={{ fontSize: cx(12), color: '#000000' }}>
|
|
318
|
+
{I18n.formatValue('feature_summary_action_txt_4', `${Number(state.onHour)}`, `${Number(state.onMinute)}`)}
|
|
319
|
+
</Text>
|
|
320
|
+
</View>
|
|
321
|
+
<View style={{ flexDirection: 'row' }}>
|
|
322
|
+
<View style={styles.filletCorner}>
|
|
323
|
+
<Text style={styles.rightTitle}>{params.channels?.length > 0 && params.channels[0]}</Text>
|
|
324
|
+
</View>
|
|
325
|
+
</View>
|
|
326
|
+
</>
|
|
327
|
+
<>
|
|
328
|
+
<View>
|
|
329
|
+
<Text style={{ fontSize: cx(12), color: '#000000' }}>
|
|
330
|
+
{I18n.formatValue('feature_summary_action_txt_6', `${Number(state.offHour)}`, `${Number(state.offMinute)}`)}
|
|
331
|
+
</Text>
|
|
332
|
+
</View>
|
|
333
|
+
<View style={{ flexDirection: 'row' }}>
|
|
334
|
+
<View style={styles.filletCorner}>
|
|
335
|
+
<Text style={styles.rightTitle}>{params.channels?.length > 0 && params.channels[0]}</Text>
|
|
336
|
+
</View>
|
|
337
|
+
</View>
|
|
338
|
+
</>
|
|
339
|
+
</View>}
|
|
340
|
+
/>
|
|
341
|
+
<Spacer/>
|
|
342
|
+
{params.mode === 'edit' &&
|
|
343
|
+
<View style={{marginHorizontal: cx(24)}}>
|
|
344
|
+
<DeleteButton
|
|
345
|
+
text={I18n.getLang('edit_fixedtimecycle_bttn_text')}
|
|
346
|
+
onPress={onDelete}/>
|
|
347
|
+
</View>
|
|
348
|
+
}
|
|
349
|
+
<Spacer/>
|
|
350
|
+
</ScrollView>
|
|
351
|
+
</Page>
|
|
352
|
+
)
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
const styles = StyleSheet.create({
|
|
356
|
+
cardContainer: {
|
|
357
|
+
marginHorizontal: cx(24)
|
|
358
|
+
},
|
|
359
|
+
itemTitle: {
|
|
360
|
+
color: '#000',
|
|
361
|
+
fontSize: cx(16),
|
|
362
|
+
fontWeight: 'bold',
|
|
363
|
+
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
364
|
+
},
|
|
365
|
+
applyContent: {
|
|
366
|
+
backgroundColor: '#f6f6f6',
|
|
367
|
+
borderRadius: 4,
|
|
368
|
+
minHeight: cx(55),
|
|
369
|
+
flex: 1,
|
|
370
|
+
justifyContent: 'center',
|
|
371
|
+
paddingHorizontal: cx(10),
|
|
372
|
+
paddingTop: cx(10)
|
|
373
|
+
},
|
|
374
|
+
applyItem: {
|
|
375
|
+
paddingLeft: cx(5),
|
|
376
|
+
flexDirection: 'row',
|
|
377
|
+
justifyContent: 'space-between',
|
|
378
|
+
alignItems: 'center',
|
|
379
|
+
backgroundColor: '#fff',
|
|
380
|
+
height: cx(35),
|
|
381
|
+
},
|
|
382
|
+
summaryContainer: {
|
|
383
|
+
flexDirection: 'row',
|
|
384
|
+
justifyContent: 'flex-start',
|
|
385
|
+
marginBottom: cx(10)
|
|
386
|
+
},
|
|
387
|
+
summaryLeft: {
|
|
388
|
+
flexDirection: 'row',
|
|
389
|
+
justifyContent: 'flex-start',
|
|
390
|
+
alignItems: 'center',
|
|
391
|
+
},
|
|
392
|
+
summaryImg: {
|
|
393
|
+
width: cx(12),
|
|
394
|
+
height: cx(12),
|
|
395
|
+
marginRight: cx(6)
|
|
396
|
+
},
|
|
397
|
+
leftTitle: {
|
|
398
|
+
fontSize: cx(14),
|
|
399
|
+
color: '#000'
|
|
400
|
+
},
|
|
401
|
+
summaryRight: {
|
|
402
|
+
flexDirection: 'column',
|
|
403
|
+
marginLeft: cx(21),
|
|
404
|
+
borderRadius: cx(16),
|
|
405
|
+
backgroundColor: '#cbcbcb',
|
|
406
|
+
},
|
|
407
|
+
rightItem: {
|
|
408
|
+
paddingHorizontal: cx(12),
|
|
409
|
+
color: '#000',
|
|
410
|
+
},
|
|
411
|
+
rightTitle: {
|
|
412
|
+
paddingLeft: cx(12),
|
|
413
|
+
paddingRight: cx(12),
|
|
414
|
+
fontSize: cx(10),
|
|
415
|
+
textAlign: 'center',
|
|
416
|
+
alignSelf: 'flex-start'
|
|
417
|
+
},
|
|
418
|
+
filletCorner: {
|
|
419
|
+
flexDirection: 'row',
|
|
420
|
+
backgroundColor: '#cbcbcb',
|
|
421
|
+
borderRadius: cx(16),
|
|
422
|
+
alignSelf: 'flex-start'
|
|
423
|
+
}
|
|
424
|
+
})
|
|
425
|
+
|
|
426
|
+
export default FixedTimingForLightDetailPage
|