1/**
2 * Copyright (c) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file: Button group configuration file
18 */
19
20import ImagePathConst from '../constant/ImagePathConst';
21
22const firstBtns = [
23  {
24    type: 'record',
25    iconDisableUrl: 'ic_public_recording_Grey',
26    iconDefaultUrl: 'ic_public_recording_',
27    iconActiveUrl: 'soundEnabled',
28    isDisable: true,
29    isActive: false,
30    iconText: ''
31  },
32  {
33    type: 'keep',
34    iconDisableUrl: 'ic_public_pause_Grey',
35    iconDefaultUrl: 'ic_public_pause',
36    iconActiveUrl: 'ic_public_pause_Enabled',
37    isDisable: false,
38    isActive: false,
39    iconText: ''
40  },
41  {
42    type: 'add',
43    iconDisableUrl: 'ic_public_add_filled_Grey',
44    iconDefaultUrl: 'ic_public_add_filled',
45    iconActiveUrl: '',
46    isDisable: false,
47    isActive: false,
48    iconText: ''
49  },
50  {
51    type: 'video',
52    iconDisableUrl: 'ic_public_video_Grey',
53    iconDefaultUrl: 'ic_public_video',
54    iconActiveUrl: 'ic_public_video_filled',
55    isDisable: true,
56    isActive: false,
57    iconText: ''
58  },
59  {
60    type: 'mute',
61    iconDisableUrl: 'ic_public_voice_Grey',
62    iconDefaultUrl: 'ic_public_voice',
63    iconActiveUrl: 'ic_public_voice_Enabled',
64    isDisable: true,
65    isActive: false,
66    iconText: ''
67  },
68  {
69    type: 'contact',
70    iconDisableUrl: 'ic_public_contacts_Grey',
71    iconDefaultUrl: 'ic_public_contacts',
72    iconActiveUrl: '',
73    isDisable: false,
74    isActive: false,
75    iconText: ''
76  }
77];
78
79const secondBtns = [
80  {
81    type: 'exchange',
82    iconDisableUrl: 'ic_public_shuffle_Grey',
83    iconDefaultUrl: 'ic_public_shuffle',
84    iconActiveUrl: 'ic_public_shuffle_Enabled',
85    isDisable: false,
86    isActive: false,
87    iconText: ''
88  },
89  {
90    type: 'merge',
91    iconDisableUrl: 'ic_merge_Grey',
92    iconDefaultUrl: 'ic_merge',
93    iconActiveUrl: 'ic_merge_Enabled',
94    isDisable: true,
95    isActive: false,
96    iconText: ''
97  }
98];
99
100/**
101 * Process the image text of the button group
102 *
103 * @param {Array} arr - Pass in an array
104 */
105function addIconUrl(arr) {
106  const regExp = /^icon.*.*Url$/;
107  arr.forEach((item) => {
108    for (let key in item) {
109      if (Object.prototype.hasOwnProperty.call(item, key) && regExp.test(key)) {
110        item[key] = `${ImagePathConst.BASE_URL}${item[key]}.svg`;
111      }
112    }
113  });
114}
115
116addIconUrl(firstBtns);
117addIconUrl(secondBtns);
118
119export const btnGroupList = firstBtns;
120export const threePartyList = secondBtns;
121
122const btnGroupConfig = {
123  btnGroupList,
124  threePartyList
125}
126export default btnGroupConfig;