Files
calendar/packages/features/ee/teams/components/RoundRobinTimestampBasis.tsx
T
6de715b884 feat: Round Robin timestamp basis (#21337)
* add rrTimeStampBasis to prisma schema

* add rr time stamp basis setting

* update migration

* add getLuckyUser logic

* add rrTimestampBasis to tests

* add load balancing warning message

* disable load balancing logic

* disable load balancing in event type settings

* add missing translations

* fix UI

* disable load balancing on all team event types

* don't show routing forms in router position

* use correct interval times

* fix variable naming

* fix event type update handler

* add test to booking.test.ts

* add test for getting interval times

* remove not needed prop

* fix label

* improve warning message

* fix removing maxLeadTreshold

* fix typo

* fix disabling maxLeadThreshold

* add back missing translation

* improve rr reset interval label

* fix rr_load_balancing_disabled text

* improve test

* fix description

* only use rrTimestampBasis in weights round robin

* fix dropdown width

---------

Co-authored-by: CarinaWolli <wollencarina@gmail.com>
2025-06-12 11:37:38 +01:00

56 lines
1.5 KiB
TypeScript

"use client";
import { Controller } from "react-hook-form";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { RRTimestampBasis } from "@calcom/prisma/enums";
import { Select } from "@calcom/ui/components/form";
const RoundRobinTimestampBasis = () => {
const { t } = useLocale();
const timestampBasisOptions: {
value: RRTimestampBasis;
label: string;
}[] = [
{
value: RRTimestampBasis.CREATED_AT,
label: t("booking_creation_time"),
},
{
value: RRTimestampBasis.START_TIME,
label: t("meeting_start_time"),
},
];
return (
<Controller
name="rrTimestampBasis"
render={({ field: { value, onChange } }) => {
return (
<>
<h4 className="text-emphasis text-sm font-semibold leading-5">
{t("distribution_basis_weighted_rr")}
</h4>
<p className="text-default text-sm leading-tight">{t("timestamp_basis_description")}</p>
<div className="mt-4 w-52">
<Select
options={timestampBasisOptions}
value={timestampBasisOptions.find((opt) => opt.value === value)}
onChange={(val) => {
onChange(val?.value);
}}
/>
</div>
{value !== RRTimestampBasis.CREATED_AT && (
<p className="text-attention mt-2 text-sm">{t("load_balancing_warning")}</p>
)}
</>
);
}}
/>
);
};
export default RoundRobinTimestampBasis;