Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
olemp committed Apr 5, 2024
1 parent df6690f commit 0c00e4a
Show file tree
Hide file tree
Showing 2 changed files with 1,346 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { FieldContainer } from 'pp365-shared-library'
import React, { FC, useEffect, useState } from 'react'
import { useRiskActionFieldCustomizerContext } from '../../../../../riskAction/context'
import { IResponsibleFieldProps } from './types'
import { format } from '@fluentui/react'
import { stringIsNullOrEmpty } from '@pnp/core'

export const ResponsibleField: FC<IResponsibleFieldProps> = (props) => {
const context = useRiskActionFieldCustomizerContext()
Expand All @@ -19,6 +21,8 @@ export const ResponsibleField: FC<IResponsibleFieldProps> = (props) => {
return (
<FieldContainer label={strings.ResponsibleFieldLabel} iconName='Person'>
<Combobox
freeform
value={value}
onOptionSelect={(_e, data) => {
props.onChange(data.optionValue)
}}
Expand All @@ -38,11 +42,11 @@ export const ResponsibleField: FC<IResponsibleFieldProps> = (props) => {
/>
</Option>
))}
{matchingUsers.length === 0 ? (
<Option key='no-results' text=''>
{strings.ResponsibleFieldNoResults}
{(!stringIsNullOrEmpty(value) && matchingUsers.length === 0) && (
<Option key='ResponsibleFieldNoResults' text=''>
{format(strings.ResponsibleFieldNoResults, value)}
</Option>
) : null}
)}
</Combobox>
</FieldContainer>
)
Expand Down
Loading

0 comments on commit 0c00e4a

Please sign in to comment.