diff --git a/packages/nicolium/src/features/ui/components/action-button.tsx b/packages/nicolium/src/features/ui/components/action-button.tsx index 95fe4d3f2..32d313ed5 100644 --- a/packages/nicolium/src/features/ui/components/action-button.tsx +++ b/packages/nicolium/src/features/ui/components/action-button.tsx @@ -19,6 +19,7 @@ import { useUnfollowAccountMutation, } from '@/queries/accounts/use-relationship'; import { useModalsActions } from '@/stores/modals'; +import { useSettings } from '@/stores/settings'; import toast from '@/toast'; import type { Account } from 'pl-api'; @@ -26,6 +27,7 @@ import type { Account } from 'pl-api'; const messages = defineMessages({ userBit: { id: 'account.bite.success', defaultMessage: 'You have bit @{acct}' }, userBiteFail: { id: 'account.bite.fail', defaultMessage: 'Failed to bite @{acct}' }, + unfollowConfirm: { id: 'confirmations.unfollow.confirm', defaultMessage: 'Unfollow' }, }); interface IActionButton { @@ -46,6 +48,7 @@ const ActionButton: React.FC = ({ account, actionType, small = tr const features = useFeatures(); const intl = useIntl(); const client = useClient(); + const settings = useSettings(); const { openModal } = useModalsActions(); const { isLoggedIn, me } = useLoggedIn(); @@ -67,7 +70,30 @@ const ActionButton: React.FC = ({ account, actionType, small = tr const handleFollow = () => { if (relationship?.following || relationship?.requested) { - unfollowAccount(); + if (settings.unfollowModal) { + openModal('CONFIRM', { + heading: ( + @{account.acct} }} + /> + ), + message: ( + @{account.acct} }} + /> + ), + confirm: intl.formatMessage(messages.unfollowConfirm), + onConfirm: () => { + unfollowAccount(); + }, + }); + } else { + unfollowAccount(); + } } else { followAccount(undefined); } diff --git a/packages/nicolium/src/locales/en.json b/packages/nicolium/src/locales/en.json index d068e0815..4d431486a 100644 --- a/packages/nicolium/src/locales/en.json +++ b/packages/nicolium/src/locales/en.json @@ -795,6 +795,8 @@ "confirmations.scheduled_status_delete.heading": "Cancel scheduled post", "confirmations.scheduled_status_delete.message": "Are you sure you want to discard this scheduled post?", "confirmations.unfollow.confirm": "Unfollow", + "confirmations.unfollow.heading": "Unfollow {name}", + "confirmations.unfollow.message": "Are you sure you want to unfollow {name}?", "copy.success": "Copied to clipboard!", "crypto.lightning": "Lightning", "crypto_donate.explanation_box.message": "{siteTitle} accepts cryptocurrency donations. You may send a donation to any of the addresses below. Thank you for your support!",