import { useContext } from 'react'; import { collectionPageContext, entityPageContext } from '../providers'; import { ToolbarCollectionContext } from './ToolbarCollectionContext'; export const usePageButtonBiParams = (): { pageType: 'Entity' | 'Collection' | undefined; location: | 'Entity Page Header' | 'Collection Page Header' | 'Patterns toolbar' | undefined; } => { const entityContext = useContext(entityPageContext); const collectionContext = useContext(collectionPageContext); const toolbarContext = useContext(ToolbarCollectionContext); if (toolbarContext) { return { pageType: 'Collection', location: 'Patterns toolbar' }; } if (entityContext) { return { pageType: 'Entity', location: 'Entity Page Header' }; } if (collectionContext) { return { pageType: 'Collection', location: 'Collection Page Header' }; } return { pageType: undefined, location: undefined }; };