diff --git a/apps/builder/app/builder/shared/image-manager/image-info.tsx b/apps/builder/app/builder/shared/image-manager/image-info.tsx index 03a323c469..7fd9852d73 100644 --- a/apps/builder/app/builder/shared/image-manager/image-info.tsx +++ b/apps/builder/app/builder/shared/image-manager/image-info.tsx @@ -1,24 +1,25 @@ import { useStore } from "@nanostores/react"; -import prettyBytes from "pretty-bytes"; +import { getMimeByExtension } from "@webstudio-is/asset-uploader"; import { - theme, Box, + Button, Flex, Grid, Text, - Button, + theme, Tooltip, } from "@webstudio-is/design-system"; import { - CloudIcon, AspectRatioIcon, + CloudIcon, DimensionsIcon, + PageIcon, TrashIcon, } from "@webstudio-is/icons"; import type { Asset } from "@webstudio-is/sdk"; -import { Filename } from "./filename"; -import { getFormattedAspectRatio } from "./utils"; +import prettyBytes from "pretty-bytes"; import { $authPermit } from "~/shared/nano-states"; +import { getFormattedAspectRatio } from "./utils"; type ImageInfoProps = { asset: Asset; @@ -27,6 +28,10 @@ type ImageInfoProps = { export const ImageInfo = ({ asset, onDelete }: ImageInfoProps) => { const { size, meta, id, name } = asset; + + const parts = name.split("."); + const extension = "." + parts.pop(); + const authPermit = useStore($authPermit); const isDeleteDisabled = authPermit === "view"; @@ -36,35 +41,44 @@ export const ImageInfo = ({ asset, onDelete }: ImageInfoProps) => { return ( <> + + {name} + - - - {name} - + {prettyBytes(size)} + + + + {getMimeByExtension(extension)} + + + {"width" in meta && "height" in meta ? ( + <> + + + + {meta.width} x {meta.height} + + + + + + {getFormattedAspectRatio(meta)} + + + + ) : null} - {"width" in meta && "height" in meta ? ( - - - - - - {meta.width} x {meta.height} - - {" "} - - - - {getFormattedAspectRatio(meta)} - - - - - ) : null}