gab-social/app/javascript/gabsocial/pages/lists_page.js

61 lines
1.4 KiB
JavaScript
Raw Normal View History

import React from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
2020-04-11 23:29:19 +01:00
import { openModal } from '../actions/modal'
2020-04-16 07:00:43 +01:00
import { defineMessages, injectIntl } from 'react-intl'
2020-04-11 23:29:19 +01:00
import PageTitle from '../features/ui/util/page_title'
2020-02-24 21:56:07 +00:00
import DefaultLayout from '../layouts/default_layout'
import { MODAL_LIST_CREATE } from '../constants'
import {
LinkFooter,
TrendsPanel,
UserSuggestionsPanel,
} from '../features/ui/util/async_components'
2020-02-19 23:57:07 +00:00
class ListsPage extends React.PureComponent {
2020-03-25 03:08:43 +00:00
onOpenListCreateModal = () => {
this.props.dispatch(openModal(MODAL_LIST_CREATE))
2020-02-19 23:57:07 +00:00
}
render() {
const { children, intl } = this.props
const title = intl.formatMessage(messages.lists)
2020-02-19 23:57:07 +00:00
return (
<DefaultLayout
showBackBtn
title={title}
page='lists'
2020-02-19 23:57:07 +00:00
actions={[
{
2020-04-08 02:06:59 +01:00
icon: 'add',
onClick: this.onOpenListCreateModal,
2020-02-19 23:57:07 +00:00
},
]}
layout={[
TrendsPanel,
UserSuggestionsPanel,
LinkFooter,
]}
2020-02-19 23:57:07 +00:00
>
<PageTitle path={title} />
2020-02-19 23:57:07 +00:00
{children}
</DefaultLayout>
)
}
2020-04-08 02:06:59 +01:00
}
const messages = defineMessages({
lists: { id: 'lists', defaultMessage: 'Lists' },
})
ListsPage.propTypes = {
intl: PropTypes.object.isRequired,
children: PropTypes.node.isRequired,
dispatch: PropTypes.func.isRequired,
}
export default injectIntl(connect()(ListsPage))