add send to upscale to context menu

This commit is contained in:
Mary Hipp 2024-07-17 12:09:24 -04:00 committed by psychedelicious
parent fd91b83d86
commit ce5b1103ed

View File

@ -38,6 +38,7 @@ import {
} from 'react-icons/pi'; } from 'react-icons/pi';
import { useStarImagesMutation, useUnstarImagesMutation } from 'services/api/endpoints/images'; import { useStarImagesMutation, useUnstarImagesMutation } from 'services/api/endpoints/images';
import type { ImageDTO } from 'services/api/types'; import type { ImageDTO } from 'services/api/types';
import { upscaleInitialImageChanged } from '../../../parameters/store/upscaleSlice';
type SingleSelectionMenuItemsProps = { type SingleSelectionMenuItemsProps = {
imageDTO: ImageDTO; imageDTO: ImageDTO;
@ -124,6 +125,11 @@ const SingleSelectionMenuItems = (props: SingleSelectionMenuItemsProps) => {
dispatch(imageToCompareChanged(imageDTO)); dispatch(imageToCompareChanged(imageDTO));
}, [dispatch, imageDTO]); }, [dispatch, imageDTO]);
const handleSendToUpscale = useCallback(() => {
dispatch(upscaleInitialImageChanged(imageDTO));
dispatch(setActiveTab('upscaling'));
}, [dispatch, imageDTO]);
return ( return (
<> <>
<MenuItem as="a" href={imageDTO.image_url} target="_blank" icon={<PiShareFatBold />}> <MenuItem as="a" href={imageDTO.image_url} target="_blank" icon={<PiShareFatBold />}>
@ -185,6 +191,9 @@ const SingleSelectionMenuItems = (props: SingleSelectionMenuItemsProps) => {
{t('parameters.sendToUnifiedCanvas')} {t('parameters.sendToUnifiedCanvas')}
</MenuItem> </MenuItem>
)} )}
<MenuItem icon={<PiShareFatBold />} onClickCapture={handleSendToUpscale} id="send-to-upscale">
Send to upscale
</MenuItem>
<MenuDivider /> <MenuDivider />
<MenuItem icon={<PiFoldersBold />} onClickCapture={handleChangeBoard}> <MenuItem icon={<PiFoldersBold />} onClickCapture={handleChangeBoard}>
{t('boards.changeBoard')} {t('boards.changeBoard')}