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

+10 -12
View File
@@ -43,6 +43,7 @@ import {
import { useBookerTime } from "../bookings/Booker/components/hooks/useBookerTime";
import { buildCssVarsPerTheme } from "./lib/buildCssVarsPerTheme";
import { EmbedTheme } from "./lib/constants";
import { getDimension } from "./lib/getDimension";
import { useEmbedDialogCtx } from "./lib/hooks/useEmbedDialogCtx";
import { useEmbedParams } from "./lib/hooks/useEmbedParams";
@@ -68,12 +69,6 @@ type GotoStateProps = {
dialog?: string;
};
const enum Theme {
auto = "auto",
light = "light",
dark = "dark",
}
const queryParamsForDialog = [
"embedType",
"embedTabName",
@@ -178,7 +173,10 @@ function useEmbedGoto(noQueryParamMode = false) {
return { gotoState, resetState, gotoEmbedTypeSelectionState };
}
const ThemeSelectControl = ({ children, ...props }: ControlProps<{ value: Theme; label: string }, false>) => {
const ThemeSelectControl = ({
children,
...props
}: ControlProps<{ value: EmbedTheme; label: string }, false>) => {
return (
<components.Control {...props}>
<Icon name="sun" className="text-subtle mr-2 h-4 w-4" />
@@ -764,7 +762,7 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
height: "100%",
config: defaultConfig,
} as PreviewState["inline"],
theme: Theme.auto,
theme: EmbedTheme.auto,
layout: defaultConfig.layout,
floatingPopup: {
config: defaultConfig,
@@ -882,9 +880,9 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
}
const ThemeOptions = [
{ value: Theme.auto, label: "Auto" },
{ value: Theme.dark, label: "Dark Theme" },
{ value: Theme.light, label: "Light Theme" },
{ value: EmbedTheme.auto, label: "Auto" },
{ value: EmbedTheme.dark, label: "Dark EmbedTheme" },
{ value: EmbedTheme.light, label: "Light EmbedTheme" },
];
const layoutOptions = [
@@ -1113,7 +1111,7 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
<CollapsibleContent>
<div className="text-sm">
<Label className="mb-6">
<div className="mb-2">Theme</div>
<div className="mb-2">EmbedTheme</div>
<Select
className="w-full"
defaultValue={ThemeOptions[0]}
+5
View File
@@ -2,3 +2,8 @@ import { EMBED_LIB_URL, WEBAPP_URL } from "@calcom/lib/constants";
export const embedLibUrl = EMBED_LIB_URL;
export const EMBED_PREVIEW_HTML_URL = `${WEBAPP_URL}/embed/preview.html`;
export const enum EmbedTheme {
auto = "auto",
light = "light",
dark = "dark",
}