Skip to content

Commit f9e3d85

Browse files
committed
fixes
1 parent 558de48 commit f9e3d85

3 files changed

Lines changed: 15 additions & 4 deletions

File tree

client/src/pages/products/ad-action/AdAction.module.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
line-height: 1;
1010

1111
cursor: pointer;
12-
display: flex;
1312
align-items: center;
1413
justify-content: center;
1514
display: none;

client/src/pages/products/ad-action/AdAction.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useEffect, useRef } from "preact/hooks";
1+
import { useEffect, useRef, useState } from "preact/hooks";
22
import { Button } from "../../../design/button/Button";
33
import styles from "./global-modal.module.css";
44
import localStyles from "./AdAction.module.css";
@@ -11,7 +11,9 @@ export interface AdActionProps {
1111

1212
export function AdAction({ url, label }: AdActionProps) {
1313
const dialogRef = useRef<HTMLDialogElement>(null);
14+
const iframeRef = useRef<HTMLIFrameElement>(null);
1415
const scrollPositionRef = useRef(0);
16+
const [iframeKey, setIframeKey] = useState(0); // To force iframe reload on each open
1517

1618
const handleOpenModal = () => {
1719
// Save current scroll position
@@ -22,6 +24,10 @@ export function AdAction({ url, label }: AdActionProps) {
2224
document.body.classList.add("modal-open");
2325

2426
dialogRef.current?.showModal();
27+
iframeRef.current?.contentWindow?.postMessage(
28+
{ type: "bolt-gaming-start-ads" },
29+
"*",
30+
);
2531
};
2632

2733
const handleCloseModal = () => {
@@ -31,6 +37,8 @@ export function AdAction({ url, label }: AdActionProps) {
3137
document.body.classList.remove("modal-open");
3238
document.body.style.top = "";
3339
window.scrollTo(0, scrollPositionRef.current);
40+
41+
setIframeKey((prev) => prev + 1);
3442
};
3543

3644
useEffect(() => {
@@ -80,6 +88,8 @@ export function AdAction({ url, label }: AdActionProps) {
8088
Close Demo <Close size={20} />
8189
</button>
8290
<iframe
91+
key={iframeKey}
92+
ref={iframeRef}
8393
src={url}
8494
className={localStyles.iframe}
8595
sandbox="allow-scripts allow-same-origin allow-forms"

client/src/pages/sdks/DeveloperSDKs.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ export function DevelopmentSDKs() {
3434
action={
3535
<LinkButton
3636
href="https://github.com/BoltApp/bolt-unity-sdk"
37-
target="_blank">
37+
target="_blank"
38+
rel="noopener noreferrer">
3839
Go to Unity SDK
3940
</LinkButton>
4041
}
@@ -55,7 +56,8 @@ export function DevelopmentSDKs() {
5556
action={
5657
<LinkButton
5758
href="https://github.com/BoltApp/bolt-frontend-sdk"
58-
target="_blank">
59+
target="_blank"
60+
rel="noopener noreferrer">
5961
Go to TypeScript SDK
6062
</LinkButton>
6163
}

0 commit comments

Comments
 (0)