From 09dfc9edf820396ba0132e89ed6d98c2a4231d5d Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 5 Jul 2024 20:17:47 +0100 Subject: Show feedback for Follow button in interstitials (#4738) * Fix Follow in interstitials * Show feedback in toast --- src/components/ProfileCard.tsx | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'src/components/ProfileCard.tsx') diff --git a/src/components/ProfileCard.tsx b/src/components/ProfileCard.tsx index 77016d4fe..79f1108cb 100644 --- a/src/components/ProfileCard.tsx +++ b/src/components/ProfileCard.tsx @@ -62,7 +62,11 @@ export function Card({
- +
@@ -273,11 +278,13 @@ export function FollowButton(props: FollowButtonProps) { export function FollowButtonInner({ profile: profileUnshadowed, + moderationOpts, logContext, ...rest }: FollowButtonProps) { const {_} = useLingui() const profile = useProfileShadow(profileUnshadowed) + const moderation = moderateProfile(profile, moderationOpts) const [queueFollow, queueUnfollow] = useProfileFollowMutationQueue( profile, logContext, @@ -289,6 +296,14 @@ export function FollowButtonInner({ e.stopPropagation() try { await queueFollow() + Toast.show( + _( + msg`Following ${sanitizeDisplayName( + profile.displayName || profile.handle, + moderation.ui('displayName'), + )}`, + ), + ) } catch (e: any) { if (e?.name !== 'AbortError') { Toast.show(_(msg`An issue occurred, please try again.`)) @@ -301,6 +316,14 @@ export function FollowButtonInner({ e.stopPropagation() try { await queueUnfollow() + Toast.show( + _( + msg`No longer following ${sanitizeDisplayName( + profile.displayName || profile.handle, + moderation.ui('displayName'), + )}`, + ), + ) } catch (e: any) { if (e?.name !== 'AbortError') { Toast.show(_(msg`An issue occurred, please try again.`)) -- cgit 1.4.1