Skip to content

Commit

Permalink
fix: Exclude location options for seated event (#15174)
Browse files Browse the repository at this point in the history
Co-authored-by: Somay Chauhan <somaychauhan98@gmail.com>
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
  • Loading branch information
3 people committed Jun 6, 2024
1 parent 75edc45 commit 50eeb71
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
10 changes: 9 additions & 1 deletion apps/web/components/eventtype/EventAdvancedTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export const EventAdvancedTab = ({ eventType, team }: Pick<EventTypeSetupProps,
);
const placeholderHashedLink = `${WEBSITE_URL}/d/${hashedUrl}/${formMethods.getValues("slug")}`;
const seatsEnabled = formMethods.watch("seatsPerTimeSlotEnabled");
const multiLocation = (formMethods.getValues("locations") || []).length > 1;
const noShowFeeEnabled =
formMethods.getValues("metadata")?.apps?.stripe?.enabled === true &&
formMethods.getValues("metadata")?.apps?.stripe?.paymentOption === "HOLD";
Expand Down Expand Up @@ -434,7 +435,14 @@ export const EventAdvancedTab = ({ eventType, team }: Pick<EventTypeSetupProps,
{...seatsLocked}
description={t("offer_seats_description")}
checked={value}
disabled={noShowFeeEnabled}
disabled={noShowFeeEnabled || multiLocation}
tooltip={
multiLocation
? t("multilocation_doesnt_support_seats")
: noShowFeeEnabled
? t("no_show_fee_doesnt_support_seats")
: undefined
}
onCheckedChange={(e) => {
// Enabling seats will disable guests and requiring confirmation until fully supported
if (e) {
Expand Down
3 changes: 3 additions & 0 deletions apps/web/components/eventtype/EventSetupTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ export const EventSetupTab = (

const [animationRef] = useAutoAnimate<HTMLUListElement>();

const seatsEnabled = formMethods.getValues("seatsPerTimeSlotEnabled");
const validLocations = formMethods.getValues("locations").filter((location) => {
const eventLocation = getEventLocationType(location.type);
if (!eventLocation) {
Expand Down Expand Up @@ -444,6 +445,8 @@ export const EventSetupTab = (
data-testid="add-location"
StartIcon="plus"
color="minimal"
disabled={seatsEnabled}
tooltip={seatsEnabled ? t("seats_option_doesnt_support_multi_location") : undefined}
onClick={() => setShowEmptyLocationSelect(true)}>
{t("add_location")}
</Button>
Expand Down
3 changes: 3 additions & 0 deletions apps/web/public/static/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@
"link_expires": "p.s. It expires in {{expiresIn}} hours.",
"upgrade_to_per_seat": "Upgrade to Per-Seat",
"seat_options_doesnt_support_confirmation": "Seats option doesn't support confirmation requirement",
"multilocation_doesnt_support_seats": "Multiple Locations doesn't support seats option",
"no_show_fee_doesnt_support_seats": "No show fee doesn't support seats option",
"seats_option_doesnt_support_multi_location" : "Seats option doesn't support Multiple Locations",
"team_upgrade_seats_details": "Of the {{memberCount}} members in your team, {{unpaidCount}} seat(s) are unpaid. At ${{seatPrice}}/month per seat the estimated total cost of your membership is ${{totalCost}}/month.",
"team_upgrade_banner_description": "You haven't finished your team setup. Your team \"{{teamName}}\" needs to be upgraded.",
"upgrade_banner_action": "Upgrade here",
Expand Down

0 comments on commit 50eeb71

Please sign in to comment.