2019-08-07 06:02:36 +01:00
|
|
|
import { Fragment } from 'react';
|
2019-07-15 14:47:05 +01:00
|
|
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
|
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
2020-01-29 21:53:33 +00:00
|
|
|
import { fetchGroup } from '../actions/groups';
|
2019-07-15 14:47:05 +01:00
|
|
|
import HeaderContainer from '../features/groups/timeline/containers/header_container';
|
|
|
|
import GroupPanel from '../features/groups/timeline/components/panel';
|
2020-02-22 23:26:23 +00:00
|
|
|
// import GroupSidebarPanel from '../features/groups/sidebar_panel';
|
2020-02-24 21:56:07 +00:00
|
|
|
import DefaultLayout from '../layouts/default_layout';
|
2020-01-29 21:53:33 +00:00
|
|
|
import { WhoToFollowPanel } from '../components/panel';
|
|
|
|
import LinkFooter from '../components/link_footer';
|
2019-07-15 14:47:05 +01:00
|
|
|
|
|
|
|
const mapStateToProps = (state, { params: { id } }) => ({
|
|
|
|
group: state.getIn(['groups', id]),
|
|
|
|
relationships: state.getIn(['group_relationships', id]),
|
|
|
|
});
|
|
|
|
|
2020-02-25 16:04:44 +00:00
|
|
|
export default
|
|
|
|
@connect(mapStateToProps)
|
2019-07-15 14:47:05 +01:00
|
|
|
class GroupPage extends ImmutablePureComponent {
|
|
|
|
|
2019-08-07 06:02:36 +01:00
|
|
|
static propTypes = {
|
|
|
|
group: ImmutablePropTypes.map,
|
2019-07-15 14:47:05 +01:00
|
|
|
relationships: ImmutablePropTypes.map,
|
|
|
|
dispatch: PropTypes.func.isRequired,
|
|
|
|
};
|
2019-08-07 06:02:36 +01:00
|
|
|
|
2019-07-15 14:47:05 +01:00
|
|
|
componentWillMount() {
|
|
|
|
const { params: { id }, dispatch } = this.props;
|
|
|
|
|
|
|
|
dispatch(fetchGroup(id));
|
|
|
|
}
|
|
|
|
|
|
|
|
render () {
|
|
|
|
const { children, group, relationships } = this.props;
|
2019-08-07 06:02:36 +01:00
|
|
|
const top = group ? <HeaderContainer groupId={group.get('id')} /> : null;
|
2019-07-15 14:47:05 +01:00
|
|
|
|
|
|
|
return (
|
2020-02-17 17:50:29 +00:00
|
|
|
<DefaultLayout
|
2019-08-07 06:02:36 +01:00
|
|
|
layout={{
|
2019-08-09 17:06:27 +01:00
|
|
|
TOP: top,
|
|
|
|
RIGHT: (
|
2019-08-07 06:02:36 +01:00
|
|
|
<Fragment>
|
|
|
|
<WhoToFollowPanel />
|
|
|
|
</Fragment>
|
|
|
|
),
|
2019-08-09 17:06:27 +01:00
|
|
|
LEFT: (
|
2019-08-07 06:02:36 +01:00
|
|
|
<Fragment>
|
|
|
|
{group && relationships &&
|
|
|
|
<GroupPanel
|
|
|
|
group={group}
|
|
|
|
relationships={relationships}
|
|
|
|
/>}
|
|
|
|
<LinkFooter />
|
|
|
|
</Fragment>
|
|
|
|
)
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{children}
|
2020-02-17 17:50:29 +00:00
|
|
|
</DefaultLayout>
|
2019-07-15 14:47:05 +01:00
|
|
|
)
|
|
|
|
}
|
2019-08-07 06:02:36 +01:00
|
|
|
}
|