Create codemod for updating Toast calls to v2 (#10045)

This commit is contained in:
DS Boyce
2026-03-12 11:35:58 -07:00
committed by GitHub
parent 9c9970f680
commit 35cb2bcf94
62 changed files with 422 additions and 171 deletions
+13 -5
View File
@@ -30,7 +30,6 @@ import {useUpdateAllRead} from '#/state/queries/messages/update-all-read'
import {FAB} from '#/view/com/util/fab/FAB'
import {List} from '#/view/com/util/List'
import {ChatListLoadingPlaceholder} from '#/view/com/util/LoadingPlaceholder'
import * as Toast from '#/view/com/util/Toast'
import {atoms as a, useBreakpoints, useTheme} from '#/alf'
import {AgeRestrictedScreen} from '#/components/ageAssurance/AgeRestrictedScreen'
import {useAgeAssuranceCopy} from '#/components/ageAssurance/useAgeAssuranceCopy'
@@ -43,6 +42,7 @@ import {CircleInfo_Stroke2_Corner0_Rounded as CircleInfoIcon} from '#/components
import {Message_Stroke2_Corner0_Rounded as MessageIcon} from '#/components/icons/Message'
import * as Layout from '#/components/Layout'
import {ListFooter} from '#/components/Lists'
import * as Toast from '#/components/Toast'
import {Text} from '#/components/Typography'
import {IS_NATIVE} from '#/env'
import {RequestListItem} from './components/RequestListItem'
@@ -313,10 +313,14 @@ function MarkAllReadFAB() {
const t = useTheme()
const {mutate: markAllRead} = useUpdateAllRead('request', {
onMutate: () => {
Toast.show(_(msg`Marked all as read`), 'check')
Toast.show(_(msg`Marked all as read`), {
type: 'success',
})
},
onError: () => {
Toast.show(_(msg`Failed to mark all requests as read`), 'xmark')
Toast.show(_(msg`Failed to mark all requests as read`), {
type: 'error',
})
},
})
@@ -336,10 +340,14 @@ function MarkAsReadHeaderButton() {
const {_} = useLingui()
const {mutate: markAllRead} = useUpdateAllRead('request', {
onMutate: () => {
Toast.show(_(msg`Marked all as read`), 'check')
Toast.show(_(msg`Marked all as read`), {
type: 'success',
})
},
onError: () => {
Toast.show(_(msg`Failed to mark all requests as read`), 'xmark')
Toast.show(_(msg`Failed to mark all requests as read`), {
type: 'error',
})
},
})