Skip to content

Commit

Permalink
floweditor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mdshamoon committed Feb 25, 2021
1 parent 87a8abd commit fb4bbf1
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export default class AddGroupsForm extends React.Component<ActionFormProps, Chan
placeholder={i18n.t('select_groups', 'Select Collection')}
expressions={true}
// Groups can be created on the fly
createPrefix={i18n.t('create_group', 'Create Collection') + ': '}
// createPrefix={i18n.t('create_group', 'Create Collection') + ': '}
createAssetFromInput={this.handleCreateAssetFromInput}
onAssetCreated={this.handleGroupAdded}
/>
Expand Down
43 changes: 18 additions & 25 deletions src/components/flow/actions/sendbroadcast/SendBroadcast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,37 +18,30 @@ const SendBroadcastComp: React.SFC<BroadcastMsg> = (
context: any
): JSX.Element => {
const assets = getRecipients(action);
if (action.text) {
return (
<div className={styles.node}>
<div className={styles.to} key={action.uuid + '_broadcast_recipients'}>
{renderAssetList(assets, MAX_TO_SHOW, context.config.endpoints)}
</div>
<div className={styles.message}>
{action.text.split(/\r?\n/).map((line: string, idx: number) => (

return (
<div className={styles.node}>
<div className={styles.to} key={action.uuid + '_broadcast_recipients'}>
{renderAssetList(assets, MAX_TO_SHOW, context.config.endpoints)}
</div>
<div className={styles.message}>
{action.text &&
action.text.split(/\r?\n/).map((line: string, idx: number) => (
<div key={action.uuid + idx} className={styles.line}>
{line}
</div>
))}
<div className={styles.icons}>
{action.attachments && action.attachments.length > 0 ? (
<div className={`${styles.attachment} fe-paperclip`} />
) : null}
{action.templating && action.templating.template ? (
<div className={`${styles.whatsapp} fe-whatsapp`} />
) : null}
</div>
<div className={styles.icons}>
{action.attachments && action.attachments.length > 0 ? (
<div className={`${styles.attachment} fe-paperclip`} />
) : null}
{action.templating && action.templating.template ? (
<div className={`${styles.whatsapp} fe-whatsapp`} />
) : null}
</div>
</div>
);
}
if (action.attachments && action.attachments.length > 0) {
return <div className={`${styles.attachment} fe-paperclip`} />;
}
if (action.templating && action.templating.template) {
return <div className={`${styles.whatsapp} fe-whatsapp`} />;
}
return <div className="placeholder">{PLACEHOLDER}</div>;
</div>
);
};

SendBroadcastComp.contextTypes = {
Expand Down
14 changes: 11 additions & 3 deletions src/components/flow/actions/sendbroadcast/SendBroadcastForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export default class SendBroadcastForm extends React.Component<
this.setState({ valid });
}
} else {
this.setState({ attachmentError: `Not a valid ${type} url` });
this.setState({ attachmentError: response.data.message });
}
})
.catch(error => {
Expand Down Expand Up @@ -387,7 +387,7 @@ export default class SendBroadcastForm extends React.Component<
</>
) : null}
</div>
{this.state.validAttachment && !this.state.attachmentError ? (
{this.state.valid && this.state.validAttachment && !this.state.attachmentError ? (
<div className={styles.loading}>
Checking URL validity
<Loading size={10} units={6} color="#999999" />
Expand Down Expand Up @@ -427,6 +427,14 @@ export default class SendBroadcastForm extends React.Component<
);
}

private checkAttachmentErrors(): boolean {
if (this.state.valid) {
return this.state.validAttachment;
} else {
return false;
}
}

public render(): JSX.Element {
const typeConfig = this.props.typeConfig;

Expand All @@ -441,7 +449,7 @@ export default class SendBroadcastForm extends React.Component<
name: 'Attachments',
body: this.renderAttachments(),
checked: this.state.attachments.length > 0,
hasErrors: this.state.validAttachment
hasErrors: this.checkAttachmentErrors()
};
return (
<Dialog
Expand Down
2 changes: 1 addition & 1 deletion src/components/flow/actions/sendmsg/SendMsgForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export default class SendMsgForm extends React.Component<ActionFormProps, SendMs
this.setState({ templateVariables, valid });
}
} else {
this.setState({ attachmentError: `Not a valid ${type} url` });
this.setState({ attachmentError: response.data.message });
}
})
.catch(error => {
Expand Down

0 comments on commit fb4bbf1

Please sign in to comment.