mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
fix Clip Gif Support (#3765)
This commit is contained in:
@@ -25,6 +25,7 @@ import { ImageDetailPanel } from "./ImageDetailPanel";
|
||||
import { DeleteImagesDialog } from "../DeleteImagesDialog";
|
||||
import { faEllipsisV } from "@fortawesome/free-solid-svg-icons";
|
||||
import { objectPath, objectTitle } from "src/core/files";
|
||||
import { isVideo } from "src/utils/visualFile";
|
||||
|
||||
interface IImageParams {
|
||||
id?: string;
|
||||
@@ -260,8 +261,7 @@ export const Image: React.FC = () => {
|
||||
}
|
||||
|
||||
const title = objectTitle(image);
|
||||
const ImageView =
|
||||
image.visual_files[0].__typename == "VideoFile" ? "video" : "img";
|
||||
const ImageView = isVideo(image.visual_files[0]) ? "video" : "img";
|
||||
|
||||
return (
|
||||
<div className="row">
|
||||
|
||||
@@ -47,6 +47,7 @@ import {
|
||||
} from "@fortawesome/free-solid-svg-icons";
|
||||
import { RatingSystem } from "src/components/Shared/Rating/RatingSystem";
|
||||
import { useDebounce } from "../debounce";
|
||||
import { isVideo } from "src/utils/visualFile";
|
||||
|
||||
const CLASSNAME = "Lightbox";
|
||||
const CLASSNAME_HEADER = `${CLASSNAME}-header`;
|
||||
@@ -850,7 +851,7 @@ export const LightboxComponent: React.FC<IProps> = ({
|
||||
scrollAttemptsBeforeChange={scrollAttemptsBeforeChange}
|
||||
setZoom={(v) => setZoom(v)}
|
||||
resetPosition={resetPosition}
|
||||
isVideo={image.visual_files?.[0]?.__typename == "VideoFile"}
|
||||
isVideo={isVideo(image.visual_files?.[0] ?? {})}
|
||||
/>
|
||||
) : undefined}
|
||||
</div>
|
||||
|
||||
@@ -10,6 +10,7 @@ interface IFiles {
|
||||
__typename?: string;
|
||||
width: number;
|
||||
height: number;
|
||||
video_codec?: GQL.Maybe<string>;
|
||||
}
|
||||
|
||||
export interface ILightboxImage {
|
||||
|
||||
9
ui/v2.5/src/utils/visualFile.ts
Normal file
9
ui/v2.5/src/utils/visualFile.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { Maybe } from "src/core/generated-graphql";
|
||||
|
||||
// returns true if the file should be treated as a video in the UI
|
||||
export function isVideo(o: {
|
||||
__typename?: string;
|
||||
video_codec?: Maybe<string>;
|
||||
}) {
|
||||
return o.__typename == "VideoFile" && o.video_codec != "gif";
|
||||
}
|
||||
Reference in New Issue
Block a user