Skip to content

Commit

Permalink
update app layout (#17126)
Browse files Browse the repository at this point in the history
  • Loading branch information
hbjORbj authored Dec 14, 2024
1 parent 73d1a6f commit 1f4cda3
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions apps/web/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,45 @@ export default async function RootLayout({ children }: { children: React.ReactNo
}}
/>
)}
<script
nonce={nonce}
id="headScript"
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, "")};
Expand Down

0 comments on commit 1f4cda3

Please sign in to comment.