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

fix: Timezone in Email Embed not working #15525 #15537

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/features/embed/Embed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ const EmailEmbed = ({
<Collapsible open>
<CollapsibleContent>
<div className="text-default mb-[9px] text-sm">{t("timezone")}</div>
<TimezoneSelect id="timezone" value={timezone} isDisabled />
Copy link
Contributor

Choose a reason for hiding this comment

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

@acharyayush how about toggling the value of the prop isDisabled?
<TimezoneSelect id="timezone" value={timezone} isDisabled={false} />

<TimezoneSelect id="timezone" value={timezone} isDisabled={false} />
Copy link
Contributor

Choose a reason for hiding this comment

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

@hariombalhara was this disabled on purpose?

Copy link
Member

Choose a reason for hiding this comment

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

@Pradumn27 worked on this feature. I believe there has to be a reason. It isn't accidental.

</CollapsibleContent>
</Collapsible>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useMemo, useState } from "react";
import type { ITimezoneOption, ITimezone, Props as SelectProps } from "react-timezone-select";
import BaseSelect from "react-timezone-select";

import { useTimePreferences } from "@calcom/features/bookings/lib/timePreferences";
import { classNames } from "@calcom/lib";
import { filterByCities, addCitiesToDropdown, handleOptionLabel } from "@calcom/lib/timezone";
import { trpc } from "@calcom/trpc/react";
Expand Down Expand Up @@ -42,6 +43,7 @@ export function TimezoneSelectComponent({
value,
...props
}: TimezoneSelectComponentProps) {
const [setTimezone] = useTimePreferences((state) => [state.setTimezone]);
const [cities, setCities] = useState<ICity[]>([]);
const handleInputChange = (tz: string) => {
if (data) setCities(filterByCities(tz, data));
Expand All @@ -64,6 +66,7 @@ export function TimezoneSelectComponent({
...(data ? addCitiesToDropdown(data) : {}),
...addCitiesToDropdown(cities),
}}
onChange={({ value }) => setTimezone(value)}
Copy link
Contributor

@Ryukemeister Ryukemeister Jun 24, 2024

Choose a reason for hiding this comment

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

Aren't onChange and onInputChange handlers one and the same? The issue was that the timezone selector was disabled because of previously setting the isDisabled prop to true right? So is this really needed now?

onInputChange={handleInputChange}
{...props}
formatOptionLabel={(option) => (
Expand Down
Loading