Updated pages, layout component structures
• Updated: - pages, layout component structures
This commit is contained in:
@@ -4,7 +4,6 @@ import { defineMessages, injectIntl } from 'react-intl'
|
||||
import { openModal } from '../actions/modal'
|
||||
import {
|
||||
MODAL_LIST_EDITOR,
|
||||
// MODAL_LIST_TIMELINE_SETTINGS,
|
||||
} from '../constants'
|
||||
import PageTitle from '../features/ui/util/page_title'
|
||||
import DefaultLayout from '../layouts/default_layout'
|
||||
@@ -16,68 +15,38 @@ import {
|
||||
WhoToFollowPanel,
|
||||
} from '../features/ui/util/async_components'
|
||||
|
||||
const messages = defineMessages({
|
||||
list: { id: 'list', defaultMessage: 'List' },
|
||||
})
|
||||
|
||||
const mapStateToProps = (state, props) => ({
|
||||
list: state.getIn(['lists', props.params.id]),
|
||||
})
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
onOpenListEditModal(list) {
|
||||
if (!list) return
|
||||
const listId = list.get('id')
|
||||
dispatch(openModal(MODAL_LIST_EDITOR, { id: listId }))
|
||||
},
|
||||
// : todo :
|
||||
// onOpenListTimelineSettingsModal() {
|
||||
// dispatch(openModal(MODAL_LIST_TIMELINE_SETTINGS))
|
||||
// },
|
||||
})
|
||||
|
||||
export default
|
||||
@injectIntl
|
||||
@connect(mapStateToProps, mapDispatchToProps)
|
||||
class ListPage extends ImmutablePureComponent {
|
||||
|
||||
static propTypes = {
|
||||
intl: PropTypes.object.isRequired,
|
||||
list: ImmutablePropTypes.map,
|
||||
children: PropTypes.node.isRequired,
|
||||
onOpenListEditModal: PropTypes.func.isRequired,
|
||||
// onOpenListTimelineSettingsModal: PropTypes.func.isRequired,
|
||||
}
|
||||
|
||||
handleOnOpenListEditModal = () => {
|
||||
this.props.onOpenListEditModal(this.props.list)
|
||||
onOpenListEditModal = () => {
|
||||
const { list } = this.props
|
||||
|
||||
if (!list) return
|
||||
|
||||
this.props.dispatch(openModal(MODAL_LIST_EDITOR, {
|
||||
id: list.get('id'),
|
||||
}))
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
intl,
|
||||
children,
|
||||
intl,
|
||||
list,
|
||||
onOpenListEditModal,
|
||||
// onOpenListTimelineSettingsModal
|
||||
} = this.props
|
||||
|
||||
const title = !!list ? list.get('title') : ''
|
||||
const listTitle = !!list ? list.get('title') : ''
|
||||
const title = intl.formatMessage(messages.list)
|
||||
|
||||
return (
|
||||
<DefaultLayout
|
||||
showBackBtn
|
||||
title={intl.formatMessage(messages.list)}
|
||||
title={title}
|
||||
page='list'
|
||||
actions={[
|
||||
{
|
||||
icon: 'cog',
|
||||
onClick: this.handleOnOpenListEditModal,
|
||||
onClick: this.onOpenListEditModal,
|
||||
},
|
||||
// {
|
||||
// icon: 'ellipsis',
|
||||
// onClick: onOpenListTimelineSettingsModal,
|
||||
// },
|
||||
]}
|
||||
layout={[
|
||||
<WrappedBundle component={ListDetailsPanel} componentParams={{ list: list, onEdit: this.handleOnOpenListEditModal }} />,
|
||||
@@ -86,9 +55,26 @@ class ListPage extends ImmutablePureComponent {
|
||||
LinkFooter,
|
||||
]}
|
||||
>
|
||||
<PageTitle path={[title, intl.formatMessage(messages.list)]} />
|
||||
<PageTitle path={[listTitle, title]} />
|
||||
{ children }
|
||||
</DefaultLayout>
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const messages = defineMessages({
|
||||
list: { id: 'list', defaultMessage: 'List' },
|
||||
})
|
||||
|
||||
const mapStateToProps = (state, props) => ({
|
||||
list: state.getIn(['lists', props.params.id]),
|
||||
})
|
||||
|
||||
ListPage.propTypes = {
|
||||
children: PropTypes.node.isRequired,
|
||||
dispatch: PropTypes.func.isRequired,
|
||||
intl: PropTypes.object.isRequired,
|
||||
list: ImmutablePropTypes.map,
|
||||
}
|
||||
|
||||
export default injectIntl(connect(mapStateToProps)(ListPage))
|
||||
Reference in New Issue
Block a user