From 25b64cc3b041fc18b807f9551d9e8de3b269b1da Mon Sep 17 00:00:00 2001 From: Sean Sube Date: Wed, 11 Jan 2023 21:45:31 -0600 Subject: [PATCH] lint(gui): add component keys, remove some arrow fns --- gui/src/components/ImageCard.tsx | 20 +++-- gui/src/components/ImageHistory.tsx | 4 +- gui/src/components/OnnxWeb.tsx | 118 ++++++++++++++-------------- 3 files changed, 73 insertions(+), 69 deletions(-) diff --git a/gui/src/components/ImageCard.tsx b/gui/src/components/ImageCard.tsx index d6401d86..abfeea73 100644 --- a/gui/src/components/ImageCard.tsx +++ b/gui/src/components/ImageCard.tsx @@ -11,7 +11,7 @@ export interface ImageCardProps { onDelete?: (key: ApiResponse) => void; } -export function GridItem(props: {xs: number; children: React.ReactNode}) { +export function GridItem(props: { xs: number; children: React.ReactNode }) { return {props.children} ; @@ -21,6 +21,16 @@ export function ImageCard(props: ImageCardProps) { const { value } = props; const { params, output } = value; + function deleteImage() { + if (doesExist(props.onDelete)) { + props.onDelete(value); + } + } + + function downloadImage() { + window.open(output, '_blank'); + } + return Scheduler: {params.scheduler} {params.prompt} - - diff --git a/gui/src/components/ImageHistory.tsx b/gui/src/components/ImageHistory.tsx index 2d135990..ff27a677 100644 --- a/gui/src/components/ImageHistory.tsx +++ b/gui/src/components/ImageHistory.tsx @@ -16,7 +16,7 @@ export function ImageHistory() { const children = []; if (state.history.loading) { - children.push(); // TODO: get dimensions from config + children.push(); // TODO: get dimensions from config } function removeHistory(image: ApiResponse) { @@ -24,7 +24,7 @@ export function ImageHistory() { } if (images.length > 0) { - children.push(...images.map((item) => )); + children.push(...images.map((item) => )); } else { if (state.history.loading === false) { children.push(
No results. Press Generate.
); diff --git a/gui/src/components/OnnxWeb.tsx b/gui/src/components/OnnxWeb.tsx index eb970ad5..21af00ca 100644 --- a/gui/src/components/OnnxWeb.tsx +++ b/gui/src/components/OnnxWeb.tsx @@ -38,66 +38,64 @@ export function OnnxWeb(props: OnnxWebProps) { }); return ( -
- - - - ONNX Web - + + + + ONNX Web + + + + + { + setModel(value); + }} + /> + { + setPlatform(value); + }} + /> + + + + + { + setTab(idx); + }}> + + + + + - - - { - setModel(value); - }} - /> - { - setPlatform(value); - }} - /> - - - - - { - setTab(idx); - }}> - - - - - - - - - - - - - - - - - - - - - - - - -
+ + + + + + + + + + + + + + + + + + ); }