mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
Fix UI error when image has no files (#5325)
This commit is contained in:
@@ -279,7 +279,10 @@ const ImagePage: React.FC<IProps> = ({ image }) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const title = objectTitle(image);
|
const title = objectTitle(image);
|
||||||
const ImageView = isVideo(image.visual_files[0]) ? "video" : "img";
|
const ImageView =
|
||||||
|
image.visual_files.length > 0 && isVideo(image.visual_files[0])
|
||||||
|
? "video"
|
||||||
|
: "img";
|
||||||
|
|
||||||
const resolution = useMemo(() => {
|
const resolution = useMemo(() => {
|
||||||
return file?.width && file?.height
|
return file?.width && file?.height
|
||||||
@@ -362,19 +365,21 @@ const ImagePage: React.FC<IProps> = ({ image }) => {
|
|||||||
{renderTabs()}
|
{renderTabs()}
|
||||||
</div>
|
</div>
|
||||||
<div className="image-container">
|
<div className="image-container">
|
||||||
<ImageView
|
{image.visual_files.length > 0 && (
|
||||||
loop={image.visual_files[0].__typename == "VideoFile"}
|
<ImageView
|
||||||
autoPlay={image.visual_files[0].__typename == "VideoFile"}
|
loop={image.visual_files[0].__typename == "VideoFile"}
|
||||||
controls={image.visual_files[0].__typename == "VideoFile"}
|
autoPlay={image.visual_files[0].__typename == "VideoFile"}
|
||||||
className="m-sm-auto no-gutter image-image"
|
controls={image.visual_files[0].__typename == "VideoFile"}
|
||||||
style={
|
className="m-sm-auto no-gutter image-image"
|
||||||
image.visual_files[0].__typename == "VideoFile"
|
style={
|
||||||
? { width: "100%", height: "100%" }
|
image.visual_files[0].__typename == "VideoFile"
|
||||||
: {}
|
? { width: "100%", height: "100%" }
|
||||||
}
|
: {}
|
||||||
alt={title}
|
}
|
||||||
src={image.paths.image ?? ""}
|
alt={title}
|
||||||
/>
|
src={image.paths.image ?? ""}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user