From 6dfc19247e02acd086ff6b5de01d0d1587f07239 Mon Sep 17 00:00:00 2001 From: Hariom Balhara Date: Tue, 18 Jul 2023 06:32:42 +0530 Subject: [PATCH] fix: Embed `theme` not working using Embed API (#10163) ## What does this PR do? Fixes #10187 See [Tests Done](https://www.loom.com/share/f03e0191b60143d8b45a505042dbfa11) ## Type of change - [x] Bug fix (non-breaking change which fixes an issue) ## How should this be tested? - [x] Configure embed to use `dark` theme and verify that dark theme is shown on event booking page(when user has light theme set). This is failing in main - Additional Tests for embed to avoid any new regression - [x] - Configure "auto" theme using embed API and see it reacts to system theme - [x] - Don't configure any theme and see that "light" theme is shown even when we switch system theme(Because User has configured light theme in App) - Tests outside embed to avoid any new regression - [x] - See that light theme is shown even after switching system theme - [x] - Now, switch the user theme to dark and see that it reflects the change. ## Mandatory Tasks [x] Make sure you have self-reviewed the code. A decent size PR without self-review might be rejected. --- apps/web/components/ui/form/Select.tsx | 4 +- apps/web/lib/app-providers.tsx | 14 +- apps/web/pages/[user]/[type].tsx | 1 + apps/web/pages/booking/[uid].tsx | 2 +- apps/web/pages/d/[link]/[slug].tsx | 1 + .../web/pages/org/[orgSlug]/[user]/[type].tsx | 1 + apps/web/pages/org/[orgSlug]/[user]/index.tsx | 1 + apps/web/pages/team/[slug]/[type].tsx | 1 + packages/embeds/embed-core/playground.ts | 14 +- .../playwright/tests/action-based.e2e.ts | 159 ++++++++++++------ .../Booker/utils/use-brand-colors.tsx | 9 +- packages/lib/hooks/useTheme.tsx | 46 +++-- packages/prisma/seed.ts | 2 + 13 files changed, 173 insertions(+), 82 deletions(-) diff --git a/apps/web/components/ui/form/Select.tsx b/apps/web/components/ui/form/Select.tsx index e54c893b7b..ca8df83836 100644 --- a/apps/web/components/ui/form/Select.tsx +++ b/apps/web/components/ui/form/Select.tsx @@ -3,7 +3,7 @@ import type { GroupBase, Props, InputProps, SingleValue, MultiValue } from "reac import ReactSelect, { components } from "react-select"; import classNames from "@calcom/lib/classNames"; -import useTheme from "@calcom/lib/hooks/useTheme"; +import { useGetTheme } from "@calcom/lib/hooks/useTheme"; export type SelectProps< Option, @@ -30,7 +30,7 @@ function Select< Group extends GroupBase