Skip to content

Commit

Permalink
updated to use
Browse files Browse the repository at this point in the history
  • Loading branch information
sharunkumar committed Nov 8, 2023
1 parent 676d5d8 commit ca9720e
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/features/gallery/GalleryImg.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import "photoswipe/dist/photoswipe.css";
import { PostView } from "lemmy-js-client";
import { GalleryContext } from "./GalleryProvider";
import { PreparedPhotoSwipeOptions } from "photoswipe";
import mime from "mime";
import Video from "../shared/Video";
import { isUrlVideo } from "../../helpers/lemmy";

export interface GalleryImgProps {
src?: string;
Expand Down Expand Up @@ -35,11 +35,7 @@ export function GalleryImg({
const imgRef = useRef<HTMLImageElement>(null);
const { open } = useContext(GalleryContext);

const mt = mime.getType(`${src}`);

const isVideo = mt?.startsWith("video/");

const InnerComponent = !isVideo ? (
return !isUrlVideo(`${src}`) ? (
<img
ref={imgRef}
draggable="false"
Expand All @@ -63,6 +59,4 @@ export function GalleryImg({
) : (
<Video src={`${src}`} />
);

return InnerComponent;
}

0 comments on commit ca9720e

Please sign in to comment.