Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

1.2 KB
Raw Blame
import { IconButton } from '@invoke-ai/ui-library';
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
import { selectShouldShowProgressInViewer } from 'features/ui/store/uiSelectors';
import { setShouldShowProgressInViewer } from 'features/ui/store/uiSlice';
import { memo, useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import { PiHourglassHighBold } from 'react-icons/pi';

export const ToggleProgressButton = memo(() => {
  const dispatch = useAppDispatch();
  const shouldShowProgressInViewer = useAppSelector(selectShouldShowProgressInViewer);
  const { t } = useTranslation();

  const onClick = useCallback(() => {
    dispatch(setShouldShowProgressInViewer(!shouldShowProgressInViewer));
  }, [dispatch, shouldShowProgressInViewer]);

  return (
    <IconButton
      aria-label={t('settings.displayInProgress')}
      tooltip={t('settings.displayInProgress')}
      icon={<PiHourglassHighBold />}
      onClick={onClick}
      variant="link"
      alignSelf="stretch"
      colorScheme={shouldShowProgressInViewer ? 'invokeBlue' : 'base'}
      data-testid="toggle-show-progress-button"
    />
  );
});

ToggleProgressButton.displayName = 'ToggleProgressButton';