@ledvance/group-ui-biz-bundle 1.0.15 → 1.0.17

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.15",
7
+ "version": "1.0.17",
8
8
  "scripts": {},
9
9
  "dependencies": {
10
10
  "@ledvance/base": "^1.x",
@@ -300,7 +300,7 @@ export const defFlagList: FlagUiInfo[] = [
300
300
  version: 0,
301
301
  mode: SceneNodeTransitionMode.Jump,
302
302
  speed: 70,
303
- name: '',
303
+ name: I18n.getLang('flag_leverkusen'),
304
304
  icon: res.leverkusen_icon,
305
305
  whiteColors: [
306
306
  { brightness: 100, colorTemp: 0},
@@ -12,6 +12,7 @@ export interface TimerTask {
12
12
  dp: {
13
13
  key: string
14
14
  code: string
15
+ enable: boolean
15
16
  }
16
17
  status: TaskStatus
17
18
  stringOn: string
@@ -41,16 +42,18 @@ export function useTimerTasks(timerSettableDps: TimerSettableDp[]):
41
42
  }
42
43
  })
43
44
 
44
- const defTasks = useMemo(() => timerSettableDps.map(timerSettableDp => ({
45
- name: timerSettableDp.label,
46
- startTime: 0,
47
- duration: 0,
48
- timeLeft: 0,
49
- dp: timerSettableDp.dp,
50
- status: TaskStatus.NoSelected,
51
- stringOn: timerSettableDp.stringOn,
52
- stringOff: timerSettableDp.stringOff,
53
- })), [JSON.stringify(timerSettableDps)])
45
+ const defTasks = useMemo(() => {
46
+ return timerSettableDps.map(timerSettableDp => ({
47
+ name: timerSettableDp.label,
48
+ startTime: 0,
49
+ duration: 0,
50
+ timeLeft: 0,
51
+ dp: timerSettableDp.dp,
52
+ status: TaskStatus.NoSelected,
53
+ stringOn: timerSettableDp.stringOn,
54
+ stringOff: timerSettableDp.stringOff,
55
+ }))
56
+ }, [JSON.stringify(timerSettableDps)])
54
57
 
55
58
  const [remoteTasks, setTasks] = useFeatureHook<TimerConfig, TimerTask[]>(
56
59
  'timerTasks',
@@ -67,7 +70,7 @@ export function useTimerTasks(timerSettableDps: TimerSettableDp[]):
67
70
 
68
71
  const tasks = defTasks.map(defTask => {
69
72
  const findTask = remoteTasks.find(remoteTask => remoteTask.dp.code === defTask.dp.code)
70
- return findTask ? { ...findTask } : defTask
73
+ return findTask ? { ...findTask, dp: defTask.dp } : defTask
71
74
  })
72
75
 
73
76
  const state = useReactive({ tasks: tasks })
@@ -149,6 +152,7 @@ export interface TimerSettableDp {
149
152
  dp: {
150
153
  key: string
151
154
  code: string
155
+ enable: boolean
152
156
  }
153
157
  stringOn: string
154
158
  stringOff: string
@@ -167,4 +171,4 @@ export function timeFormat(time: number): string {
167
171
  min = 0
168
172
  }
169
173
  return `${hour > 0 ? `${hour} h ` : ''}${min > 0 ? `${min} min` : ''}`
170
- }
174
+ }
@@ -60,151 +60,151 @@ const TimerPage = () => {
60
60
  showsVerticalScrollIndicator={false}>
61
61
  <View>
62
62
  {startedTasks.length !== state.tasks.length &&
63
- <View style={styles.content}>
64
- <LdvPickerView
65
- hour={state.hour}
66
- minute={state.min}
67
- unit={['h', 'min']}
68
- setHour={hour => {
69
- state.hour = hour
70
- }}
71
- setMinute={min => {
72
- state.min = min
73
- }}/>
74
- <Spacer height={cx(30)}/>
75
- <Text style={styles.applyFor}>{I18n.getLang('timeschedule_add_schedule_subheadline_text')}</Text>
76
- <Spacer height={cx(10)}/>
77
- <FlatList
78
- data={selectedTasks}
79
- style={styles.taskList}
80
- renderItem={({ item }) => {
81
- return (
82
- <View style={styles.taskItem}>
83
- <Text style={styles.taskItemText}>{item.name}</Text>
84
- {state.tasks.length > 1 &&
85
- <TouchableOpacity
86
- onPress={() => {
87
- item.status = TaskStatus.NoSelected
88
- changeTimerTasks([cloneDeep(item)])
89
- }}>
90
- <Image style={styles.taskItemIcon} source={GroupBizRes.ic_arrows_nav_clear}/>
91
- </TouchableOpacity>}
92
- </View>
93
- )
94
- }}
95
- keyExtractor={item => item.dp.key}
96
- ListEmptyComponent={() => <View style={styles.listEmptyView}>
97
- <Text style={styles.listEmptyText}>
98
- {I18n.getLang('timer_ceiling_fan_selectionfield_no_components_text')}
99
- </Text>
100
- </View>}/>
101
- <Spacer height={cx(6)}/>
102
- <FlatList
103
- data={noSelectedTasks}
104
- style={styles.noSelectTaskList}
105
- renderItem={({ item }) => {
106
- return (
107
- <TouchableOpacity
108
- style={styles.noSelectTaskItem}
109
- onPress={() => {
110
- item.status = TaskStatus.Selected
111
- changeTimerTasks([cloneDeep(item)])
112
- }}>
113
- <Spacer width={cx(8)}/>
114
- <Text style={styles.noSelectTaskText}>{item.name}</Text>
115
- <Image style={styles.taskItemIcon} source={GroupBizRes.device_panel_timer_add}/>
116
- </TouchableOpacity>
117
- )
118
- }}
119
- keyExtractor={item => item.dp.key}/>
120
- <Spacer/>
121
- <DeleteButton
122
- text={I18n.getLang('timer_sockets_button_text')}
123
- disabled={selectedTasks.length === 0}
124
- onPress={async () => {
125
- state.loading = true
126
- const tasks = selectedTasks.map(task => {
127
- return {
128
- ...task,
129
- startTime: dayjs().unix(),
130
- duration: (parseInt(state.hour) * 60 + parseInt(state.min)) * 60,
131
- status: TaskStatus.Started,
132
- }
133
- })
134
- tasks.push(...cloneDeep(startedTasks))
135
- await setTimerTasks(cloneDeep(tasks))
136
- state.loading = false
137
- }}
138
- textStyle={{ fontSize: cx(14) }}
139
- style={{ backgroundColor: !startEnable ? '#FFE0D4' : '#f60' }}/>
140
- </View>
141
- }
142
- {startedTasks.length > 0 && params.timerSettableDps.length > 1 &&
143
- <>
144
- <Spacer height={cx(30)}/>
145
63
  <View style={styles.content}>
146
- <Text style={styles.applyFor}>{
147
- I18n.formatValue('timer_nightplug_active_timer_subheadline2_text', startedTasks.length.toString())
148
- }</Text>
64
+ <LdvPickerView
65
+ hour={state.hour}
66
+ minute={state.min}
67
+ unit={['h', 'min']}
68
+ setHour={hour => {
69
+ state.hour = hour
70
+ }}
71
+ setMinute={min => {
72
+ state.min = min
73
+ }}/>
74
+ <Spacer height={cx(30)}/>
75
+ <Text style={styles.applyFor}>{I18n.getLang('timeschedule_add_schedule_subheadline_text')}</Text>
76
+ <Spacer height={cx(10)}/>
77
+ <FlatList
78
+ data={selectedTasks}
79
+ style={styles.taskList}
80
+ renderItem={({ item }) => {
81
+ return (
82
+ <View style={styles.taskItem}>
83
+ <Text style={styles.taskItemText}>{item.name}</Text>
84
+ {state.tasks.length > 1 &&
85
+ <TouchableOpacity
86
+ onPress={() => {
87
+ item.status = TaskStatus.NoSelected
88
+ changeTimerTasks([cloneDeep(item)])
89
+ }}>
90
+ <Image style={styles.taskItemIcon} source={GroupBizRes.ic_arrows_nav_clear}/>
91
+ </TouchableOpacity>}
92
+ </View>
93
+ )
94
+ }}
95
+ keyExtractor={item => item.dp.key}
96
+ ListEmptyComponent={() => <View style={styles.listEmptyView}>
97
+ <Text style={styles.listEmptyText}>
98
+ {I18n.getLang('timer_ceiling_fan_selectionfield_no_components_text')}
99
+ </Text>
100
+ </View>}/>
101
+ <Spacer height={cx(6)}/>
102
+ <FlatList
103
+ data={noSelectedTasks}
104
+ style={styles.noSelectTaskList}
105
+ renderItem={({ item }) => {
106
+ return (
107
+ <TouchableOpacity
108
+ style={styles.noSelectTaskItem}
109
+ onPress={() => {
110
+ item.status = TaskStatus.Selected
111
+ changeTimerTasks([cloneDeep(item)])
112
+ }}>
113
+ <Spacer width={cx(8)}/>
114
+ <Text style={styles.noSelectTaskText}>{item.name}</Text>
115
+ <Image style={styles.taskItemIcon} source={GroupBizRes.device_panel_timer_add}/>
116
+ </TouchableOpacity>
117
+ )
118
+ }}
119
+ keyExtractor={item => item.dp.key}/>
120
+ <Spacer/>
121
+ <DeleteButton
122
+ text={I18n.getLang('timer_sockets_button_text')}
123
+ disabled={selectedTasks.length === 0}
124
+ onPress={async () => {
125
+ state.loading = true
126
+ const tasks = selectedTasks.map(task => {
127
+ return {
128
+ ...task,
129
+ startTime: dayjs().unix(),
130
+ duration: (parseInt(state.hour) * 60 + parseInt(state.min)) * 60,
131
+ status: TaskStatus.Started,
132
+ }
133
+ })
134
+ tasks.push(...cloneDeep(startedTasks))
135
+ await setTimerTasks(cloneDeep(tasks))
136
+ state.loading = false
137
+ }}
138
+ textStyle={{ fontSize: cx(14) }}
139
+ style={{ backgroundColor: !startEnable ? '#FFE0D4' : '#f60' }}/>
149
140
  </View>
150
- <FlatList
151
- data={startedTasks}
152
- renderItem={({ item }) => {
153
- return ActiveTimerItem(item, async () => {
154
- state.loading = true
155
- const tasks = cloneDeep(startedTasks)
156
- tasks.forEach(task => {
157
- if (task.dp.code === item.dp.code) {
158
- task.status = TaskStatus.NoSelected
159
- task.startTime = 0
160
- task.duration = 0
161
- }
162
- })
163
- await setTimerTasks(tasks)
164
- state.loading = false
165
- })
166
- }}
167
- keyExtractor={item => item.dp.key}
168
- ListHeaderComponent={() => (<Spacer height={cx(10)}/>)}
169
- ItemSeparatorComponent={() => (<Spacer height={cx(10)}/>)}
170
- ListFooterComponent={() => (<Spacer height={cx(20)}/>)}/>
171
- </>
141
+ }
142
+ {startedTasks.length > 0 && params.timerSettableDps.length > 1 &&
143
+ <>
144
+ <Spacer height={cx(30)}/>
145
+ <View style={styles.content}>
146
+ <Text style={styles.applyFor}>{
147
+ I18n.formatValue('timer_nightplug_active_timer_subheadline2_text', startedTasks.length.toString())
148
+ }</Text>
149
+ </View>
150
+ <FlatList
151
+ data={startedTasks}
152
+ renderItem={({ item }) => {
153
+ return ActiveTimerItem(item, async () => {
154
+ state.loading = true
155
+ const tasks = cloneDeep(startedTasks)
156
+ tasks.forEach(task => {
157
+ if (task.dp.code === item.dp.code) {
158
+ task.status = TaskStatus.NoSelected
159
+ task.startTime = 0
160
+ task.duration = 0
161
+ }
162
+ })
163
+ await setTimerTasks(tasks)
164
+ state.loading = false
165
+ })
166
+ }}
167
+ keyExtractor={item => item.dp.key}
168
+ ListHeaderComponent={() => (<Spacer height={cx(10)}/>)}
169
+ ItemSeparatorComponent={() => (<Spacer height={cx(10)}/>)}
170
+ ListFooterComponent={() => (<Spacer height={cx(20)}/>)}/>
171
+ </>
172
172
  }
173
173
  {
174
174
  startedTasks.length === 1 && params.timerSettableDps.length === 1 &&
175
- <View style={{ justifyContent: 'center', marginHorizontal: cx(24) }}>
176
- <Spacer height={cx(116)}/>
177
- <View
178
- style={{
179
- justifyContent: 'center',
180
- alignItems: 'center',
181
- }}>
182
- <CircularProgress
183
- progress={(startedTasks[0].timeLeft / startedTasks[0].duration) * 100}
184
- size={cx(172)}
185
- strokeWidth={cx(14)}>
186
- <Text style={styles.activeTaskTimeText2}>{timeFormat(startedTasks[0].timeLeft)}</Text>
187
- </CircularProgress>
175
+ <View style={{ justifyContent: 'center', marginHorizontal: cx(24) }}>
176
+ <Spacer height={cx(116)}/>
177
+ <View
178
+ style={{
179
+ justifyContent: 'center',
180
+ alignItems: 'center',
181
+ }}>
182
+ <CircularProgress
183
+ progress={(startedTasks[0].timeLeft / startedTasks[0].duration) * 100}
184
+ size={cx(172)}
185
+ strokeWidth={cx(14)}>
186
+ <Text style={styles.activeTaskTimeText2}>{timeFormat(startedTasks[0].timeLeft)}</Text>
187
+ </CircularProgress>
188
+ </View>
189
+ <Spacer height={cx(32)}/>
190
+ <Text
191
+ style={[styles.activeTaskDesc, { textAlign: 'center' }]}>{I18n.formatValue(startedTasks[0].dp.enable ? startedTasks[0].stringOff : startedTasks[0].stringOn, timeFormat(startedTasks[0].timeLeft))}</Text>
192
+ <Spacer height={cx(32)}/>
193
+ <TextButton
194
+ text={I18n.getLang('auto_scan_system_cancel')}
195
+ style={styles.activeTasBtn}
196
+ textStyle={styles.activeTaskBtnText}
197
+ onPress={async () => {
198
+ state.loading = true
199
+ const task = cloneDeep(startedTasks[0])
200
+ task.status = TaskStatus.NoSelected
201
+ task.startTime = 0
202
+ task.duration = 0
203
+ await setTimerTasks([task])
204
+ state.loading = false
205
+ }}/>
206
+ <Spacer width={cx(20)}/>
188
207
  </View>
189
- <Spacer height={cx(32)}/>
190
- <Text
191
- style={[styles.activeTaskDesc, { textAlign: 'center' }]}>{I18n.formatValue(startedTasks[0].stringOn, timeFormat(startedTasks[0].timeLeft))}</Text>
192
- <Spacer height={cx(32)}/>
193
- <TextButton
194
- text={I18n.getLang('auto_scan_system_cancel')}
195
- style={styles.activeTasBtn}
196
- textStyle={styles.activeTaskBtnText}
197
- onPress={async () => {
198
- state.loading = true
199
- const task = cloneDeep(startedTasks[0])
200
- task.status = TaskStatus.NoSelected
201
- task.startTime = 0
202
- task.duration = 0
203
- await setTimerTasks([task])
204
- state.loading = false
205
- }}/>
206
- <Spacer width={cx(20)}/>
207
- </View>
208
208
  }
209
209
  <Spacer/>
210
210
  </View>
@@ -241,7 +241,7 @@ function ActiveTimerItem(task: TimerTask, onCancel: () => void) {
241
241
  <Spacer/>
242
242
  <View style={{ marginHorizontal: cx(20) }}>
243
243
  <Text style={styles.activeTaskDesc}>{
244
- I18n.formatValue(task.stringOn, timeFormat(task.timeLeft))
244
+ I18n.formatValue(task.dp.enable ? task.stringOff : task.stringOn, timeFormat(task.timeLeft))
245
245
  }</Text>
246
246
  </View>
247
247
  <Spacer height={cx(22)}/>