refactor: Remove duplicated AvatarGroup
CSS and familiar followers cleanup (#34681)
This commit is contained in:
parent
d475bcce65
commit
ccffa11f2b
10 changed files with 110 additions and 100 deletions
|
@ -5,16 +5,21 @@ import { FormattedMessage } from 'react-intl';
|
|||
import { Link } from 'react-router-dom';
|
||||
|
||||
import { fetchAccountsFamiliarFollowers } from '@/mastodon/actions/accounts_familiar_followers';
|
||||
import { Avatar } from '@/mastodon/components/avatar';
|
||||
import { AvatarGroup } from '@/mastodon/components/avatar_group';
|
||||
import type { Account } from '@/mastodon/models/account';
|
||||
import { getAccountFamiliarFollowers } from '@/mastodon/selectors/accounts';
|
||||
import { useAppDispatch, useAppSelector } from '@/mastodon/store';
|
||||
|
||||
const AccountLink: React.FC<{ account?: Account }> = ({ account }) => (
|
||||
<Link to={`/@${account?.username}`} data-hover-card-account={account?.id}>
|
||||
{account?.display_name}
|
||||
</Link>
|
||||
);
|
||||
const AccountLink: React.FC<{ account?: Account }> = ({ account }) => {
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
||||
const name = account?.display_name || `@${account?.acct}`;
|
||||
return (
|
||||
<Link to={`/@${account?.acct}`} data-hover-card-account={account?.id}>
|
||||
{name}
|
||||
</Link>
|
||||
);
|
||||
};
|
||||
|
||||
const FamiliarFollowersReadout: React.FC<{ familiarFollowers: Account[] }> = ({
|
||||
familiarFollowers,
|
||||
|
@ -74,10 +79,11 @@ export const FamiliarFollowers: React.FC<{ accountId: string }> = ({
|
|||
|
||||
return (
|
||||
<div className='account__header__familiar-followers'>
|
||||
<AvatarGroup
|
||||
compact
|
||||
accountIds={familiarFollowers.slice(0, 3).map((account) => account.id)}
|
||||
/>
|
||||
<AvatarGroup compact>
|
||||
{familiarFollowers.map((account) => (
|
||||
<Avatar withLink key={account.id} account={account} size={28} />
|
||||
))}
|
||||
</AvatarGroup>
|
||||
<FamiliarFollowersReadout familiarFollowers={familiarFollowers} />
|
||||
</div>
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue