feat: add time shift badge for recurring events with shifted local times (#25568)
* feat: highlight recurring bookings with time shift badge across DST * Update packages/lib/__tests__/timeShift.test.ts Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> * refactor: show time shift badge only on first shift in bookings view and occurrences * refactor: update recurring bookings display logic and wrap booking title text * refactor: add getFirstShiftFlags helper for time shift flags and update components --------- Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
da4fec9c27
commit
8dc8d87ad0
5 files changed
+160
-12
No files matched your search
@@ -38,6 +38,7 @@ import isSmsCalEmail from "@calcom/lib/isSmsCalEmail";
|
||||
import { markdownToSafeHTML } from "@calcom/lib/markdownToSafeHTML";
|
||||
import { getEveryFreqFor } from "@calcom/lib/recurringStrings";
|
||||
import { getIs24hClockFromLocalStorage, isBrowserLocale24h } from "@calcom/lib/timeFormat";
|
||||
import { getTimeShiftFlags, getFirstShiftFlags } from "@calcom/lib/timeShift";
|
||||
import { CURRENT_TIMEZONE } from "@calcom/lib/timezoneConstants";
|
||||
import { localStorage } from "@calcom/lib/webstorage";
|
||||
import { BookingStatus, SchedulingType } from "@calcom/prisma/enums";
|
||||
@@ -571,8 +572,14 @@ export default function Success(props: PageProps) {
|
||||
</>
|
||||
)}
|
||||
<div className="font-medium">{t("what")}</div>
|
||||
<div className="col-span-2 mb-6 break-words last:mb-0" data-testid="booking-title">
|
||||
{isRoundRobin ? (typeof bookingInfo.title === 'string' ? bookingInfo.title : eventName) : eventName}
|
||||
<div
|
||||
className="wrap-break-word col-span-2 mb-6 last:mb-0"
|
||||
data-testid="booking-title">
|
||||
{isRoundRobin
|
||||
? typeof bookingInfo.title === "string"
|
||||
? bookingInfo.title
|
||||
: eventName
|
||||
: eventName}
|
||||
</div>
|
||||
<div className="font-medium">{t("when")}</div>
|
||||
<div className="col-span-2 mb-6 last:mb-0">
|
||||
@@ -1163,6 +1170,12 @@ function RecurringBookings({
|
||||
if (!duration) return null;
|
||||
|
||||
if (recurringBookingsSorted && allRemainingBookings) {
|
||||
const shiftFlags = getTimeShiftFlags({
|
||||
dates: recurringBookingsSorted,
|
||||
timezone: tz,
|
||||
});
|
||||
const displayFlags = getFirstShiftFlags(shiftFlags);
|
||||
|
||||
return (
|
||||
<>
|
||||
{eventType.recurringEvent?.count && (
|
||||
@@ -1197,6 +1210,14 @@ function RecurringBookings({
|
||||
<span className="text-bookinglight">
|
||||
({formatToLocalizedTimezone(dayjs.utc(dateStr), language, tz)})
|
||||
</span>
|
||||
{displayFlags[idx] && (
|
||||
<>
|
||||
{" "}
|
||||
<Badge variant="orange" size="sm">
|
||||
{t("time_shift")}
|
||||
</Badge>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
{recurringBookingsSorted.length > 4 && (
|
||||
@@ -1228,6 +1249,14 @@ function RecurringBookings({
|
||||
<span className="text-bookinglight">
|
||||
({formatToLocalizedTimezone(dayjs.utc(dateStr), language, tz)})
|
||||
</span>
|
||||
{displayFlags[idx + 4] && (
|
||||
<>
|
||||
{" "}
|
||||
<Badge variant="orange" size="sm">
|
||||
{t("time_shift")}
|
||||
</Badge>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
</CollapsibleContent>
|
||||
|
||||
Reference in new issue
Block a user