mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-04-23 03:00:31 -04:00
feat(ui): progress toggle button displays spinner when in progress
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { ButtonGroup, Flex, IconButton, Menu, MenuButton, MenuList } from '@invoke-ai/ui-library';
|
||||
import type { SystemStyleObject } from '@invoke-ai/ui-library';
|
||||
import { ButtonGroup, Flex, IconButton, Menu, MenuButton, MenuList, spinAnimation } from '@invoke-ai/ui-library';
|
||||
import { createSelector } from '@reduxjs/toolkit';
|
||||
import { skipToken } from '@reduxjs/toolkit/query';
|
||||
import { useAppToaster } from 'app/components/Toaster';
|
||||
@@ -23,10 +24,11 @@ import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
PiArrowsCounterClockwiseBold,
|
||||
PiAsteriskBold,
|
||||
PiCircleNotchBold,
|
||||
PiDotsThreeOutlineFill,
|
||||
PiEyeBold,
|
||||
PiFlowArrowBold,
|
||||
PiHourglassHighBold,
|
||||
PiHourglassMediumFill,
|
||||
PiInfoBold,
|
||||
PiPlantBold,
|
||||
PiQuotesBold,
|
||||
@@ -44,9 +46,14 @@ const selectShouldDisableToolbarButtons = createSelector(
|
||||
}
|
||||
);
|
||||
|
||||
const loadingStyles: SystemStyleObject = {
|
||||
svg: { animation: spinAnimation },
|
||||
};
|
||||
|
||||
export const ViewerToolbar = memo(() => {
|
||||
const dispatch = useAppDispatch();
|
||||
const isConnected = useAppSelector((s) => s.system.isConnected);
|
||||
const hasProgress = useAppSelector((s) => s.progress.latestDenoiseProgress !== null);
|
||||
const lastSelectedImage = useAppSelector(selectLastSelectedImage);
|
||||
const shouldDisableToolbarButtons = useAppSelector(selectShouldDisableToolbarButtons);
|
||||
const viewerMode = useAppSelector((s) => s.viewer.viewerMode);
|
||||
@@ -288,9 +295,10 @@ export const ViewerToolbar = memo(() => {
|
||||
<IconButton
|
||||
aria-label={`${t('viewer.viewerModeProgress')}`}
|
||||
tooltip={`${t('viewer.viewerModeProgress')}`}
|
||||
icon={<PiHourglassHighBold />}
|
||||
icon={hasProgress ? <PiCircleNotchBold /> : <PiHourglassMediumFill />}
|
||||
isChecked={viewerMode === 'progress'}
|
||||
onClick={handleSelectViewerProgress}
|
||||
sx={hasProgress ? loadingStyles : undefined}
|
||||
/>
|
||||
</ButtonGroup>
|
||||
</Flex>
|
||||
|
||||
Reference in New Issue
Block a user