mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
chore: add dev guard for memo chat (#1968)
This commit is contained in:
@ -1,18 +1,33 @@
|
||||
import classNames from "classnames";
|
||||
import { getResourceUrl } from "@/utils/resource";
|
||||
import Icon from "./Icon";
|
||||
import SquareDiv from "./kit/SquareDiv";
|
||||
import showPreviewImageDialog from "./PreviewImageDialog";
|
||||
|
||||
interface Props {
|
||||
className: string;
|
||||
resourceType: string;
|
||||
resource: Resource;
|
||||
}
|
||||
|
||||
const ResourceIcon = (props: Props) => {
|
||||
const { className, resourceType } = props;
|
||||
const { className, resource } = props;
|
||||
|
||||
let ResourceIcon = Icon.FileText;
|
||||
if (resourceType.includes("image")) {
|
||||
ResourceIcon = Icon.Image;
|
||||
if (resource.type.includes("image")) {
|
||||
const url = getResourceUrl(resource);
|
||||
return (
|
||||
<SquareDiv key={resource.id} className={classNames("cursor-pointer rounded hover:shadow", className)}>
|
||||
<img
|
||||
className="min-h-full min-w-full w-auto h-auto rounded"
|
||||
src={resource.externalLink ? url : url + "?thumbnail=1"}
|
||||
onClick={() => showPreviewImageDialog([url], 0)}
|
||||
decoding="async"
|
||||
loading="lazy"
|
||||
/>
|
||||
</SquareDiv>
|
||||
);
|
||||
}
|
||||
|
||||
const ResourceIcon = Icon.FileText;
|
||||
return <ResourceIcon className={className} />;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user