diff --git a/src/components/misc/Button.jsx b/src/components/misc/Button.jsx index a6958580e..ff1f01178 100644 --- a/src/components/misc/Button.jsx +++ b/src/components/misc/Button.jsx @@ -16,6 +16,7 @@ export default class Button extends React.Component { const formatMessage = this.props.intl.formatMessage; let classes = cx("Button", this.props.className, { + "disabled": this.props.isDisabled, "pending": this.props.isPending, }); @@ -23,7 +24,7 @@ export default class Button extends React.Component { this.props.labelValues); return ( - @@ -31,8 +32,10 @@ export default class Button extends React.Component { } onClick(ev) { - if(!this.props.isPending && this.props.onClick) { - this.props.onClick(ev); + if(this.props.isDisabled || this.props.isPending || !this.props.onClick) { + return; } + + this.props.onClick(ev); } } diff --git a/src/components/panes/SmsDistributionPane.jsx b/src/components/panes/SmsDistributionPane.jsx index 85c7a91a8..6e07a2531 100644 --- a/src/components/panes/SmsDistributionPane.jsx +++ b/src/components/panes/SmsDistributionPane.jsx @@ -91,6 +91,17 @@ export default class SmsDistributionPane extends PaneBase { const stats = data && data.statsItem && data.statsItem.data; + let amount; + if (stats) { + if (state === 'draft') { + const split = splitter(message); + + amount = split.parts.length * stats.num_target_matches; + } else { + amount = stats.amount; + } + } + return { isLoaded, @@ -102,6 +113,7 @@ export default class SmsDistributionPane extends PaneBase { sent, + amount, stats, }; } @@ -165,14 +177,7 @@ export default class SmsDistributionPane extends PaneBase { // Draft - renderDraftPaneContent({ title, sender, message, stats }) { - let estimated_amount; - if (stats) { - const split = splitter(message); - - estimated_amount = split.parts.length * stats.num_target_matches; - } - + renderDraftPaneContent({ title, sender, message, amount, stats }) { return (