feat: Made booker layout settings more user friendly#9397
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
2 Ignored Deployments
|
|
CAL-1894 Disabled buttons for default layouts if that layout is not enabled CAL-1889 Layout toggle improvements
CAL-1895 Hide default layout selection completely when you only enable one layout. |
| form={formMethods} | ||
| handleSubmit={(values) => { | ||
| const layoutError = validateBookerLayouts(values.defaultBookerLayouts || null); | ||
| const layoutError = validateBookerLayouts(values?.metadata?.defaultBookerLayouts || null); |
There was a problem hiding this comment.
This is an unrelated issue. I noticed that I didn't change the fieldname after I moved the layout settings to metadata, so client side validation wasn't working. It is now.
| defaultLayout: BookerLayouts.MONTH_VIEW, | ||
| enabledLayouts: bookerLayoutOptions, | ||
| }; | ||
| const bookerLayouts = event.data?.profile?.bookerLayouts || defaultBookerLayoutSettings; |
There was a problem hiding this comment.
Instead of repeating the default settings I've moved it into a reusable variable.
| // Converts the settings array into a boolean object, which can be used as form values. | ||
| const toggleValues: BookerLayoutState = bookerLayoutOptions.reduce((layouts, layout) => { | ||
| layouts[layout] = !shownSettings?.enabledLayouts | ||
| ? true |
There was a problem hiding this comment.
Before if no settings were set, all layouts would be enabled. Now we only enable the layouts that are enabled in the default settings (so only month view as of now).
| enabledLayouts: newEnabledLayouts, | ||
| // If default layout is toggled off, we set the default layout to the first enabled layout | ||
| // if there's none enabled, we set it to month view. | ||
| defaultLayout: isDefaultLayoutToggledOff |
There was a problem hiding this comment.
Added behaviour that if you disable the layout that's currently marked as the default, that we switch to the next best candidate. Otherwise you would have a layout marked as default that's actually a disabled radio button.
| {bookerLayoutOptions.map((layout) => ( | ||
| <RadioGroup.Item | ||
| className="aria-checked:bg-emphasis hover:bg-subtle focus:bg-subtle w-full rounded-[4px] p-1 text-sm transition-colors" | ||
| className="aria-checked:bg-emphasis hover:[&:not(:disabled)]:bg-subtle focus:[&:not(:disabled)]:bg-subtle w-full rounded-[4px] p-1 text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-40" |
There was a problem hiding this comment.
Style changes to not show hover effects for disabled buttons.
| let isPremiumUsername = false; | ||
|
|
||
| const layoutError = validateBookerLayouts(input?.metadata?.defaultBookerLayouts || null); | ||
| if (layoutError) { |
There was a problem hiding this comment.
There was now backend validation yet for the booker layouts in the update profile handler. There is now.
| <RadioGroup.Item | ||
| className="aria-checked:bg-emphasis hover:bg-subtle focus:bg-subtle w-full rounded-[4px] p-1 text-sm transition-colors" | ||
| className="aria-checked:bg-emphasis hover:[&:not(:disabled)]:bg-subtle focus:[&:not(:disabled)]:bg-subtle w-full rounded-[4px] p-1 text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-40" | ||
| disabled={toggleValues[layout] === false} |
There was a problem hiding this comment.
This part disables this layout for being a default layout, if the layout itself is not enabled.
📦 Next.js Bundle Analysis for @calcom/webThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
Current Playwright Test Results Summary✅ 107 Passing - Run may still be in progress, this comment will be updated as current testing workflow or job completes... (Last updated on 06/07/2023 06:15:37pm UTC) Run DetailsRunning Workflow PR Update on Github Actions Commit: d5922a1 Started: 06/07/2023 06:13:28pm UTC
|
| Test Case | Last 7 days Failures | Last 7 days Flakes |
|---|---|---|
|
Can delete user account
Retry 1 • Initial Attempt |
0.80% (3)3 / 376 runsfailed over last 7 days |
3.72% (14)14 / 376 runsflaked over last 7 days |
📄 apps/web/playwright/login.2fa.e2e.ts • 2 Flakes
Top 1 Common Error Messages
|
|
2 Test Cases Affected |
Test Case Results
| Test Case | Last 7 days Failures | Last 7 days Flakes |
|---|---|---|
|
2FA Tests should allow a user to enable 2FA and login using 2FA
Retry 1 • Initial Attempt |
0.54% (2)2 / 372 runsfailed over last 7 days |
18.28% (68)68 / 372 runsflaked over last 7 days |
|
2FA Tests should allow a user to disable 2FA
Retry 1 • Initial Attempt |
0.54% (2)2 / 370 runsfailed over last 7 days |
19.73% (73)73 / 370 runsflaked over last 7 days |
📄 packages/embeds/embed-core/playwright/tests/action-based.e2e.ts • 1 Flake
Test Case Results
| Test Case | Last 7 days Failures | Last 7 days Flakes |
|---|---|---|
|
Popup Tests should be able to reschedule
Retry 1 • Initial Attempt |
6.61% (15)15 / 227 runsfailed over last 7 days |
93.39% (212)212 / 227 runsflaked over last 7 days |
this has been undone right? ideally everyone has all 3 layouts and its opt-out to remove them |
as far as I know, yes. |
Correct. This isn't in there anymore. Let me update the description. |
|
|
||
| const layoutError = validateBookerLayouts(input?.metadata?.defaultBookerLayouts || null); | ||
| if (layoutError) { | ||
| const t = await getTranslation("en", "common"); |
There was a problem hiding this comment.
why not const t = await getTranslation(ctx.user.locale ?? "en", "common");
?
Udit-takkar
left a comment
There was a problem hiding this comment.
@JeroenReumkens LGTM great work. Left just one comment
|
@Udit-takkar is this good to merge or does your comment need addressing? If so can we jump in for @JeroenReumkens to address? |
|
@Jaibles It is good to merge. he can address the comment later |
* Made booker layout settings more user friendly * Fixed tyeps and default values in appearance form for booker layout * Enable all layouts by default
What does this PR do?
Makes booker layout settings a bit more user friendly. These things have changed:
Fixes CAL-1889 CAL-1893 CAL-1894 CAL-1895
CleanShot.2023-06-07.at.18.34.22.mp4
Type of change
How should this be tested?