Added share button to StatusActionBar

• Added:
- share button to StatusActionBar

• Todo:
- Fix styles for responsiveness
This commit is contained in:
mgabdev 2020-10-24 14:18:06 -05:00
parent a4a1cb19ce
commit 651e2bd381

View File

@ -13,6 +13,10 @@ class StatusActionBar extends ImmutablePureComponent {
updateOnProps = ['status'] updateOnProps = ['status']
handleShareClick = () => {
this.props.onShare(this.shareButton, this.props.status)
}
handleReplyClick = () => { handleReplyClick = () => {
this.props.onReply(this.props.status, null, true) this.props.onReply(this.props.status, null, true)
} }
@ -37,8 +41,8 @@ class StatusActionBar extends ImmutablePureComponent {
this.props.onOpenReposts(this.props.status) this.props.onOpenReposts(this.props.status)
} }
setRepostButton = (n) => { setShareButton = (n) => {
this.repostButton = n this.shareButton = n
} }
render() { render() {
@ -164,7 +168,6 @@ class StatusActionBar extends ImmutablePureComponent {
icon={!publicStatus ? 'lock' : 'repost'} icon={!publicStatus ? 'lock' : 'repost'}
disabled={!publicStatus} disabled={!publicStatus}
active={!!status.get('reblogged')} active={!!status.get('reblogged')}
buttonRef={this.setRepostButton}
onClick={this.handleRepostClick} onClick={this.handleRepostClick}
/> />
<StatusActionBarItem <StatusActionBarItem
@ -174,6 +177,13 @@ class StatusActionBar extends ImmutablePureComponent {
disabled={!publicStatus} disabled={!publicStatus}
onClick={this.handleQuoteClick} onClick={this.handleQuoteClick}
/> />
<StatusActionBarItem
title={intl.formatMessage(messages.share)}
altTitle={intl.formatMessage(messages.share)}
buttonRef={this.setShareButton}
icon='share'
onClick={this.handleShareClick}
/>
</div> </div>
</div> </div>
</div> </div>
@ -183,6 +193,7 @@ class StatusActionBar extends ImmutablePureComponent {
} }
const messages = defineMessages({ const messages = defineMessages({
share: { id: 'status.share', defaultMessage: 'Share' },
comment: { id: 'status.comment', defaultMessage: 'Comment' }, comment: { id: 'status.comment', defaultMessage: 'Comment' },
quote: { id: 'status.quote', defaultMessage: 'Quote' }, quote: { id: 'status.quote', defaultMessage: 'Quote' },
repost: { id: 'status.repost', defaultMessage: 'Repost' }, repost: { id: 'status.repost', defaultMessage: 'Repost' },
@ -199,6 +210,7 @@ StatusActionBar.propTypes = {
onQuote: PropTypes.func.isRequired, onQuote: PropTypes.func.isRequired,
onReply: PropTypes.func.isRequired, onReply: PropTypes.func.isRequired,
onRepost: PropTypes.func.isRequired, onRepost: PropTypes.func.isRequired,
onShare: PropTypes.func.isRequired,
status: ImmutablePropTypes.map.isRequired, status: ImmutablePropTypes.map.isRequired,
onOpenLikes: PropTypes.func.isRequired, onOpenLikes: PropTypes.func.isRequired,
onOpenReposts: PropTypes.func.isRequired, onOpenReposts: PropTypes.func.isRequired,