Fixed issues in StatusLikes, StatusReposts, made own pages
• Fixed: - issues in StatusLikes, StatusReposts, made own pages
This commit is contained in:
parent
5cb539061b
commit
eeb0fdcd47
|
@ -11,17 +11,17 @@ import Account from '../components/account'
|
|||
import ColumnIndicator from '../components/column_indicator'
|
||||
import ScrollableList from '../components/scrollable_list'
|
||||
|
||||
class StatusReposts extends ImmutablePureComponent {
|
||||
class StatusLikes extends ImmutablePureComponent {
|
||||
|
||||
componentWillMount () {
|
||||
this.props.dispatch(fetchLikes(this.props.params.statusId))
|
||||
this.props.dispatch(fetchStatus(this.props.params.statusId))
|
||||
this.props.dispatch(fetchLikes(this.props.statusId))
|
||||
this.props.dispatch(fetchStatus(this.props.statusId))
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
if (nextProps.params.statusId !== this.props.params.statusId && nextProps.params.statusId) {
|
||||
this.props.dispatch(fetchLikes(nextProps.params.statusId))
|
||||
this.props.dispatch(fetchStatus(nextProps.params.statusId))
|
||||
if (nextProps.statusId !== this.props.statusId && nextProps.statusId) {
|
||||
this.props.dispatch(fetchLikes(nextProps.statusId))
|
||||
this.props.dispatch(fetchStatus(nextProps.statusId))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,23 +51,25 @@ class StatusReposts extends ImmutablePureComponent {
|
|||
}
|
||||
|
||||
const mapStateToProps = (state, props) => {
|
||||
const statusId = props.params ? props.params.statusId : props.statusId
|
||||
|
||||
const getStatus = makeGetStatus()
|
||||
const status = getStatus(state, {
|
||||
id: props.params.statusId,
|
||||
username: props.params.username,
|
||||
id: statusId
|
||||
})
|
||||
|
||||
return {
|
||||
status,
|
||||
accountIds: state.getIn(['user_lists', 'liked_by', props.params.statusId]),
|
||||
statusId,
|
||||
accountIds: state.getIn(['user_lists', 'liked_by', statusId]),
|
||||
}
|
||||
}
|
||||
|
||||
StatusReposts.propTypes = {
|
||||
params: PropTypes.object.isRequired,
|
||||
dispatch: PropTypes.func.isRequired,
|
||||
StatusLikes.propTypes = {
|
||||
accountIds: ImmutablePropTypes.list,
|
||||
dispatch: PropTypes.func.isRequired,
|
||||
status: ImmutablePropTypes.map,
|
||||
statusId: PropTypes.string.isRequired,
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps)(StatusReposts)
|
||||
export default connect(mapStateToProps)(StatusLikes)
|
|
@ -14,14 +14,14 @@ import ScrollableList from '../components/scrollable_list'
|
|||
class StatusReposts extends ImmutablePureComponent {
|
||||
|
||||
componentWillMount () {
|
||||
this.props.dispatch(fetchReposts(this.props.params.statusId))
|
||||
this.props.dispatch(fetchStatus(this.props.params.statusId))
|
||||
this.props.dispatch(fetchReposts(this.props.statusId))
|
||||
this.props.dispatch(fetchStatus(this.props.statusId))
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
if (nextProps.params.statusId !== this.props.params.statusId && nextProps.params.statusId) {
|
||||
this.props.dispatch(fetchReposts(nextProps.params.statusId))
|
||||
this.props.dispatch(fetchStatus(nextProps.params.statusId))
|
||||
if (nextProps.statusId !== this.props.statusId && nextProps.statusId) {
|
||||
this.props.dispatch(fetchReposts(nextProps.statusId))
|
||||
this.props.dispatch(fetchStatus(nextProps.statusId))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,23 +51,26 @@ class StatusReposts extends ImmutablePureComponent {
|
|||
}
|
||||
|
||||
const mapStateToProps = (state, props) => {
|
||||
const statusId = props.params ? props.params.statusId : props.statusId
|
||||
|
||||
const getStatus = makeGetStatus()
|
||||
const status = getStatus(state, {
|
||||
id: props.params.statusId,
|
||||
username: props.params.username,
|
||||
id: statusId,
|
||||
// username: props.params.username,
|
||||
})
|
||||
|
||||
return {
|
||||
status,
|
||||
accountIds: state.getIn(['user_lists', 'reblogged_by', props.params.statusId]),
|
||||
statusId,
|
||||
accountIds: state.getIn(['user_lists', 'reblogged_by', statusId]),
|
||||
}
|
||||
}
|
||||
|
||||
StatusReposts.propTypes = {
|
||||
params: PropTypes.object.isRequired,
|
||||
dispatch: PropTypes.func.isRequired,
|
||||
accountIds: ImmutablePropTypes.list,
|
||||
dispatch: PropTypes.func.isRequired,
|
||||
status: ImmutablePropTypes.map,
|
||||
statusId: PropTypes.string.isRequired,
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps)(StatusReposts)
|
|
@ -245,12 +245,11 @@ class SwitchingArea extends React.PureComponent {
|
|||
<Redirect from='/@:username/posts/:statusId' to='/:username/posts/:statusId' exact />
|
||||
<WrappedRoute path='/:username/posts/:statusId' publicRoute exact page={BasicPage} component={StatusFeature} content={children} componentParams={{ title: 'Status', page: 'status' }} />
|
||||
|
||||
{ /*
|
||||
<Redirect from='/@:username/posts/:statusId/reposts' to='/:username/posts/:statusId/reposts' />
|
||||
<WrappedRoute path='/:username/posts/:statusId/reposts' page={BasicPage} component={StatusReposts} content={children} componentParams={{ title: 'Reposts' }} />
|
||||
<WrappedRoute path='/:username/posts/:statusId/reposts' publicRoute page={ModalPage} component={StatusReposts} content={children} componentParams={{ title: 'Reposts' }} />
|
||||
|
||||
<Redirect from='/@:username/posts/:statusId/likes' to='/:username/posts/:statusId/likes' />
|
||||
<WrappedRoute path='/:username/posts/:statusId/likes' page={BasicPage} component={StatusLikes} content={children} componentParams={{ title: 'Likes' }} /> */ }
|
||||
<WrappedRoute path='/:username/posts/:statusId/likes' page={ModalPage} component={StatusLikes} content={children} componentParams={{ title: 'Likes' }} />
|
||||
|
||||
<WrappedRoute page={ErrorPage} component={GenericNotFound} content={children} />
|
||||
</Switch>
|
||||
|
|
Loading…
Reference in New Issue