diff options
author | 2019-02-25 16:47:32 +0100 | |
---|---|---|
committer | 2019-02-25 16:47:32 +0100 | |
commit | 645850d341edb9b6a1e8e033dfb738717ad10a82 (patch) | |
tree | 9277abdf82a6f1027ff6beccd4e83de895a0f2fa /src/features/shareFranz | |
parent | Add dialog to share franz on social media (diff) | |
download | ferdium-app-645850d341edb9b6a1e8e033dfb738717ad10a82.tar.gz ferdium-app-645850d341edb9b6a1e8e033dfb738717ad10a82.tar.zst ferdium-app-645850d341edb9b6a1e8e033dfb738717ad10a82.zip |
Fix service count
Diffstat (limited to 'src/features/shareFranz')
-rw-r--r-- | src/features/shareFranz/Component.js | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/features/shareFranz/Component.js b/src/features/shareFranz/Component.js index 753176e9c..d463664df 100644 --- a/src/features/shareFranz/Component.js +++ b/src/features/shareFranz/Component.js | |||
@@ -1,6 +1,6 @@ | |||
1 | import React, { Component } from 'react'; | 1 | import React, { Component } from 'react'; |
2 | import PropTypes from 'prop-types'; | 2 | import PropTypes from 'prop-types'; |
3 | import { observer } from 'mobx-react'; | 3 | import { observer, inject } from 'mobx-react'; |
4 | import injectSheet from 'react-jss'; | 4 | import injectSheet from 'react-jss'; |
5 | import { defineMessages, intlShape } from 'react-intl'; | 5 | import { defineMessages, intlShape } from 'react-intl'; |
6 | import { Button } from '@meetfranz/forms'; | 6 | import { Button } from '@meetfranz/forms'; |
@@ -9,6 +9,7 @@ import { H1, Icon } from '@meetfranz/ui'; | |||
9 | import Modal from '../../components/ui/Modal'; | 9 | import Modal from '../../components/ui/Modal'; |
10 | import { state } from '.'; | 10 | import { state } from '.'; |
11 | import { gaEvent } from '../../lib/analytics'; | 11 | import { gaEvent } from '../../lib/analytics'; |
12 | import ServicesStore from '../../stores/ServicesStore'; | ||
12 | 13 | ||
13 | const messages = defineMessages({ | 14 | const messages = defineMessages({ |
14 | headline: { | 15 | headline: { |
@@ -86,7 +87,7 @@ const styles = theme => ({ | |||
86 | }, | 87 | }, |
87 | }); | 88 | }); |
88 | 89 | ||
89 | export default @injectSheet(styles) @observer class ShareFranzModal extends Component { | 90 | export default @injectSheet(styles) @inject('stores') @observer class ShareFranzModal extends Component { |
90 | static propTypes = { | 91 | static propTypes = { |
91 | classes: PropTypes.object.isRequired, | 92 | classes: PropTypes.object.isRequired, |
92 | } | 93 | } |
@@ -104,8 +105,11 @@ export default @injectSheet(styles) @observer class ShareFranzModal extends Comp | |||
104 | 105 | ||
105 | const { | 106 | const { |
106 | classes, | 107 | classes, |
108 | stores, | ||
107 | } = this.props; | 109 | } = this.props; |
108 | 110 | ||
111 | const serviceCount = stores.services.all.length; | ||
112 | |||
109 | const { intl } = this.context; | 113 | const { intl } = this.context; |
110 | 114 | ||
111 | return ( | 115 | return ( |
@@ -127,7 +131,7 @@ export default @injectSheet(styles) @observer class ShareFranzModal extends Comp | |||
127 | label={intl.formatMessage(messages.actions.email)} | 131 | label={intl.formatMessage(messages.actions.email)} |
128 | className={classes.cta} | 132 | className={classes.cta} |
129 | icon="mdiEmail" | 133 | icon="mdiEmail" |
130 | href={`mailto:?subject=Meet the cool app Franz&body=${intl.formatMessage(messages.shareText.email, { count: 10 })}}`} | 134 | href={`mailto:?subject=Meet the cool app Franz&body=${intl.formatMessage(messages.shareText.email, { count: serviceCount })}}`} |
131 | target="_blank" | 135 | target="_blank" |
132 | onClick={() => { | 136 | onClick={() => { |
133 | gaEvent('Share Franz', 'share', 'Share via email'); | 137 | gaEvent('Share Franz', 'share', 'Share via email'); |
@@ -147,7 +151,7 @@ export default @injectSheet(styles) @observer class ShareFranzModal extends Comp | |||
147 | label={intl.formatMessage(messages.actions.twitter)} | 151 | label={intl.formatMessage(messages.actions.twitter)} |
148 | className={classes.cta} | 152 | className={classes.cta} |
149 | icon="mdiTwitter" | 153 | icon="mdiTwitter" |
150 | href={`http://twitter.com/intent/tweet?status=${intl.formatMessage(messages.shareText.twitter, { count: 10 })}`} | 154 | href={`http://twitter.com/intent/tweet?status=${intl.formatMessage(messages.shareText.twitter, { count: serviceCount })}`} |
151 | target="_blank" | 155 | target="_blank" |
152 | onClick={() => { | 156 | onClick={() => { |
153 | gaEvent('Share Franz', 'share', 'Share via Twitter'); | 157 | gaEvent('Share Franz', 'share', 'Share via Twitter'); |
@@ -158,3 +162,9 @@ export default @injectSheet(styles) @observer class ShareFranzModal extends Comp | |||
158 | ); | 162 | ); |
159 | } | 163 | } |
160 | } | 164 | } |
165 | |||
166 | ShareFranzModal.wrappedComponent.propTypes = { | ||
167 | stores: PropTypes.shape({ | ||
168 | services: PropTypes.instanceOf(ServicesStore).isRequired, | ||
169 | }).isRequired, | ||
170 | }; | ||