2020-02-19 23:57:07 +00:00
|
|
|
import ImmutablePropTypes from 'react-immutable-proptypes'
|
|
|
|
import ImmutablePureComponent from 'react-immutable-pure-component'
|
2020-04-16 07:00:43 +01:00
|
|
|
import { defineMessages, injectIntl } from 'react-intl'
|
2020-03-25 03:08:43 +00:00
|
|
|
import { openModal } from '../actions/modal'
|
2020-04-28 06:33:58 +01:00
|
|
|
import {
|
|
|
|
MODAL_LIST_EDITOR,
|
|
|
|
// MODAL_LIST_TIMELINE_SETTINGS,
|
|
|
|
} from '../constants'
|
2020-04-11 23:29:19 +01:00
|
|
|
import PageTitle from '../features/ui/util/page_title'
|
2020-02-19 23:57:07 +00:00
|
|
|
import LinkFooter from '../components/link_footer'
|
2020-02-24 21:56:07 +00:00
|
|
|
import DefaultLayout from '../layouts/default_layout'
|
2020-02-19 23:57:07 +00:00
|
|
|
import ListDetailsPanel from '../components/panel/list_details_panel'
|
2020-03-25 03:08:43 +00:00
|
|
|
import WhoToFollowPanel from '../components/panel/who_to_follow_panel'
|
|
|
|
import TrendsPanel from '../components/panel/trends_panel'
|
2020-02-19 23:57:07 +00:00
|
|
|
|
2020-04-16 07:00:43 +01:00
|
|
|
const messages = defineMessages({
|
|
|
|
list: { id: 'list', defaultMessage: 'List' },
|
|
|
|
})
|
|
|
|
|
2020-02-19 23:57:07 +00:00
|
|
|
const mapStateToProps = (state, props) => ({
|
|
|
|
list: state.getIn(['lists', props.params.id]),
|
2020-03-25 03:08:43 +00:00
|
|
|
})
|
|
|
|
|
2020-04-28 06:33:58 +01:00
|
|
|
const mapDispatchToProps = (dispatch) => ({
|
|
|
|
onOpenListEditModal(list) {
|
|
|
|
if (!list) return
|
|
|
|
const listId = list.get('id')
|
2020-05-03 06:22:49 +01:00
|
|
|
dispatch(openModal(MODAL_LIST_EDITOR, { id: listId }))
|
2020-03-25 03:08:43 +00:00
|
|
|
},
|
2020-04-28 06:33:58 +01:00
|
|
|
// : todo :
|
|
|
|
// onOpenListTimelineSettingsModal() {
|
|
|
|
// dispatch(openModal(MODAL_LIST_TIMELINE_SETTINGS))
|
|
|
|
// },
|
2020-03-25 03:08:43 +00:00
|
|
|
})
|
2020-02-19 23:57:07 +00:00
|
|
|
|
2020-02-25 16:04:44 +00:00
|
|
|
export default
|
2020-04-16 07:00:43 +01:00
|
|
|
@injectIntl
|
2020-03-25 03:08:43 +00:00
|
|
|
@connect(mapStateToProps, mapDispatchToProps)
|
2020-02-19 23:57:07 +00:00
|
|
|
class ListPage extends ImmutablePureComponent {
|
|
|
|
|
|
|
|
static propTypes = {
|
2020-04-16 07:00:43 +01:00
|
|
|
intl: PropTypes.object.isRequired,
|
2020-02-19 23:57:07 +00:00
|
|
|
list: ImmutablePropTypes.map,
|
2020-04-16 07:00:43 +01:00
|
|
|
children: PropTypes.node.isRequired,
|
2020-03-25 03:08:43 +00:00
|
|
|
onOpenListEditModal: PropTypes.func.isRequired,
|
2020-04-28 06:33:58 +01:00
|
|
|
// onOpenListTimelineSettingsModal: PropTypes.func.isRequired,
|
2020-03-25 03:08:43 +00:00
|
|
|
}
|
2020-03-12 16:09:15 +00:00
|
|
|
|
2020-04-28 06:33:58 +01:00
|
|
|
handleOnOpenListEditModal = () => {
|
|
|
|
this.props.onOpenListEditModal(this.props.list)
|
|
|
|
}
|
|
|
|
|
2020-02-19 23:57:07 +00:00
|
|
|
render() {
|
2020-03-25 03:08:43 +00:00
|
|
|
const {
|
2020-04-16 07:00:43 +01:00
|
|
|
intl,
|
2020-03-25 03:08:43 +00:00
|
|
|
children,
|
|
|
|
list,
|
|
|
|
onOpenListEditModal,
|
2020-04-28 06:33:58 +01:00
|
|
|
// onOpenListTimelineSettingsModal
|
2020-03-25 03:08:43 +00:00
|
|
|
} = this.props
|
2020-02-19 23:57:07 +00:00
|
|
|
|
2020-03-25 03:08:43 +00:00
|
|
|
const title = !!list ? list.get('title') : ''
|
2020-02-19 23:57:07 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<DefaultLayout
|
2020-04-28 06:33:58 +01:00
|
|
|
showBackBtn
|
2020-05-03 06:22:49 +01:00
|
|
|
title={intl.formatMessage(messages.list)}
|
2020-07-16 05:05:08 +01:00
|
|
|
page='list'
|
2020-02-19 23:57:07 +00:00
|
|
|
actions={[
|
2020-03-25 03:08:43 +00:00
|
|
|
{
|
2020-04-28 06:33:58 +01:00
|
|
|
icon: 'cog',
|
|
|
|
onClick: this.handleOnOpenListEditModal,
|
2020-02-19 23:57:07 +00:00
|
|
|
},
|
2020-04-28 06:33:58 +01:00
|
|
|
// {
|
|
|
|
// icon: 'ellipsis',
|
|
|
|
// onClick: onOpenListTimelineSettingsModal,
|
|
|
|
// },
|
2020-02-19 23:57:07 +00:00
|
|
|
]}
|
2020-07-16 05:05:08 +01:00
|
|
|
layout={[
|
|
|
|
<ListDetailsPanel list={list} onEdit={this.handleOnOpenListEditModal} key='list-page-list-panel' />,
|
|
|
|
<TrendsPanel key='list-page-trends-panel' />,
|
|
|
|
<WhoToFollowPanel key='list-page-wtf-panel' />,
|
|
|
|
<LinkFooter key='list-page-link-footer' />,
|
|
|
|
]}
|
2020-02-19 23:57:07 +00:00
|
|
|
>
|
2020-04-16 07:00:43 +01:00
|
|
|
<PageTitle path={[title, intl.formatMessage(messages.list)]} />
|
2020-02-19 23:57:07 +00:00
|
|
|
{ children }
|
|
|
|
</DefaultLayout>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|