diff --git a/src/components/views/AllCatalog.jsx b/src/components/views/AllCatalog.jsx
index da8a0bf6..71ac7a58 100755
--- a/src/components/views/AllCatalog.jsx
+++ b/src/components/views/AllCatalog.jsx
@@ -78,10 +78,21 @@ const CatalogPost = ({post}) => {
const postMenuCatalogRef = useRef(null);
const popupRef = useRef(null);
const threadRefs = useRef([]);
+ const textRef = useRef(null);
+ const imageRef = useRef(null);
const [isEnoughSpaceOnRight, setIsEnoughSpaceOnRight] = useState(null);
const [isEnoughSpaceOnLeft,setIsEnoughSpaceOnLeft] = useState(null);
const [isCalculationDone,setIsCalculationDone] = useState(false);
const [hoverTimeoutId, setHoverTimeoutId] = useState(null);
+ const textRect = textRef.current?.getBoundingClientRect();
+ const imageRect = imageRef.current?.getBoundingClientRect();
+ const isMediaShowed = (thread.link && commentMediaInfo && (
+ commentMediaInfo.type === 'image' ||
+ commentMediaInfo.type === 'video' ||
+ (commentMediaInfo.type === 'webpage' &&
+ commentMediaInfo.thumbnail) ||
+ (commentMediaInfo.type === 'iframe' &&
+ commentMediaInfo.thumbnail))) ? true : false;
useLayoutEffect(() => {
@@ -337,8 +348,17 @@ const CatalogPost = ({post}) => {
style={{
opacity: isCalculationDone && isEnoughSpaceOnRight !== null ? 1 : 0,
visibility: isCalculationDone && isEnoughSpaceOnRight !== null ? 'visible' : 'hidden',
- left: isCalculationDone && isEnoughSpaceOnRight !== null && isEnoughSpaceOnRight ? '100%' : 'auto',
- right: isCalculationDone && isEnoughSpaceOnRight !== null && !isEnoughSpaceOnRight ? '100%' : 'auto',}}
+ left: isCalculationDone && isEnoughSpaceOnRight !== null && isEnoughSpaceOnRight
+ ? isMediaShowed
+ ? `calc(50% + ${imageRect.width}px / 2 + 5px)`
+ : `calc(50% + ${textRect.width}px / 2 + 5px)`
+ : 'auto',
+ right: isCalculationDone && isEnoughSpaceOnRight !== null && !isEnoughSpaceOnRight
+ ? isMediaShowed
+ ? `calc(50% + ${imageRect.width}px / 2 + 5px)`
+ : `calc(50% + ${textRect.width}px / 2 + 5px)`
+ : 'auto',
+ }}
className="thread_popup">
{
{commentMediaInfo?.type === "webpage" ? (
thread.thumbnailUrl ? (
-
{
e.target.src = fallbackImgUrl
@@ -380,7 +400,7 @@ const CatalogPost = ({post}) => {
) : null}
{commentMediaInfo?.type === "image" ? (
-
{
e.target.src = fallbackImgUrl
@@ -389,14 +409,14 @@ const CatalogPost = ({post}) => {
) : null}
{commentMediaInfo?.type === "video" ? (
-
) : null}
{commentMediaInfo?.type === "audio" ? (
-