group sidebar panel improvements
This commit is contained in:
parent
61134fb645
commit
06e1c47ff4
@ -14,7 +14,7 @@ class Api::V1::GroupsController < Api::BaseController
|
|||||||
when 'featured'
|
when 'featured'
|
||||||
@groups = Group.where(is_featured: true).limit(25).all
|
@groups = Group.where(is_featured: true).limit(25).all
|
||||||
when 'member'
|
when 'member'
|
||||||
@groups = Group.joins(:group_accounts).where(is_archived: false, group_accounts: { account: current_account }).all
|
@groups = Group.joins(:group_accounts).where(is_archived: false, group_accounts: { account: current_account }).order('group_accounts.unread_count DESC, group_accounts.id DESC').all
|
||||||
when 'admin'
|
when 'admin'
|
||||||
@groups = Group.joins(:group_accounts).where(is_archived: false, group_accounts: { account: current_account, role: :admin }).all
|
@groups = Group.joins(:group_accounts).where(is_archived: false, group_accounts: { account: current_account, role: :admin }).all
|
||||||
end
|
end
|
||||||
|
@ -5,9 +5,11 @@ import { defineMessages, injectIntl } from 'react-intl';
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import Item from './item';
|
import Item from './item';
|
||||||
import Icon from 'gabsocial/components/icon';
|
import Icon from 'gabsocial/components/icon';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
title: { id: 'groups.sidebar-panel.title', defaultMessage: 'Groups you\'re in' },
|
title: { id: 'groups.sidebar-panel.title', defaultMessage: 'Groups you\'re in' },
|
||||||
|
show_all: { id: 'groups.sidebar-panel.show_all', defaultMessage: 'Show all' },
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapStateToProps = (state, { id }) => ({
|
const mapStateToProps = (state, { id }) => ({
|
||||||
@ -23,9 +25,10 @@ class GroupSidebarPanel extends ImmutablePureComponent {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { intl, groupIds } = this.props;
|
const { intl, groupIds } = this.props;
|
||||||
|
const count = groupIds.count();
|
||||||
|
|
||||||
// Only when there are groups to show
|
// Only when there are groups to show
|
||||||
if (groupIds.count() === 0) return null;
|
if (count === 0) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='wtf-panel group-sidebar-panel'>
|
<div className='wtf-panel group-sidebar-panel'>
|
||||||
@ -36,7 +39,8 @@ class GroupSidebarPanel extends ImmutablePureComponent {
|
|||||||
|
|
||||||
<div className='wtf-panel__content'>
|
<div className='wtf-panel__content'>
|
||||||
<div className="group-sidebar-panel__items">
|
<div className="group-sidebar-panel__items">
|
||||||
{groupIds.map(groupId => <Item key={groupId} id={groupId} />)}
|
{groupIds.slice(0, 10).map(groupId => <Item key={groupId} id={groupId} />)}
|
||||||
|
{count > 10 && <Link className="group-sidebar-panel__items__show-all" to='/groups/browse/member'>{intl.formatMessage(messages.show_all)}</Link>}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -7,7 +7,6 @@ import WhoToFollowPanel from '../features/ui/components/who_to_follow_panel';
|
|||||||
import LinkFooter from '../features/ui/components/link_footer';
|
import LinkFooter from '../features/ui/components/link_footer';
|
||||||
import PromoPanel from '../features/ui/components/promo_panel';
|
import PromoPanel from '../features/ui/components/promo_panel';
|
||||||
import UserPanel from '../features/ui/components/user_panel';
|
import UserPanel from '../features/ui/components/user_panel';
|
||||||
import GroupSidebarPanel from '../features/groups/sidebar_panel';
|
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => ({
|
||||||
account: state.getIn(['accounts', me]),
|
account: state.getIn(['accounts', me]),
|
||||||
@ -43,7 +42,6 @@ class GroupsPage extends ImmutablePureComponent {
|
|||||||
|
|
||||||
<div className='columns-area__panels__pane columns-area__panels__pane--right'>
|
<div className='columns-area__panels__pane columns-area__panels__pane--right'>
|
||||||
<div className='columns-area__panels__pane__inner'>
|
<div className='columns-area__panels__pane__inner'>
|
||||||
<GroupSidebarPanel />
|
|
||||||
<WhoToFollowPanel />
|
<WhoToFollowPanel />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
.group-sidebar-panel {
|
.group-sidebar-panel {
|
||||||
&__items {
|
&__items {
|
||||||
padding: 0 15px 15px;
|
padding: 0 15px 15px;
|
||||||
|
|
||||||
|
&__show-all {
|
||||||
|
color: $primary-text-color;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&__item {
|
&__item {
|
||||||
|
Loading…
Reference in New Issue
Block a user