Echo 4f319747c5 [Glitch] Profile editing: Control follower/following list visibility
Port c270634565a3dcf311857bfac6d59c27ac67e9be to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2026-04-30 20:11:22 +02:00

71 lines
2.3 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import type { FC } from 'react';
import { FormattedMessage, useIntl } from 'react-intl';
import type { MessageDescriptor } from 'react-intl';
import { Link } from 'react-router-dom';
import { Callout } from '@/flavours/glitch/components/callout';
import { DisplayNameSimple } from '@/flavours/glitch/components/display_name/simple';
import { useAccount } from '@/flavours/glitch/hooks/useAccount';
import { useCurrentAccountId } from '@/flavours/glitch/hooks/useAccountId';
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);
const currentId = useCurrentAccountId();
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>
)}
{accountId === currentId && account?.hide_collections && (
<Callout className={classes.callout}>
<FormattedMessage
id='account_list.hidden_notice'
defaultMessage='This is only visible to you. To show this list to others, go to <link>{page} > {modal} > {field}</link>.'
values={{
link: (chunks) => <Link to='/profile/edit'>{chunks}</Link>,
page: (
<FormattedMessage
id='account.edit_profile'
defaultMessage='Edit profile'
/>
),
modal: (
<FormattedMessage
id='account_edit.profile_tab.title'
defaultMessage='Profile display settings'
/>
),
field: (
<FormattedMessage
id='account_edit.profile_tab.show_relations.title'
defaultMessage='Show Followers and Following'
/>
),
}}
/>
</Callout>
)}
</>
);
};