Updated Explore, Group, Groups Pages

• Updated:
- Explore, Group, Groups Pages
This commit is contained in:
mgabdev 2020-08-06 00:13:19 -05:00
parent 2d44027cef
commit 0a26abbbc2
3 changed files with 36 additions and 57 deletions
app/javascript/gabsocial/pages

@ -1,10 +1,5 @@
import PageTitle from '../features/ui/util/page_title' import PageTitle from '../features/ui/util/page_title'
import DefaultLayout from '../layouts/default_layout' import ExploreLayout from '../layouts/explore_layout'
import ProgressPanel from '../components/panel/progress_panel'
import VerifiedAccountsPanel from '../components/panel/verified_accounts_panel'
import ShopPanel from '../components/panel/shop_panel'
import SignupPanel from '../components/panel/sign_up_panel'
import LinkFooter from '../components/link_footer'
export default class ExplorePage extends PureComponent { export default class ExplorePage extends PureComponent {
@ -17,22 +12,13 @@ export default class ExplorePage extends PureComponent {
const { children, title } = this.props const { children, title } = this.props
return ( return (
<DefaultLayout <ExploreLayout
page='explore' page='explore'
title={title} title={title}
noComposeButton
showBackBtn
layout={[
<SignupPanel key='explore-page-signup-panel' />,
<ProgressPanel key='explore-page-progress-panel' />,
<VerifiedAccountsPanel key='explore-page-verified-panel' />,
<ShopPanel key='explore-page-shop-panel' />,
<LinkFooter key='explore-page-link-footer' />,
]}
> >
<PageTitle path={title} /> <PageTitle path={title} />
{children} {children}
</DefaultLayout> </ExploreLayout>
) )
} }

@ -7,6 +7,7 @@ import PageTitle from '../features/ui/util/page_title'
import GroupLayout from '../layouts/group_layout' import GroupLayout from '../layouts/group_layout'
import TimelineComposeBlock from '../components/timeline_compose_block' import TimelineComposeBlock from '../components/timeline_compose_block'
import Divider from '../components/divider' import Divider from '../components/divider'
import GroupSortBlock from '../components/group_sort_block'
const messages = defineMessages({ const messages = defineMessages({
group: { id: 'group', defaultMessage: 'Group' }, group: { id: 'group', defaultMessage: 'Group' },
@ -20,7 +21,7 @@ const mapStateToProps = (state, { params: { id } }) => ({
const mapDispatchToProps = (dispatch) => ({ const mapDispatchToProps = (dispatch) => ({
onFetchGroup(groupId) { onFetchGroup(groupId) {
dispatch(fetchGroup(groupId)) dispatch(fetchGroup(groupId))
} },
}) })
export default export default
@ -34,10 +35,13 @@ class GroupPage extends ImmutablePureComponent {
children: PropTypes.node.isRequired, children: PropTypes.node.isRequired,
relationships: ImmutablePropTypes.map, relationships: ImmutablePropTypes.map,
onFetchGroup: PropTypes.func.isRequired, onFetchGroup: PropTypes.func.isRequired,
sortByValue: PropTypes.string.isRequired,
sortByTopValue: PropTypes.string.isRequired,
} }
componentDidMount() { componentDidMount() {
this.props.onFetchGroup(this.props.params.id) this.props.onFetchGroup(this.props.params.id)
// this.props.onFetchGroup(this.props.params.slug)
} }
render() { render() {
@ -46,29 +50,35 @@ class GroupPage extends ImmutablePureComponent {
children, children,
group, group,
relationships, relationships,
isTimeline,
} = this.props } = this.props
const groupTitle = !!group ? group.get('title') : '' const groupTitle = !!group ? group.get('title') : ''
const groupId = !!group ? group.get('id') : undefined const groupId = !!group ? group.get('id') : undefined
return ( return (
<GroupLayout <GroupLayout
showBackBtn showBackBtn
title={groupTitle} title={'Group'}
group={group} group={group}
groupId={groupId} groupId={groupId}
relationships={relationships} relationships={relationships}
isTimeline={isTimeline}
> >
<PageTitle path={[groupTitle, intl.formatMessage(messages.group)]} /> <PageTitle path={[groupTitle, intl.formatMessage(messages.group)]} />
{ {
!!relationships && relationships.get('member') && !!relationships && isTimeline && relationships.get('member') &&
<Fragment> <Fragment>
<TimelineComposeBlock size={46} groupId={groupId} autoFocus /> <TimelineComposeBlock size={46} groupId={groupId} autoFocus />
<Divider /> <Divider />
</Fragment> </Fragment>
} }
{
isTimeline && <GroupSortBlock />
}
{children} {children}
</GroupLayout> </GroupLayout>
) )

@ -1,20 +1,15 @@
import { me } from '../initial_state' import { me } from '../initial_state'
import { defineMessages, injectIntl } from 'react-intl' import { defineMessages, injectIntl } from 'react-intl'
import { openModal } from '../actions/modal'
import {
MODAL_GROUP_CREATE,
MODAL_PRO_UPGRADE,
} from '../constants'
import PageTitle from '../features/ui/util/page_title' import PageTitle from '../features/ui/util/page_title'
import LinkFooter from '../components/link_footer' import LinkFooter from '../components/link_footer'
import GroupsPanel from '../components/panel/groups_panel' import GroupsPanel from '../components/panel/groups_panel'
import WhoToFollowPanel from '../components/panel/who_to_follow_panel'
import DefaultLayout from '../layouts/default_layout' import DefaultLayout from '../layouts/default_layout'
const messages = defineMessages({ const messages = defineMessages({
groups: { id: 'groups', defaultMessage: 'Groups' }, groups: { id: 'groups', defaultMessage: 'Groups' },
featured: { id: 'featured', defaultMessage: 'Featured' }, new: { id: 'new', defaultMessage: 'Recently Added Groups' },
new: { id: 'new', defaultMessage: 'Just Added' }, featured: { id: 'featured', defaultMessage: 'Featured Groups' },
myGroupsTimeline: { id: 'my_groups_timeline', defaultMessage: 'Timeline' },
myGroups: { id: 'my_groups', defaultMessage: 'My Groups' }, myGroups: { id: 'my_groups', defaultMessage: 'My Groups' },
admin: { id: 'admin', defaultMessage: 'Admin' }, admin: { id: 'admin', defaultMessage: 'Admin' },
}) })
@ -23,30 +18,15 @@ const mapStateToProps = (state) => ({
isPro: state.getIn(['accounts', me, 'is_pro']), isPro: state.getIn(['accounts', me, 'is_pro']),
}) })
const mapDispatchToProps = (dispatch) => ({
onOpenGroupCreateModal(isPro) {
if (!isPro) {
dispatch(openModal(MODAL_PRO_UPGRADE))
} else {
dispatch(openModal(MODAL_GROUP_CREATE))
}
},
})
export default export default
@injectIntl @injectIntl
@connect(mapStateToProps, mapDispatchToProps) @connect(mapStateToProps)
class GroupsPage extends PureComponent { class GroupsPage extends PureComponent {
static propTypes = { static propTypes = {
intl: PropTypes.object.isRequired, intl: PropTypes.object.isRequired,
children: PropTypes.node.isRequired, children: PropTypes.node.isRequired,
isPro: PropTypes.bool, isPro: PropTypes.bool,
onOpenGroupCreateModal: PropTypes.func.isRequired,
}
handleOnOpenGroupCreateModal = () => {
this.props.onOpenGroupCreateModal(this.props.isPro)
} }
render() { render() {
@ -54,28 +34,32 @@ class GroupsPage extends PureComponent {
intl, intl,
children, children,
isPro, isPro,
onOpenGroupCreateModal,
} = this.props } = this.props
const actions = [ const actions = isPro ? [
{ {
icon: 'add', icon: 'add',
onClick: this.handleOnOpenGroupCreateModal, to: '/groups/create',
}, },
] ] : []
const tabs = !!me ? [ const tabs = !!me ? [
{ {
title: intl.formatMessage(messages.featured), title: intl.formatMessage(messages.myGroupsTimeline),
to: '/groups', to: '/groups',
}, },
{
title: intl.formatMessage(messages.new),
to: '/groups/new',
},
{ {
title: intl.formatMessage(messages.myGroups), title: intl.formatMessage(messages.myGroups),
to: '/groups/browse/member', to: '/groups/browse/member',
}, },
{
title: intl.formatMessage(messages.featured),
to: '/groups/browse/featured',
},
{
title: intl.formatMessage(messages.new),
to: '/groups/browse/new',
},
] : [] ] : []
if (isPro) { if (isPro) {
@ -94,8 +78,7 @@ class GroupsPage extends PureComponent {
tabs={tabs} tabs={tabs}
page='groups' page='groups'
layout={[ layout={[
<WhoToFollowPanel key='groups-page-wtf-panel' />, <GroupsPanel key='groups-page-groups-panel' groupType='member' />,
<GroupsPanel slim key='groups-page-groups-panel' />,
<LinkFooter key='groups-page-link-footer' />, <LinkFooter key='groups-page-link-footer' />,
]} ]}
> >
@ -105,4 +88,4 @@ class GroupsPage extends PureComponent {
) )
} }
} }