-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui): add actions for reset canvas layers / generation settings t…
…o session menus
- Loading branch information
1 parent
fbc629f
commit 7ad1c29
Showing
5 changed files
with
68 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
invokeai/frontend/web/src/common/components/SessionMenuItems.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { MenuItem } from '@invoke-ai/ui-library'; | ||
import { useAppDispatch } from 'app/store/storeHooks'; | ||
import { | ||
useNewCanvasSession, | ||
useNewGallerySession, | ||
} from 'features/controlLayers/components/NewSessionConfirmationAlertDialog'; | ||
import { canvasReset } from 'features/controlLayers/store/actions'; | ||
import { paramsReset } from 'features/controlLayers/store/paramsSlice'; | ||
import { memo, useCallback } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { PiArrowsCounterClockwiseBold, PiFilePlusBold } from 'react-icons/pi'; | ||
|
||
export const SessionMenuItems = memo(() => { | ||
const { t } = useTranslation(); | ||
const dispatch = useAppDispatch(); | ||
const { newGallerySessionWithDialog } = useNewGallerySession(); | ||
const { newCanvasSessionWithDialog } = useNewCanvasSession(); | ||
const resetCanvasLayers = useCallback(() => { | ||
dispatch(canvasReset()); | ||
}, [dispatch]); | ||
const resetGenerationSettings = useCallback(() => { | ||
dispatch(paramsReset()); | ||
}, [dispatch]); | ||
return ( | ||
<> | ||
<MenuItem icon={<PiFilePlusBold />} onClick={newGallerySessionWithDialog}> | ||
{t('controlLayers.newGallerySession')} | ||
</MenuItem> | ||
<MenuItem icon={<PiFilePlusBold />} onClick={newCanvasSessionWithDialog}> | ||
{t('controlLayers.newCanvasSession')} | ||
</MenuItem> | ||
<MenuItem icon={<PiArrowsCounterClockwiseBold />} onClick={resetCanvasLayers}> | ||
{t('controlLayers.resetCanvasLayers')} | ||
</MenuItem> | ||
<MenuItem icon={<PiArrowsCounterClockwiseBold />} onClick={resetGenerationSettings}> | ||
{t('controlLayers.resetGenerationSettings')} | ||
</MenuItem> | ||
</> | ||
); | ||
}); | ||
|
||
SessionMenuItems.displayName = 'SessionMenuItems'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters