From 2ae11fa3502c490e568bf824868dcdde1459ee52 Mon Sep 17 00:00:00 2001 From: Innei Date: Thu, 4 Jul 2024 12:31:54 +0800 Subject: [PATCH] feat: add download button Signed-off-by: Innei --- icons/mgc/download_2_cute_re.svg | 1 + .../src/components/ui/image/preview-image.tsx | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 icons/mgc/download_2_cute_re.svg diff --git a/icons/mgc/download_2_cute_re.svg b/icons/mgc/download_2_cute_re.svg new file mode 100644 index 0000000000..e90e66fba1 --- /dev/null +++ b/icons/mgc/download_2_cute_re.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/renderer/src/components/ui/image/preview-image.tsx b/src/renderer/src/components/ui/image/preview-image.tsx index 8c410d3df4..acee7e6c7d 100644 --- a/src/renderer/src/components/ui/image/preview-image.tsx +++ b/src/renderer/src/components/ui/image/preview-image.tsx @@ -31,9 +31,19 @@ const Wrapper: Component<{ initial={{ opacity: 0.8 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }} - className="absolute bottom-4 right-4" + className="absolute bottom-4 right-4 flex gap-3" onClick={stopPropagation} > + {!!window.electron && ( + { + tipcClient?.saveImage(src) + }} + > + + + )} { @@ -76,7 +86,6 @@ export const PreviewImageContent: FC<{ label: "Save image as...", type: "text", click: () => { - // window.electron.ipcRenderer.invoke("save-image", image); tipcClient?.saveImage(image) }, },