Updated ComposeDestinationHeader to not open dropdown if is edit
• Updated: - ComposeDestinationHeader to not open dropdown if is edit - ComposeDestinationHeader titles if is edit
This commit is contained in:
parent
e7993f9550
commit
365cd86ab0
@ -32,26 +32,33 @@ class ComposeDestinationHeader extends ImmutablePureComponent {
|
|||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
account,
|
account,
|
||||||
|
isEdit,
|
||||||
isReply,
|
isReply,
|
||||||
isModal,
|
isModal,
|
||||||
composeGroup,
|
composeGroup,
|
||||||
|
composeGroupId,
|
||||||
formLocation,
|
formLocation,
|
||||||
} = this.props
|
} = this.props
|
||||||
|
|
||||||
const isIntroduction = formLocation === 'introduction'
|
const isIntroduction = formLocation === 'introduction'
|
||||||
|
|
||||||
|
console.log("composeGroup, composeGroupId:", composeGroup, composeGroupId)
|
||||||
|
|
||||||
|
let editText = isEdit ? ' edit ' : ''
|
||||||
let groupTitle = !!composeGroup ? composeGroup.get('title') : ''
|
let groupTitle = !!composeGroup ? composeGroup.get('title') : ''
|
||||||
groupTitle = groupTitle.length > 32 ? `${groupTitle.substring(0, 32).trim()}...` : groupTitle
|
groupTitle = groupTitle.length > 32 ? `${groupTitle.substring(0, 32).trim()}...` : groupTitle
|
||||||
let title = 'Post to timeline'
|
if (!groupTitle && composeGroupId) groupTitle = 'group'
|
||||||
if (!!composeGroup) {
|
|
||||||
|
let title = `Post${editText}to timeline`
|
||||||
|
if (!!composeGroupId) {
|
||||||
if (isReply) {
|
if (isReply) {
|
||||||
title = `Comment in ${groupTitle}`
|
title = `Comment${editText}in ${groupTitle}`
|
||||||
} else {
|
} else {
|
||||||
title = `Post to ${groupTitle}`
|
title = `Post${editText}to ${groupTitle}`
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isReply) {
|
if (isReply) {
|
||||||
title = 'Post as comment'
|
title = `Post${editText}as comment`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,12 +76,12 @@ class ComposeDestinationHeader extends ImmutablePureComponent {
|
|||||||
buttonRef={this.setDestinationBtn}
|
buttonRef={this.setDestinationBtn}
|
||||||
backgroundColor='secondary'
|
backgroundColor='secondary'
|
||||||
color='primary'
|
color='primary'
|
||||||
onClick={isReply ? undefined : this.handleOnClick}
|
onClick={(isReply || isEdit) ? undefined : this.handleOnClick}
|
||||||
className={[_s.border1PX, _s.borderColorPrimary].join(' ')}
|
className={[_s.border1PX, _s.borderColorPrimary].join(' ')}
|
||||||
>
|
>
|
||||||
<Text color='inherit' size='small' className={_s.jcCenter}>
|
<Text color='inherit' size='small' className={_s.jcCenter}>
|
||||||
{title}
|
{title}
|
||||||
{ !isReply && <Icon id='caret-down' size='8px' className={_s.ml5} /> }
|
{ !isReply && !isEdit && <Icon id='caret-down' size='8px' className={_s.ml5} /> }
|
||||||
</Text>
|
</Text>
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
@ -102,6 +109,7 @@ const mapStateToProps = (state) => {
|
|||||||
return {
|
return {
|
||||||
composeGroupId,
|
composeGroupId,
|
||||||
isReply: !!state.getIn(['compose', 'in_reply_to']),
|
isReply: !!state.getIn(['compose', 'in_reply_to']),
|
||||||
|
isEdit: state.getIn(['compose', 'id']) !== null,
|
||||||
composeGroup: state.getIn(['groups', composeGroupId]),
|
composeGroup: state.getIn(['groups', composeGroupId]),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -125,6 +133,7 @@ ComposeDestinationHeader.propTypes = {
|
|||||||
onOpenPopover: PropTypes.func.isRequired,
|
onOpenPopover: PropTypes.func.isRequired,
|
||||||
formLocation: PropTypes.string,
|
formLocation: PropTypes.string,
|
||||||
isReply: PropTypes.bool.isRequired,
|
isReply: PropTypes.bool.isRequired,
|
||||||
|
isEdit: PropTypes.bool.isRequired,
|
||||||
}
|
}
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(ComposeDestinationHeader)
|
export default connect(mapStateToProps, mapDispatchToProps)(ComposeDestinationHeader)
|
@ -384,6 +384,7 @@ export default function compose(state = initialState, action) {
|
|||||||
map.set('markdown', action.status.get('plain_markdown'));
|
map.set('markdown', action.status.get('plain_markdown'));
|
||||||
map.set('in_reply_to', action.status.get('in_reply_to_id'));
|
map.set('in_reply_to', action.status.get('in_reply_to_id'));
|
||||||
map.set('quote_of_id', action.status.get('quote_of_id'));
|
map.set('quote_of_id', action.status.get('quote_of_id'));
|
||||||
|
map.set('group_id', action.status.getIn(['group', 'id'], null));
|
||||||
map.set('privacy', action.status.get('visibility'));
|
map.set('privacy', action.status.get('visibility'));
|
||||||
map.set('media_attachments', action.status.get('media_attachments'));
|
map.set('media_attachments', action.status.get('media_attachments'));
|
||||||
map.set('focusDate', new Date());
|
map.set('focusDate', new Date());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user