Update src/app/layout.tsx
This commit is contained in:
@@ -4,12 +4,10 @@ import "./globals.css";
|
|||||||
import "./styles/variables.css";
|
import "./styles/variables.css";
|
||||||
import "./styles/base.css";
|
import "./styles/base.css";
|
||||||
|
|
||||||
const inter = Inter({
|
const inter = Inter({ subsets: ["latin"] });
|
||||||
variable: "--font-inter", subsets: ["latin"],
|
|
||||||
});
|
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
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({
|
export default function RootLayout({
|
||||||
children,
|
children,
|
||||||
@@ -18,7 +16,7 @@ export default function RootLayout({
|
|||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<body className={inter.variable}>{children}
|
<body className={inter.className}>{children}
|
||||||
<script
|
<script
|
||||||
dangerouslySetInnerHTML={{
|
dangerouslySetInnerHTML={{
|
||||||
__html: `
|
__html: `
|
||||||
@@ -1233,6 +1231,31 @@ export default function RootLayout({
|
|||||||
window.addEventListener('scroll', handleScroll, true);
|
window.addEventListener('scroll', handleScroll, true);
|
||||||
window.addEventListener('message', handleMessage, 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 = () => {
|
window.webildCleanup = () => {
|
||||||
isActive = false;
|
isActive = false;
|
||||||
|
|
||||||
@@ -1243,6 +1266,10 @@ export default function RootLayout({
|
|||||||
removeHoverOverlay();
|
removeHoverOverlay();
|
||||||
removeElementTypeLabel();
|
removeElementTypeLabel();
|
||||||
|
|
||||||
|
if (urlCheckInterval) {
|
||||||
|
clearInterval(urlCheckInterval);
|
||||||
|
}
|
||||||
|
|
||||||
document.removeEventListener('mouseover', handleMouseOver, true);
|
document.removeEventListener('mouseover', handleMouseOver, true);
|
||||||
document.removeEventListener('mouseout', handleMouseOut, true);
|
document.removeEventListener('mouseout', handleMouseOut, true);
|
||||||
document.removeEventListener('click', handleClick, true);
|
document.removeEventListener('click', handleClick, true);
|
||||||
|
|||||||
Reference in New Issue
Block a user