1
1
/**
2
2
* External dependencies
3
3
*/
4
- import { PanelBody , PanelRow , ToggleControl } from '@wordpress/components' ;
4
+ import { PanelBody , ToggleControl } from '@wordpress/components' ;
5
5
import { __ } from '@wordpress/i18n' ;
6
6
7
7
/**
8
8
* Internal dependencies
9
9
*/
10
10
import { UserSelector } from '../../../components' ;
11
11
import { AllowedRoles } from '../allowed-roles' ;
12
+ import { SettingsRow } from '../settings-row' ;
12
13
13
14
export const UserPermissions = ( {
14
15
featureName,
@@ -20,37 +21,44 @@ export const UserPermissions = ( {
20
21
title = { __ ( 'User permissions' , 'classifai' ) }
21
22
initialOpen = { true }
22
23
>
23
- < PanelRow >
24
- < AllowedRoles featureName = { featureName } />
25
- </ PanelRow >
26
- < PanelRow >
27
- < div className = "classifai-settings__users" >
28
- < UserSelector
29
- value = { featureSettings . users || [ ] }
30
- onChange = { ( users ) => {
31
- setSettings ( {
32
- ...featureSettings ,
33
- users,
34
- } ) ;
35
- } }
36
- label = { __ ( 'Allowed users' , 'classifai' ) }
37
- />
38
- </ div >
39
- </ PanelRow >
40
- < PanelRow >
41
- < div className = "classifai-settings__user_based_opt_out" >
42
- < ToggleControl
43
- checked = { featureSettings ?. user_based_opt_out === '1' }
44
- label = { __ ( 'Enable user-based opt-out' , 'classifai' ) }
45
- onChange = { ( value ) => {
46
- setSettings ( {
47
- ...featureSettings ,
48
- user_based_opt_out : value ? '1' : 'no' ,
49
- } ) ;
50
- } }
51
- />
52
- </ div >
53
- </ PanelRow >
24
+ < AllowedRoles featureName = { featureName } />
25
+
26
+ < SettingsRow
27
+ label = { __ ( 'Allowed users' , 'classifai' ) }
28
+ className = "classifai-settings__users"
29
+ description = { __ (
30
+ 'Select users who can access this feature.' ,
31
+ 'classifai'
32
+ ) }
33
+ >
34
+ < UserSelector
35
+ value = { featureSettings . users || [ ] }
36
+ onChange = { ( users ) => {
37
+ setSettings ( {
38
+ ...featureSettings ,
39
+ users,
40
+ } ) ;
41
+ } }
42
+ />
43
+ </ SettingsRow >
44
+
45
+ < SettingsRow
46
+ label = { __ ( 'Enable user-based opt-out' , 'classifai' ) }
47
+ description = { __ (
48
+ 'Enables ability for users to opt-out from their user profile page.' ,
49
+ 'classifai'
50
+ ) }
51
+ >
52
+ < ToggleControl
53
+ checked = { featureSettings ?. user_based_opt_out === '1' }
54
+ onChange = { ( value ) => {
55
+ setSettings ( {
56
+ ...featureSettings ,
57
+ user_based_opt_out : value ? '1' : 'no' ,
58
+ } ) ;
59
+ } }
60
+ />
61
+ </ SettingsRow >
54
62
</ PanelBody >
55
63
) ;
56
64
} ;
0 commit comments