mirror of
https://github.com/glitch-soc/mastodon.git
synced 2026-03-29 03:00:33 +02:00
Profile redesign: Adjust account number fields to be stacked (#38283)
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import { useMemo } from 'react';
|
||||||
import type { FC } from 'react';
|
import type { FC } from 'react';
|
||||||
|
|
||||||
import { FormattedMessage, useIntl } from 'react-intl';
|
import { FormattedMessage, useIntl } from 'react-intl';
|
||||||
@@ -18,9 +19,7 @@ import { isRedesignEnabled } from '../common';
|
|||||||
|
|
||||||
import classes from './redesign.module.scss';
|
import classes from './redesign.module.scss';
|
||||||
|
|
||||||
export const AccountNumberFields: FC<{ accountId: string }> = ({
|
const LegacyNumberFields: FC<{ accountId: string }> = ({ accountId }) => {
|
||||||
accountId,
|
|
||||||
}) => {
|
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const account = useAccount(accountId);
|
const account = useAccount(accountId);
|
||||||
|
|
||||||
@@ -29,23 +28,16 @@ export const AccountNumberFields: FC<{ accountId: string }> = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div className='account__header__extra__links'>
|
||||||
className={classNames(
|
<NavLink
|
||||||
'account__header__extra__links',
|
to={`/@${account.acct}`}
|
||||||
isRedesignEnabled() && classes.fieldNumbersWrapper,
|
title={intl.formatNumber(account.statuses_count)}
|
||||||
)}
|
>
|
||||||
>
|
<ShortNumber
|
||||||
{!isRedesignEnabled() && (
|
value={account.statuses_count}
|
||||||
<NavLink
|
renderer={StatusesCounter}
|
||||||
to={`/@${account.acct}`}
|
/>
|
||||||
title={intl.formatNumber(account.statuses_count)}
|
</NavLink>
|
||||||
>
|
|
||||||
<ShortNumber
|
|
||||||
value={account.statuses_count}
|
|
||||||
renderer={StatusesCounter}
|
|
||||||
/>
|
|
||||||
</NavLink>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<NavLink
|
<NavLink
|
||||||
exact
|
exact
|
||||||
@@ -68,25 +60,80 @@ export const AccountNumberFields: FC<{ accountId: string }> = ({
|
|||||||
renderer={FollowersCounter}
|
renderer={FollowersCounter}
|
||||||
/>
|
/>
|
||||||
</NavLink>
|
</NavLink>
|
||||||
|
|
||||||
{isRedesignEnabled() && (
|
|
||||||
<FormattedMessage
|
|
||||||
id='account.joined_long'
|
|
||||||
defaultMessage='Joined on {date}'
|
|
||||||
values={{
|
|
||||||
date: (
|
|
||||||
<strong>
|
|
||||||
<FormattedDateWrapper
|
|
||||||
value={account.created_at}
|
|
||||||
year='numeric'
|
|
||||||
month='short'
|
|
||||||
day='2-digit'
|
|
||||||
/>
|
|
||||||
</strong>
|
|
||||||
),
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const RedesignNumberFields: FC<{ accountId: string }> = ({ accountId }) => {
|
||||||
|
const intl = useIntl();
|
||||||
|
const account = useAccount(accountId);
|
||||||
|
const createdThisYear = useMemo(
|
||||||
|
() => account?.created_at.includes(new Date().getFullYear().toString()),
|
||||||
|
[account?.created_at],
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!account) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ul
|
||||||
|
className={classNames(
|
||||||
|
'account__header__extra__links',
|
||||||
|
classes.fieldNumbersWrapper,
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<li>
|
||||||
|
<FormattedMessage id='account.posts' defaultMessage='Posts' />
|
||||||
|
<strong>
|
||||||
|
<ShortNumber value={account.statuses_count} />
|
||||||
|
</strong>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<NavLink
|
||||||
|
exact
|
||||||
|
to={`/@${account.acct}/followers`}
|
||||||
|
title={intl.formatNumber(account.followers_count)}
|
||||||
|
>
|
||||||
|
<FormattedMessage id='account.followers' defaultMessage='Followers' />
|
||||||
|
<strong>
|
||||||
|
<ShortNumber value={account.followers_count} />
|
||||||
|
</strong>
|
||||||
|
</NavLink>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<NavLink
|
||||||
|
exact
|
||||||
|
to={`/@${account.acct}/following`}
|
||||||
|
title={intl.formatNumber(account.following_count)}
|
||||||
|
>
|
||||||
|
<FormattedMessage id='account.following' defaultMessage='Following' />
|
||||||
|
<strong>
|
||||||
|
<ShortNumber value={account.following_count} />
|
||||||
|
</strong>
|
||||||
|
</NavLink>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<FormattedMessage id='account.joined_short' defaultMessage='Joined' />
|
||||||
|
<strong>
|
||||||
|
{createdThisYear ? (
|
||||||
|
<FormattedDateWrapper
|
||||||
|
value={account.created_at}
|
||||||
|
month='short'
|
||||||
|
day='2-digit'
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<FormattedDateWrapper value={account.created_at} year='numeric' />
|
||||||
|
)}
|
||||||
|
</strong>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const AccountNumberFields = isRedesignEnabled()
|
||||||
|
? RedesignNumberFields
|
||||||
|
: LegacyNumberFields;
|
||||||
|
|||||||
@@ -308,16 +308,34 @@ svg.badgeIcon {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.fieldNumbersWrapper {
|
.fieldNumbersWrapper {
|
||||||
|
display: flex;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
margin: 8px 0;
|
||||||
|
gap: 20px;
|
||||||
|
|
||||||
|
li {
|
||||||
|
@container (width < 420px) {
|
||||||
|
flex: 1 1 0px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
|
color: inherit;
|
||||||
font-weight: unset;
|
font-weight: unset;
|
||||||
|
padding: 0;
|
||||||
|
|
||||||
|
&:hover,
|
||||||
|
&:focus {
|
||||||
|
color: var(--color-text-brand-soft);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
strong {
|
strong {
|
||||||
|
display: block;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: var(--color-text-primary);
|
color: var(--color-text-primary);
|
||||||
|
font-size: 15px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,6 @@
|
|||||||
"account.go_to_profile": "Go to profile",
|
"account.go_to_profile": "Go to profile",
|
||||||
"account.hide_reblogs": "Hide boosts from @{name}",
|
"account.hide_reblogs": "Hide boosts from @{name}",
|
||||||
"account.in_memoriam": "In Memoriam.",
|
"account.in_memoriam": "In Memoriam.",
|
||||||
"account.joined_long": "Joined on {date}",
|
|
||||||
"account.joined_short": "Joined",
|
"account.joined_short": "Joined",
|
||||||
"account.languages": "Change subscribed languages",
|
"account.languages": "Change subscribed languages",
|
||||||
"account.link_verified_on": "Ownership of this link was checked on {date}",
|
"account.link_verified_on": "Ownership of this link was checked on {date}",
|
||||||
|
|||||||
Reference in New Issue
Block a user