Progress and testing status w comments

This commit is contained in:
mgabdev
2020-04-16 02:00:43 -04:00
parent 0c6837213d
commit 35852e7fee
22 changed files with 605 additions and 534 deletions

View File

@@ -49,6 +49,7 @@ class ComposeForm extends ImmutablePureComponent {
static propTypes = {
intl: PropTypes.object.isRequired,
edit: PropTypes.bool,
isMatch: PropTypes.bool,
text: PropTypes.string.isRequired,
suggestions: ImmutablePropTypes.list,
account: ImmutablePropTypes.map.isRequired,
@@ -234,6 +235,7 @@ class ComposeForm extends ImmutablePureComponent {
replyToId,
hasPoll,
isUploading,
isMatch,
} = this.props
const disabled = this.props.isSubmitting;
const text = [this.props.spoilerText, countableText(this.props.text)].join('');
@@ -248,7 +250,10 @@ class ComposeForm extends ImmutablePureComponent {
const childContainerClasses = cx({
default: 1,
flexNormal: 1,
flexWrap: 1,
overflowHidden: 1,
flex1: 1,
alignItemsEnd: shouldCondense,
flexRow: shouldCondense,
radiusSmall: shouldCondense,
backgroundSubtle: shouldCondense,
@@ -262,6 +267,7 @@ class ComposeForm extends ImmutablePureComponent {
alignItemsStart: shouldCondense,
mt10: !shouldCondense,
px15: !shouldCondense,
marginLeftAuto: shouldCondense,
})
return (
@@ -361,7 +367,21 @@ class ComposeForm extends ImmutablePureComponent {
<SchedulePostButton />
}
<GifSelectorButton small={shouldCondense} />
<EmojiPickerButton small={shouldCondense} />
<EmojiPickerButton small={shouldCondense} isMatch={isMatch} />
{
shouldCondense /* && (hasPoll || anyMedia || text) */ &&
<div className={[_s.default, _s.justifyContentCenter].join(' ')}>
<Button
narrow
onClick={this.handleSubmit}
disabled={disabledButton}
className={_s.px10}
>
{intl.formatMessage(scheduledAt ? messages.schedulePost : messages.publish)}
</Button>
</div>
}
</div>
{

View File

@@ -30,6 +30,7 @@ class EmojiPickerButton extends PureComponent {
onClick: PropTypes.func.isRequired,
active: PropTypes.bool,
small: PropTypes.bool,
isMatch: PropTypes.bool,
}
handleClick = (e) => {
@@ -42,7 +43,12 @@ class EmojiPickerButton extends PureComponent {
}
render() {
const { active, small, intl } = this.props
const {
active,
intl,
isMatch,
small,
} = this.props
return (
<ComposeExtraButton
@@ -50,7 +56,7 @@ class EmojiPickerButton extends PureComponent {
onClick={this.handleClick}
icon='happy'
small={small}
active={active}
active={active && isMatch}
buttonRef={this.setButton}
/>
)

View File

@@ -1,6 +1,6 @@
import { injectIntl, defineMessages } from 'react-intl'
import { openModal } from '../../../actions/modal'
import { openPopover } from '../../../actions/popover'
import { closePopover, openPopover } from '../../../actions/popover'
import { me } from '../../../initial_state'
import ComposeExtraButton from './compose_extra_button'
@@ -11,6 +11,7 @@ const messages = defineMessages({
})
const mapStateToProps = (state) => ({
active: !!state.getIn(['compose', 'scheduled_at']) || state.getIn(['popover', 'popoverType']) === 'DATE_PICKER',
isPro: state.getIn(['accounts', me, 'is_pro']),
})
@@ -21,6 +22,10 @@ const mapDispatchToProps = (dispatch) => ({
}))
},
onCloseDatePickerPopover() {
dispatch(closePopover())
},
onOpenProUpgradeModal() {
dispatch(openModal('PRO_UPGRADE'))
},
@@ -32,10 +37,12 @@ export default
class SchedulePostDropdown extends PureComponent {
static propTypes = {
active: PropTypes.bool.isRequired,
intl: PropTypes.object.isRequired,
isPro: PropTypes.bool,
onOpenProUpgradeModal: PropTypes.func.isRequired,
onOpenDatePickerPopover: PropTypes.func.isRequired,
onCloseDatePickerPopover: PropTypes.func.isRequired,
small: PropTypes.bool,
}
@@ -52,15 +59,20 @@ class SchedulePostDropdown extends PureComponent {
}
render () {
const { intl, small } = this.props
const {
active,
intl,
small,
} = this.props
return (
<ComposeExtraButton
active={active}
buttonRef={this.setButton}
icon='calendar'
title={intl.formatMessage(messages.schedule_status)}
onClick={this.handleToggle}
small={small}
buttonRef={this.setButton}
title={intl.formatMessage(messages.schedule_status)}
/>
)
}

View File

@@ -21,6 +21,7 @@ const mapStateToProps = (state, { replyToId }) => {
// console.log("isMatch:", isMatch, reduxReplyToId, replyToId)
return {
isMatch,
edit: !isMatch ? null : state.getIn(['compose', 'id']) !== null,
text: !isMatch ? '' : state.getIn(['compose', 'text']),
suggestions: !isMatch ? ImmutableList() : state.getIn(['compose', 'suggestions']),

View File

@@ -52,9 +52,12 @@ const makeMapStateToProps = () => {
const getStatus = makeGetStatus()
const mapStateToProps = (state, props) => {
const statusId = props.id || props.params.statusId
const username = props.params ? props.params.username : undefined
const status = getStatus(state, {
id: props.params.statusId,
username: props.params.username,
id: statusId,
username: username,
})
// : todo : if is comment (i.e. if any ancestorsIds) use comment not status
@@ -101,7 +104,7 @@ const makeMapStateToProps = () => {
})
}
console.log("descendantsIds:", descendantsIds)
// console.log("descendantsIds:", descendantsIds)
return {
status,
@@ -142,13 +145,18 @@ class Status extends ImmutablePureComponent {
};
componentWillMount() {
this.props.dispatch(fetchStatus(this.props.params.statusId));
const statusId = this.props.id || this.props.params.statusId
// console.log("statusId:", statusId)
this.props.dispatch(fetchStatus(statusId));
}
componentWillReceiveProps(nextProps) {
if (nextProps.params.statusId !== this.props.params.statusId && nextProps.params.statusId) {
const statusId = this.props.id || this.props.params.statusId
const nextStatusId = nextProps.id || nextProps.params.statusId
if (nextStatusId !== statusId && nextStatusId) {
this._scrolledIntoView = false;
this.props.dispatch(fetchStatus(nextProps.params.statusId));
this.props.dispatch(fetchStatus(nextStatusId));
}
if (nextProps.status && nextProps.status.get('id') !== this.state.loadedStatusId) {
@@ -366,7 +374,7 @@ class Status extends ImmutablePureComponent {
}
renderChildren(list) {
console.log("list:", list)
// console.log("list:", list)
return null
// : todo : comments
return list.map(id => (
@@ -434,7 +442,7 @@ class Status extends ImmutablePureComponent {
};
return (
<div ref={this.setRef}>
<div ref={this.setRef} className={_s.mb15}>
<Block>
{
/* ancestors */