@@ -12,7 +12,7 @@ import { ScimObject } from "../types"
1212import { toSentence } from "./toSentence"
1313
1414import { ScimResourceTypeahead } from "./ScimResourceTypeahead"
15- import { MobileTypeahead } from "./MobileTypeahead "
15+ import { UsersTypeahead } from "./UsersTypeahead "
1616import { CriteriaList } from "./CriteriaList"
1717import { CriteriaForm } from "./CriteriaForm"
1818import { ActionBar } from "./ActionBar"
@@ -25,6 +25,7 @@ type AudienceFormProps = {
2525 allowIndividuals : boolean
2626 allowMatchAll : boolean
2727 isMobile ?: boolean
28+ isPrivate ?: boolean
2829 onSkip ?: ( ) => void
2930}
3031
@@ -34,11 +35,11 @@ export const AudienceForm = ({
3435 allowIndividuals = true ,
3536 allowMatchAll = true ,
3637 isMobile,
38+ isPrivate,
3739 onSkip,
3840} : AudienceFormProps ) => {
3941 const [ editing , setEditing ] = useState < number > ( )
4042 const { error, value : context , change } = useAudiencesContext ( )
41-
4243 if ( isEmpty ( context ) ) {
4344 return null
4445 }
@@ -73,38 +74,31 @@ export const AudienceForm = ({
7374 ) }
7475 { ! context . match_all && (
7576 < >
76- { allowIndividuals &&
77- ( isMobile ? (
78- < MobileTypeahead
79- label = "Add Individuals"
80- value = { context . extra_users || [ ] }
81- onChange = { ( users : ScimObject [ ] ) =>
82- change ( "extra_users" , users )
83- }
84- resourceId = { userResource }
85- />
86- ) : (
87- < ScimResourceTypeahead
88- label = "Add Individuals"
89- value = { context . extra_users || [ ] }
90- onChange = { ( users : ScimObject [ ] ) =>
91- change ( "extra_users" , users )
92- }
93- resourceId = { userResource }
94- />
95- ) ) }
96- < CriteriaList onEditCriteria = { setEditing } />
97- < FlexItem alignSelf = "center" >
98- < Button
99- fixedWidth
100- marginTop = "md"
101- paddingX = { isMobile && "xs" }
102- size = { isMobile ? "sm" : "md" }
103- onClick = { ( ) => setEditing ( context . criteria . length ) }
104- text = { `Add Members by ${ toSentence ( groupResources ) } ` }
105- variant = "link"
77+ { allowIndividuals && (
78+ < UsersTypeahead
79+ label = "Add Individuals"
80+ value = { context . extra_users || [ ] }
81+ isMobile = { isMobile }
82+ onChange = { ( users : ScimObject [ ] ) =>
83+ change ( "extra_users" , users )
84+ }
85+ resourceId = { userResource }
10686 />
107- </ FlexItem >
87+ ) }
88+ < CriteriaList onEditCriteria = { setEditing } />
89+ { isPrivate !== false && (
90+ < FlexItem alignSelf = "center" >
91+ < Button
92+ fixedWidth
93+ marginTop = "md"
94+ paddingX = { isMobile && "xs" }
95+ size = { isMobile ? "sm" : "md" }
96+ onClick = { ( ) => setEditing ( context . criteria . length ) }
97+ text = { `Add Members by ${ toSentence ( groupResources ) } ` }
98+ variant = "link"
99+ />
100+ </ FlexItem >
101+ ) }
108102 </ >
109103 ) }
110104 </ Flex >
0 commit comments