Files
calendar/packages/features/bookings/Booker/components/InstantBooking.tsx
T
1e610ea684 perf: don't fetch all the hosts (#18319)
* perf: don't fetch all the hosts

* fix: type err

* use appschema only when necessary

* Variable casing change and type fixes

* Another missing ts fix

* chore: update variable name

* chore: remove from personal event types

* chore: remove limitHostsToThree

* chore: make it a variable

* chore: move it below

* chore: change name to firstThreeHosts

* chore: update to first three users

* fix: type error

* chore: add firstThreeHosts

* fix: type error

* fix: type error

* fix: support users

* chore: update metadata

* fix: API v2 build error

* chore: change var name

* chore: remove cursorrules

* chore: undo API v2 changes

* chore: add type

---------

Co-authored-by: Hariom <hariombalhara@gmail.com>
Co-authored-by: Keith Williams <keithwillcode@gmail.com>
2025-01-29 19:05:54 +02:00

49 lines
1.6 KiB
TypeScript

import type { BookerEvent } from "@calcom/features/bookings/types";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import type { User } from "@calcom/prisma/client";
import { Button, UserAvatarGroupWithOrg } from "@calcom/ui";
interface IInstantBookingProps {
onConnectNow: () => void;
event: Pick<BookerEvent, "entity" | "schedulingType"> & {
subsetOfUsers: (Pick<User, "name" | "username" | "avatarUrl"> & { bookerUrl: string })[];
};
}
export const InstantBooking = ({ onConnectNow, event }: IInstantBookingProps) => {
const { t } = useLocale();
return (
<div className=" bg-default border-subtle mx-2 block items-center gap-3 rounded-xl border p-[6px] text-sm shadow-sm delay-1000 sm:flex">
<div className="flex items-center gap-3 ps-1">
<div className="relative">
<UserAvatarGroupWithOrg
size="sm"
className="border-muted"
organization={{
slug: event.entity.orgSlug,
name: event.entity.name || "",
logoUrl: event.entity.logoUrl ?? null,
}}
users={event.subsetOfUsers.slice(0, 2)}
disableHref
/>
<div className="border-muted absolute -bottom-0.5 -right-1 h-2 w-2 rounded-full border bg-green-500" />
</div>
<div>{t("dont_want_to_wait")}</div>
</div>
<div className="mt-2 sm:mt-0">
<Button
color="primary"
onClick={() => {
onConnectNow();
}}
size="sm"
className="w-full justify-center rounded-lg sm:w-auto">
{t("connect_now")}
</Button>
</div>
</div>
);
};