From d0960ff55cb069e221a391498b29330cf96af144 Mon Sep 17 00:00:00 2001 From: Ryukemeister Date: Thu, 19 Oct 2023 02:32:41 +0530 Subject: [PATCH] update view for standalone EventType --- packages/atoms/EventTypeList/EventType.tsx | 86 +++++++++++++++++++++- 1 file changed, 83 insertions(+), 3 deletions(-) diff --git a/packages/atoms/EventTypeList/EventType.tsx b/packages/atoms/EventTypeList/EventType.tsx index c593f6cf4d..6a5b011201 100644 --- a/packages/atoms/EventTypeList/EventType.tsx +++ b/packages/atoms/EventTypeList/EventType.tsx @@ -1,7 +1,87 @@ -export function EventType() { - return ( +import { memo } from "react"; + +import { SchedulingType } from "@calcom/prisma/enums"; +import { ArrowButton } from "@calcom/ui"; + +const Item = ({ type, group, readOnly }: { type: any; group: any; readonly: boolean }) => { + const content = () => (
-

Standalone event type goes here

+ + {type.title} + + {group.profile.slug ? ( + + {`/${type.schedulingType !== SchedulingType.MANAGED ? group.profile.slug : "username"}/${ + type.slug + }`} + + ) : null} + {readOnly && <>Return badge from shadcn here}
); + + return readOnly ? ( +
+ {content()} + {/* Return EventTypeDescription component here */} +
+ ) : ( + +
+ + {type.title} + + {group.profile.slug ? ( + + {`/${group.profile.slug}/${type.slug}`} + + ) : null} + {readOnly && <>Return badge from shadcn here} +
+ {/* Return EventTypeDescription component here */} +
+ ); +}; + +const MemoizedItem = memo(Item); + +export function EventType({ + event, + type, + index, + firstItem, + lastItem, + moveEventType, +}: { + event: any; + type: any; + index: number; + firstItem: { id: string }; + lastItem: { id: string }; + moveEventType: (index: number, increment: 1 | -1) => void; +}) { + return ( +
  • +
    +
    + {!(firstItem && firstItem.id === type.id) && ( + moveEventType(index, -1)} /> + )} + {!(lastItem && lastItem.id === type.id) && ( + moveEventType(index, 1)} /> + )} + +
    +
    +
    +
  • + ); }