Recurring event improvements (#2750)

* Loading state and rejected bookings gone

* Listing fixes

* Tweaking upcoming vs recurring bookings tabs

* Tweaking new emails to avoid recurringEvent param

* Tweaks to support recurring events in common flows

* Missed one renderEmail

* Removing uneeded references

* Reverting manual plural fixes

* Refactoring recurring event strings

* Correcting merge issues

* Relying on newly introduced obj

* Fixing mobile

* Final tweaks

* Latest fixes

Co-authored-by: Peer Richelsen <[email protected]>
Co-authored-by: Bailey Pumfleet <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2022-06-10 17:38:06 -03:00
1 parent 67a7c578b1
commit 514fca7a53
25 files changed
+999 -510

No files matched your search

+14 -10
View File
@@ -3,22 +3,26 @@ import timezone from "dayjs/plugin/timezone";
import { TFunction } from "next-i18next";
import rrule from "rrule";
import { getEveryFreqFor } from "@calcom/lib/recurringStrings";
import type { CalendarEvent } from "@calcom/types/Calendar";
import { RecurringEvent } from "@calcom/types/Calendar";
import { Info } from "./Info";
dayjs.extend(timezone);
function getRecurringWhen(props: { calEvent: CalendarEvent }) {
const t = props.calEvent.attendees[0].language.translate;
const { calEvent: { recurringEvent } = {} } = props;
return recurringEvent?.count && recurringEvent?.freq
? ` - ${t("every_for_freq", {
freq: t(`${rrule.FREQUENCIES[recurringEvent.freq].toString().toLowerCase()}`),
})} ${recurringEvent.count} ${t(`${rrule.FREQUENCIES[recurringEvent.freq].toString().toLowerCase()}`, {
count: recurringEvent.count,
})}`
: "";
function getRecurringWhen({ calEvent }: { calEvent: CalendarEvent }) {
if (calEvent.recurringEvent) {
const t = calEvent.attendees[0].language.translate;
const rruleOptions = new rrule(calEvent.recurringEvent).options;
const recurringEvent: RecurringEvent = {
freq: rruleOptions.freq,
count: rruleOptions.count || 1,
interval: rruleOptions.interval,
};
return ` - ${getEveryFreqFor({ t, recurringEvent })}`;
}
return "";
}
export function WhenInfo(props: { calEvent: CalendarEvent; timeZone: string; t: TFunction }) {
@@ -15,7 +15,11 @@ export const OrganizerRequestEmail = (props: React.ComponentProps<typeof Organiz
<CallToActionTable>
<CallToAction
label={props.calEvent.organizer.language.translate("confirm_or_reject_request")}
href={process.env.NEXT_PUBLIC_WEBAPP_URL + "/bookings/upcoming"}
href={
process.env.NEXT_PUBLIC_WEBAPP_URL + props.calEvent.recurringEvent?.count
? "/bookings/recurring"
: "/bookings/upcoming"
}
/>
</CallToActionTable>
}