Small UI fixes for seats & destination calendars (#6859)

* Do not add former time for events on seats

* Default display destination calendar

* Add seats badge to event type item

* Add string

* Actively watch seats enabled option for requires confirmation

* Only show former time when there is a rescheduleUid
This commit is contained in:
Joe Au-Yeung authored and GitHub committed 2023-02-08 21:13:10 +00:00
1 parent 2f628a17df
commit 2462e8e597
9 files changed
+51 -10

No files matched your search

@@ -167,7 +167,7 @@ const BookingPage = ({
isSuccessBookingPage: true,
email: bookingForm.getValues("email"),
eventTypeSlug: eventType.slug,
formerTime: booking?.startTime.toString(),
...(rescheduleUid && booking?.startTime && { formerTime: booking.startTime.toString() }),
},
});
},
@@ -74,7 +74,7 @@ export const EventAdvancedTab = ({ eventType, team }: Pick<EventTypeSetupProps,
const [selectedCustomInputModalOpen, setSelectedCustomInputModalOpen] = useState(false);
const [requiresConfirmation, setRequiresConfirmation] = useState(eventType.requiresConfirmation);
const placeholderHashedLink = `${CAL_URL}/d/${hashedUrl}/${eventType.slug}`;
const seatsEnabled = formMethods.getValues("seatsPerTimeSlotEnabled");
const seatsEnabled = formMethods.watch("seatsPerTimeSlotEnabled");
const removeCustom = (index: number) => {
formMethods.getValues("customInputs").splice(index, 1);
@@ -1588,5 +1588,6 @@
"meetings_are_better_with_the_right": "Meetings are better with the right team members there. Invite them now.",
"create_a_one_one_template": "Create a one-one one template for an event type and distribute it to multiple members.",
"collective_or_roundrobin": "Collective or round-robin",
"book_your_team_members": "Book your team members together with collective events or cycle through to get the right person with round-robin."
"book_your_team_members": "Book your team members together with collective events or cycle through to get the right person with round-robin.",
"event_type_seats": "{{numberOfSeats}} seats"
}
@@ -121,6 +121,8 @@ const DestinationCalendarSelector = ({
// be used when no destination calendar is selected.
const primaryCalendar = query.data.destinationCalendarEmail;
const queryDestinationCalendar = query.data.destinationCalendar;
return (
<div className="relative" title={`${t("select_destination_calendar")}: ${selectedOption?.label || ""}`}>
<Select
@@ -129,8 +131,10 @@ const DestinationCalendarSelector = ({
!hidePlaceholder ? (
`${t("select_destination_calendar")}`
) : (
<span>
{t("default_calendar_selected")} {primaryCalendar && `(${primaryCalendar})`}
<span className="min-w-0 overflow-hidden truncate whitespace-nowrap">
{t("default_calendar_selected")}{" "}
{queryDestinationCalendar.name &&
`(${queryDestinationCalendar?.integration} - ${queryDestinationCalendar.name})`}
</span>
)
}
@@ -9,7 +9,15 @@ import { useLocale } from "@calcom/lib/hooks/useLocale";
import { baseEventTypeSelect } from "@calcom/prisma";
import { EventTypeModel } from "@calcom/prisma/zod";
import { Badge } from "@calcom/ui";
import { FiClock, FiUsers, FiRefreshCw, FiCreditCard, FiClipboard, FiPlus } from "@calcom/ui/components/icon";
import {
FiClock,
FiUsers,
FiRefreshCw,
FiCreditCard,
FiClipboard,
FiPlus,
FiUser,
} from "@calcom/ui/components/icon";
export type EventTypeDescriptionProps = {
eventType: Pick<
@@ -17,6 +25,7 @@ export type EventTypeDescriptionProps = {
Exclude<keyof typeof baseEventTypeSelect, "recurringEvent"> | "metadata"
> & {
recurringEvent: Prisma.JsonValue;
seatsPerTimeSlot?: number;
};
className?: string;
};
@@ -105,6 +114,13 @@ export const EventTypeDescription = ({ eventType, className }: EventTypeDescript
) : (
<></>
)}
{eventType.seatsPerTimeSlot && (
<li>
<Badge variant="gray" size="lg" StartIcon={FiUser}>
<p>{t("event_type_seats", { numberOfSeats: eventType.seatsPerTimeSlot })} </p>
</Badge>
</li>
)}
</ul>
</div>
</>
+1 -1
View File
@@ -69,7 +69,7 @@ export const tips = [
title: "Automate Workflows",
description: "Make time work for you and automate tasks",
href: "https://go.cal.com/workflows",
},
},
];
export default function Tips() {
+21 -2
View File
@@ -1,4 +1,4 @@
import { AppCategories, BookingStatus, IdentityProvider, Prisma } from "@prisma/client";
import { AppCategories, BookingStatus, DestinationCalendar, IdentityProvider, Prisma } from "@prisma/client";
import _ from "lodash";
import { authenticator } from "otplib";
import z from "zod";
@@ -374,9 +374,28 @@ const loggedInViewerRouter = router({
destinationCalendarEmail = destinationCal?.email ?? user.destinationCalendar?.externalId;
}
let destinationCalendarName = user.destinationCalendar?.externalId || "";
let destinationCalendarIntegration = "";
for (const integration of connectedCalendars) {
if (integration.calendars) {
for (const calendar of integration.calendars) {
if (calendar.externalId === user.destinationCalendar?.externalId) {
destinationCalendarName = calendar.name || calendar.externalId;
destinationCalendarIntegration = integration.integration.title || "";
break;
}
}
}
}
return {
connectedCalendars,
destinationCalendar: user.destinationCalendar,
destinationCalendar: {
...(user.destinationCalendar as DestinationCalendar),
name: destinationCalendarName,
integration: destinationCalendarIntegration,
},
destinationCalendarEmail,
};
}),
@@ -320,7 +320,7 @@ export const bookingsRouter = router({
const recurringInfo = recurringInfoBasic.map(
(
info: (typeof recurringInfoBasic)[number]
info: typeof recurringInfoBasic[number]
): {
recurringEventId: string | null;
count: number;
@@ -202,6 +202,7 @@ export const eventTypesRouter = router({
},
},
},
seatsPerTimeSlot: true,
...baseEventTypeSelect,
});