mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(post): image marked as spoiler was visible
This commit is contained in:
@@ -135,7 +135,7 @@ interface ImageProps {
|
|||||||
|
|
||||||
const Image = ({ commentMediaInfo, displayHeight, displayWidth, isOutOfFeed, post }: ImageProps) => {
|
const Image = ({ commentMediaInfo, displayHeight, displayWidth, isOutOfFeed, post }: ImageProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { parentCid } = post || {};
|
const { parentCid, spoiler } = post || {};
|
||||||
const { type, url } = commentMediaInfo || {};
|
const { type, url } = commentMediaInfo || {};
|
||||||
const isReply = parentCid;
|
const isReply = parentCid;
|
||||||
const isMobile = useIsMobile();
|
const isMobile = useIsMobile();
|
||||||
@@ -151,6 +151,15 @@ const Image = ({ commentMediaInfo, displayHeight, displayWidth, isOutOfFeed, pos
|
|||||||
const [hasError, setHasError] = useState(false);
|
const [hasError, setHasError] = useState(false);
|
||||||
const handleError = () => setHasError(true);
|
const handleError = () => setHasError(true);
|
||||||
|
|
||||||
|
if (spoiler && !isImageExpanded) {
|
||||||
|
const spoilerDimensions = { '--width': '150px', '--height': '150px' } as React.CSSProperties;
|
||||||
|
return (
|
||||||
|
<span className={`${isOutOfFeed ? styles.subplebbitAvatar : styles.thumbnailBig} ${styles.thumbnail}`} style={spoilerDimensions}>
|
||||||
|
<img className={styles.spoiler} src='assets/spoiler.png' alt='' onClick={() => setIsImageExpanded(true)} />
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return isMobile ? (
|
return isMobile ? (
|
||||||
<span className={styles.thumbnail}>
|
<span className={styles.thumbnail}>
|
||||||
<span
|
<span
|
||||||
@@ -227,7 +236,7 @@ const CommentMedia = ({ commentMediaInfo, isFloatingEmbed, post, showThumbnail,
|
|||||||
displayHeight = '100%';
|
displayHeight = '100%';
|
||||||
}
|
}
|
||||||
const { isDescription, isRules } = post || {}; // custom properties, not from api
|
const { isDescription, isRules } = post || {}; // custom properties, not from api
|
||||||
const isOutOfFeed = isDescription || isRules || isFloatingEmbed; // virtuoso wrapper unneeded
|
const isOutOfFeed = isDescription || isRules || isFloatingEmbed || spoiler; // virtuoso wrapper unneeded
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<span className={styles.content}>
|
<span className={styles.content}>
|
||||||
|
|||||||
Reference in New Issue
Block a user