Skip to content

Commit 581a0b2

Browse files
linter fix
1 parent 9121cd0 commit 581a0b2

File tree

3 files changed

+44
-35
lines changed

3 files changed

+44
-35
lines changed

package-lock.json

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,7 @@
104104
"vanilla-cookieconsent": "^3.0.1",
105105
"vite": "^5.0.0",
106106
"winston": "^3.17.0",
107-
"winston-daily-rotate-file": "^5.0.0",
108-
"prettier": "^3.6.2"
107+
"winston-daily-rotate-file": "^5.0.0"
109108
},
110109
"devDependencies": {
111110
"@eslint/js": "^9.17.0",
@@ -130,6 +129,7 @@
130129
"globals": "^15.14.0",
131130
"jsdom": "^25.0.1",
132131
"nodemon": "^3.1.7",
132+
"prettier": "^3.6.2",
133133
"vitest": "^2.1.8"
134134
}
135135
}

src/components/WhoIsEdit/WhoIsEdit.jsx

Lines changed: 40 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,19 @@ function WhoIsEdit({ contacts, isOpen, checkAll, onChange, domain }) {
1313
(acc, { ident, disclosed_attributes, system_disclosed_attributes = [] }) => ({
1414
checkedCount:
1515
acc.checkedCount +
16-
// eslint-disable-next-line func-names
17-
(function () {
18-
if (domain.registrant.org) {
19-
return 2;
20-
}
16+
(() => {
2117
if (ident.type === 'org') {
2218
return 2;
2319
}
24-
// Учитываем system_disclosed_attributes при подсчете
25-
return disclosed_attributes.size + (system_disclosed_attributes ? system_disclosed_attributes.length : 0);
20+
return (
21+
disclosed_attributes.size +
22+
(system_disclosed_attributes ? system_disclosed_attributes.length : 0)
23+
);
2624
})(),
2725
isCheckedAll: disclosed_attributes.size === contactsList.length * 3,
2826
totalCount: acc.totalCount + 3,
2927
}),
30-
{
31-
checkedCount: 0,
32-
isCheckedAll: false,
33-
totalCount: 0,
34-
}
28+
{ checkedCount: 0, isCheckedAll: false, totalCount: 0 }
3529
);
3630

3731
const indeterminate = checkedCount > 0 && checkedCount < totalCount;
@@ -43,14 +37,15 @@ function WhoIsEdit({ contacts, isOpen, checkAll, onChange, domain }) {
4337
const attributes = new Set(disclosed_attributes);
4438
let publishable = registrant_publishable;
4539

46-
const canChangeAttributes = type.every(attr =>
47-
!system_disclosed_attributes || !system_disclosed_attributes.includes(attr)
40+
const canChangeAttributes = type.every(
41+
(attr) =>
42+
!system_disclosed_attributes || !system_disclosed_attributes.includes(attr)
4843
);
4944

5045
if (!canChangeAttributes) {
5146
return {
5247
...acc,
53-
[id]: contacts[id]
48+
[id]: contacts[id],
5449
};
5550
}
5651

@@ -60,7 +55,7 @@ function WhoIsEdit({ contacts, isOpen, checkAll, onChange, domain }) {
6055
}
6156

6257
if (system_disclosed_attributes) {
63-
system_disclosed_attributes.forEach(attr => {
58+
system_disclosed_attributes.forEach((attr) => {
6459
attributes.add(attr);
6560
});
6661
}
@@ -71,7 +66,10 @@ function WhoIsEdit({ contacts, isOpen, checkAll, onChange, domain }) {
7166
} else if (checked) {
7267
attributes.add(attr);
7368
} else {
74-
if (!system_disclosed_attributes || !system_disclosed_attributes.includes(attr)) {
69+
if (
70+
!system_disclosed_attributes ||
71+
!system_disclosed_attributes.includes(attr)
72+
) {
7573
attributes.delete(attr);
7674
}
7775
}
@@ -126,13 +124,19 @@ function WhoIsEdit({ contacts, isOpen, checkAll, onChange, domain }) {
126124
indeterminate={indeterminate}
127125
label={<CheckAllLabel />}
128126
onChange={(e, elem) => {
129-
// При массовом изменении не трогаем system_disclosed_attributes
130-
const attributesToChange = ['name', 'email', 'phone'].filter(attr => {
127+
const attributesToChange = ['name', 'email', 'phone'].filter((attr) => {
131128
const contact = Object.values(contacts)[0];
132-
return !contact.system_disclosed_attributes || !contact.system_disclosed_attributes.includes(attr);
129+
return (
130+
!contact.system_disclosed_attributes ||
131+
!contact.system_disclosed_attributes.includes(attr)
132+
);
133133
});
134134
if (attributesToChange.length > 0) {
135-
handleChange(elem.checked, Object.keys(contacts), attributesToChange);
135+
handleChange(
136+
elem.checked,
137+
Object.keys(contacts),
138+
attributesToChange
139+
);
136140
}
137141
}}
138142
/>
@@ -158,9 +162,10 @@ function WhoIsEdit({ contacts, isOpen, checkAll, onChange, domain }) {
158162
item.disclosed_attributes.has('name')
159163
)}
160164
disabled={Boolean(
161-
item.ident.type === 'org' ||
162-
domain.registrant.org ||
163-
(item.system_disclosed_attributes && item.system_disclosed_attributes.includes('name'))
165+
item.ident.type === 'org' ||
166+
domain.registrant.org ||
167+
(item.system_disclosed_attributes &&
168+
item.system_disclosed_attributes.includes('name'))
164169
)}
165170
id={`name-${item.id}`}
166171
label={
@@ -188,9 +193,10 @@ function WhoIsEdit({ contacts, isOpen, checkAll, onChange, domain }) {
188193
item.disclosed_attributes.has('email')
189194
)}
190195
disabled={Boolean(
191-
item.ident.type === 'org' ||
192-
domain.registrant.org ||
193-
(item.system_disclosed_attributes && item.system_disclosed_attributes.includes('email'))
196+
item.ident.type === 'org' ||
197+
domain.registrant.org ||
198+
(item.system_disclosed_attributes &&
199+
item.system_disclosed_attributes.includes('email'))
194200
)}
195201
id={`email-${item.id}`}
196202
label={
@@ -215,10 +221,12 @@ function WhoIsEdit({ contacts, isOpen, checkAll, onChange, domain }) {
215221
<Checkbox
216222
checked={Boolean(
217223
item.disclosed_attributes.has('phone') ||
218-
(item.system_disclosed_attributes && item.system_disclosed_attributes.includes('phone'))
224+
(item.system_disclosed_attributes &&
225+
item.system_disclosed_attributes.includes('phone'))
219226
)}
220227
disabled={Boolean(
221-
item.system_disclosed_attributes && item.system_disclosed_attributes.includes('phone')
228+
item.system_disclosed_attributes &&
229+
item.system_disclosed_attributes.includes('phone')
222230
)}
223231
id={`phone-${item.id}`}
224232
label={
@@ -232,7 +240,9 @@ function WhoIsEdit({ contacts, isOpen, checkAll, onChange, domain }) {
232240
</label>
233241
}
234242
name="phone"
235-
onChange={(e, elem) => handleChange(elem.checked, [item.id], ['phone'])}
243+
onChange={(e, elem) =>
244+
handleChange(elem.checked, [item.id], ['phone'])
245+
}
236246
value={item.phone}
237247
/>
238248
</Form.Field>

0 commit comments

Comments
 (0)