From 1a42735106ed66c39e4ef373035809fa9fccbe11 Mon Sep 17 00:00:00 2001 From: Stefan Fisk Date: Sun, 14 Apr 2019 12:33:37 +0200 Subject: [PATCH] Make SmsDistributionPane title show state --- locale/panes/smsDistribution/en.yaml | 5 +++++ src/components/panes/SmsDistributionPane.jsx | 11 +++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/locale/panes/smsDistribution/en.yaml b/locale/panes/smsDistribution/en.yaml index b641e4790..6b9f11f2b 100644 --- a/locale/panes/smsDistribution/en.yaml +++ b/locale/panes/smsDistribution/en.yaml @@ -22,3 +22,8 @@ stats: num_delivered_messages: '{ num_delivered_messages } Delivered' targets: Targets target_matches_have_changed: The target query's matches have changed since confirming +title: + draft: '{ title }' + confirm: 'Confirm "{ title }"' + sending: 'Sending "{ title }"' + sent: 'Sent "{ title }"' diff --git a/src/components/panes/SmsDistributionPane.jsx b/src/components/panes/SmsDistributionPane.jsx index 74e1e5aaf..85c7a91a8 100644 --- a/src/components/panes/SmsDistributionPane.jsx +++ b/src/components/panes/SmsDistributionPane.jsx @@ -106,14 +106,17 @@ export default class SmsDistributionPane extends PaneBase { }; } - getPaneTitle(data) { - const { distributionItem } = this.props; + getPaneTitle({ isLoaded, title, state }) { + const formatMessage = this.props.intl.formatMessage; - if (!distributionItem || !distributionItem.data || distributionItem.isPending) { + if (!isLoaded) { return null; } - return this.props.distributionItem.data.title; + return formatMessage( + { id: `panes.smsDistribution.title.${state}` }, + { title }, + ); } renderPaneContent(data) {