diff --git a/packages/features/eventtypes/components/AddMembersWithSwitch.tsx b/packages/features/eventtypes/components/AddMembersWithSwitch.tsx index be1ac93c40..863ec394d2 100644 --- a/packages/features/eventtypes/components/AddMembersWithSwitch.tsx +++ b/packages/features/eventtypes/components/AddMembersWithSwitch.tsx @@ -9,14 +9,19 @@ import { AddMembersWithSwitchPlatformWrapper, } from "@calcom/atoms/monorepo"; import { Segment } from "@calcom/features/Segment"; -import type { FormValues, Host, TeamMember } from "@calcom/features/eventtypes/lib/types"; +import type { + FormValues, + Host, + SettingsToggleClassNames, + TeamMember, +} from "@calcom/features/eventtypes/lib/types"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import type { AttributesQueryValue } from "@calcom/lib/raqb/types"; import { Label, SettingsToggle } from "@calcom/ui"; import AssignAllTeamMembers from "./AssignAllTeamMembers"; import CheckedTeamSelect from "./CheckedTeamSelect"; -import type { CheckedSelectOption } from "./CheckedTeamSelect"; +import type { CheckedSelectOption, CheckedTeamSelectCustomClassNames } from "./CheckedTeamSelect"; interface IUserToValue { id: number | null; @@ -57,6 +62,7 @@ const CheckedHostField = ({ onChange, helperText, isRRWeightsEnabled, + customClassNames, ...rest }: { labelText?: string; @@ -100,6 +106,7 @@ const CheckedHostField = ({ options={options} placeholder={placeholder} isRRWeightsEnabled={isRRWeightsEnabled} + customClassNames={customClassNames} {...rest} /> @@ -154,6 +161,11 @@ function MembersSegmentWithToggle({ ); } +export type AddMembersWithSwitchCustomClassNames = { + assingAllTeamMembers?: SettingsToggleClassNames; + teamMemberSelect?: CheckedTeamSelectCustomClassNames; +}; + export type AddMembersWithSwitchProps = { teamMembers: TeamMember[]; value: Host[]; @@ -168,6 +180,7 @@ export type AddMembersWithSwitchProps = { teamId: number; isSegmentApplicable?: boolean; "data-testid"?: string; + customClassNames?: AddMembersWithSwitchCustomClassNames; }; const enum AssignmentState { @@ -232,6 +245,7 @@ export function AddMembersWithSwitch({ isRRWeightsEnabled, teamId, isSegmentApplicable, + customClassNames, ...rest }: AddMembersWithSwitchProps) { const { t } = useLocale(); @@ -267,6 +281,7 @@ export function AddMembersWithSwitch({ onActive(); }} onInactive={onAssignAllTeamMembersInactive} + customClassNames={customClassNames?.assingAllTeamMembers} /> {assignmentState !== AssignmentState.ALL_TEAM_MEMBERS_ENABLED_AND_SEGMENT_NOT_APPLICABLE && (
@@ -293,6 +308,7 @@ export function AddMembersWithSwitch({ setAssignAllTeamMembers={setAssignAllTeamMembers} onActive={onActive} onInactive={onAssignAllTeamMembersInactive} + customClassNames={customClassNames?.assingAllTeamMembers} /> )}
@@ -306,6 +322,7 @@ export function AddMembersWithSwitch({ options={teamMembers.sort(sortByLabel)} placeholder={placeholder ?? t("add_attendees")} isRRWeightsEnabled={isRRWeightsEnabled} + customClassNames={customClassNames?.teamMemberSelect} /> diff --git a/packages/features/eventtypes/components/AssignAllTeamMembers.tsx b/packages/features/eventtypes/components/AssignAllTeamMembers.tsx index cb9c214670..5d915ec60c 100644 --- a/packages/features/eventtypes/components/AssignAllTeamMembers.tsx +++ b/packages/features/eventtypes/components/AssignAllTeamMembers.tsx @@ -1,7 +1,8 @@ import type { Dispatch, SetStateAction } from "react"; import { Controller, useFormContext } from "react-hook-form"; -import type { FormValues } from "@calcom/features/eventtypes/lib/types"; +import type { FormValues, SettingsToggleClassNames } from "@calcom/features/eventtypes/lib/types"; +import { classNames } from "@calcom/lib"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { SettingsToggle } from "@calcom/ui"; @@ -10,11 +11,13 @@ const AssignAllTeamMembers = ({ setAssignAllTeamMembers, onActive, onInactive, + customClassNames, }: { assignAllTeamMembers: boolean; setAssignAllTeamMembers: Dispatch>; onActive: () => void; onInactive?: () => void; + customClassNames?: SettingsToggleClassNames; }) => { const { t } = useLocale(); const { setValue } = useFormContext(); @@ -26,7 +29,8 @@ const AssignAllTeamMembers = ({ { setValue("assignAllTeamMembers", active, { shouldDirty: true }); diff --git a/packages/features/eventtypes/components/CheckedTeamSelect.tsx b/packages/features/eventtypes/components/CheckedTeamSelect.tsx index 7ca4763c5a..35df4cdbf9 100644 --- a/packages/features/eventtypes/components/CheckedTeamSelect.tsx +++ b/packages/features/eventtypes/components/CheckedTeamSelect.tsx @@ -5,10 +5,12 @@ import { useState } from "react"; import type { Props } from "react-select"; import { useIsPlatform } from "@calcom/atoms/monorepo"; +import type { SelectClassNames } from "@calcom/features/eventtypes/lib/types"; import { classNames } from "@calcom/lib"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { Avatar, Button, Icon, Select, Tooltip } from "@calcom/ui"; +import type { PriorityDialogCustomClassNames, WeightDialogCustomClassNames } from "./HostEditDialogs"; import { PriorityDialog, WeightDialog } from "./HostEditDialogs"; export type CheckedSelectOption = { @@ -22,15 +24,33 @@ export type CheckedSelectOption = { defaultScheduleId?: number | null; }; +export type CheckedTeamSelectCustomClassNames = { + hostsSelect?: SelectClassNames; + selectedHostList?: { + container?: string; + listItem?: { + container?: string; + avatar?: string; + name?: string; + changePriorityButton?: string; + changeWeightButton?: string; + removeButton?: string; + }; + }; + priorityDialog?: PriorityDialogCustomClassNames; + weightDialog?: WeightDialogCustomClassNames; +}; export const CheckedTeamSelect = ({ options = [], value = [], isRRWeightsEnabled, + customClassNames, ...props }: Omit, "value" | "onChange"> & { value?: readonly CheckedSelectOption[]; onChange: (value: readonly CheckedSelectOption[]) => void; isRRWeightsEnabled?: boolean; + customClassNames?: CheckedTeamSelectCustomClassNames; }) => { const isPlatform = useIsPlatform(); const [priorityDialogOpen, setPriorityDialogOpen] = useState(false); @@ -50,21 +70,44 @@ export const CheckedTeamSelect = ({ options={options} value={value} isMulti + className={customClassNames?.hostsSelect?.select} + innerClassNames={customClassNames?.hostsSelect?.innerClassNames} {...props} /> {/* This class name conditional looks a bit odd but it allows a seemless transition when using autoanimate - Slides down from the top instead of just teleporting in from nowhere*/}
    = 1 && "border-subtle border")} + className={classNames( + "mb-4 mt-3 rounded-md", + value.length >= 1 && "border-subtle border", + customClassNames?.selectedHostList?.container + )} ref={animationRef}> {value.map((option, index) => ( <>
  • + className={classNames( + `flex px-3 py-2 ${index === value.length - 1 ? "" : "border-subtle border-b"}`, + customClassNames?.selectedHostList?.listItem?.container + )}> {!isPlatform && } - {isPlatform && } -

    {option.label}

    + {isPlatform && ( + + )} +

    + {option.label} +

    {option && !option.isFixed ? ( <> @@ -77,7 +120,8 @@ export const CheckedTeamSelect = ({ }} className={classNames( "mr-6 h-2 p-0 text-sm hover:bg-transparent", - getPriorityTextAndColor(option.priority).color + getPriorityTextAndColor(option.priority).color, + customClassNames?.selectedHostList?.listItem?.changePriorityButton )}> {t(getPriorityTextAndColor(option.priority).text)} @@ -85,7 +129,10 @@ export const CheckedTeamSelect = ({ {isRRWeightsEnabled ? (
  • @@ -117,12 +167,14 @@ export const CheckedTeamSelect = ({ setIsOpenDialog={setPriorityDialogOpen} option={currentOption} onChange={props.onChange} + customClassNames={customClassNames?.priorityDialog} /> ) : ( diff --git a/packages/features/eventtypes/components/ChildrenEventTypeSelect.tsx b/packages/features/eventtypes/components/ChildrenEventTypeSelect.tsx index be6fd104b3..d35a40699d 100644 --- a/packages/features/eventtypes/components/ChildrenEventTypeSelect.tsx +++ b/packages/features/eventtypes/components/ChildrenEventTypeSelect.tsx @@ -1,6 +1,7 @@ import { useAutoAnimate } from "@formkit/auto-animate/react"; import type { Props } from "react-select"; +import type { SelectClassNames } from "@calcom/features/eventtypes/lib/types"; import { classNames } from "@calcom/lib"; import { getBookerBaseUrlSync } from "@calcom/lib/getBookerUrl/client"; import { useLocale } from "@calcom/lib/hooks/useLocale"; @@ -26,14 +27,38 @@ export type ChildrenEventType = { hidden: boolean; }; +export type ChildrenEventTypeSelectCustomClassNames = { + assignToSelect?: SelectClassNames; + selectedChildrenList?: { + container?: string; + listItem?: { + container?: string; + avatar?: string; + name?: string; + ownerBadge?: string; + memberBadge?: string; + hiddenBadge?: string; + badgeContainer?: string; + eventLink?: string; + showOnProfileTooltip?: string; + previewEventTypeTooltip?: string; + previewEventTypeButton?: string; + deleteEventTypeTooltip?: string; + deleteEventTypeButton?: string; + }; + }; +}; + // TODO: This isnt just a select... rename this component in the future took me ages to find the component i was looking for export const ChildrenEventTypeSelect = ({ options = [], value = [], + customClassNames, ...props }: Omit, "value" | "onChange"> & { value?: ChildrenEventType[]; onChange: (value: readonly ChildrenEventType[]) => void; + customClassNames?: ChildrenEventTypeSelectCustomClassNames; }) => { const { t } = useLocale(); const [animationRef] = useAutoAnimate(); @@ -44,6 +69,8 @@ export const ChildrenEventTypeSelect = ({ name={props.name} placeholder={t("select")} options={options} + className={customClassNames?.assignToSelect?.select} + innerClassNames={customClassNames?.assignToSelect?.innerClassNames} value={value} isMulti {...props} @@ -53,39 +80,75 @@ export const ChildrenEventTypeSelect = ({
      = 1 && "border" + value.length >= 1 && "border", + customClassNames?.selectedChildrenList?.container )} ref={animationRef}> {value.map((children, index) => (
    • -
      +
      - + {children.owner.name || children.owner.email} -
      +
      {children.owner.membership === MembershipRole.OWNER ? ( - {t("owner")} + + {t("owner")} + ) : ( - {t("member")} + + {t("member")} + + )} + {children.hidden && ( + + {t("hidden")} + )} - {children.hidden && {t("hidden")}}
      {children.owner.username && ( - + {`/${children.owner.username}/${children.slug}`} )}
      -
      - +
      +
      {children.created && children.owner.username && ( - +