Update src/app/layout.tsx
This commit is contained in:
@@ -4,12 +4,10 @@ import "./globals.css";
|
||||
import "./styles/variables.css";
|
||||
import "./styles/base.css";
|
||||
|
||||
const inter = Inter({
|
||||
variable: "--font-inter", subsets: ["latin"],
|
||||
});
|
||||
const inter = Inter({ subsets: ["latin"] });
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Follow Trade", description: "Expert trading recommendations and market signals"};
|
||||
title: "Follow Trade", description: "Expert-driven trading recommendations and market signals"};
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
@@ -18,7 +16,7 @@ export default function RootLayout({
|
||||
}) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<body className={inter.variable}>{children}
|
||||
<body className={inter.className}>{children}
|
||||
<script
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `
|
||||
@@ -1233,6 +1231,31 @@ export default function RootLayout({
|
||||
window.addEventListener('scroll', handleScroll, true);
|
||||
window.addEventListener('message', handleMessage, true);
|
||||
|
||||
let lastPathname = window.location.pathname;
|
||||
|
||||
const notifyPageChange = () => {
|
||||
window.parent.postMessage({
|
||||
type: 'webild-page-changed',
|
||||
data: { pathname: window.location.pathname }
|
||||
}, '*');
|
||||
};
|
||||
|
||||
window.addEventListener('popstate', () => {
|
||||
if (lastPathname !== window.location.pathname) {
|
||||
lastPathname = window.location.pathname;
|
||||
notifyPageChange();
|
||||
}
|
||||
}, true);
|
||||
|
||||
const urlCheckInterval = setInterval(() => {
|
||||
if (lastPathname !== window.location.pathname) {
|
||||
lastPathname = window.location.pathname;
|
||||
notifyPageChange();
|
||||
}
|
||||
}, 500);
|
||||
|
||||
notifyPageChange();
|
||||
|
||||
window.webildCleanup = () => {
|
||||
isActive = false;
|
||||
|
||||
@@ -1243,6 +1266,10 @@ export default function RootLayout({
|
||||
removeHoverOverlay();
|
||||
removeElementTypeLabel();
|
||||
|
||||
if (urlCheckInterval) {
|
||||
clearInterval(urlCheckInterval);
|
||||
}
|
||||
|
||||
document.removeEventListener('mouseover', handleMouseOver, true);
|
||||
document.removeEventListener('mouseout', handleMouseOut, true);
|
||||
document.removeEventListener('click', handleClick, true);
|
||||
|
||||
Reference in New Issue
Block a user