Skip to content

Fix/Keep themes in peace across embed and booking pages and App#8108

Merged
hariombalhara merged 8 commits into
mainfrom
fix/make-themes-in-peace-across-embed-booking-app
Apr 17, 2023
Merged

Fix/Keep themes in peace across embed and booking pages and App#8108
hariombalhara merged 8 commits into
mainfrom
fix/make-themes-in-peace-across-embed-booking-app

Conversation

@hariombalhara
Copy link
Copy Markdown
Member

@hariombalhara hariombalhara commented Apr 5, 2023

What does this PR do?

Fixes #8068

  • Ensures, different embeds with different namespace can have different themes simultaneously.
  • Ensure, App can be in one theme for an organizer and his Booking Pages can be in another theme. This is required because App uses System Theme only and Booking Pages use theme configured in Appearance.
  • Cleans up unnecessary use of useTheme and documents it better so that it's users would know when it should be used.

Environment: Production

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How should this be tested?

Checklist

  • I haven't added tests that prove my fix is effective or that my feature works

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 5, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
cal ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 17, 2023 11:52am
ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 17, 2023 11:52am
web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 17, 2023 11:52am

@hariombalhara hariombalhara changed the base branch from main to feat/tokens April 5, 2023 13:21
@hariombalhara hariombalhara mentioned this pull request Apr 5, 2023
7 tasks
Comment thread apps/web/lib/app-providers.tsx Outdated
const forcedTheme = !isThemeSupported ? "light" : undefined;
const themeSupport = isBookingPage
? ThemeSupport.Booking
: props.isThemeSupported === false
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if isThemeSupport is explicitly false, then theme would be none otherwise we consider it App Theme

? ThemeSupport.None
: ThemeSupport.App;

const forcedTheme = themeSupport === ThemeSupport.None ? "light" : undefined;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If theme is none, we force light mode regardless of what's stored in storage.

Comment thread apps/web/lib/app-providers.tsx Outdated
@hariombalhara hariombalhara force-pushed the fix/make-themes-in-peace-across-embed-booking-app branch from b3be9a9 to 0610a3f Compare April 5, 2023 13:30
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 5, 2023

📦 Next.js Bundle Analysis for @calcom/web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@deploysentinel
Copy link
Copy Markdown

deploysentinel Bot commented Apr 5, 2023

Current Playwright Test Results Summary

✅ 67 Passing - ⚠️ 4 Flaky

Run may still be in progress, this comment will be updated as current testing workflow or job completes...

(Last updated on 04/17/2023 12:03:58pm UTC)

Run Details

Running Workflow PR Update on Github Actions

Commit: c4fce55

Started: 04/17/2023 11:57:08am UTC

⚠️ Flakes

📄   apps/web/playwright/webhook.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
add webhook & test that creating an event triggers a webhook call
Retry 1Initial Attempt
0% (0) 0 / 210 runs
failed over last 7 days
1.43% (3) 3 / 210 runs
flaked over last 7 days

📄   apps/web/playwright/managed-event-types.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Managed Event Types tests Can create managed event type
Retry 1Initial Attempt
2.35% (2) 2 / 85 runs
failed over last 7 days
35.29% (30) 30 / 85 runs
flaked over last 7 days

📄   packages/app-store/routing-forms/playwright/tests/basic.e2e.ts • 2 Flakes

Top 1 Common Error Messages

null

2 Test Cases Affected

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Routing Forms Seeded Routing Form Routing Link - Reporting and CSV Download
Retry 1Initial Attempt
8.33% (17) 17 / 204 runs
failed over last 7 days
27.45% (56) 56 / 204 runs
flaked over last 7 days
Routing Forms Seeded Routing Form Router URL should work
Retry 1Initial Attempt
2.45% (5) 5 / 204 runs
failed over last 7 days
13.73% (28) 28 / 204 runs
flaked over last 7 days

View Detailed Build Results


Base automatically changed from feat/tokens to main April 5, 2023 18:14
@hariombalhara hariombalhara marked this pull request as ready for review April 12, 2023 05:49
@hariombalhara hariombalhara requested a review from a team April 12, 2023 05:49
@hariombalhara hariombalhara requested a review from zomars as a code owner April 12, 2023 05:49
@hariombalhara hariombalhara requested a review from a team April 12, 2023 05:49
Copy link
Copy Markdown
Member Author

@hariombalhara hariombalhara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self review done

} as const;
};

TeamPage.isBookingPage = true;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With new Booker I expect it to be simpler to identify a booking page and thus we can set the prop at one place.

This is required because we can't reliably derive if the page being served is a booking page by it's URL.

/>
);
}
FormEditPage.isThemeSupported = true;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to set isThemeSupported for App Pages. They by default support system theme

}

RoutingLink.isThemeSupported = true;
RoutingLink.isBookingPage = true;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Booking Pages, we don;t need to set isThemeSupported because isBookingPage being true derives that.

const [loading, setLoading] = useState(false);
const telemetry = useTelemetry();
const [error, setError] = useState<string | null>(booking ? null : t("booking_already_cancelled"));
useTheme(props.theme);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to use useTheme here. It's used by booking/[uid] and that has useTheme call.

Comment thread apps/web/pages/[user].tsx
);
}

User.isBookingPage = true;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has to be set on all booking pages(including routing forms)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wish there could have been a single place to mark a page as a booking page that can be used by app-providers

cc @JeroenReumkens Not sure if new booker can do this.

Comment thread apps/web/styles/globals.css Outdated
--cal-brand-text: white;
}
.dark {
color-scheme: dark;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sean-brydon I removed this in the PR. Though it should go live as a separate hotfix once you confirm

@github-actions
Copy link
Copy Markdown
Contributor

📦 Next.js Bundle Analysis for @calcom/web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@github-actions
Copy link
Copy Markdown
Contributor

📦 Next.js Bundle Analysis for @calcom/web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

Copy link
Copy Markdown
Member

@sean-brydon sean-brydon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - One question will this change anything like login/onboarding/password reset where we always force light?

Guessing not since its controlled by isThemeSupported still?

@hariombalhara hariombalhara requested a review from G3root April 17, 2023 11:25
@hariombalhara
Copy link
Copy Markdown
Member Author

isThemeSupported

Yeah isThemeSupported is explicitly false there. So, themeSupport would be none
Screenshot 2023-04-17 at 4 57 08 PM

@hariombalhara hariombalhara removed the request for review from G3root April 17, 2023 11:30
@github-actions
Copy link
Copy Markdown
Contributor

📦 Next.js Bundle Analysis for @calcom/web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

Five Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load % of Budget (350 KB)
/[user]/book 188.93 KB 420.31 KB 120.09% (🟡 +0.14%)
/apps/[slug]/[...pages] 389.06 KB 620.45 KB 177.27% (🟢 -0.17%)
/auth/setup 81.57 KB 312.96 KB 89.42% (🟢 -0.17%)
/d/[link]/book 188.58 KB 419.96 KB 119.99% (🟡 +0.14%)
/team/[slug]/book 188.58 KB 419.96 KB 119.99% (🟡 +0.14%)
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this. If you see "+/- <0.01%" it means that there was a change in bundle size, but it is a trivial enough amount that it can be ignored.

@github-actions
Copy link
Copy Markdown
Contributor

📦 Next.js Bundle Analysis for @calcom/web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@hariombalhara hariombalhara merged commit 2c96444 into main Apr 17, 2023
@hariombalhara hariombalhara deleted the fix/make-themes-in-peace-across-embed-booking-app branch April 17, 2023 12:16
@PeerRich PeerRich added the core area: core, team members only label Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge core area: core, team members only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CAL-1456] Booking area flickring after embedding

3 participants