* bookings page redesign work in progress fix: duplicate translation key chore: use newly supported separator type remove outdated BookingDetailsSheet remove dropdown and related code revert unncessary changes * fix wrong rebase * fix type error * refactor: separate bookings columns into filter and display columns (#24959) * refactor: separate bookings columns into filter and display columns - Extract filter-only columns into shared filterColumns.ts - Extract list display columns into listColumns.tsx - Create BookingsListContainer for list view with both column sets - Create BookingsCalendarContainer for calendar view with filter columns only - Refactor bookings-view.tsx to use dynamic imports for containers - Remove column/table creation logic from bookings-view.tsx This ensures calendar view doesn't import list-specific UI components (AvatarGroup, Badge, etc.) Co-Authored-By: eunjae@cal.com <hey@eunjae.dev> * fix: return null instead of false for separator rows in filter accessors The filter accessor functions were returning false for separator rows instead of null, which would pollute the multi-select filters with bogus 'false' values. This fix ensures that separator rows return null so they are properly excluded from filters. Addresses cubic AI reviewer feedback on PR #24959 Co-Authored-By: eunjae@cal.com <hey@eunjae.dev> * clean up filter column visibility * feat: integrate booking calendar view with re-designed list (#24973) * add toggle button * remove the dateRange filter when switching from calendar to list view * move "view" to the action dropdown * add close button the details sheet * move close button * fix more button behavior --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix type error * update the test case * fix e2e util * fix actions dropdown * revert e2e tests * fix type error on BookingActionsDropdown.tsx * fix: include today's bookings in flatData for past status Previously, flatData excluded groupedBookings.today, which caused past bookings that happened today to not show up when status === 'past'. This fix includes today's bookings in flatData for all statuses. Co-Authored-By: eunjae@cal.com <hey@eunjae.dev> * improve attendee cell * fix e2e tests * change max * fix e2e * add reschedule requested message * fix e2e * update e2e * remove flaky checks --------- Co-authored-by: Eunjae Lee <hey@eunjae.dev> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
47 lines
1.5 KiB
TypeScript
47 lines
1.5 KiB
TypeScript
import type { TFunction } from "i18next";
|
|
import { useMemo } from "react";
|
|
|
|
import { useBookingLocation } from "@calcom/features/bookings/hooks";
|
|
import type { BookingStatus } from "@calcom/prisma/enums";
|
|
import { bookingMetadataSchema } from "@calcom/prisma/zod-utils";
|
|
|
|
interface UseJoinableLocationParams {
|
|
location: string | null;
|
|
metadata?: unknown;
|
|
bookingStatus: BookingStatus;
|
|
t: TFunction;
|
|
}
|
|
|
|
/**
|
|
* Custom hook to determine if a booking location is joinable (i.e., has a clickable URL).
|
|
* This hook is used to show/hide the join meeting button and related UI elements.
|
|
*
|
|
* @returns An object containing:
|
|
* - `isJoinable`: Whether the location is joinable (has a valid URL)
|
|
* - `locationToDisplay`: The location URL or text to display
|
|
* - `provider`: Provider information (label, iconUrl, etc.)
|
|
* - `isLocationURL`: Whether the location is a URL
|
|
*/
|
|
export function useJoinableLocation({ location, metadata, bookingStatus, t }: UseJoinableLocationParams) {
|
|
const bookingMetadata = useMemo(() => {
|
|
const parsedMetadata = bookingMetadataSchema.safeParse(metadata ?? null);
|
|
return parsedMetadata.success ? parsedMetadata.data : null;
|
|
}, [metadata]);
|
|
|
|
const { locationToDisplay, provider, isLocationURL } = useBookingLocation({
|
|
location,
|
|
videoCallUrl: bookingMetadata?.videoCallUrl,
|
|
t,
|
|
bookingStatus,
|
|
});
|
|
|
|
const isJoinable = isLocationURL && !!locationToDisplay;
|
|
|
|
return {
|
|
isJoinable,
|
|
locationToDisplay,
|
|
provider,
|
|
isLocationURL,
|
|
};
|
|
}
|