add alf dialogs to useCloseAllActiveElements (#3021)

zio/stable
Hailey 2024-02-28 11:46:19 -08:00 committed by GitHub
parent 60eb6e23d1
commit a697b39c48
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 1 deletions

View File

@ -3,6 +3,7 @@ import {useLightboxControls} from './lightbox'
import {useModalControls} from './modals' import {useModalControls} from './modals'
import {useComposerControls} from './shell/composer' import {useComposerControls} from './shell/composer'
import {useSetDrawerOpen} from './shell/drawer-open' import {useSetDrawerOpen} from './shell/drawer-open'
import {useDialogStateControlContext} from 'state/dialogs'
/** /**
* returns true if something was closed * returns true if something was closed
@ -35,11 +36,19 @@ export function useCloseAllActiveElements() {
const {closeLightbox} = useLightboxControls() const {closeLightbox} = useLightboxControls()
const {closeAllModals} = useModalControls() const {closeAllModals} = useModalControls()
const {closeComposer} = useComposerControls() const {closeComposer} = useComposerControls()
const {closeAllDialogs: closeAlfDialogs} = useDialogStateControlContext()
const setDrawerOpen = useSetDrawerOpen() const setDrawerOpen = useSetDrawerOpen()
return useCallback(() => { return useCallback(() => {
closeLightbox() closeLightbox()
closeAllModals() closeAllModals()
closeComposer() closeComposer()
closeAlfDialogs()
setDrawerOpen(false) setDrawerOpen(false)
}, [closeLightbox, closeAllModals, closeComposer, setDrawerOpen]) }, [
closeLightbox,
closeAllModals,
closeComposer,
closeAlfDialogs,
setDrawerOpen,
])
} }