| 38 | } |
| 39 | |
| 40 | const buildFeedbackMessage = ( |
| 41 | { tags, blockSource }: HideFeedbackPayload, |
| 42 | source?: Source, |
| 43 | ): string => { |
| 44 | const sourceName = source?.name ?? 'this source'; |
| 45 | const tagCount = tags.length; |
| 46 | |
| 47 | if (blockSource && tagCount > 0) { |
| 48 | return tagCount === 1 |
| 49 | ? `Unfollowed ${sourceName} and blocked #${tags[0]}` |
| 50 | : `Unfollowed ${sourceName} and blocked ${tagCount} tags`; |
| 51 | } |
| 52 | |
| 53 | if (blockSource) { |
| 54 | return `You won't see posts from ${sourceName} anymore`; |
| 55 | } |
| 56 | |
| 57 | if (tagCount === 1) { |
| 58 | return `Blocked #${tags[0]}`; |
| 59 | } |
| 60 | |
| 61 | return `Blocked ${tagCount} tags`; |
| 62 | }; |
| 63 | |
| 64 | export const useHidePost = ({ |
| 65 | post, |