@ledvance/ui-biz-bundle 1.1.165 → 1.1.167
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/FlagInfo.tsx +18 -0
- package/src/newModules/energyConsumption/EnergyConsumptionActions.ts +4 -18
- package/src/newModules/energyConsumption/EnergyConsumptionChart/PowerChartSection.tsx +5 -4
- package/src/newModules/energyConsumption/co2Data.ts +7 -0
- package/src/newModules/energyConsumption/component/PowerLineChart.tsx +17 -2
- package/src/newModules/fixedTime/FixedTimePage.tsx +1 -1
- package/src/newModules/randomTime/RandomTimePage.tsx +1 -1
- package/src/newModules/timeSchedule/TimeScheduleDetailPage.tsx +53 -51
- package/src/newModules/timeSchedule/TimeSchedulePage.tsx +57 -4
- package/src/newModules/timeSchedule/components/ManuaSettings.tsx +10 -0
- package/src/newModules/timeSchedule/components/ScheduleCard.tsx +20 -22
package/package.json
CHANGED
|
@@ -88,6 +88,7 @@ export const defFlagList: FlagUiInfo[] = [
|
|
|
88
88
|
{
|
|
89
89
|
id: 249,
|
|
90
90
|
name: I18n.getLang('country_TR'),
|
|
91
|
+
groupKey: 'latam_2026_d',
|
|
91
92
|
...defFlagConfig,
|
|
92
93
|
colors: [{ h: 360, s: 100, v: 100 }, { h: 360, s: 100, v: 100 }, { h: 0, s: 0, v: 100 }]
|
|
93
94
|
},
|
|
@@ -164,6 +165,7 @@ export const defFlagList: FlagUiInfo[] = [
|
|
|
164
165
|
{
|
|
165
166
|
id: 237,
|
|
166
167
|
name: I18n.getLang('country_CZ'),
|
|
168
|
+
groupKey: 'latam_2026_a',
|
|
167
169
|
...defFlagConfig,
|
|
168
170
|
colors: [{ h: 360, s: 100, v: 100 }, { h: 0, s: 0, v: 100 }, { h: 211, s: 100, v: 100 }]
|
|
169
171
|
},
|
|
@@ -183,6 +185,7 @@ export const defFlagList: FlagUiInfo[] = [
|
|
|
183
185
|
{
|
|
184
186
|
id: 234,
|
|
185
187
|
name: I18n.getLang('country_SE'),
|
|
188
|
+
groupKey: 'latam_2026_f',
|
|
186
189
|
...defFlagConfig,
|
|
187
190
|
colors: [{ h: 201, s: 100, v: 100 }, { h: 48, s: 99, v: 100 }, { h: 201, s: 100, v: 100 }]
|
|
188
191
|
},
|
|
@@ -630,6 +633,7 @@ export const defFlagList: FlagUiInfo[] = [
|
|
|
630
633
|
{
|
|
631
634
|
id: 163,
|
|
632
635
|
name: I18n.getLang('country_BA'),
|
|
636
|
+
groupKey: 'latam_2026_b',
|
|
633
637
|
...defFlagConfig,
|
|
634
638
|
colors: [{"h":0,"s":0,"v":100}, {"h":214,"s":100,"v":42}, {"h":48,"s":100,"v":100}],
|
|
635
639
|
},
|
|
@@ -687,4 +691,18 @@ export const defFlagList: FlagUiInfo[] = [
|
|
|
687
691
|
...defFlagConfig,
|
|
688
692
|
colors: [{"h":207,"s":100,"v":81}, {"h":0,"s":0,"v":100}, {"h":109,"s":76,"v":69}],
|
|
689
693
|
},
|
|
694
|
+
{
|
|
695
|
+
id: 154,
|
|
696
|
+
name: I18n.getLang('country_IQ'),
|
|
697
|
+
groupKey: 'latam_2026_i',
|
|
698
|
+
...defFlagConfig,
|
|
699
|
+
colors: [{"h":353,"s":92,"v":81}, {"h":0,"s":0,"v":100}, {"h":0,"s":0,"v":0}, {"h":150,"s":100,"v":48}],
|
|
700
|
+
},
|
|
701
|
+
{
|
|
702
|
+
id: 153,
|
|
703
|
+
name: I18n.getLang('country_CD'),
|
|
704
|
+
groupKey: 'latam_2026_k',
|
|
705
|
+
...defFlagConfig,
|
|
706
|
+
colors: [{ h: 200, s: 100, v: 79 }, { h: 49, s: 100, v: 100 }, { h: 356, s: 79, v: 94 },],
|
|
707
|
+
},
|
|
690
708
|
]
|
|
@@ -3,7 +3,6 @@ import I18n from '@ledvance/base/src/i18n'
|
|
|
3
3
|
import { useDp } from '@ledvance/base/src/models/modules/NativePropsSlice'
|
|
4
4
|
import {
|
|
5
5
|
DpReportSataData,
|
|
6
|
-
DpResultByMonthResData,
|
|
7
6
|
getDataWithSpecified,
|
|
8
7
|
getDpResultByHour,
|
|
9
8
|
getDpResultByMonth,
|
|
@@ -148,7 +147,8 @@ export interface PowerDataItem {
|
|
|
148
147
|
key: string
|
|
149
148
|
chartTitle: string
|
|
150
149
|
time: number,
|
|
151
|
-
value: number
|
|
150
|
+
value: number,
|
|
151
|
+
interval: number,
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
// 常量抽离(便于维护)
|
|
@@ -161,21 +161,6 @@ const RETRY_CONFIG = {
|
|
|
161
161
|
backoffFactor: 2,
|
|
162
162
|
} as const;
|
|
163
163
|
|
|
164
|
-
/**
|
|
165
|
-
* 创建一个0值填充的数据点
|
|
166
|
-
* @param timePoint Dayjs对象
|
|
167
|
-
* @returns PowerDataItem
|
|
168
|
-
*/
|
|
169
|
-
function createZeroPaddingPoint(timePoint: dayjs.Dayjs): PowerDataItem {
|
|
170
|
-
const timeMs = timePoint.valueOf();
|
|
171
|
-
return {
|
|
172
|
-
key: timePoint.format('HH:mm:ss'),
|
|
173
|
-
chartTitle: timePoint.format('MM/DD/YYYY HH:mm:ss'),
|
|
174
|
-
time: timeMs,
|
|
175
|
-
value: 0,
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
|
|
179
164
|
/**
|
|
180
165
|
* 获取设备功率数据
|
|
181
166
|
* @param devId 设备ID
|
|
@@ -205,7 +190,8 @@ export async function getPowerData(devId: string, powerDpCode: string, interval:
|
|
|
205
190
|
key: dp.timeStr,
|
|
206
191
|
chartTitle: dayjs.unix(dp.timeStamp).format('MM/DD/YYYY HH:mm:ss'),
|
|
207
192
|
time: dp.timeStamp * 1000,
|
|
208
|
-
value: parseFloat(dp.value) / 10
|
|
193
|
+
value: parseFloat(dp.value) / 10,
|
|
194
|
+
interval: interval
|
|
209
195
|
}
|
|
210
196
|
})
|
|
211
197
|
}
|
|
@@ -3,12 +3,13 @@ import React from 'react'
|
|
|
3
3
|
import { Text, TouchableOpacity, View } from 'react-native'
|
|
4
4
|
import PowerLineChart from '../component/PowerLineChart'
|
|
5
5
|
import { EmptyDataView } from './EmptyDataView'
|
|
6
|
+
import { PowerRangeInterval } from '../co2Data'
|
|
6
7
|
|
|
7
8
|
const INTERVAL_OPTIONS = [
|
|
8
|
-
{ label: 'charttime_type1', value:
|
|
9
|
-
{ label: 'charttime_type2', value:
|
|
10
|
-
{ label: 'charttime_type3', value:
|
|
11
|
-
{ label: 'charttime_type4', value:
|
|
9
|
+
{ label: 'charttime_type1', value: PowerRangeInterval.DAY_1 },
|
|
10
|
+
{ label: 'charttime_type2', value: PowerRangeInterval.HOUR_6 },
|
|
11
|
+
{ label: 'charttime_type3', value: PowerRangeInterval.HOUR_1 },
|
|
12
|
+
{ label: 'charttime_type4', value: PowerRangeInterval.MINUTE_5 },
|
|
12
13
|
]
|
|
13
14
|
|
|
14
15
|
export const PowerChartSection = ({ isLandscape, state, actions, styles, theme, chartHeight }) => {
|
|
@@ -23664,3 +23664,10 @@ export enum ChartType {
|
|
|
23664
23664
|
kWh = 'kWh',
|
|
23665
23665
|
Watt = 'Watt',
|
|
23666
23666
|
}
|
|
23667
|
+
|
|
23668
|
+
export enum PowerRangeInterval {
|
|
23669
|
+
MINUTE_5 = 5,
|
|
23670
|
+
HOUR_1 = 1 * 60,
|
|
23671
|
+
HOUR_6 = 6 * 60,
|
|
23672
|
+
DAY_1 = 24 * 60,
|
|
23673
|
+
}
|
|
@@ -5,6 +5,7 @@ import React, { useRef } from 'react'
|
|
|
5
5
|
import { View } from 'react-native'
|
|
6
6
|
import { Utils } from 'tuya-panel-kit'
|
|
7
7
|
import { PowerDataItem } from '../EnergyConsumptionActions'
|
|
8
|
+
import { PowerRangeInterval } from '../co2Data'
|
|
8
9
|
import dayjs from 'dayjs'
|
|
9
10
|
|
|
10
11
|
const { withTheme } = Utils.ThemeUtils
|
|
@@ -24,6 +25,8 @@ const GAP_THRESHOLD_MS = 5 * 1000 // 5 秒
|
|
|
24
25
|
*/
|
|
25
26
|
function fillGaps(items: PowerDataItem[]): PowerDataItem[] {
|
|
26
27
|
if (!items || items.length < 2) return items
|
|
28
|
+
// MINUTE_5 模式下数据点本身间隔约 30s,不做间隙补充
|
|
29
|
+
if (items[0].interval === PowerRangeInterval.MINUTE_5) return items
|
|
27
30
|
const result: PowerDataItem[] = []
|
|
28
31
|
for (let i = 0; i < items.length; i++) {
|
|
29
32
|
result.push(items[i])
|
|
@@ -45,10 +48,11 @@ function fillGaps(items: PowerDataItem[]): PowerDataItem[] {
|
|
|
45
48
|
}
|
|
46
49
|
const gapDayjs = dayjs(gapTime)
|
|
47
50
|
result.push({
|
|
48
|
-
key: gapDayjs.format('
|
|
51
|
+
key: gapDayjs.format('MM/DD/YYYY HH:mm:ss'),
|
|
49
52
|
chartTitle: gapDayjs.format('MM/DD/YYYY HH:mm:ss'),
|
|
50
53
|
time: gapTime,
|
|
51
54
|
value: gapValue,
|
|
55
|
+
interval: cur.interval,
|
|
52
56
|
})
|
|
53
57
|
}
|
|
54
58
|
}
|
|
@@ -73,7 +77,18 @@ const PowerLineChart = (props: PowerLineChartProps) => {
|
|
|
73
77
|
show: true,
|
|
74
78
|
triggerOn: 'mousemove|click',
|
|
75
79
|
trigger: 'axis',
|
|
76
|
-
position: ['30%', '50%']
|
|
80
|
+
position: ['30%', '50%'],
|
|
81
|
+
formatter: function (params) {
|
|
82
|
+
if (!params || !params.length) return ''
|
|
83
|
+
var item = params[0]
|
|
84
|
+
var date = new Date(item.value[0])
|
|
85
|
+
function pad(num) {
|
|
86
|
+
return num < 10 ? '0' + num : num
|
|
87
|
+
}
|
|
88
|
+
var time = pad(date.getMonth() + 1) + '/' + pad(date.getDate()) + '/' + date.getFullYear() + ' ' +
|
|
89
|
+
pad(date.getHours()) + ':' + pad(date.getMinutes()) + ':' + pad(date.getSeconds())
|
|
90
|
+
return (time + '<br/>' + item.marker + item.seriesName + ': ' + item.value[1])
|
|
91
|
+
}
|
|
77
92
|
},
|
|
78
93
|
grid: {
|
|
79
94
|
right: '5%'
|
|
@@ -346,7 +346,7 @@ const newFixedTime = (isPlug: boolean) => {
|
|
|
346
346
|
enable: true,
|
|
347
347
|
weeks: [0, 0, 0, 0, 0, 0, 0],
|
|
348
348
|
startTime: startTime,
|
|
349
|
-
endTime: startTime +
|
|
349
|
+
endTime: startTime + 30, //Fix https://ledvance.atlassian.net/browse/SUH-12973
|
|
350
350
|
closeTime: 1,
|
|
351
351
|
openTime: 1,
|
|
352
352
|
channel: isPlug ? 0 : 1,
|
|
@@ -347,7 +347,7 @@ const newRandomTime = (isPlug: boolean) => {
|
|
|
347
347
|
enable: true,
|
|
348
348
|
weeks: [0, 0, 0, 0, 0, 0, 0],
|
|
349
349
|
startTime: startTime,
|
|
350
|
-
endTime: startTime +
|
|
350
|
+
endTime: startTime + 30, //Fix https://ledvance.atlassian.net/browse/SUH-12973
|
|
351
351
|
channel: isPlug ? 0 : 1,
|
|
352
352
|
color: {
|
|
353
353
|
h: 0,
|
|
@@ -454,59 +454,61 @@ const TimeScheduleDetailPage = (props: { theme?: ThemeType }) => {
|
|
|
454
454
|
<Spacer height={cx(30)} />
|
|
455
455
|
|
|
456
456
|
{/* Apply for */}
|
|
457
|
-
|
|
458
|
-
<
|
|
459
|
-
{
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
{state.selectedSkill.length
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
457
|
+
{(!params.applyForDisabled && params.applyForList.length > 1) && (
|
|
458
|
+
<View style={styles.cardContainer}>
|
|
459
|
+
<Text style={styles.itemTitle}>
|
|
460
|
+
{I18n.getLang('timeschedule_add_schedule_subheadline_text')}
|
|
461
|
+
</Text>
|
|
462
|
+
<Spacer height={cx(10)} />
|
|
463
|
+
<View style={[styles.applyContent, { paddingTop: state.selectedSkill.length ? cx(10) : 0 }]}>
|
|
464
|
+
{state.selectedSkill.length === 0 ? (
|
|
465
|
+
<Text style={{color: props.theme?.global.fontColor}}>{I18n.getLang('timer_ceiling_fan_selectionfield_no_components_text')}</Text>
|
|
466
|
+
) : (
|
|
467
|
+
state.selectedSkill.map(skill => (
|
|
468
|
+
<View
|
|
469
|
+
style={[styles.applyItem, { marginBottom: cx(10), borderRadius: 4 }]}
|
|
470
|
+
key={skill.dp}
|
|
471
|
+
>
|
|
472
|
+
<Text style={{ color: props.theme?.global.fontColor, fontSize: cx(12) }}>{skill.key}</Text>
|
|
473
|
+
{showSelectedIcon && (
|
|
474
|
+
<TouchableOpacity
|
|
475
|
+
onPress={() => {
|
|
476
|
+
state.selectedSkill = state.selectedSkill.filter(s => skill.dp !== s.dp);
|
|
477
|
+
state.unSelectedSkill = [...state.unSelectedSkill, skill];
|
|
478
|
+
}}
|
|
479
|
+
style={{ paddingHorizontal: cx(5) }}
|
|
480
|
+
>
|
|
481
|
+
<Image
|
|
482
|
+
style={{ width: cx(16), height: cx(16), tintColor: props.theme?.global.fontColor }}
|
|
483
|
+
source={{ uri: res.ic_arrows_nav_clear}}
|
|
484
|
+
/>
|
|
485
|
+
</TouchableOpacity>
|
|
486
|
+
)}
|
|
487
|
+
</View>
|
|
488
|
+
))
|
|
489
|
+
)}
|
|
490
|
+
</View>
|
|
491
|
+
{state.unSelectedSkill.map((item: ApplyForItem) => {
|
|
492
|
+
return (
|
|
493
|
+
<TouchableOpacity
|
|
494
|
+
style={styles.applyItem}
|
|
495
|
+
key={item.dp}
|
|
496
|
+
onPress={() => {
|
|
497
|
+
state.selectedSkill = [...state.selectedSkill, item];
|
|
498
|
+
state.unSelectedSkill = state.unSelectedSkill.filter(s => item.dp !== s.dp);
|
|
499
|
+
}}
|
|
470
500
|
>
|
|
471
|
-
<Text style={{ color: props.theme?.global.fontColor, fontSize: cx(12) }}>{
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
<Image
|
|
481
|
-
style={{ width: cx(16), height: cx(16), tintColor: props.theme?.global.fontColor }}
|
|
482
|
-
source={{ uri: res.ic_arrows_nav_clear}}
|
|
483
|
-
/>
|
|
484
|
-
</TouchableOpacity>
|
|
485
|
-
)}
|
|
486
|
-
</View>
|
|
487
|
-
))
|
|
488
|
-
)}
|
|
501
|
+
<Text style={{ color: props.theme?.global.fontColor, fontSize: cx(12) }}>{item.key}</Text>
|
|
502
|
+
<Image
|
|
503
|
+
style={{ width: cx(16), height: cx(16), tintColor: props.theme?.global.fontColor }}
|
|
504
|
+
source={{ uri: res.device_panel_timer_add}}
|
|
505
|
+
/>
|
|
506
|
+
</TouchableOpacity>
|
|
507
|
+
);
|
|
508
|
+
})}
|
|
509
|
+
<Spacer />
|
|
489
510
|
</View>
|
|
490
|
-
|
|
491
|
-
return (
|
|
492
|
-
<TouchableOpacity
|
|
493
|
-
style={styles.applyItem}
|
|
494
|
-
key={item.dp}
|
|
495
|
-
onPress={() => {
|
|
496
|
-
state.selectedSkill = [...state.selectedSkill, item];
|
|
497
|
-
state.unSelectedSkill = state.unSelectedSkill.filter(s => item.dp !== s.dp);
|
|
498
|
-
}}
|
|
499
|
-
>
|
|
500
|
-
<Text style={{ color: props.theme?.global.fontColor, fontSize: cx(12) }}>{item.key}</Text>
|
|
501
|
-
<Image
|
|
502
|
-
style={{ width: cx(16), height: cx(16), tintColor: props.theme?.global.fontColor }}
|
|
503
|
-
source={{ uri: res.device_panel_timer_add}}
|
|
504
|
-
/>
|
|
505
|
-
</TouchableOpacity>
|
|
506
|
-
);
|
|
507
|
-
})}
|
|
508
|
-
<Spacer />
|
|
509
|
-
</View>
|
|
511
|
+
)}
|
|
510
512
|
|
|
511
513
|
{/* device state */}
|
|
512
514
|
<Text style={[styles.itemTitle, styles.cardContainer]}>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { xLog } from '@ledvance/base/src/utils'
|
|
1
2
|
import React, { useCallback, useEffect, useMemo } from 'react';
|
|
2
3
|
import { ScrollView, Text, StyleSheet, FlatList, View, Image } from 'react-native';
|
|
3
4
|
import { useNavigation } from '@react-navigation/core';
|
|
@@ -14,7 +15,7 @@ import Spacer from '@ledvance/base/src/components/Spacer';
|
|
|
14
15
|
import InfoText from '@ledvance/base/src/components/InfoText';
|
|
15
16
|
import DeleteButton from '@ledvance/base/src/components/DeleteButton';
|
|
16
17
|
import { useReactive, useUpdateEffect } from 'ahooks';
|
|
17
|
-
import {DeviceStateType, SuggestItem, Timer, TimerActions} from './Interface';
|
|
18
|
+
import {DeviceStateType, SuggestItem, Timer, TimerActions, DeviceType, SirenData} from './Interface';
|
|
18
19
|
import { getTimeSchedule, manageTimeSchedule } from './TimeScheduleActions';
|
|
19
20
|
import { useParams } from '@ledvance/base/src/hooks/Hooks';
|
|
20
21
|
import ScheduleCard from './components/ScheduleCard';
|
|
@@ -23,7 +24,7 @@ import Tag from '@ledvance/base/src/components/Tag';
|
|
|
23
24
|
import { cloneDeep } from 'lodash';
|
|
24
25
|
import ThemeType from '@ledvance/base/src/config/themeType'
|
|
25
26
|
import { showDialog } from '@ledvance/base/src/utils/common';
|
|
26
|
-
import { ApplyForItem } from '@ledvance/base/src/utils/interface'
|
|
27
|
+
import { AlarmState, ApplyForItem } from '@ledvance/base/src/utils/interface'
|
|
27
28
|
import FeatureInfo from "@ledvance/base/src/components/FeatureInfo"
|
|
28
29
|
|
|
29
30
|
const { convertX: cx } = Utils.RatioUtils;
|
|
@@ -74,6 +75,14 @@ const TimeSchedulePage = (props: { theme?: ThemeType }) => {
|
|
|
74
75
|
state.originList,
|
|
75
76
|
]);
|
|
76
77
|
|
|
78
|
+
const alarmStateValueMap = useMemo(() => {
|
|
79
|
+
return {
|
|
80
|
+
[AlarmState.AlarmSound]: I18n.getLang('siren_alarm_type_sound'),
|
|
81
|
+
[AlarmState.AlarmLight]: I18n.getLang('siren_alarm_type_light'),
|
|
82
|
+
[AlarmState.AlarmSoundAndLight]: I18n.getLang('siren_alarm_type_sound_light'),
|
|
83
|
+
}
|
|
84
|
+
}, [])
|
|
85
|
+
|
|
77
86
|
useUpdateEffect(() => {
|
|
78
87
|
const status = state.originList.some(item => item.enable);
|
|
79
88
|
if (status !== timeScheduleStatus) {
|
|
@@ -148,6 +157,51 @@ const TimeSchedulePage = (props: { theme?: ThemeType }) => {
|
|
|
148
157
|
});
|
|
149
158
|
}, []);
|
|
150
159
|
|
|
160
|
+
const calculateTagStatus: (item: Timer) => ApplyForItem[] = useCallback((item: Timer) => {
|
|
161
|
+
return params.applyForList.map(tag => {
|
|
162
|
+
const deviceData = params.manualDataDp2Obj(item.dps).deviceData
|
|
163
|
+
if (params.isMixLight && deviceData.type === DeviceType.MixLight) {
|
|
164
|
+
return {
|
|
165
|
+
...tag,
|
|
166
|
+
enable:
|
|
167
|
+
tag.type === 'mainLight'
|
|
168
|
+
? deviceData.deviceData.whiteLightSwitch
|
|
169
|
+
: deviceData.deviceData.colorLightSwitch,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
if (item.dps.hasOwnProperty(tag.dp)) {
|
|
173
|
+
return {
|
|
174
|
+
...tag,
|
|
175
|
+
enable: item.dps[tag.dp],
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
return tag;
|
|
179
|
+
}).filter(tag => params.applyForDisabled || item.dps.hasOwnProperty(tag.dp))
|
|
180
|
+
.map(tag => {
|
|
181
|
+
const {isManual, deviceData} = params.manualDataDp2Obj(item.dps)
|
|
182
|
+
let tagName: string;
|
|
183
|
+
if (params.isSiren) {
|
|
184
|
+
tagName = `${tag.key} : ${alarmStateValueMap[(deviceData.deviceData as SirenData).alarmState]}`
|
|
185
|
+
tagName = alarmStateValueMap[(deviceData.deviceData as SirenData).alarmState]
|
|
186
|
+
} else {
|
|
187
|
+
if (isManual) {
|
|
188
|
+
if (tag.enable) {
|
|
189
|
+
tagName = `${tag.key} : ${I18n.getLang(params.isShutter ? 'curtain_summary_action_txt_1' : 'routine_push_msg_on')}`
|
|
190
|
+
} else {
|
|
191
|
+
tagName = `${tag.key} : ${I18n.getLang(params.isShutter ? 'curtain_summary_action_txt_2' : 'watchapp_entitystate_off')}`
|
|
192
|
+
}
|
|
193
|
+
} else {
|
|
194
|
+
tagName = `${tag.key} : ${I18n.getLang('mood_overview_headline_text')}`
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
}
|
|
198
|
+
return {
|
|
199
|
+
...tag,
|
|
200
|
+
key: tagName,
|
|
201
|
+
};
|
|
202
|
+
});
|
|
203
|
+
}, [])
|
|
204
|
+
|
|
151
205
|
const styles = StyleSheet.create({
|
|
152
206
|
overviewDescription: {
|
|
153
207
|
color: props.theme?.global.fontColor,
|
|
@@ -226,8 +280,7 @@ const TimeSchedulePage = (props: { theme?: ThemeType }) => {
|
|
|
226
280
|
renderItem={({ item }) => (
|
|
227
281
|
<ScheduleCard
|
|
228
282
|
item={item}
|
|
229
|
-
|
|
230
|
-
showTag={params.applyForList.length > 1}
|
|
283
|
+
calculateTagStatus={() => calculateTagStatus(item)}
|
|
231
284
|
onEnableChange={async enable => {
|
|
232
285
|
state.loading = true;
|
|
233
286
|
await modDeleteTimeSchedule('update', {
|
|
@@ -101,6 +101,8 @@ function ManualSettings(props: ManualSettingProps) {
|
|
|
101
101
|
title={item.name || item.key}
|
|
102
102
|
color={getBlockColor(item as any)}
|
|
103
103
|
colorAlpha={1}
|
|
104
|
+
onText={I18n.getLang('routine_push_msg_on')}
|
|
105
|
+
offText={I18n.getLang('watchapp_entitystate_off')}
|
|
104
106
|
enable={item.enable}
|
|
105
107
|
setEnable={(enable: boolean) => {
|
|
106
108
|
state.applyForList = state.applyForList.map((apply, index) => {
|
|
@@ -259,6 +261,8 @@ function ManualSettings(props: ManualSettingProps) {
|
|
|
259
261
|
title={item.key}
|
|
260
262
|
color={getBlockColor(item.type)}
|
|
261
263
|
colorAlpha={1}
|
|
264
|
+
onText={I18n.getLang('routine_push_msg_on')}
|
|
265
|
+
offText={I18n.getLang('watchapp_entitystate_off')}
|
|
262
266
|
enable={item.enable}
|
|
263
267
|
setEnable={(enable: boolean) => {
|
|
264
268
|
state.applyForList[idx].enable = enable;
|
|
@@ -329,6 +333,8 @@ function ManualSettings(props: ManualSettingProps) {
|
|
|
329
333
|
title={state.applyForList[0]?.name || state.applyForList[0]?.key}
|
|
330
334
|
color={getBlockColor()}
|
|
331
335
|
colorAlpha={1}
|
|
336
|
+
onText={I18n.getLang('routine_push_msg_on')}
|
|
337
|
+
offText={I18n.getLang('watchapp_entitystate_off')}
|
|
332
338
|
enable={state.applyForList[0]?.enable}
|
|
333
339
|
setEnable={(enable: boolean) => {
|
|
334
340
|
state.applyForList[0].enable = enable;
|
|
@@ -408,6 +414,8 @@ function ManualSettings(props: ManualSettingProps) {
|
|
|
408
414
|
title={item.key}
|
|
409
415
|
color={getBlockColor(item.type)}
|
|
410
416
|
colorAlpha={1}
|
|
417
|
+
onText={I18n.getLang('routine_push_msg_on')}
|
|
418
|
+
offText={I18n.getLang('watchapp_entitystate_off')}
|
|
411
419
|
enable={item.enable}
|
|
412
420
|
setEnable={(enable: boolean) => {
|
|
413
421
|
state.applyForList[idx].enable = enable;
|
|
@@ -499,6 +507,8 @@ function ManualSettings(props: ManualSettingProps) {
|
|
|
499
507
|
icon={{ uri: PowerStripIcon[item.index ?? 0] }}
|
|
500
508
|
disabledEdit={true}
|
|
501
509
|
onNameChange={() => { }}
|
|
510
|
+
onText={I18n.getLang('routine_push_msg_on')}
|
|
511
|
+
offText={I18n.getLang('watchapp_entitystate_off')}
|
|
502
512
|
enabled={item.enable}
|
|
503
513
|
onSwitchChange={async enable => {
|
|
504
514
|
state.applyForList = state.applyForList.map((apply, index) => {
|
|
@@ -1,32 +1,30 @@
|
|
|
1
|
-
import React, { useMemo } from
|
|
2
|
-
import { ViewStyle, View, Text, StyleSheet } from
|
|
3
|
-
import Card from
|
|
4
|
-
import { SwitchButton, Utils } from 'tuya-panel-kit'
|
|
5
|
-
import { convertTo12HourFormat, loopText } from '@ledvance/base/src/utils/common'
|
|
6
|
-
import { ApplyForItem
|
|
7
|
-
import { useSystemTimeFormate } from
|
|
1
|
+
import React, { useMemo } from 'react'
|
|
2
|
+
import { ViewStyle, View, Text, StyleSheet } from 'react-native'
|
|
3
|
+
import Card from '@ledvance/base/src/components/Card'
|
|
4
|
+
import { SwitchButton, Utils } from 'tuya-panel-kit'
|
|
5
|
+
import { convertTo12HourFormat, loopText } from '@ledvance/base/src/utils/common'
|
|
6
|
+
import { ApplyForItem } from '@ledvance/base/src/utils/interface'
|
|
7
|
+
import { useSystemTimeFormate } from '@ledvance/base/src/models/modules/NativePropsSlice'
|
|
8
8
|
import ThemeType from '@ledvance/base/src/config/themeType'
|
|
9
|
-
import
|
|
10
|
-
|
|
9
|
+
import { Timer } from '../Interface'
|
|
10
|
+
|
|
11
|
+
const { convertX: cx } = Utils.RatioUtils
|
|
11
12
|
const { withTheme } = Utils.ThemeUtils
|
|
12
13
|
|
|
13
14
|
interface ScheduleCardProps {
|
|
14
15
|
theme?: ThemeType
|
|
15
16
|
item: Timer
|
|
16
17
|
style?: ViewStyle
|
|
17
|
-
|
|
18
|
-
tags: ApplyForItem[]
|
|
18
|
+
calculateTagStatus: () => ApplyForItem[]
|
|
19
19
|
onEnableChange: (enable: boolean) => void
|
|
20
20
|
onPress: (item: any) => void
|
|
21
21
|
onLongPress?: (item: any) => void
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
const ScheduleCard = (props: ScheduleCardProps) => {
|
|
25
|
-
const { item, style,
|
|
25
|
+
const { item, style, calculateTagStatus, onEnableChange, onPress, onLongPress } = props
|
|
26
26
|
const is24HourClock = useSystemTimeFormate()
|
|
27
|
-
const
|
|
28
|
-
return tags.filter(tag => item.dps.hasOwnProperty(tag.dp))
|
|
29
|
-
}, [tags, item.dps])
|
|
27
|
+
const tags = useMemo(() => calculateTagStatus(), [item.dps])
|
|
30
28
|
|
|
31
29
|
const styles = StyleSheet.create({
|
|
32
30
|
card: {
|
|
@@ -87,15 +85,15 @@ const ScheduleCard = (props: ScheduleCardProps) => {
|
|
|
87
85
|
// fontFamily: 'PingFangSC-Medium',
|
|
88
86
|
color: '#000'
|
|
89
87
|
},
|
|
90
|
-
})
|
|
88
|
+
})
|
|
91
89
|
return (
|
|
92
90
|
<Card
|
|
93
91
|
style={styles.card}
|
|
94
92
|
containerStyle={[style]}
|
|
95
93
|
onPress={() => {
|
|
96
|
-
onPress(item)
|
|
94
|
+
onPress(item)
|
|
97
95
|
}}
|
|
98
|
-
onLongPress={() =>{
|
|
96
|
+
onLongPress={() => {
|
|
99
97
|
onLongPress && onLongPress(item)
|
|
100
98
|
}}
|
|
101
99
|
>
|
|
@@ -112,20 +110,20 @@ const ScheduleCard = (props: ScheduleCardProps) => {
|
|
|
112
110
|
value={item.enable}
|
|
113
111
|
thumbStyle={{ elevation: 0 }}
|
|
114
112
|
onValueChange={() => {
|
|
115
|
-
onEnableChange(!item.enable)
|
|
113
|
+
onEnableChange(!item.enable)
|
|
116
114
|
}}
|
|
117
115
|
/>
|
|
118
116
|
</View>
|
|
119
117
|
</View>
|
|
120
|
-
|
|
121
|
-
{
|
|
118
|
+
<View style={styles.typeContainer}>
|
|
119
|
+
{tags.map(tag => (
|
|
122
120
|
<View style={styles.tag} key={tag.dp}>
|
|
123
121
|
<Text style={styles.tagTitle}>
|
|
124
122
|
{tag.key}
|
|
125
123
|
</Text>
|
|
126
124
|
</View>
|
|
127
125
|
))}
|
|
128
|
-
</View>
|
|
126
|
+
</View>
|
|
129
127
|
</Card>
|
|
130
128
|
)
|
|
131
129
|
|