chore: polish some components
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { CheckCircleIcon, DownloadIcon } from "@lume/icons";
|
||||
import { getImageMeta } from "@lume/utils";
|
||||
import { downloadDir } from "@tauri-apps/api/path";
|
||||
import { Window } from "@tauri-apps/api/window";
|
||||
import { download } from "@tauri-apps/plugin-upload";
|
||||
@@ -21,8 +22,15 @@ export function ImagePreview({ url }: { url: string }) {
|
||||
}
|
||||
};
|
||||
|
||||
const open = () => {
|
||||
return new Window("image-viewer", { url, title: "Image Viewer" });
|
||||
const open = async () => {
|
||||
const name = new URL(url).pathname.split("/").pop();
|
||||
const image = await getImageMeta(url);
|
||||
return new Window("image-viewer", {
|
||||
url,
|
||||
title: name,
|
||||
width: image.width,
|
||||
height: image.height,
|
||||
});
|
||||
};
|
||||
|
||||
const fallback = (event: SyntheticEvent<HTMLImageElement, Event>) => {
|
||||
|
||||
Reference in New Issue
Block a user