Skip to content

Commit

Permalink
Limit displayed fields to 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Gargron committed Jun 18, 2024
1 parent 6e80bca commit 00e5522
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions app/javascript/mastodon/components/account_fields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import type { Account } from 'mastodon/models/account';

export const AccountFields: React.FC<{
fields: Account['fields'];
}> = ({ fields }) => {
limit: number;
}> = ({ fields, limit = -1 }) => {
const ref = useLinks(fields);

if (fields.size === 0) {
Expand All @@ -16,7 +17,7 @@ export const AccountFields: React.FC<{

return (
<div className='account-fields' ref={ref}>
{fields.map((pair, i) => (
{fields.take(limit).map((pair, i) => (
<dl
key={i}
className={classNames({ verified: pair.get('verified_at') })}
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/mastodon/components/hover_card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export const HoverCard: React.FC = () => {
note={account.note_emojified}
className='hover-card__bio'
/>
<AccountFields fields={account.fields} />
<AccountFields fields={account.fields} limit={2} />
</div>

<div className='hover-card__number'>
Expand Down

0 comments on commit 00e5522

Please sign in to comment.