mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-22 12:58:06 +01:00
[Glitch] Add fallback to domain block confirmation modal
Port 7a62d57427
to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
7b290cee47
commit
8439084587
1 changed files with 35 additions and 16 deletions
|
@ -30,9 +30,9 @@ export const DomainBlockModal: React.FC<{
|
||||||
}> = ({ domain, accountId, acct }) => {
|
}> = ({ domain, accountId, acct }) => {
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [preview, setPreview] = useState<DomainBlockPreviewResponse | null>(
|
const [preview, setPreview] = useState<
|
||||||
null,
|
DomainBlockPreviewResponse | 'error' | null
|
||||||
);
|
>(null);
|
||||||
|
|
||||||
const handleClick = useCallback(() => {
|
const handleClick = useCallback(() => {
|
||||||
if (loading) {
|
if (loading) {
|
||||||
|
@ -65,6 +65,7 @@ export const DomainBlockModal: React.FC<{
|
||||||
return '';
|
return '';
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
|
setPreview('error');
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
});
|
});
|
||||||
}, [setPreview, setLoading, domain]);
|
}, [setPreview, setLoading, domain]);
|
||||||
|
@ -89,7 +90,35 @@ export const DomainBlockModal: React.FC<{
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className='safety-action-modal__bullet-points'>
|
<div className='safety-action-modal__bullet-points'>
|
||||||
{preview && preview.followers_count + preview.following_count > 0 && (
|
{preview &&
|
||||||
|
preview !== 'error' &&
|
||||||
|
preview.followers_count + preview.following_count > 0 && (
|
||||||
|
<div>
|
||||||
|
<div className='safety-action-modal__bullet-points__icon'>
|
||||||
|
<Icon id='' icon={PersonRemoveIcon} />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<strong>
|
||||||
|
<FormattedMessage
|
||||||
|
id='domain_block_modal.you_will_lose_num_followers'
|
||||||
|
defaultMessage='You will lose {followersCount, plural, one {{followersCountDisplay} follower} other {{followersCountDisplay} followers}} and {followingCount, plural, one {{followingCountDisplay} person you follow} other {{followingCountDisplay} people you follow}}.'
|
||||||
|
values={{
|
||||||
|
followersCount: preview.followers_count,
|
||||||
|
followersCountDisplay: (
|
||||||
|
<ShortNumber value={preview.followers_count} />
|
||||||
|
),
|
||||||
|
followingCount: preview.following_count,
|
||||||
|
followingCountDisplay: (
|
||||||
|
<ShortNumber value={preview.following_count} />
|
||||||
|
),
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</strong>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{preview === 'error' && (
|
||||||
<div>
|
<div>
|
||||||
<div className='safety-action-modal__bullet-points__icon'>
|
<div className='safety-action-modal__bullet-points__icon'>
|
||||||
<Icon id='' icon={PersonRemoveIcon} />
|
<Icon id='' icon={PersonRemoveIcon} />
|
||||||
|
@ -97,18 +126,8 @@ export const DomainBlockModal: React.FC<{
|
||||||
<div>
|
<div>
|
||||||
<strong>
|
<strong>
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='domain_block_modal.you_will_lose_num_followers'
|
id='domain_block_modal.you_will_lose_relationships'
|
||||||
defaultMessage='You will lose {followersCount, plural, one {{followersCountDisplay} follower} other {{followersCountDisplay} followers}} and {followingCount, plural, one {{followingCountDisplay} person you follow} other {{followingCountDisplay} people you follow}}.'
|
defaultMessage='You will lose all followers and people you follow from this server.'
|
||||||
values={{
|
|
||||||
followersCount: preview.followers_count,
|
|
||||||
followersCountDisplay: (
|
|
||||||
<ShortNumber value={preview.followers_count} />
|
|
||||||
),
|
|
||||||
followingCount: preview.following_count,
|
|
||||||
followingCountDisplay: (
|
|
||||||
<ShortNumber value={preview.following_count} />
|
|
||||||
),
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
</strong>
|
</strong>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue