Create codemod for updating Toast calls to v2 (#10045)
This commit is contained in:
@@ -5,10 +5,10 @@ import {useLingui} from '@lingui/react'
|
||||
import {Trans} from '@lingui/react/macro'
|
||||
|
||||
import {logger} from '#/logger'
|
||||
import * as Toast from '#/view/com/util/Toast'
|
||||
import {atoms as a} from '#/alf'
|
||||
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
|
||||
import {CC_Stroke2_Corner0_Rounded as CCIcon} from '#/components/icons/CC'
|
||||
import * as Toast from '#/components/Toast'
|
||||
|
||||
export function SubtitleFilePicker({
|
||||
onSelectFile,
|
||||
|
||||
@@ -7,8 +7,8 @@ import {type CompressedVideo} from '#/lib/media/video/types'
|
||||
import {clamp} from '#/lib/numbers'
|
||||
import {useAutoplayDisabled} from '#/state/preferences'
|
||||
import {ExternalEmbedRemoveBtn} from '#/view/com/composer/ExternalEmbedRemoveBtn'
|
||||
import * as Toast from '#/view/com/util/Toast'
|
||||
import {atoms as a} from '#/alf'
|
||||
import * as Toast from '#/components/Toast'
|
||||
import {PlayButtonIcon} from '#/components/video/PlayButtonIcon'
|
||||
|
||||
export function VideoPreview({
|
||||
@@ -63,7 +63,9 @@ export function VideoPreview({
|
||||
playsInline
|
||||
onError={err => {
|
||||
console.error('Error loading video', err)
|
||||
Toast.show(_(msg`Could not process your video`), 'xmark')
|
||||
Toast.show(_(msg`Could not process your video`), {
|
||||
type: 'error',
|
||||
})
|
||||
clear()
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -44,7 +44,6 @@ import {FeedSourceCard} from '#/view/com/feeds/FeedSourceCard'
|
||||
import {Post} from '#/view/com/post/Post'
|
||||
import {formatCount} from '#/view/com/util/numeric/format'
|
||||
import {TimeElapsed} from '#/view/com/util/TimeElapsed'
|
||||
import * as Toast from '#/view/com/util/Toast'
|
||||
import {PreviewableUserAvatar, UserAvatar} from '#/view/com/util/UserAvatar'
|
||||
import {atoms as a, platform, useTheme} from '#/alf'
|
||||
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
|
||||
@@ -67,6 +66,7 @@ import {ProfileBadges} from '#/components/ProfileBadges'
|
||||
import {ProfileHoverCard} from '#/components/ProfileHoverCard'
|
||||
import {Notification as StarterPackCard} from '#/components/StarterPack/StarterPackCard'
|
||||
import {SubtleHover} from '#/components/SubtleHover'
|
||||
import * as Toast from '#/components/Toast'
|
||||
import {Text} from '#/components/Typography'
|
||||
import * as bsky from '#/types/bsky'
|
||||
|
||||
@@ -769,7 +769,9 @@ function FollowBackButton({profile}: {profile: AppBskyActorDefs.ProfileView}) {
|
||||
)
|
||||
} catch (err: any) {
|
||||
if (err?.name !== 'AbortError') {
|
||||
Toast.show(_(msg`An issue occurred, please try again.`), 'xmark')
|
||||
Toast.show(_(msg`An issue occurred, please try again.`), {
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -789,7 +791,9 @@ function FollowBackButton({profile}: {profile: AppBskyActorDefs.ProfileView}) {
|
||||
)
|
||||
} catch (err: any) {
|
||||
if (err?.name !== 'AbortError') {
|
||||
Toast.show(_(msg`An issue occurred, please try again.`), 'xmark')
|
||||
Toast.show(_(msg`An issue occurred, please try again.`), {
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,11 +12,11 @@ import {
|
||||
useReplaceForYouWithDiscoverFeedMutation,
|
||||
} from '#/state/queries/preferences'
|
||||
import {useSetSelectedFeed} from '#/state/shell/selected-feed'
|
||||
import * as Toast from '#/view/com/util/Toast'
|
||||
import {atoms as a, useTheme} from '#/alf'
|
||||
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
|
||||
import {InlineLinkText} from '#/components/Link'
|
||||
import {Loader} from '#/components/Loader'
|
||||
import * as Toast from '#/components/Toast'
|
||||
import {Text} from '#/components/Typography'
|
||||
|
||||
export function FeedShutdownMsg({feedUri}: {feedUri: string}) {
|
||||
@@ -52,7 +52,9 @@ export function FeedShutdownMsg({feedUri}: {feedUri: string}) {
|
||||
_(
|
||||
msg`There was an issue updating your feeds, please check your internet connection and try again.`,
|
||||
),
|
||||
'exclamation-circle',
|
||||
{
|
||||
type: 'warning',
|
||||
},
|
||||
)
|
||||
logger.error('Failed to update feeds', {message: err})
|
||||
}
|
||||
@@ -71,7 +73,9 @@ export function FeedShutdownMsg({feedUri}: {feedUri: string}) {
|
||||
_(
|
||||
msg`There was an issue updating your feeds, please check your internet connection and try again.`,
|
||||
),
|
||||
'exclamation-circle',
|
||||
{
|
||||
type: 'warning',
|
||||
},
|
||||
)
|
||||
logger.error('Failed to update feeds', {message: err})
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ import {
|
||||
} from '#/state/queries/profile'
|
||||
import {useSession} from '#/state/session'
|
||||
import {EventStopper} from '#/view/com/util/EventStopper'
|
||||
import * as Toast from '#/view/com/util/Toast'
|
||||
import {atoms as a, useTheme} from '#/alf'
|
||||
import {Button, ButtonIcon} from '#/components/Button'
|
||||
import {useDialogControl} from '#/components/Dialog'
|
||||
@@ -52,6 +51,7 @@ import {
|
||||
useReportDialogControl,
|
||||
} from '#/components/moderation/ReportDialog'
|
||||
import * as Prompt from '#/components/Prompt'
|
||||
import * as Toast from '#/components/Toast'
|
||||
import {useFullVerificationState} from '#/components/verification'
|
||||
import {VerificationCreatePrompt} from '#/components/verification/VerificationCreatePrompt'
|
||||
import {VerificationRemovePrompt} from '#/components/verification/VerificationRemovePrompt'
|
||||
@@ -149,7 +149,9 @@ let ProfileMenu = ({
|
||||
} catch (e: any) {
|
||||
if (e?.name !== 'AbortError') {
|
||||
ax.logger.error('Failed to unmute account', {message: e})
|
||||
Toast.show(_(msg`There was an issue! ${e.toString()}`), 'xmark')
|
||||
Toast.show(_(msg`There was an issue! ${e.toString()}`), {
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -159,7 +161,9 @@ let ProfileMenu = ({
|
||||
} catch (e: any) {
|
||||
if (e?.name !== 'AbortError') {
|
||||
ax.logger.error('Failed to mute account', {message: e})
|
||||
Toast.show(_(msg`There was an issue! ${e.toString()}`), 'xmark')
|
||||
Toast.show(_(msg`There was an issue! ${e.toString()}`), {
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -173,7 +177,9 @@ let ProfileMenu = ({
|
||||
} catch (e: any) {
|
||||
if (e?.name !== 'AbortError') {
|
||||
ax.logger.error('Failed to unblock account', {message: e})
|
||||
Toast.show(_(msg`There was an issue! ${e.toString()}`), 'xmark')
|
||||
Toast.show(_(msg`There was an issue! ${e.toString()}`), {
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -183,7 +189,9 @@ let ProfileMenu = ({
|
||||
} catch (e: any) {
|
||||
if (e?.name !== 'AbortError') {
|
||||
ax.logger.error('Failed to block account', {message: e})
|
||||
Toast.show(_(msg`There was an issue! ${e.toString()}`), 'xmark')
|
||||
Toast.show(_(msg`There was an issue! ${e.toString()}`), {
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -196,7 +204,9 @@ let ProfileMenu = ({
|
||||
} catch (e: any) {
|
||||
if (e?.name !== 'AbortError') {
|
||||
ax.logger.error('Failed to follow account', {message: e})
|
||||
Toast.show(_(msg`There was an issue! ${e.toString()}`), 'xmark')
|
||||
Toast.show(_(msg`There was an issue! ${e.toString()}`), {
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
}
|
||||
}, [_, ax, queueFollow])
|
||||
@@ -208,7 +218,9 @@ let ProfileMenu = ({
|
||||
} catch (e: any) {
|
||||
if (e?.name !== 'AbortError') {
|
||||
ax.logger.error('Failed to unfollow account', {message: e})
|
||||
Toast.show(_(msg`There was an issue! ${e.toString()}`), 'xmark')
|
||||
Toast.show(_(msg`There was an issue! ${e.toString()}`), {
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
}
|
||||
}, [_, ax, queueUnfollow])
|
||||
|
||||
Reference in New Issue
Block a user