mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(post): some gifs would appear animated before expanded
This commit is contained in:
@@ -53,7 +53,9 @@ const Thumbnail = ({ commentMediaInfo, isFloatingEmbed, post, setShowThumbnail }
|
|||||||
const gifFrameUrl = useFetchGifFirstFrame(type === 'gif' ? url : undefined);
|
const gifFrameUrl = useFetchGifFirstFrame(type === 'gif' ? url : undefined);
|
||||||
const hasThumbnail = getHasThumbnail(commentMediaInfo, url);
|
const hasThumbnail = getHasThumbnail(commentMediaInfo, url);
|
||||||
|
|
||||||
if (type === 'image') {
|
if (type === 'gif' && gifFrameUrl) {
|
||||||
|
thumbnailComponent = <img src={gifFrameUrl} alt='' onClick={() => setShowThumbnail(false)} />;
|
||||||
|
} else if (type === 'image') {
|
||||||
thumbnailComponent = <img src={url} alt='' onError={handleError} onClick={() => setShowThumbnail(false)} />;
|
thumbnailComponent = <img src={url} alt='' onError={handleError} onClick={() => setShowThumbnail(false)} />;
|
||||||
} else if (type === 'video') {
|
} else if (type === 'video') {
|
||||||
thumbnailComponent = thumbnail ? (
|
thumbnailComponent = thumbnail ? (
|
||||||
@@ -66,10 +68,6 @@ const Thumbnail = ({ commentMediaInfo, isFloatingEmbed, post, setShowThumbnail }
|
|||||||
thumbnailComponent = <img src={thumbnail} alt='' onClick={() => setShowThumbnail(false)} />;
|
thumbnailComponent = <img src={thumbnail} alt='' onClick={() => setShowThumbnail(false)} />;
|
||||||
} else if (type === 'iframe') {
|
} else if (type === 'iframe') {
|
||||||
thumbnailComponent = iframeThumbnail ? <img src={iframeThumbnail} alt='' onClick={() => setShowThumbnail(false)} /> : null;
|
thumbnailComponent = iframeThumbnail ? <img src={iframeThumbnail} alt='' onClick={() => setShowThumbnail(false)} /> : null;
|
||||||
} else if (type === 'gif' && gifFrameUrl) {
|
|
||||||
thumbnailComponent = <img src={gifFrameUrl} alt='' onClick={() => setShowThumbnail(false)} />;
|
|
||||||
} else if (type === 'gif' && !gifFrameUrl) {
|
|
||||||
thumbnailComponent = <img src={url} alt='' onClick={() => setShowThumbnail(false)} />;
|
|
||||||
} else if (type === 'audio') {
|
} else if (type === 'audio') {
|
||||||
thumbnailComponent = <audio src={url} controls />;
|
thumbnailComponent = <audio src={url} controls />;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user