fix: App theme being used in routing-form embed (#19489)

* fix wrong theme routing-form embed

* fix wrong theme routing-form embed
This commit is contained in:
Hariom Balhara authored and GitHub committed 2025-02-28 23:50:46 +05:30
1 parent 6068829d70
commit 564c84dade
13 files changed
+433 -157

No files matched your search

@@ -7,7 +7,7 @@ export default async function BookingPageWrapperLayout({ children }: { children:
const nonce = h.get("x-nonce") ?? undefined;
return (
<PageWrapper isBookingPage={true} requiresLicense={false} nonce={nonce} themeBasis={null}>
<PageWrapper isBookingPage={true} requiresLicense={false} nonce={nonce}>
{children}
</PageWrapper>
);
+1 -1
View File
@@ -7,7 +7,7 @@ export default async function PageWrapperLayout({ children }: { children: React.
const nonce = h.get("x-nonce") ?? undefined;
return (
<PageWrapper requiresLicense={false} nonce={nonce} themeBasis={null}>
<PageWrapper requiresLicense={false} nonce={nonce}>
{children}
</PageWrapper>
);
-40
View File
@@ -78,46 +78,6 @@ export default async function RootLayout({ children }: { children: React.ReactNo
}}
/>
)}
<script
nonce={nonce}
id="headScript"
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{
__html: `
window.calNewLocale = "${locale}";
(function applyTheme() {
try {
const appTheme = localStorage.getItem('app-theme');
if (!appTheme) return;
let bookingTheme, username;
for (let i = 0; i < localStorage.length; i++) {
const key = localStorage.key(i);
if (key.startsWith('booking-theme:')) {
bookingTheme = localStorage.getItem(key);
username = key.split("booking-theme:")[1];
break;
}
}
const onReady = () => {
const isBookingPage = username && window.location.pathname.slice(1).startsWith(username);
if (document.body) {
document.body.classList.add(isBookingPage ? bookingTheme : appTheme);
} else {
requestAnimationFrame(onReady);
}
};
requestAnimationFrame(onReady);
} catch (e) {
console.error('Error applying theme:', e);
}
})();
`,
}}
/>
<style>{`
:root {
--font-inter: ${interFont.style.fontFamily.replace(/\'/g, "")};
+1 -1
View File
@@ -246,7 +246,7 @@ const ServerPage = async () => {
const h = headers();
const nonce = h.get("x-nonce") ?? undefined;
return (
<PageWrapper requiresLicense={false} nonce={nonce} themeBasis={null}>
<PageWrapper requiresLicense={false} nonce={nonce}>
<NotFound t={t} headers={h} />
</PageWrapper>
);