Skip to content

Commit

Permalink
Still working on labels
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyist committed Nov 4, 2021
1 parent fc0ea7e commit 2fe740c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/components/flow/actions/sendmsg/SendMsg.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import i18n from 'config/i18n';
import { renderAssetList } from '../helpers';
import { AssetType } from '../../../../store/flowContext';
import { MAX_TO_SHOW } from '../addlabels/AddLabels';
import { fakePropType } from '../../../../config/ConfigProvider';

export const PLACEHOLDER = i18n.t('actions.send_msg.placeholder', 'Send a message to the contact');

const SendMsgComp: React.SFC<SendMsg> = (action: SendMsg): JSX.Element => {
const SendMsgComp: React.SFC<SendMsg> = (action: SendMsg, context: any): JSX.Element => {
if (action.text) {
let replies = null;

Expand Down Expand Up @@ -43,14 +44,21 @@ const SendMsgComp: React.SFC<SendMsg> = (action: SendMsg): JSX.Element => {
{action.labels
? renderAssetList(
action.labels.map(label => {
if (label.name_match) {
return {
id: label.name_match,
name: label.name_match,
type: AssetType.NameMatch
};
}
return {
id: label.uuid,
name: label.name,
type: AssetType.Label
};
}),
MAX_TO_SHOW,
null
context.config.endpoints
)
: null}

Expand All @@ -71,4 +79,8 @@ const SendMsgComp: React.SFC<SendMsg> = (action: SendMsg): JSX.Element => {
return <div className="placeholder">{PLACEHOLDER}</div>;
};

SendMsgComp.contextTypes = {
config: fakePropType
};

export default SendMsgComp;
1 change: 1 addition & 0 deletions src/components/flow/actions/sendmsg/SendMsgForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ export default class SendMsgForm extends React.Component<ActionFormProps, SendMs
entry={this.state.labels}
searchable={true}
multi={true}
expressions={true}
onChange={this.handleLabelsChanged}
createPrefix={i18n.t('create_label', 'Create Label') + ': '}
createAssetFromInput={this.handleCreateAssetFromInput}
Expand Down

0 comments on commit 2fe740c

Please sign in to comment.