Profile redesign: Simplify header for follower/following lists (#38366)
This commit is contained in:
6 files changed
+85
-5
No files matched your search
@@ -0,0 +1,36 @@
|
||||
import type { FC } from 'react';
|
||||
|
||||
import { FormattedMessage, useIntl } from 'react-intl';
|
||||
import type { MessageDescriptor } from 'react-intl';
|
||||
|
||||
import { DisplayNameSimple } from '@/mastodon/components/display_name/simple';
|
||||
import { useAccount } from '@/mastodon/hooks/useAccount';
|
||||
|
||||
import classes from '../styles.module.scss';
|
||||
|
||||
export const AccountListHeader: FC<{
|
||||
accountId: string;
|
||||
total?: number;
|
||||
titleText: MessageDescriptor;
|
||||
}> = ({ accountId, total, titleText }) => {
|
||||
const intl = useIntl();
|
||||
const account = useAccount(accountId);
|
||||
return (
|
||||
<>
|
||||
<h1 className={classes.title}>
|
||||
{intl.formatMessage(titleText, {
|
||||
name: <DisplayNameSimple account={account} />,
|
||||
})}
|
||||
</h1>
|
||||
{!!total && (
|
||||
<h2 className={classes.subtitle}>
|
||||
<FormattedMessage
|
||||
id='account_list.total'
|
||||
defaultMessage='{total, plural, one {# account} other {# accounts}}'
|
||||
values={{ total }}
|
||||
/>
|
||||
</h2>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
@@ -11,8 +11,6 @@ import { useAccount } from '@/mastodon/hooks/useAccount';
|
||||
import { useAccountVisibility } from '@/mastodon/hooks/useAccountVisibility';
|
||||
import { useLayout } from '@/mastodon/hooks/useLayout';
|
||||
|
||||
import { AccountHeader } from '../../account_timeline/components/account_header';
|
||||
|
||||
import { RemoteHint } from './remote';
|
||||
|
||||
export interface AccountList {
|
||||
@@ -25,6 +23,7 @@ interface AccountListProps {
|
||||
accountId?: string | null;
|
||||
append?: ReactNode;
|
||||
emptyMessage: ReactNode;
|
||||
header?: ReactNode;
|
||||
footer?: ReactNode;
|
||||
list?: AccountList | null;
|
||||
loadMore: () => void;
|
||||
@@ -36,6 +35,7 @@ export const AccountList: FC<AccountListProps> = ({
|
||||
accountId,
|
||||
append,
|
||||
emptyMessage,
|
||||
header,
|
||||
footer,
|
||||
list,
|
||||
loadMore,
|
||||
@@ -90,7 +90,7 @@ export const AccountList: FC<AccountListProps> = ({
|
||||
hasMore={!forceEmptyState && list?.hasMore}
|
||||
isLoading={list?.isLoading ?? true}
|
||||
onLoadMore={loadMore}
|
||||
prepend={<AccountHeader accountId={accountId} hideTabs />}
|
||||
prepend={header}
|
||||
alwaysPrepend
|
||||
append={append ?? <RemoteHint domain={domain} url={account.url} />}
|
||||
emptyMessage={emptyMessage}
|
||||
|
||||
Reference in new issue
Block a user