Merge branch 'group-improvements' into 'develop'

Group improvements

See merge request soapbox-pub/soapbox!2525
This commit is contained in:
Chewbacca 2023-05-30 13:12:21 +00:00
commit 02479efc35
5 changed files with 24 additions and 18 deletions

View file

@ -1,5 +1,6 @@
import React from 'react';
import { FormattedMessage } from 'react-intl';
import { Link } from 'react-router-dom';
import { Text } from 'soapbox/components/ui';
import { Group } from 'soapbox/types/entities';
@ -11,17 +12,19 @@ interface IGroupMemberCount {
const GroupMemberCount = ({ group }: IGroupMemberCount) => {
return (
<Text theme='inherit' tag='span' size='sm' weight='medium' data-testid='group-member-count'>
{shortNumberFormat(group.members_count)}
{' '}
<FormattedMessage
id='groups.discover.search.results.member_count'
defaultMessage='{members, plural, one {member} other {members}}'
values={{
members: group.members_count,
}}
/>
</Text>
<Link to={`/group/${group.slug}/members`} className='hover:underline'>
<Text theme='inherit' tag='span' size='sm' weight='medium' data-testid='group-member-count'>
{shortNumberFormat(group.members_count)}
{' '}
<FormattedMessage
id='groups.discover.search.results.member_count'
defaultMessage='{members, plural, one {member} other {members}}'
values={{
members: group.members_count,
}}
/>
</Text>
</Link>
);
};

View file

@ -22,17 +22,18 @@ const GroupListItem = (props: IGroup) => {
justifyContent='between'
data-testid='group-list-item'
>
<Link key={group.id} to={`/group/${group.slug}`}>
<Link key={group.id} to={`/group/${group.slug}`} className='overflow-hidden'>
<HStack alignItems='center' space={2}>
<GroupAvatar
group={group}
size={44}
/>
<Stack>
<Stack className='overflow-hidden'>
<Text
weight='bold'
dangerouslySetInnerHTML={{ __html: group.display_name_html }}
truncate
/>
<HStack className='text-gray-700 dark:text-gray-600' space={1} alignItems='center'>

View file

@ -4,7 +4,7 @@ import { HStack, Stack, Text } from 'soapbox/components/ui';
import { generateText, randomIntFromInterval } from '../utils';
export default () => {
export default ({ withJoinAction = true }: { withJoinAction?: boolean }) => {
const groupNameLength = randomIntFromInterval(12, 20);
return (
@ -13,7 +13,7 @@ export default () => {
justifyContent='between'
className='animate-pulse'
>
<HStack alignItems='center' space={2}>
<HStack alignItems='center' space={2} className='overflow-hidden'>
{/* Group Avatar */}
<div className='h-11 w-11 rounded-full bg-gray-500 dark:bg-gray-700 dark:ring-primary-900' />
@ -37,7 +37,9 @@ export default () => {
</HStack>
{/* Join Group Button */}
<div className='h-10 w-36 rounded-full bg-gray-300 dark:bg-gray-800' />
{withJoinAction && (
<div className='h-10 w-36 rounded-full bg-gray-300 dark:bg-gray-800' />
)}
</HStack>
);
};

View file

@ -19,7 +19,7 @@ const MyGroupsPanel = () => {
>
{isFetching ? (
new Array(3).fill(0).map((_, idx) => (
<PlaceholderGroupSearch key={idx} />
<PlaceholderGroupSearch key={idx} withJoinAction={false} />
))
) : (
groups.slice(0, 3).map((group) => (

View file

@ -19,7 +19,7 @@ const SuggestedGroupsPanel = () => {
>
{isFetching ? (
new Array(3).fill(0).map((_, idx) => (
<PlaceholderGroupSearch key={idx} />
<PlaceholderGroupSearch key={idx} withJoinAction={false} />
))
) : (
groups.slice(0, 3).map((group) => (