Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CAL-1673: Use dark/light colors from user profile settings in booker #8905

Merged
merged 3 commits into from May 18, 2023

Conversation

JeroenReumkens
Copy link
Contributor

What does this PR do?

New booker didn't use the theme setting in appearance to make the booker dark / light. With this PR that is now the case.

Fixes CAL-1673

Environment: Staging(main branch)

Type of change

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

How should this be tested?

  • Ensure that when changing the appearance in the app settings, the booker is either force light/dark or automatic based on your system preferences.

@JeroenReumkens JeroenReumkens requested a review from a team May 15, 2023 13:31
@linear
Copy link

linear bot commented May 15, 2023

CAL-1673 new booker: only dark mode for me

seems like light mode is not working, its always dark for me

@vercel
Copy link

vercel bot commented May 15, 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 May 18, 2023 6:06am
ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 18, 2023 6:06am


const PoweredBy = dynamic(() => import("@calcom/ee/components/PoweredBy"));
const DatePicker = dynamic(() => import("./components/DatePicker").then((mod) => mod.DatePicker), {
ssr: false,
});

const useBrandColors = ({ brandColor, darkBrandColor }: { brandColor?: string; darkBrandColor?: string }) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved it to a separate file so booker component stays more readable <3

@github-actions
Copy link
Contributor

github-actions bot commented May 15, 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

deploysentinel bot commented May 15, 2023

Current Playwright Test Results Summary

✅ 98 Passing - ⚠️ 4 Flaky

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

(Last updated on 05/18/2023 06:16:13am UTC)

Run Details

Running Workflow PR Update on Github Actions

Commit: 7251874

Started: 05/18/2023 06:05:23am UTC

⚠️ Flakes

📄   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 2Retry 1Initial Attempt
1.48% (4) 4 / 271 runs
failed over last 7 days
25.46% (69) 69 / 271 runs
flaked over last 7 days

📄   apps/web/playwright/embed-code-generator.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Embed Code Generator Tests Event Type Edit Page open Embed Dialog for the Event Type
Retry 1Initial Attempt
6.14% (17) 17 / 277 runs
failed over last 7 days
29.96% (83) 83 / 277 runs
flaked over last 7 days

📄   apps/web/playwright/booking-seats.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
Booking with Seats -- new-booker Reschedule for booking with seats -- old-booker Should reschedule booking with seats and if everyone rescheduled it should be deleted
Retry 1Initial Attempt
0% (0) 0 / 276 runs
failed over last 7 days
83.33% (230) 230 / 276 runs
flaked over last 7 days
Booking with Seats -- old-booker Reschedule for booking with seats -- old-booker Should reschedule booking with seats and if everyone rescheduled it should be deleted
Retry 1Initial Attempt
0% (0) 0 / 276 runs
failed over last 7 days
20.29% (56) 56 / 276 runs
flaked over last 7 days

View Detailed Build Results


Copy link
Contributor

@leog leog left a comment

Choose a reason for hiding this comment

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

LGTM, great stuff!

useEffect(() => {
if (theme) setTheme(theme);
}, [setTheme, theme]);
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this util maybe worth having it in a more generic path to be applied somewhere else if makes sense? perhaps @calcom/lib?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah great question. I took the logic from the current booker, and actually not really sure if it's used anywhere else (and the current booker will be gone soon).

@sean-brydon what do you think about this? It pretty much combines most of your hooks into one hook – so perhaps it indeed makes sense to reuse it. On top of that I also added an effect that triggers the setTheme again, because in our case the theme is undefined during load, which would cause to set the default and not update it anymore later.

@PeerRich PeerRich requested a review from sean-brydon May 15, 2023 20:17
@@ -113,6 +115,7 @@ export const getPublicEvent = async (username: string, eventSlug: string, prisma
image: `${WEBAPP_URL}/${users[0].username}/avatar.png`,
brandColor: users[0].brandColor,
darkBrandColor: users[0].darkBrandColor,
theme: users[0].theme,
Copy link
Member

Choose a reason for hiding this comment

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

It doesn't seem to use system theme for dynamic booking. I am not sure which is better, but currently dynamic group bookings always use system theme(by setting theme to null) as it's not clear whose theme to use, so we use system theme which is a good default.

Copy link
Member

Choose a reason for hiding this comment

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

Also, I don't see handling for team.theme. That got added not too long ago.

The team handling is there, nevermind. Beautifully handled. Only, dynamic group booking handling is different.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point! I'll change dynamic theme to system theme indeed. Makes a lot of sense! Thanks for spotting this!

Copy link
Member

@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.

Looks good. Works good 🙏

Blocking merge just to get clarity on the dynamic booking link theme first.

@JeroenReumkens
Copy link
Contributor Author

@hariombalhara Thanks a lot for checking this! Just now updated the dynamic booking to indeed use the system theme. Makes a lot more sense. Ready to approve? 😁

Copy link
Member

@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.

All good !!

@hariombalhara hariombalhara added this pull request to the merge queue May 18, 2023
Merged via the queue into main with commit 175fc4f May 18, 2023
21 checks passed
@hariombalhara hariombalhara deleted the fix/use-dark-lightmode-from-user-settings branch May 18, 2023 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants