feat: atoms enhancements (#27224)
This commit is contained in:
1 parent
0171b5a08c
commit
9a927206bd
12 files changed
+186
-170
No files matched your search
@@ -36,6 +36,8 @@ interface AppListProps {
|
||||
data: RouterOutputs["viewer"]["apps"]["integrations"];
|
||||
handleDisconnect: HandleDisconnect;
|
||||
listClassName?: string;
|
||||
appCardClassName?: string;
|
||||
appCardMenuClassName?: string;
|
||||
defaultConferencingApp: RouterOutputs["viewer"]["apps"]["getUsersDefaultConferencingApp"];
|
||||
handleUpdateUserDefaultConferencingApp: (params: UpdateUsersDefaultConferencingAppParams) => void;
|
||||
handleBulkUpdateDefaultLocation: (params: BulkUpdatParams) => void;
|
||||
@@ -51,6 +53,8 @@ export const AppList = ({
|
||||
handleDisconnect,
|
||||
variant,
|
||||
listClassName,
|
||||
appCardClassName,
|
||||
appCardMenuClassName,
|
||||
defaultConferencingApp,
|
||||
handleUpdateUserDefaultConferencingApp,
|
||||
handleBulkUpdateDefaultLocation,
|
||||
@@ -85,6 +89,7 @@ export const AppList = ({
|
||||
slug={item.slug}
|
||||
invalidCredential={item?.invalidCredentialIds ? item.invalidCredentialIds.length > 0 : false}
|
||||
credentialOwner={item?.credentialOwner}
|
||||
className={appCardClassName}
|
||||
actions={
|
||||
!item.credentialOwner?.readOnly ? (
|
||||
<div className="flex justify-end">
|
||||
@@ -92,7 +97,7 @@ export const AppList = ({
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button StartIcon="ellipsis" variant="icon" color="secondary" />
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent>
|
||||
<DropdownMenuContent className={appCardMenuClassName}>
|
||||
{!appIsDefault && variant === "conferencing" && (
|
||||
<DropdownMenuItem>
|
||||
<DropdownItem
|
||||
|
||||
@@ -91,6 +91,7 @@ const BookerComponent = ({
|
||||
timeZones,
|
||||
eventMetaChildren,
|
||||
roundRobinHideOrgAndTeam,
|
||||
hideOrgTeamAvatar,
|
||||
showNoAvailabilityDialog,
|
||||
}: BookerProps & WrappedBookerProps) => {
|
||||
const searchParams = useCompatSearchParams();
|
||||
@@ -470,6 +471,7 @@ const BookerComponent = ({
|
||||
locale={userLocale}
|
||||
timeZones={timeZones}
|
||||
roundRobinHideOrgAndTeam={roundRobinHideOrgAndTeam}
|
||||
hideOrgTeamAvatar={hideOrgTeamAvatar}
|
||||
hideEventTypeDetails={hideEventTypeDetails}>
|
||||
{eventMetaChildren}
|
||||
</EventMeta>
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
import { m } from "framer-motion";
|
||||
import dynamic from "next/dynamic";
|
||||
import { useEffect, useMemo } from "react";
|
||||
import { shallow } from "zustand/shallow";
|
||||
|
||||
import { Timezone as PlatformTimezoneSelect } from "@calcom/atoms/timezone";
|
||||
import { EventDetails, EventMembers, EventMetaSkeleton, EventTitle } from "./event-meta";
|
||||
import { useBookerStoreContext } from "@calcom/features/bookings/Booker/BookerStoreProvider";
|
||||
import { useBookerTime } from "@calcom/features/bookings/Booker/components/hooks/useBookerTime";
|
||||
import { fadeInUp } from "@calcom/features/bookings/Booker/config";
|
||||
import type { Timezone } from "@calcom/features/bookings/Booker/types";
|
||||
import { SeatsAvailabilityText } from "@calcom/web/modules/bookings/components/SeatsAvailabilityText";
|
||||
import { EventMetaBlock } from "@calcom/web/modules/bookings/components/event-meta/Details";
|
||||
import { FromToTime } from "@calcom/features/bookings/Booker/utils/dates";
|
||||
import { useTimePreferences } from "@calcom/features/bookings/lib";
|
||||
import type { BookerEvent } from "@calcom/features/bookings/types";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
@@ -16,12 +11,15 @@ import { markdownToSafeHTMLClient } from "@calcom/lib/markdownToSafeHTMLClient";
|
||||
import { CURRENT_TIMEZONE } from "@calcom/lib/timezoneConstants";
|
||||
import type { EventTypeTranslation } from "@calcom/prisma/client";
|
||||
import { EventTypeAutoTranslatedField } from "@calcom/prisma/enums";
|
||||
|
||||
import { EventMetaBlock } from "@calcom/web/modules/bookings/components/event-meta/Details";
|
||||
import { SeatsAvailabilityText } from "@calcom/web/modules/bookings/components/SeatsAvailabilityText";
|
||||
import { m } from "framer-motion";
|
||||
import dynamic from "next/dynamic";
|
||||
import { useEffect, useMemo } from "react";
|
||||
import { shallow } from "zustand/shallow";
|
||||
import i18nConfigration from "../../../../../i18n.json";
|
||||
import { fadeInUp } from "@calcom/features/bookings/Booker/config";
|
||||
import { FromToTime } from "@calcom/features/bookings/Booker/utils/dates";
|
||||
import { EventDetails, EventMembers, EventMetaSkeleton, EventTitle } from "./event-meta";
|
||||
import { ScrollableWithGradients } from "./ScrollableWithGradients";
|
||||
import { useBookerTime } from "@calcom/features/bookings/Booker/components/hooks/useBookerTime";
|
||||
|
||||
const WebTimezoneSelect = dynamic(
|
||||
() => import("@calcom/web/modules/timezone/components/TimezoneSelect").then((mod) => mod.TimezoneSelect),
|
||||
@@ -56,6 +54,7 @@ export const EventMeta = ({
|
||||
children,
|
||||
selectedTimeslot,
|
||||
roundRobinHideOrgAndTeam,
|
||||
hideOrgTeamAvatar,
|
||||
hideEventTypeDetails = false,
|
||||
}: {
|
||||
event?: Pick<
|
||||
@@ -96,6 +95,7 @@ export const EventMeta = ({
|
||||
children?: React.ReactNode;
|
||||
selectedTimeslot: string | null;
|
||||
roundRobinHideOrgAndTeam?: boolean;
|
||||
hideOrgTeamAvatar?: boolean;
|
||||
hideEventTypeDetails?: boolean;
|
||||
}) => {
|
||||
const { timeFormat, timezone } = useBookerTime();
|
||||
@@ -141,8 +141,8 @@ export const EventMeta = ({
|
||||
const colorClass = isNearlyFull
|
||||
? "text-rose-600"
|
||||
: isHalfFull
|
||||
? "text-yellow-500"
|
||||
: "text-bookinghighlight";
|
||||
? "text-yellow-500"
|
||||
: "text-bookinghighlight";
|
||||
const userLocale = locale ?? navigator.language;
|
||||
const translatedDescription = getTranslatedField(
|
||||
event?.fieldTranslations ?? [],
|
||||
@@ -171,6 +171,7 @@ export const EventMeta = ({
|
||||
entity={event.entity}
|
||||
isPrivateLink={isPrivateLink}
|
||||
roundRobinHideOrgAndTeam={roundRobinHideOrgAndTeam}
|
||||
hideOrgTeamAvatar={hideOrgTeamAvatar}
|
||||
/>
|
||||
<EventTitle className={`${classNames?.eventMetaTitle} my-2`}>
|
||||
{translatedTitle ?? event?.title}
|
||||
|
||||
@@ -19,6 +19,7 @@ export interface EventMembersProps {
|
||||
entity: BookerEvent["entity"];
|
||||
isPrivateLink: boolean;
|
||||
roundRobinHideOrgAndTeam?: boolean;
|
||||
hideOrgTeamAvatar?: boolean;
|
||||
}
|
||||
|
||||
export const EventMembers = ({
|
||||
@@ -28,6 +29,7 @@ export const EventMembers = ({
|
||||
entity,
|
||||
isPrivateLink,
|
||||
roundRobinHideOrgAndTeam,
|
||||
hideOrgTeamAvatar,
|
||||
}: EventMembersProps) => {
|
||||
const username = useBookerStore((state) => state.username);
|
||||
const isDynamic = !!(username && username.indexOf("+") > -1);
|
||||
@@ -46,8 +48,12 @@ export const EventMembers = ({
|
||||
return <div className="h-6" />;
|
||||
}
|
||||
|
||||
if (schedulingType === SchedulingType.ROUND_ROBIN && hideOrgTeamAvatar) {
|
||||
return <p className="text-subtle pt-6 text-sm font-semibold">{profile.name}</p>;
|
||||
}
|
||||
|
||||
const orgOrTeamAvatarItem =
|
||||
isDynamic || (!profile.image && !entity.logoUrl) || !entity.teamSlug
|
||||
hideOrgTeamAvatar || isDynamic || (!profile.image && !entity.logoUrl) || !entity.teamSlug
|
||||
? []
|
||||
: [
|
||||
{
|
||||
@@ -56,8 +62,8 @@ export const EventMembers = ({
|
||||
isEmbed || isPlatform || isPrivateLink || entity.hideProfileLink
|
||||
? null
|
||||
: entity.teamSlug
|
||||
? getTeamUrlSync({ orgSlug: entity.orgSlug, teamSlug: entity.teamSlug })
|
||||
: getBookerBaseUrlSync(entity.orgSlug),
|
||||
? getTeamUrlSync({ orgSlug: entity.orgSlug, teamSlug: entity.teamSlug })
|
||||
: getBookerBaseUrlSync(entity.orgSlug),
|
||||
image: entity.logoUrl ?? profile.image ?? "",
|
||||
alt: entity.name ?? profile.name ?? "",
|
||||
title: entity.name ?? profile.name ?? "",
|
||||
|
||||
+25
-18
@@ -52,6 +52,7 @@ export type EventTeamAssignmentTabBaseProps = Pick<
|
||||
customClassNames?: EventTeamAssignmentTabCustomClassNames;
|
||||
orgId: number | null;
|
||||
isSegmentApplicable: boolean;
|
||||
hideFixedHostsForCollective?: boolean;
|
||||
};
|
||||
|
||||
export const mapMemberToChildrenOption = (
|
||||
@@ -615,6 +616,7 @@ const Hosts = ({
|
||||
setAssignAllTeamMembers,
|
||||
customClassNames,
|
||||
isSegmentApplicable,
|
||||
hideFixedHostsForCollective = false,
|
||||
}: {
|
||||
orgId: number | null;
|
||||
teamId: number;
|
||||
@@ -623,6 +625,7 @@ const Hosts = ({
|
||||
setAssignAllTeamMembers: Dispatch<SetStateAction<boolean>>;
|
||||
customClassNames?: HostsCustomClassNames;
|
||||
isSegmentApplicable: boolean;
|
||||
hideFixedHostsForCollective?: boolean;
|
||||
}) => {
|
||||
const {
|
||||
control,
|
||||
@@ -662,10 +665,10 @@ const Hosts = ({
|
||||
|
||||
return existingHost
|
||||
? {
|
||||
...newValue,
|
||||
scheduleId: existingHost.scheduleId,
|
||||
groupId: existingHost.groupId,
|
||||
}
|
||||
...newValue,
|
||||
scheduleId: existingHost.scheduleId,
|
||||
groupId: existingHost.groupId,
|
||||
}
|
||||
: newValue;
|
||||
});
|
||||
};
|
||||
@@ -675,7 +678,9 @@ const Hosts = ({
|
||||
name="hosts"
|
||||
render={({ field: { onChange, value } }) => {
|
||||
const schedulingTypeRender = {
|
||||
COLLECTIVE: (
|
||||
COLLECTIVE: hideFixedHostsForCollective ? (
|
||||
<></>
|
||||
) : (
|
||||
<FixedHosts
|
||||
teamId={teamId}
|
||||
teamMembers={teamMembers}
|
||||
@@ -733,6 +738,7 @@ export const EventTeamAssignmentTab = ({
|
||||
customClassNames,
|
||||
orgId,
|
||||
isSegmentApplicable,
|
||||
hideFixedHostsForCollective = false,
|
||||
}: EventTeamAssignmentTabBaseProps) => {
|
||||
const { t } = useLocale();
|
||||
|
||||
@@ -741,17 +747,17 @@ export const EventTeamAssignmentTab = ({
|
||||
label: string;
|
||||
// description: string;
|
||||
}[] = [
|
||||
{
|
||||
value: "COLLECTIVE",
|
||||
label: t("collective"),
|
||||
// description: t("collective_description"),
|
||||
},
|
||||
{
|
||||
value: "ROUND_ROBIN",
|
||||
label: t("round_robin"),
|
||||
// description: t("round_robin_description"),
|
||||
},
|
||||
];
|
||||
{
|
||||
value: "COLLECTIVE",
|
||||
label: t("collective"),
|
||||
// description: t("collective_description"),
|
||||
},
|
||||
{
|
||||
value: "ROUND_ROBIN",
|
||||
label: t("round_robin"),
|
||||
// description: t("round_robin_description"),
|
||||
},
|
||||
];
|
||||
const pendingMembers = (member: (typeof teamMembers)[number]) =>
|
||||
!!eventType.team?.parentId || !!member.username;
|
||||
const teamMembersOptions = teamMembers
|
||||
@@ -883,11 +889,11 @@ export const EventTeamAssignmentTab = ({
|
||||
</RadioArea.Item>
|
||||
{(eventType.team?.rrTimestampBasis &&
|
||||
eventType.team?.rrTimestampBasis !== RRTimestampBasis.CREATED_AT) ||
|
||||
hostGroups?.length > 1 ? (
|
||||
hostGroups?.length > 1 ? (
|
||||
<Tooltip
|
||||
content={
|
||||
eventType.team?.rrTimestampBasis &&
|
||||
eventType.team?.rrTimestampBasis !== RRTimestampBasis.CREATED_AT
|
||||
eventType.team?.rrTimestampBasis !== RRTimestampBasis.CREATED_AT
|
||||
? t("rr_load_balancing_disabled")
|
||||
: t("rr_load_balancing_disabled_with_groups")
|
||||
}>
|
||||
@@ -942,6 +948,7 @@ export const EventTeamAssignmentTab = ({
|
||||
setAssignAllTeamMembers={setAssignAllTeamMembers}
|
||||
teamMembers={teamMembersOptions}
|
||||
customClassNames={customClassNames?.hosts}
|
||||
hideFixedHostsForCollective={hideFixedHostsForCollective}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
||||
Reference in new issue
Block a user