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

59 lines
1.4 KiB
JavaScript
Raw Normal View History

import React from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
import { defineMessages, injectIntl } from 'react-intl'
2020-03-25 03:08:43 +00:00
import { openModal } from '../actions/modal'
import { MODAL_EDIT_SHORTCUTS } from '../constants'
import PageTitle from '../features/ui/util/page_title'
2020-03-25 03:08:43 +00:00
import DefaultLayout from '../layouts/default_layout'
import {
LinkFooter,
TrendsPanel,
WhoToFollowPanel,
} from '../features/ui/util/async_components'
2020-03-25 03:08:43 +00:00
class ShortcutsPage extends React.PureComponent {
2020-03-25 03:08:43 +00:00
handleOnOpenEditShortcutsModal = () => {
this.props.dispatch(openModal(MODAL_EDIT_SHORTCUTS))
}
2020-03-25 03:08:43 +00:00
render() {
const { intl, children } = this.props
const title = intl.formatMessage(messages.shortcuts)
2020-03-25 03:08:43 +00:00
return (
<DefaultLayout
title={title}
page='shortcuts'
actions={[
{
icon: 'cog',
onClick: this.handleOnOpenEditShortcutsModal,
},
]}
layout={[
TrendsPanel,
WhoToFollowPanel,
LinkFooter,
]}
2020-03-25 03:08:43 +00:00
>
<PageTitle path={title} />
2020-03-25 03:08:43 +00:00
{children}
</DefaultLayout>
)
}
}
const messages = defineMessages({
shortcuts: { id: 'shortcuts', defaultMessage: 'Shortcuts' },
})
ShortcutsPage.propTypes = {
children: PropTypes.node.isRequired,
dispatch: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
}
export default injectIntl(connect()(ShortcutsPage))