feat(gui): navigate to appropriate tab when copying image (fixes #80)
This commit is contained in:
parent
e6e9914ca0
commit
1e477f7548
|
@ -1,8 +1,9 @@
|
||||||
import { doesExist, mustExist } from '@apextoaster/js-utils';
|
import { doesExist, mustExist } from '@apextoaster/js-utils';
|
||||||
import { Brush, ContentCopy, ContentCopyTwoTone, Delete, Download } from '@mui/icons-material';
|
import { Brush, ContentCopy, Delete, Download } from '@mui/icons-material';
|
||||||
import { Box, Button, Card, CardContent, CardMedia, Grid, IconButton, Paper, Tooltip } from '@mui/material';
|
import { Box, Card, CardContent, CardMedia, Grid, IconButton, Paper, Tooltip } from '@mui/material';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { useContext } from 'react';
|
import { useContext } from 'react';
|
||||||
|
import { useHash } from 'react-use/lib/useHash';
|
||||||
import { useStore } from 'zustand';
|
import { useStore } from 'zustand';
|
||||||
|
|
||||||
import { ImageResponse } from '../client.js';
|
import { ImageResponse } from '../client.js';
|
||||||
|
@ -24,6 +25,7 @@ export function ImageCard(props: ImageCardProps) {
|
||||||
const { value } = props;
|
const { value } = props;
|
||||||
const { params, output, size } = value;
|
const { params, output, size } = value;
|
||||||
|
|
||||||
|
const [_hash, setHash] = useHash();
|
||||||
const config = mustExist(useContext(ConfigContext));
|
const config = mustExist(useContext(ConfigContext));
|
||||||
const state = mustExist(useContext(StateContext));
|
const state = mustExist(useContext(StateContext));
|
||||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||||
|
@ -41,6 +43,7 @@ export function ImageCard(props: ImageCardProps) {
|
||||||
setImg2Img({
|
setImg2Img({
|
||||||
source: blob,
|
source: blob,
|
||||||
});
|
});
|
||||||
|
setHash('img2img');
|
||||||
}
|
}
|
||||||
|
|
||||||
async function copySourceToInpaint() {
|
async function copySourceToInpaint() {
|
||||||
|
@ -48,6 +51,7 @@ export function ImageCard(props: ImageCardProps) {
|
||||||
setInpaint({
|
setInpaint({
|
||||||
source: blob,
|
source: blob,
|
||||||
});
|
});
|
||||||
|
setHash('inpaint');
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteImage() {
|
function deleteImage() {
|
||||||
|
|
Loading…
Reference in New Issue