Skip to content

Commit

Permalink
fix: Moved value field to user tab and removed inline lu from attachm…
Browse files Browse the repository at this point in the history
…ent input (#2194)
  • Loading branch information
tdurnford committed Mar 7, 2020
1 parent 3d64659 commit a982001
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { MicrosoftInputDialog } from '@bfc/shared';

import { WidgetLabel } from '../../widgets/WidgetLabel';
import { LgEditorWidget } from '../../widgets/LgEditorWidget';
import { TextWidget } from '../../widgets';

import { Validations } from './Validations';
import { field } from './styles';
Expand All @@ -22,7 +21,7 @@ interface OtherProps extends FieldProps<MicrosoftInputDialog> {
}

export const Other: React.FC<OtherProps> = props => {
const { onChange, getSchema, idSchema, formData, errorSchema } = props;
const { onChange, getSchema, idSchema, formData } = props;

return (
<React.Fragment>
Expand Down Expand Up @@ -56,17 +55,6 @@ export const Other: React.FC<OtherProps> = props => {
height={125}
/>
</div>
<div css={field}>
<TextWidget
onChange={onChange('value')}
schema={getSchema('value')}
id={idSchema.value.__id}
value={formData.value}
label={formatMessage('Value')}
formContext={props.formContext}
rawErrors={errorSchema.value && errorSchema.value.__errors}
/>
</div>
<div css={field}>
<WidgetLabel
label={formatMessage('Default value response')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ export const UserInput: React.FC<UserInputProps> = props => {

return (
<Fragment>
{usesLuisRecognizer(formContext.currentDialog) && (
<div css={field}>
<LuEditorWidget name={intentName} formContext={formContext} />
</div>
)}
<div css={field}>
<TextWidget
onChange={onChange('property')}
Expand All @@ -72,6 +67,22 @@ export const UserInput: React.FC<UserInputProps> = props => {
/>
</div>
)}
<div css={field}>
<TextWidget
onChange={onChange('value')}
schema={getSchema('value')}
id={idSchema.value.__id}
value={formData.value}
label={formatMessage('Value')}
formContext={props.formContext}
rawErrors={errorSchema.value && errorSchema.value.__errors}
/>
</div>
{usesLuisRecognizer(formContext.currentDialog) && type !== SDKTypes.AttachmentInput && (
<div css={field}>
<LuEditorWidget name={intentName} formContext={formContext} prompt />
</div>
)}
{getSchema('defaultLocale') && (
<div css={field}>
<TextWidget
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ interface LuEditorWidgetProps {
name: string;
height?: number | string;
onChange?: (template?: string) => void;
prompt?: boolean;
}

export class LuEditorWidget extends React.Component<LuEditorWidgetProps> {
Expand Down Expand Up @@ -83,7 +84,9 @@ export class LuEditorWidget extends React.Component<LuEditorWidgetProps> {
? diagnostic.message.split('error message: ')[diagnostic.message.split('error message: ').length - 1]
: '';

const label = formatMessage('Trigger phrases (intent: #{name})', { name });
const label = prompt
? formatMessage('Expected responses (intent: {name})', { name })
: formatMessage('Trigger phrases (intent: {name})', { name });

return (
<>
Expand Down

0 comments on commit a982001

Please sign in to comment.