mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2024-12-26 08:58:54 +01:00
display clean
This commit is contained in:
parent
c7b89a1126
commit
cedc634933
@ -60,7 +60,6 @@ export default function DrawImage({
|
|||||||
const _handleMouseDown = (
|
const _handleMouseDown = (
|
||||||
e: React.MouseEvent<HTMLCanvasElement, MouseEvent>
|
e: React.MouseEvent<HTMLCanvasElement, MouseEvent>
|
||||||
) => {
|
) => {
|
||||||
|
|
||||||
const {
|
const {
|
||||||
nativeEvent: { offsetX, offsetY },
|
nativeEvent: { offsetX, offsetY },
|
||||||
} = e;
|
} = e;
|
||||||
|
@ -4,15 +4,14 @@ import { ImageRequest, useImageCreate } from "../../../stores/imageCreateStore";
|
|||||||
|
|
||||||
import {
|
import {
|
||||||
generatedImageMain,
|
generatedImageMain,
|
||||||
image,
|
image, //@ts-ignore
|
||||||
} from //@ts-ignore
|
} from "./generatedImage.css.ts";
|
||||||
"./generatedImage.css.ts";
|
|
||||||
|
|
||||||
type GeneretaedImageProps = {
|
type GeneretaedImageProps = {
|
||||||
imageData: string;
|
imageData: string;
|
||||||
metadata: ImageRequest;
|
metadata: ImageRequest;
|
||||||
className?: string;
|
className?: string;
|
||||||
children: never[];
|
// children: never[];
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function GeneratedImage({
|
export default function GeneratedImage({
|
||||||
@ -20,7 +19,6 @@ export default function GeneratedImage({
|
|||||||
metadata,
|
metadata,
|
||||||
className,
|
className,
|
||||||
}: GeneretaedImageProps) {
|
}: GeneretaedImageProps) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={[generatedImageMain, className].join(" ")}>
|
<div className={[generatedImageMain, className].join(" ")}>
|
||||||
<img className={image} src={imageData} alt={metadata.prompt} />
|
<img className={image} src={imageData} alt={metadata.prompt} />
|
||||||
|
@ -1,23 +1,18 @@
|
|||||||
|
|
||||||
|
|
||||||
import { style, globalStyle } from "@vanilla-extract/css";
|
import { style, globalStyle } from "@vanilla-extract/css";
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { vars } from "../../../../styles/theme/index.css.ts";
|
import { vars } from "../../../../styles/theme/index.css.ts";
|
||||||
|
|
||||||
|
|
||||||
export const completedImagesMain = style({
|
export const completedImagesMain = style({
|
||||||
display: 'flex',
|
display: "flex",
|
||||||
flexDirection: 'row',
|
flexDirection: "row",
|
||||||
flexWrap: 'nowrap',
|
flexWrap: "nowrap",
|
||||||
height: '100%',
|
height: "100%",
|
||||||
width: '100%',
|
width: "100%",
|
||||||
overflow: 'auto',
|
overflow: "auto",
|
||||||
paddingBottom: vars.spacing.medium,
|
paddingBottom: vars.spacing.medium,
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
export const imageContain = style({
|
export const imageContain = style({
|
||||||
width: "112px",
|
width: "112px",
|
||||||
backgroundColor: "black",
|
backgroundColor: "black",
|
||||||
@ -25,14 +20,13 @@ export const imageContain = style({
|
|||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
flexShrink: 0,
|
flexShrink: 0,
|
||||||
border: '0 none',
|
border: "0 none",
|
||||||
padding: '0',
|
padding: "0",
|
||||||
});
|
});
|
||||||
|
|
||||||
globalStyle(`${imageContain} img`, {
|
globalStyle(`${imageContain} img`, {
|
||||||
width: "100%",
|
width: "100%",
|
||||||
objectFit: "contain",
|
objectFit: "contain",
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
globalStyle(`${completedImagesMain} > ${imageContain}:first-of-type`, {
|
globalStyle(`${completedImagesMain} > ${imageContain}:first-of-type`, {
|
||||||
|
@ -1,41 +1,37 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
|
|
||||||
import { CompletedImagesType } from "../index";
|
import { CompletedImagesType } from "../index";
|
||||||
|
|
||||||
type CurrentDisplayProps = {
|
type CurrentDisplayProps = {
|
||||||
images: CompletedImagesType[] | null;
|
images: CompletedImagesType[] | null;
|
||||||
setCurrentDisplay: (image: CompletedImagesType) => void;
|
setCurrentDisplay: (image: CompletedImagesType) => void;
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
completedImagesMain,
|
completedImagesMain,
|
||||||
imageContain
|
imageContain, //@ts-ignore
|
||||||
} from //@ts-ignore
|
} from "./completedImages.css.ts";
|
||||||
"./completedImages.css.ts";
|
|
||||||
|
|
||||||
export default function CompletedImages({ images, setCurrentDisplay }: CurrentDisplayProps) {
|
|
||||||
|
|
||||||
|
|
||||||
|
export default function CompletedImages({
|
||||||
|
images,
|
||||||
|
setCurrentDisplay,
|
||||||
|
}: CurrentDisplayProps) {
|
||||||
const _handleSetCurrentDisplay = (index: number) => {
|
const _handleSetCurrentDisplay = (index: number) => {
|
||||||
debugger
|
debugger;
|
||||||
const image = images![index];
|
const image = images![index];
|
||||||
setCurrentDisplay(image);
|
setCurrentDisplay(image);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
console.log("COMP{LETED IMAGES", images);
|
||||||
console.log('COMP{LETED IMAGES', images);
|
|
||||||
return (
|
return (
|
||||||
<div className={completedImagesMain}>
|
<div className={completedImagesMain}>
|
||||||
{images && images.map((image, index) => {
|
{images &&
|
||||||
|
images.map((image, index) => {
|
||||||
// if (void 0 !== image) {
|
// if (void 0 !== image) {
|
||||||
// return null;
|
// return null;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
||||||
// <div className={imageContain} key={index} value={index} onClick={() => {
|
// <div className={imageContain} key={index} value={index} onClick={() => {
|
||||||
// debugger;
|
// debugger;
|
||||||
// const image = images[index];
|
// const image = images[index];
|
||||||
@ -44,18 +40,19 @@ export default function CompletedImages({ images, setCurrentDisplay }: CurrentDi
|
|||||||
// <img src={image.data} alt={image.info.prompt} />
|
// <img src={image.data} alt={image.info.prompt} />
|
||||||
// </div>
|
// </div>
|
||||||
|
|
||||||
<button key={index} className={imageContain} onClick={
|
<button
|
||||||
() => {
|
key={index}
|
||||||
|
className={imageContain}
|
||||||
console.log('CLICKED', index);
|
onClick={() => {
|
||||||
|
console.log("CLICKED", index);
|
||||||
debugger;
|
debugger;
|
||||||
_handleSetCurrentDisplay(index);
|
_handleSetCurrentDisplay(index);
|
||||||
}
|
}}
|
||||||
}>
|
>
|
||||||
<img src={image.data} alt={image.info.prompt} />
|
<img src={image.data} alt={image.info.prompt} />
|
||||||
</button>
|
</button>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
)
|
);
|
||||||
};
|
}
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import GeneratedImage from "../../../molecules/generatedImage";
|
import GeneratedImage from "../../../molecules/generatedImage";
|
||||||
import { ImageRequest, useImageCreate } from "../../../../stores/imageCreateStore";
|
import {
|
||||||
|
ImageRequest,
|
||||||
|
useImageCreate,
|
||||||
|
} from "../../../../stores/imageCreateStore";
|
||||||
|
|
||||||
import { CompletedImagesType } from "../index";
|
import { CompletedImagesType } from "../index";
|
||||||
|
|
||||||
@ -8,9 +11,7 @@ type CurrentDisplayProps = {
|
|||||||
image: CompletedImagesType | null;
|
image: CompletedImagesType | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export default function CurrentDisplay({ image }: CurrentDisplayProps) {
|
export default function CurrentDisplay({ image }: CurrentDisplayProps) {
|
||||||
|
|
||||||
const { info, data } = image || { info: null, data: null };
|
const { info, data } = image || { info: null, data: null };
|
||||||
|
|
||||||
const setRequestOption = useImageCreate((state) => state.setRequestOptions);
|
const setRequestOption = useImageCreate((state) => state.setRequestOptions);
|
||||||
@ -58,33 +59,20 @@ export default function CurrentDisplay({ image }: CurrentDisplayProps) {
|
|||||||
setRequestOption("init_image", data);
|
setRequestOption("init_image", data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="current-display">
|
<div className="current-display">
|
||||||
{image &&
|
{image && (
|
||||||
<div>
|
<div>
|
||||||
<p> {info!.prompt}</p>
|
<p> {info!.prompt}</p>
|
||||||
<GeneratedImage
|
<GeneratedImage imageData={data!} metadata={info!}></GeneratedImage>
|
||||||
imageData={data!}
|
|
||||||
metadata={info!}
|
|
||||||
>
|
|
||||||
</GeneratedImage>
|
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<button onClick={_handleSave}>
|
<button onClick={_handleSave}>Save</button>
|
||||||
Save
|
<button onClick={_handleUseAsInput}>Use as Input</button>
|
||||||
</button>
|
|
||||||
<button onClick={_handleUseAsInput}>
|
|
||||||
Use as Input
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
)}
|
||||||
<div>
|
<div></div>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,21 +4,19 @@ import { style } from "@vanilla-extract/css";
|
|||||||
import { vars } from "../../../styles/theme/index.css.ts";
|
import { vars } from "../../../styles/theme/index.css.ts";
|
||||||
|
|
||||||
export const displayPanel = style({
|
export const displayPanel = style({
|
||||||
height: '100%',
|
height: "100%",
|
||||||
display: 'flex',
|
display: "flex",
|
||||||
flexDirection: 'column',
|
flexDirection: "column",
|
||||||
});
|
});
|
||||||
|
|
||||||
export const displayContainer = style({
|
export const displayContainer = style({
|
||||||
|
|
||||||
flexGrow: 1,
|
flexGrow: 1,
|
||||||
display: 'flex',
|
display: "flex",
|
||||||
flexDirection: 'column',
|
flexDirection: "column",
|
||||||
justifyContent: 'center',
|
justifyContent: "center",
|
||||||
alignItems: 'center',
|
alignItems: "center",
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export const previousImages = style({
|
export const previousImages = style({
|
||||||
height: '150px',
|
height: "150px",
|
||||||
});
|
});
|
||||||
|
@ -12,7 +12,6 @@ import AudioDing from "./audioDing";
|
|||||||
// import GeneratedImage from "../../molecules/generatedImage";
|
// import GeneratedImage from "../../molecules/generatedImage";
|
||||||
// import DrawImage from "../../molecules/drawImage";
|
// import DrawImage from "../../molecules/drawImage";
|
||||||
|
|
||||||
|
|
||||||
import CurrentDisplay from "./currentDisplay";
|
import CurrentDisplay from "./currentDisplay";
|
||||||
import CompletedImages from "./completedImages";
|
import CompletedImages from "./completedImages";
|
||||||
|
|
||||||
@ -31,13 +30,14 @@ export type CompletedImagesType = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default function DisplayPanel() {
|
export default function DisplayPanel() {
|
||||||
|
|
||||||
const dingRef = useRef<HTMLAudioElement>(null);
|
const dingRef = useRef<HTMLAudioElement>(null);
|
||||||
const isSoundEnabled = useImageCreate((state) => state.isSoundEnabled());
|
const isSoundEnabled = useImageCreate((state) => state.isSoundEnabled());
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const { id, options } = useImageQueue((state) => state.firstInQueue());
|
const { id, options } = useImageQueue((state) => state.firstInQueue());
|
||||||
const removeFirstInQueue = useImageQueue((state) => state.removeFirstInQueue);
|
const removeFirstInQueue = useImageQueue((state) => state.removeFirstInQueue);
|
||||||
const [currentImage, setCurrentImage] = useState<CompletedImagesType | null>(null);
|
const [currentImage, setCurrentImage] = useState<CompletedImagesType | null>(
|
||||||
|
null
|
||||||
|
);
|
||||||
|
|
||||||
const { status, data } = useQuery(
|
const { status, data } = useQuery(
|
||||||
[MakeImageKey, id],
|
[MakeImageKey, id],
|
||||||
@ -113,9 +113,11 @@ export default function DisplayPanel() {
|
|||||||
<CurrentDisplay image={currentImage}></CurrentDisplay>
|
<CurrentDisplay image={currentImage}></CurrentDisplay>
|
||||||
</div>
|
</div>
|
||||||
<div className={previousImages}>
|
<div className={previousImages}>
|
||||||
<CompletedImages images={completedImages} setCurrentDisplay={setCurrentImage}></CompletedImages>
|
<CompletedImages
|
||||||
|
images={completedImages}
|
||||||
|
setCurrentDisplay={setCurrentImage}
|
||||||
|
></CompletedImages>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,17 +5,14 @@ import { vanillaExtractPlugin } from "@vanilla-extract/vite-plugin";
|
|||||||
import path from "path";
|
import path from "path";
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
|
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
// TODO figure out why vs code complains about this even though it works
|
// TODO figure out why vs code complains about this even though it works
|
||||||
"@stores": path.resolve(__dirname, "./src/stores"),
|
"@stores": path.resolve(__dirname, "./src/stores"),
|
||||||
// TODO - add more aliases
|
// TODO - add more aliases
|
||||||
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
plugins: [
|
plugins: [
|
||||||
react(),
|
react(),
|
||||||
vanillaExtractPlugin({
|
vanillaExtractPlugin({
|
||||||
@ -23,7 +20,6 @@ export default defineConfig({
|
|||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
||||||
server: {
|
server: {
|
||||||
port: 9001,
|
port: 9001,
|
||||||
},
|
},
|
||||||
|
2
ui/frontend/dist/index.css
vendored
2
ui/frontend/dist/index.css
vendored
File diff suppressed because one or more lines are too long
26
ui/frontend/dist/index.js
vendored
26
ui/frontend/dist/index.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user