You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526
  1. import { useSelector } from 'react-redux';
  2. import { IReduxState } from '../app/types';
  3. import { TILE_VIEW_ENABLED } from '../base/flags/constants';
  4. import { getFeatureFlag } from '../base/flags/functions';
  5. import TileViewButton from './components/TileViewButton';
  6. const tileview = {
  7. key: 'tileview',
  8. Content: TileViewButton,
  9. group: 2
  10. };
  11. /**
  12. * A hook that returns the tile view button if it is enabled and undefined otherwise.
  13. *
  14. * @returns {Object | undefined}
  15. */
  16. export function useTileViewButton() {
  17. const tileViewEnabled = useSelector((state: IReduxState) => getFeatureFlag(state, TILE_VIEW_ENABLED, true));
  18. if (tileViewEnabled) {
  19. return tileview;
  20. }
  21. }