fix(challenge-modal): improve mobile iframe challenge modal positioning and sizing

This commit is contained in:
plebeius
2025-11-26 22:52:29 +01:00
parent a7dc46fe2e
commit 76e073228f
2 changed files with 21 additions and 5 deletions
@@ -145,8 +145,19 @@
cursor: default; cursor: default;
} }
.iframeContainer {
width: calc(100% - 10px);
max-width: calc(100% - 15px);
}
.iframeWrapper { .iframeWrapper {
width: 100vw; width: 100%;
height: 70vh; height: 500px;
margin: 5px 0;
}
.iframe {
border-left: none;
border-right: none;
} }
} }
@@ -216,8 +216,10 @@ const Challenge = ({ challenge, closeModal }: ChallengeProps) => {
return null; return null;
} }
const isIframeVisible = isIframeChallenge && !showIframeConfirmation;
const containerClasses = [styles.container]; const containerClasses = [styles.container];
if (isIframeChallenge) { if (isIframeVisible) {
containerClasses.push(styles.iframeContainer); containerClasses.push(styles.iframeContainer);
} }
@@ -246,13 +248,16 @@ const Challenge = ({ challenge, closeModal }: ChallengeProps) => {
} }
})(); })();
const mobileX = isIframeVisible ? 5 : window.innerWidth / 2 - 150;
const mobileY = isIframeVisible ? Math.max(10, (window.innerHeight - 600) / 2) : window.innerHeight / 2 - 200;
return ( return (
<animated.div <animated.div
className={containerClasses.join(' ')} className={containerClasses.join(' ')}
ref={nodeRef} ref={nodeRef}
style={{ style={{
x: isMobile ? window.innerWidth / 2 - 150 : x, x: isMobile ? mobileX : x,
y: isMobile ? window.innerHeight / 2 - 200 : y, y: isMobile ? mobileY : y,
touchAction: 'none', touchAction: 'none',
}} }}
> >