Support image clips/gifs (#3583)

Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
yoshnopa
2023-05-17 01:30:51 +02:00
committed by GitHub
parent 0e199a525f
commit a2e477e1a7
62 changed files with 999 additions and 363 deletions

View File

@@ -30,7 +30,10 @@ export const ImageCard: React.FC<IImageCardProps> = (
props: IImageCardProps
) => {
const file = useMemo(
() => (props.image.files.length > 0 ? props.image.files[0] : undefined),
() =>
props.image.visual_files.length > 0
? props.image.visual_files[0]
: undefined,
[props.image]
);
@@ -138,6 +141,13 @@ export const ImageCard: React.FC<IImageCardProps> = (
return height > width;
}
const source =
props.image.paths.preview != ""
? props.image.paths.preview ?? ""
: props.image.paths.thumbnail ?? "";
const video = source.includes("preview");
const ImagePreview = video ? "video" : "img";
return (
<GridCard
className={`image-card zoom-${props.zoomIndex}`}
@@ -147,10 +157,12 @@ export const ImageCard: React.FC<IImageCardProps> = (
image={
<>
<div className={cx("image-card-preview", { portrait: isPortrait() })}>
<img
<ImagePreview
loop={video}
autoPlay={video}
className="image-card-preview-image"
alt={props.image.title ?? ""}
src={props.image.paths.thumbnail ?? ""}
src={source}
/>
{props.onPreview ? (
<div className="preview-button">