Create codemod for updating Toast calls to v2 (#10045)
This commit is contained in:
@@ -18,7 +18,6 @@ import {
|
||||
useRemoveFeedMutation,
|
||||
} from '#/state/queries/preferences'
|
||||
import {useSession} from '#/state/session'
|
||||
import * as Toast from '#/view/com/util/Toast'
|
||||
import {UserAvatar} from '#/view/com/util/UserAvatar'
|
||||
import {atoms as a, select, useTheme} from '#/alf'
|
||||
import {
|
||||
@@ -33,6 +32,7 @@ import {Link as InternalLink, type LinkProps} from '#/components/Link'
|
||||
import {Loader} from '#/components/Loader'
|
||||
import * as Prompt from '#/components/Prompt'
|
||||
import {RichText, type RichTextProps} from '#/components/RichText'
|
||||
import * as Toast from '#/components/Toast'
|
||||
import {Text} from '#/components/Typography'
|
||||
import {useActiveLiveEventFeedUris} from '#/features/liveEvents/context'
|
||||
import type * as bsky from '#/types/bsky'
|
||||
@@ -313,7 +313,9 @@ function SaveButtonInner({
|
||||
Toast.show(l({message: 'Feeds updated!', context: 'toast'}))
|
||||
} catch (err: any) {
|
||||
logger.error(err, {message: `FeedCard: failed to update feeds`, pin})
|
||||
Toast.show(l`Failed to update feeds`, 'xmark')
|
||||
Toast.show(l`Failed to update feeds`, {
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
},
|
||||
[l, pin, saveFeeds, removeFeed, uri, savedFeedConfig, type],
|
||||
|
||||
@@ -56,7 +56,6 @@ import {
|
||||
} from '#/state/queries/threadgate'
|
||||
import {useRequireAuth, useSession} from '#/state/session'
|
||||
import {useMergedThreadgateHiddenReplies} from '#/state/threadgate-hidden-replies'
|
||||
import * as Toast from '#/view/com/util/Toast'
|
||||
import {useDialogControl} from '#/components/Dialog'
|
||||
import {useGlobalDialogsControlContext} from '#/components/dialogs/Context'
|
||||
import {
|
||||
@@ -93,6 +92,7 @@ import {
|
||||
useReportDialogControl,
|
||||
} from '#/components/moderation/ReportDialog'
|
||||
import * as Prompt from '#/components/Prompt'
|
||||
import * as Toast from '#/components/Toast'
|
||||
import {useAnalytics} from '#/analytics'
|
||||
import {IS_INTERNAL} from '#/env'
|
||||
import * as bsky from '#/types/bsky'
|
||||
@@ -216,7 +216,9 @@ let PostMenuItems = ({
|
||||
},
|
||||
e => {
|
||||
logger.error('Failed to delete post', {message: e})
|
||||
Toast.show(l`Failed to delete post, please try again`, 'xmark')
|
||||
Toast.show(l`Failed to delete post, please try again`, {
|
||||
type: 'error',
|
||||
})
|
||||
},
|
||||
)
|
||||
}
|
||||
@@ -246,7 +248,9 @@ let PostMenuItems = ({
|
||||
const e = err as Error
|
||||
if (e?.name !== 'AbortError') {
|
||||
logger.error('Failed to toggle thread mute', {message: e})
|
||||
Toast.show(l`Failed to toggle thread mute, please try again`, 'xmark')
|
||||
Toast.show(l`Failed to toggle thread mute, please try again`, {
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -265,7 +269,9 @@ let PostMenuItems = ({
|
||||
const str = richTextToString(richText, true)
|
||||
|
||||
void Clipboard.setStringAsync(str)
|
||||
Toast.show(l`Copied to clipboard`, 'clipboard-check')
|
||||
Toast.show(l`Copied to clipboard`, {
|
||||
type: 'success',
|
||||
})
|
||||
}
|
||||
|
||||
const onPressTranslate = () => {
|
||||
@@ -434,7 +440,9 @@ let PostMenuItems = ({
|
||||
const e = err as Error
|
||||
if (e?.name !== 'AbortError') {
|
||||
logger.error('Failed to block account', {message: e})
|
||||
Toast.show(l`There was an issue! ${e.toString()}`, 'xmark')
|
||||
Toast.show(l`There was an issue! ${e.toString()}`, {
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
} finally {
|
||||
ax.metric('postMenu:blockAccount', {
|
||||
@@ -455,7 +463,9 @@ let PostMenuItems = ({
|
||||
const e = err as Error
|
||||
if (e?.name !== 'AbortError') {
|
||||
logger.error('Failed to unmute account', {message: e})
|
||||
Toast.show(l`There was an issue! ${e.toString()}`, 'xmark')
|
||||
Toast.show(l`There was an issue! ${e.toString()}`, {
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
} finally {
|
||||
ax.metric('postMenu:unmuteAccount', {
|
||||
@@ -473,7 +483,9 @@ let PostMenuItems = ({
|
||||
const e = err as Error
|
||||
if (e?.name !== 'AbortError') {
|
||||
logger.error('Failed to mute account', {message: e})
|
||||
Toast.show(l`There was an issue! ${e.toString()}`, 'xmark')
|
||||
Toast.show(l`There was an issue! ${e.toString()}`, {
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
} finally {
|
||||
ax.metric('postMenu:muteAccount', {
|
||||
|
||||
@@ -12,7 +12,6 @@ import {shareText, shareUrl} from '#/lib/sharing'
|
||||
import {toShareUrl} from '#/lib/strings/url-helpers'
|
||||
import {useProfileShadow} from '#/state/cache/profile-shadow'
|
||||
import {useSession} from '#/state/session'
|
||||
import * as Toast from '#/view/com/util/Toast'
|
||||
import {atoms as a} from '#/alf'
|
||||
import {Admonition} from '#/components/Admonition'
|
||||
import {useDialogControl} from '#/components/Dialog'
|
||||
@@ -22,6 +21,7 @@ import {ChainLink_Stroke2_Corner0_Rounded as ChainLinkIcon} from '#/components/i
|
||||
import {Clipboard_Stroke2_Corner2_Rounded as ClipboardIcon} from '#/components/icons/Clipboard'
|
||||
import {PaperPlane_Stroke2_Corner0_Rounded as PaperPlaneIcon} from '#/components/icons/PaperPlane'
|
||||
import * as Menu from '#/components/Menu'
|
||||
import * as Toast from '#/components/Toast'
|
||||
import {useAgeAssurance} from '#/ageAssurance'
|
||||
import {useAnalytics} from '#/analytics'
|
||||
import {IS_IOS} from '#/env'
|
||||
@@ -71,7 +71,9 @@ let ShareMenuItems = ({
|
||||
} else {
|
||||
await ExpoClipboard.setStringAsync(url)
|
||||
}
|
||||
Toast.show(_(msg`Copied to clipboard`), 'clipboard-check')
|
||||
Toast.show(_(msg`Copied to clipboard`), {
|
||||
type: 'success',
|
||||
})
|
||||
onShareProp()
|
||||
}
|
||||
|
||||
|
||||
@@ -24,11 +24,11 @@ import {
|
||||
ProgressGuideAction,
|
||||
useProgressGuideControls,
|
||||
} from '#/state/shell/progress-guide'
|
||||
import * as Toast from '#/view/com/util/Toast'
|
||||
import {atoms as a, useBreakpoints} from '#/alf'
|
||||
import {Reply as Bubble} from '#/components/icons/Reply'
|
||||
import {useFormatPostStatCount} from '#/components/PostControls/util'
|
||||
import * as Skele from '#/components/Skeleton'
|
||||
import * as Toast from '#/components/Toast'
|
||||
import {useAnalytics} from '#/analytics'
|
||||
import {BookmarkButton} from './BookmarkButton'
|
||||
import {
|
||||
@@ -106,7 +106,9 @@ let PostControls = ({
|
||||
|
||||
const onPressToggleLike = async () => {
|
||||
if (isBlocked) {
|
||||
Toast.show(l`Cannot interact with a blocked user`, 'exclamation-circle')
|
||||
Toast.show(l`Cannot interact with a blocked user`, {
|
||||
type: 'warning',
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
@@ -135,7 +137,9 @@ let PostControls = ({
|
||||
|
||||
const onRepost = async () => {
|
||||
if (isBlocked) {
|
||||
Toast.show(l`Cannot interact with a blocked user`, 'exclamation-circle')
|
||||
Toast.show(l`Cannot interact with a blocked user`, {
|
||||
type: 'warning',
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
@@ -161,7 +165,9 @@ let PostControls = ({
|
||||
|
||||
const onQuote = () => {
|
||||
if (isBlocked) {
|
||||
Toast.show(l`Cannot interact with a blocked user`, 'exclamation-circle')
|
||||
Toast.show(l`Cannot interact with a blocked user`, {
|
||||
type: 'warning',
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ import {sanitizeHandle} from '#/lib/strings/handles'
|
||||
import {useProfileShadow} from '#/state/cache/profile-shadow'
|
||||
import {useProfileFollowMutationQueue} from '#/state/queries/profile'
|
||||
import {useSession} from '#/state/session'
|
||||
import * as Toast from '#/view/com/util/Toast'
|
||||
import {PreviewableUserAvatar, UserAvatar} from '#/view/com/util/UserAvatar'
|
||||
import {
|
||||
atoms as a,
|
||||
@@ -43,6 +42,7 @@ import {Link as InternalLink, type LinkProps} from '#/components/Link'
|
||||
import * as Pills from '#/components/Pills'
|
||||
import {ProfileBadges} from '#/components/ProfileBadges'
|
||||
import {RichText} from '#/components/RichText'
|
||||
import * as Toast from '#/components/Toast'
|
||||
import {Text} from '#/components/Typography'
|
||||
import {type Metrics} from '#/analytics'
|
||||
import {useActorStatus} from '#/features/liveNow'
|
||||
@@ -504,7 +504,9 @@ export function FollowButtonInner({
|
||||
} catch (e) {
|
||||
const err = e as Error
|
||||
if (err?.name !== 'AbortError') {
|
||||
Toast.show(l`An issue occurred, please try again.`, 'xmark')
|
||||
Toast.show(l`An issue occurred, please try again.`, {
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -524,7 +526,9 @@ export function FollowButtonInner({
|
||||
} catch (e) {
|
||||
const err = e as Error
|
||||
if (err?.name !== 'AbortError') {
|
||||
Toast.show(l`An issue occurred, please try again.`, 'xmark')
|
||||
Toast.show(l`An issue occurred, please try again.`, {
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import {sanitizeHandle} from '#/lib/strings/handles'
|
||||
import {updateProfileShadow} from '#/state/cache/profile-shadow'
|
||||
import {RQKEY_getActivitySubscriptions} from '#/state/queries/activity-subscriptions'
|
||||
import {useAgent} from '#/state/session'
|
||||
import * as Toast from '#/view/com/util/Toast'
|
||||
import {atoms as a, platform, useTheme, web} from '#/alf'
|
||||
import {Admonition} from '#/components/Admonition'
|
||||
import {
|
||||
@@ -34,6 +33,7 @@ import * as Dialog from '#/components/Dialog'
|
||||
import * as Toggle from '#/components/forms/Toggle'
|
||||
import {Loader} from '#/components/Loader'
|
||||
import * as ProfileCard from '#/components/ProfileCard'
|
||||
import * as Toast from '#/components/Toast'
|
||||
import {Text} from '#/components/Typography'
|
||||
import {useAnalytics} from '#/analytics'
|
||||
import {IS_WEB} from '#/env'
|
||||
@@ -139,7 +139,9 @@ function DialogInner({
|
||||
_(
|
||||
msg`You will no longer receive notifications for ${sanitizeHandle(profile.handle, '@')}`,
|
||||
),
|
||||
'check',
|
||||
{
|
||||
type: 'success',
|
||||
},
|
||||
)
|
||||
|
||||
// filter out the subscription
|
||||
@@ -169,10 +171,14 @@ function DialogInner({
|
||||
_(
|
||||
msg`You'll start receiving notifications for ${sanitizeHandle(profile.handle, '@')}!`,
|
||||
),
|
||||
'check',
|
||||
{
|
||||
type: 'success',
|
||||
},
|
||||
)
|
||||
} else {
|
||||
Toast.show(_(msg`Changes saved`), 'check')
|
||||
Toast.show(_(msg`Changes saved`), {
|
||||
type: 'success',
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -8,12 +8,12 @@ import {useMutation} from '@tanstack/react-query'
|
||||
|
||||
import {BLUESKY_MOD_SERVICE_HEADERS} from '#/lib/constants'
|
||||
import {useAgent, useSession} from '#/state/session'
|
||||
import * as Toast from '#/view/com/util/Toast'
|
||||
import {atoms as a, useBreakpoints, web} from '#/alf'
|
||||
import {AgeAssuranceBadge} from '#/components/ageAssurance/AgeAssuranceBadge'
|
||||
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
|
||||
import * as Dialog from '#/components/Dialog'
|
||||
import {Loader} from '#/components/Loader'
|
||||
import * as Toast from '#/components/Toast'
|
||||
import {Text} from '#/components/Typography'
|
||||
import {logger} from '#/ageAssurance'
|
||||
import {useAnalytics} from '#/analytics'
|
||||
@@ -70,7 +70,9 @@ function Inner({control}: {control: Dialog.DialogControlProps}) {
|
||||
logger.error('AgeAssuranceAppealDialog failed', {safeMessage: err})
|
||||
Toast.show(
|
||||
_(msg`Age assurance inquiry failed to send, please try again.`),
|
||||
'xmark',
|
||||
{
|
||||
type: 'error',
|
||||
},
|
||||
)
|
||||
},
|
||||
onSuccess: () => {
|
||||
|
||||
@@ -37,7 +37,6 @@ import {
|
||||
usePostThreadContext,
|
||||
} from '#/state/queries/usePostThread'
|
||||
import {useAgent, useSession} from '#/state/session'
|
||||
import * as Toast from '#/view/com/util/Toast'
|
||||
import {UserAvatar} from '#/view/com/util/UserAvatar'
|
||||
import {atoms as a, useTheme, web} from '#/alf'
|
||||
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
|
||||
@@ -50,6 +49,7 @@ import {
|
||||
import {CircleInfo_Stroke2_Corner0_Rounded as CircleInfo} from '#/components/icons/CircleInfo'
|
||||
import {CloseQuote_Stroke2_Corner1_Rounded as QuoteIcon} from '#/components/icons/Quote'
|
||||
import {Loader} from '#/components/Loader'
|
||||
import * as Toast from '#/components/Toast'
|
||||
import {Text} from '#/components/Typography'
|
||||
import {useAnalytics} from '#/analytics'
|
||||
import {IS_IOS} from '#/env'
|
||||
@@ -240,7 +240,9 @@ export function PostInteractionSettingsDialogControlledInner(
|
||||
_(
|
||||
msg`There was an issue. Please check your internet connection and try again.`,
|
||||
),
|
||||
'xmark',
|
||||
{
|
||||
type: 'error',
|
||||
},
|
||||
)
|
||||
} finally {
|
||||
setIsSaving(false)
|
||||
|
||||
@@ -17,7 +17,6 @@ import {
|
||||
} from '#/state/queries/list'
|
||||
import {useAgent} from '#/state/session'
|
||||
import {ErrorMessage} from '#/view/com/util/error/ErrorMessage'
|
||||
import * as Toast from '#/view/com/util/Toast'
|
||||
import {EditableUserAvatar} from '#/view/com/util/UserAvatar'
|
||||
import {atoms as a, useTheme, web} from '#/alf'
|
||||
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
|
||||
@@ -25,6 +24,7 @@ import * as Dialog from '#/components/Dialog'
|
||||
import * as TextField from '#/components/forms/TextField'
|
||||
import {Loader} from '#/components/Loader'
|
||||
import * as Prompt from '#/components/Prompt'
|
||||
import * as Toast from '#/components/Toast'
|
||||
import {Text} from '#/components/Typography'
|
||||
import {IS_WEB} from '#/env'
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ import {
|
||||
useListMembershipAddMutation,
|
||||
useListMembershipRemoveMutation,
|
||||
} from '#/state/queries/list-memberships'
|
||||
import * as Toast from '#/view/com/util/Toast'
|
||||
import {atoms as a} from '#/alf'
|
||||
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
|
||||
import * as Dialog from '#/components/Dialog'
|
||||
@@ -24,6 +23,7 @@ import {
|
||||
} from '#/components/dialogs/SearchablePeopleList'
|
||||
import {Loader} from '#/components/Loader'
|
||||
import * as ProfileCard from '#/components/ProfileCard'
|
||||
import * as Toast from '#/components/Toast'
|
||||
import type * as bsky from '#/types/bsky'
|
||||
|
||||
export function ListAddRemoveUsersDialog({
|
||||
@@ -113,7 +113,10 @@ function UserResult({
|
||||
Toast.show(_(msg`Added to list`))
|
||||
onChange?.('add', profile)
|
||||
},
|
||||
onError: e => Toast.show(cleanError(e), 'xmark'),
|
||||
onError: e =>
|
||||
Toast.show(cleanError(e), {
|
||||
type: 'error',
|
||||
}),
|
||||
})
|
||||
const {mutate: listMembershipRemove, isPending: isRemovingPending} =
|
||||
useListMembershipRemoveMutation({
|
||||
@@ -121,7 +124,10 @@ function UserResult({
|
||||
Toast.show(_(msg`Removed from list`))
|
||||
onChange?.('remove', profile)
|
||||
},
|
||||
onError: e => Toast.show(cleanError(e), 'xmark'),
|
||||
onError: e =>
|
||||
Toast.show(cleanError(e), {
|
||||
type: 'error',
|
||||
}),
|
||||
})
|
||||
const isMutating = isAddingPending || isRemovingPending
|
||||
|
||||
|
||||
@@ -6,11 +6,11 @@ import {useLingui} from '@lingui/react'
|
||||
|
||||
import {useConvoActive} from '#/state/messages/convo'
|
||||
import {useSession} from '#/state/session'
|
||||
import * as Toast from '#/view/com/util/Toast'
|
||||
import {atoms as a, useTheme} from '#/alf'
|
||||
import {MessageContextMenu} from '#/components/dms/MessageContextMenu'
|
||||
import {DotGrid3x1_Stroke2_Corner0_Rounded as DotsHorizontalIcon} from '#/components/icons/DotGrid'
|
||||
import {EmojiSmile_Stroke2_Corner0_Rounded as EmojiSmileIcon} from '#/components/icons/Emoji'
|
||||
import * as Toast from '#/components/Toast'
|
||||
import {EmojiReactionPicker} from './EmojiReactionPicker'
|
||||
import {hasReachedReactionLimit} from './util'
|
||||
|
||||
@@ -60,11 +60,11 @@ export function ActionsWrapper({
|
||||
.catch(() => Toast.show(_(msg`Failed to remove emoji reaction`)))
|
||||
} else {
|
||||
if (hasReachedReactionLimit(message, currentAccount?.did)) return
|
||||
convo
|
||||
.addReaction(message.id, emoji)
|
||||
.catch(() =>
|
||||
Toast.show(_(msg`Failed to add emoji reaction`), 'xmark'),
|
||||
)
|
||||
convo.addReaction(message.id, emoji).catch(() =>
|
||||
Toast.show(_(msg`Failed to add emoji reaction`), {
|
||||
type: 'error',
|
||||
}),
|
||||
)
|
||||
}
|
||||
},
|
||||
[_, convo, message, currentAccount?.did],
|
||||
|
||||
@@ -13,12 +13,12 @@ import {
|
||||
useProfileBlockMutationQueue,
|
||||
useProfileQuery,
|
||||
} from '#/state/queries/profile'
|
||||
import * as Toast from '#/view/com/util/Toast'
|
||||
import {atoms as a, platform, useBreakpoints, useTheme, web} from '#/alf'
|
||||
import {Button, ButtonText} from '#/components/Button'
|
||||
import * as Dialog from '#/components/Dialog'
|
||||
import * as Toggle from '#/components/forms/Toggle'
|
||||
import {Loader} from '#/components/Loader'
|
||||
import * as Toast from '#/components/Toast'
|
||||
import {Text} from '#/components/Typography'
|
||||
import {IS_NATIVE} from '#/env'
|
||||
|
||||
@@ -135,7 +135,9 @@ function DoneStep({
|
||||
}
|
||||
},
|
||||
onError: () => {
|
||||
Toast.show(_(msg`Could not leave chat`), 'xmark')
|
||||
Toast.show(_(msg`Could not leave chat`), {
|
||||
type: 'error',
|
||||
})
|
||||
},
|
||||
})
|
||||
|
||||
@@ -161,7 +163,9 @@ function DoneStep({
|
||||
leaveConvo()
|
||||
}
|
||||
if (toastMsg) {
|
||||
Toast.show(toastMsg, 'check')
|
||||
Toast.show(toastMsg, {
|
||||
type: 'success',
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ import {
|
||||
unstableCacheProfileView,
|
||||
useProfileBlockMutationQueue,
|
||||
} from '#/state/queries/profile'
|
||||
import * as Toast from '#/view/com/util/Toast'
|
||||
import {type ViewStyleProp} from '#/alf'
|
||||
import {atoms as a} from '#/alf'
|
||||
import {Button, ButtonIcon} from '#/components/Button'
|
||||
@@ -40,6 +39,7 @@ import {SpeakerVolumeFull_Stroke2_Corner0_Rounded as Unmute} from '#/components/
|
||||
import * as Menu from '#/components/Menu'
|
||||
import {ReportDialog} from '#/components/moderation/ReportDialog'
|
||||
import * as Prompt from '#/components/Prompt'
|
||||
import * as Toast from '#/components/Toast'
|
||||
import type * as bsky from '#/types/bsky'
|
||||
|
||||
let ConvoMenu = ({
|
||||
@@ -205,7 +205,9 @@ function MenuContent({
|
||||
}
|
||||
},
|
||||
onError: () => {
|
||||
Toast.show(_(msg`Could not mute chat`), 'xmark')
|
||||
Toast.show(_(msg`Could not mute chat`), {
|
||||
type: 'error',
|
||||
})
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ import {StackActions, useNavigation} from '@react-navigation/native'
|
||||
|
||||
import {type NavigationProp} from '#/lib/routes/types'
|
||||
import {useLeaveConvo} from '#/state/queries/messages/leave-conversation'
|
||||
import * as Toast from '#/view/com/util/Toast'
|
||||
import {type DialogOuterProps} from '#/components/Dialog'
|
||||
import * as Prompt from '#/components/Prompt'
|
||||
import * as Toast from '#/components/Toast'
|
||||
import {IS_NATIVE} from '#/env'
|
||||
|
||||
export function LeaveConvoPrompt({
|
||||
@@ -32,7 +32,9 @@ export function LeaveConvoPrompt({
|
||||
}
|
||||
},
|
||||
onError: () => {
|
||||
Toast.show(_(msg`Could not leave chat`), 'xmark')
|
||||
Toast.show(_(msg`Could not leave chat`), {
|
||||
type: 'error',
|
||||
})
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ import {useConvoActive} from '#/state/messages/convo'
|
||||
import {useLanguagePrefs} from '#/state/preferences'
|
||||
import {unstableCacheProfileView} from '#/state/queries/unstable-profile-cache'
|
||||
import {useSession} from '#/state/session'
|
||||
import * as Toast from '#/view/com/util/Toast'
|
||||
import * as ContextMenu from '#/components/ContextMenu'
|
||||
import {type TriggerProps} from '#/components/ContextMenu/types'
|
||||
import {AfterReportDialog} from '#/components/dms/AfterReportDialog'
|
||||
@@ -23,6 +22,7 @@ import {Warning_Stroke2_Corner0_Rounded as Warning} from '#/components/icons/War
|
||||
import {ReportDialog} from '#/components/moderation/ReportDialog'
|
||||
import * as Prompt from '#/components/Prompt'
|
||||
import {usePromptControl} from '#/components/Prompt'
|
||||
import * as Toast from '#/components/Toast'
|
||||
import {useAnalytics} from '#/analytics'
|
||||
import {IS_NATIVE} from '#/env'
|
||||
import {EmojiReactionPicker} from './EmojiReactionPicker'
|
||||
@@ -58,7 +58,9 @@ export let MessageContextMenu = ({
|
||||
)
|
||||
|
||||
void Clipboard.setStringAsync(str)
|
||||
Toast.show(_(msg`Copied to clipboard`), 'clipboard-check')
|
||||
Toast.show(_(msg`Copied to clipboard`), {
|
||||
type: 'success',
|
||||
})
|
||||
}, [_, message.text, message.facets])
|
||||
|
||||
const onPressTranslateMessage = useCallback(() => {
|
||||
@@ -95,11 +97,11 @@ export let MessageContextMenu = ({
|
||||
.catch(() => Toast.show(_(msg`Failed to remove emoji reaction`)))
|
||||
} else {
|
||||
if (hasReachedReactionLimit(message, currentAccount?.did)) return
|
||||
convo
|
||||
.addReaction(message.id, emoji)
|
||||
.catch(() =>
|
||||
Toast.show(_(msg`Failed to add emoji reaction`), 'xmark'),
|
||||
)
|
||||
convo.addReaction(message.id, emoji).catch(() =>
|
||||
Toast.show(_(msg`Failed to add emoji reaction`), {
|
||||
type: 'error',
|
||||
}),
|
||||
)
|
||||
}
|
||||
},
|
||||
[_, convo, message, currentAccount?.did],
|
||||
|
||||
@@ -10,11 +10,11 @@ import {useRequireEmailVerification} from '#/lib/hooks/useRequireEmailVerificati
|
||||
import {type NavigationProp} from '#/lib/routes/types'
|
||||
import {useGetConvoAvailabilityQuery} from '#/state/queries/messages/get-convo-availability'
|
||||
import {useGetConvoForMembers} from '#/state/queries/messages/get-convo-for-members'
|
||||
import * as Toast from '#/view/com/util/Toast'
|
||||
import {atoms as a, useTheme} from '#/alf'
|
||||
import {Button, ButtonIcon} from '#/components/Button'
|
||||
import {canBeMessaged} from '#/components/dms/util'
|
||||
import {Message_Stroke2_Corner0_Rounded as Message} from '#/components/icons/Message'
|
||||
import * as Toast from '#/components/Toast'
|
||||
import {useAnalytics} from '#/analytics'
|
||||
|
||||
export function MessageProfileButton({
|
||||
|
||||
@@ -7,11 +7,11 @@ import {useRequireEmailVerification} from '#/lib/hooks/useRequireEmailVerificati
|
||||
import {logger} from '#/logger'
|
||||
import {useGetConvoForMembers} from '#/state/queries/messages/get-convo-for-members'
|
||||
import {FAB} from '#/view/com/util/fab/FAB'
|
||||
import * as Toast from '#/view/com/util/Toast'
|
||||
import {useTheme} from '#/alf'
|
||||
import * as Dialog from '#/components/Dialog'
|
||||
import {SearchablePeopleList} from '#/components/dialogs/SearchablePeopleList'
|
||||
import {PlusLarge_Stroke2_Corner0_Rounded as Plus} from '#/components/icons/Plus'
|
||||
import * as Toast from '#/components/Toast'
|
||||
import {useAnalytics} from '#/analytics'
|
||||
|
||||
export function NewChat({
|
||||
@@ -37,7 +37,9 @@ export function NewChat({
|
||||
},
|
||||
onError: error => {
|
||||
logger.error('Failed to create chat', {safeMessage: error})
|
||||
Toast.show(_(msg`An issue occurred starting the chat`), 'xmark')
|
||||
Toast.show(_(msg`An issue occurred starting the chat`), {
|
||||
type: 'error',
|
||||
})
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ import {useLingui} from '@lingui/react'
|
||||
|
||||
import {logger} from '#/logger'
|
||||
import {useGetConvoForMembers} from '#/state/queries/messages/get-convo-for-members'
|
||||
import * as Toast from '#/view/com/util/Toast'
|
||||
import * as Dialog from '#/components/Dialog'
|
||||
import {SearchablePeopleList} from '#/components/dialogs/SearchablePeopleList'
|
||||
import * as Toast from '#/components/Toast'
|
||||
import {useAnalytics} from '#/analytics'
|
||||
|
||||
export function SendViaChatDialog({
|
||||
@@ -47,10 +47,9 @@ function SendViaChatDialogInner({
|
||||
},
|
||||
onError: error => {
|
||||
logger.error('Failed to share post to chat', {message: error})
|
||||
Toast.show(
|
||||
_(msg`An issue occurred while trying to open the chat`),
|
||||
'xmark',
|
||||
)
|
||||
Toast.show(_(msg`An issue occurred while trying to open the chat`), {
|
||||
type: 'error',
|
||||
})
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import {logger} from '#/logger'
|
||||
import {type Shadow} from '#/state/cache/types'
|
||||
import {useProfileFollowMutationQueue} from '#/state/queries/profile'
|
||||
import {useRequireAuth} from '#/state/session'
|
||||
import * as Toast from '#/view/com/util/Toast'
|
||||
import * as Toast from '#/components/Toast'
|
||||
import {type Metrics} from '#/analytics/metrics'
|
||||
import type * as bsky from '#/types/bsky'
|
||||
|
||||
@@ -32,7 +32,9 @@ export function useFollowMethods({
|
||||
} catch (e: any) {
|
||||
logger.error(`useFollowMethods: failed to follow`, {message: String(e)})
|
||||
if (e?.name !== 'AbortError') {
|
||||
Toast.show(_(msg`An issue occurred, please try again.`), 'xmark')
|
||||
Toast.show(_(msg`An issue occurred, please try again.`), {
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -47,7 +49,9 @@ export function useFollowMethods({
|
||||
message: String(e),
|
||||
})
|
||||
if (e?.name !== 'AbortError') {
|
||||
Toast.show(_(msg`An issue occurred, please try again.`), 'xmark')
|
||||
Toast.show(_(msg`An issue occurred, please try again.`), {
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -14,11 +14,11 @@ import {makeProfileLink} from '#/lib/routes/links'
|
||||
import {sanitizeHandle} from '#/lib/strings/handles'
|
||||
import {logger} from '#/logger'
|
||||
import {useAgent, useSession} from '#/state/session'
|
||||
import * as Toast from '#/view/com/util/Toast'
|
||||
import {atoms as a, useBreakpoints, useTheme} from '#/alf'
|
||||
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
|
||||
import * as Dialog from '#/components/Dialog'
|
||||
import {InlineLinkText} from '#/components/Link'
|
||||
import * as Toast from '#/components/Toast'
|
||||
import {Text} from '#/components/Typography'
|
||||
import {IS_ANDROID} from '#/env'
|
||||
import {Admonition} from '../Admonition'
|
||||
|
||||
@@ -7,7 +7,6 @@ import {Trans} from '@lingui/react/macro'
|
||||
import {logger} from '#/logger'
|
||||
import {useModerationOpts} from '#/state/preferences/moderation-opts'
|
||||
import {useVerificationCreateMutation} from '#/state/queries/verification/useVerificationCreateMutation'
|
||||
import * as Toast from '#/view/com/util/Toast'
|
||||
import {atoms as a, useBreakpoints} from '#/alf'
|
||||
import {Admonition} from '#/components/Admonition'
|
||||
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
|
||||
@@ -17,6 +16,7 @@ import {VerifiedCheck} from '#/components/icons/VerifiedCheck'
|
||||
import {Loader} from '#/components/Loader'
|
||||
import * as ProfileCard from '#/components/ProfileCard'
|
||||
import * as Prompt from '#/components/Prompt'
|
||||
import * as Toast from '#/components/Toast'
|
||||
import type * as bsky from '#/types/bsky'
|
||||
|
||||
export function VerificationCreatePrompt({
|
||||
|
||||
@@ -5,9 +5,9 @@ import {useLingui} from '@lingui/react'
|
||||
|
||||
import {logger} from '#/logger'
|
||||
import {useVerificationsRemoveMutation} from '#/state/queries/verification/useVerificationsRemoveMutation'
|
||||
import * as Toast from '#/view/com/util/Toast'
|
||||
import {type DialogControlProps} from '#/components/Dialog'
|
||||
import * as Prompt from '#/components/Prompt'
|
||||
import * as Toast from '#/components/Toast'
|
||||
import type * as bsky from '#/types/bsky'
|
||||
|
||||
export {useDialogControl as usePromptControl} from '#/components/Dialog'
|
||||
@@ -31,7 +31,9 @@ export function VerificationRemovePrompt({
|
||||
await remove({profile, verifications})
|
||||
Toast.show(_(msg`Removed verification`))
|
||||
} catch (e) {
|
||||
Toast.show(_(msg`Failed to remove verification`), 'xmark')
|
||||
Toast.show(_(msg`Failed to remove verification`), {
|
||||
type: 'error',
|
||||
})
|
||||
logger.error('Failed to remove verification', {
|
||||
safeMessage: e,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user