@@ -8,6 +8,7 @@ import { EmptyState } from "../../components/card-image"
88import { CardNameSearchField } from "../../components/card-name-search-field"
99import { Button } from "../../components/ui/button"
1010import { ConfirmDialog } from "../../components/ui/confirm-dialog"
11+ import { useToast } from "../../components/ui/toast"
1112import {
1213 buildCollectionFilterQuery ,
1314 combineCollectionQueries ,
@@ -22,7 +23,7 @@ import {
2223 type SharedImportPayload ,
2324} from "../../lib/native-shared-import"
2425import { useLocalStorageState } from "../../lib/use-local-storage"
25- import { present } from "../../lib/utils"
26+ import { pluralize , present } from "../../lib/utils"
2627import { AutoSortSetupDialog , hasEnabledAutoSortRules } from "./auto-sort-setup-dialog"
2728import { AutoSortSummaryDialog } from "./auto-sort-summary-dialog"
2829import { CollectionLocationsSection } from "./collection-locations-section"
@@ -129,6 +130,7 @@ export function CollectionPage({ importFile = false }: { importFile?: boolean })
129130 } ,
130131 )
131132 const queryClient = useQueryClient ( )
133+ const { showToast } = useToast ( )
132134 const navigate = useNavigate ( )
133135 const deleteLocation = useMutation ( {
134136 mutationFn : ( locationId : string ) => request ( DeleteLocationDocument , { id : locationId } ) ,
@@ -184,8 +186,11 @@ export function CollectionPage({ importFile = false }: { importFile?: boolean })
184186 invalidateCollectionViews ( queryClient )
185187 queryClient . invalidateQueries ( { queryKey : [ "location" ] } )
186188 selection . clearSelection ( )
189+ showToast ( `${ pluralize ( result ?. movedCount ?? 0 , "card" ) } auto-sorted` )
190+ setAutoSortResult ( null )
191+ } else {
192+ setAutoSortResult ( result ?? null )
187193 }
188- setAutoSortResult ( result ?? null )
189194 setAutoSortError ( null )
190195 } ,
191196 onError : ( error ) => {
@@ -324,7 +329,10 @@ export function CollectionPage({ importFile = false }: { importFile?: boolean })
324329
325330 function deleteSelectedLocation ( ) {
326331 if ( ! deletingLocation ) return
327- deleteLocation . mutate ( deletingLocation . id )
332+ const locationName = deletingLocation . name
333+ deleteLocation . mutate ( deletingLocation . id , {
334+ onSuccess : ( ) => showToast ( `Deleted location ${ locationName } ` ) ,
335+ } )
328336 if ( editingLocation ?. id === deletingLocation . id ) setEditingLocation ( null )
329337 if ( exportingLocation ?. location . id === deletingLocation . id ) setExportingLocation ( null )
330338 }
0 commit comments