Skip to content

Scheduling infrastructure for absolutely everyone.

update app layout (#17126)

Benny Joo1f4cda31ac85
diff --git a/apps/web/app/layout.tsx b/apps/web/app/layout.tsx
index 9b69346a2e1..6d59291a112 100644
--- a/apps/web/app/layout.tsx
+++ b/apps/web/app/layout.tsx
@@ -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, "")};