)}
-
{booking.attendees.length !== 0 && (
-
)}
{isCancelled && booking.rescheduled && (
@@ -373,4 +377,97 @@ function BookingListItem(booking: BookingItemProps) {
);
}
+interface UserProps {
+ id: number;
+ name: string | null;
+ email: string;
+}
+
+const FirstAttendee = ({
+ user,
+ currentEmail,
+}: {
+ user: UserProps;
+ currentEmail: string | null | undefined;
+}) => {
+ return user.email === currentEmail ? (
+
You
+ ) : (
+
e.stopPropagation()}>
+ {user.name}
+
+ );
+};
+
+const Attendee: React.FC<{ email: string; children: React.ReactNode }> = ({ email, children }) => {
+ return (
+
e.stopPropagation()}>
+ {children}
+
+ );
+};
+
+interface AttendeeProps {
+ name: string;
+ email: string;
+}
+
+const DisplayAttendees = ({
+ attendees,
+ user,
+ currentEmail,
+}: {
+ attendees: AttendeeProps[];
+ user: UserProps | null;
+ currentEmail: string | null | undefined;
+}) => {
+ if (attendees.length === 1) {
+ return (
+
+ {user &&
}
+
and
+
{attendees[0].name}
+
+ );
+ } else if (attendees.length === 2) {
+ return (
+
+ {user &&
}
+
,
+
{attendees[0].name}
+
and
+
{attendees[1].name}
+
+ );
+ } else {
+ return (
+
+ {user &&
}
+
,
+
{attendees[0].name}
+
&
+
(
+ {attendee.name}
+ ))}>
+ {attendees.length - 1} more
+
+
+ );
+ }
+};
+
+const Tag = ({ children, className = "" }: React.PropsWithChildren<{ className?: string }>) => {
+ return (
+
+ {children}
+
+ );
+};
+
export default BookingListItem;
diff --git a/packages/trpc/server/routers/viewer.tsx b/packages/trpc/server/routers/viewer.tsx
index 5c39f9fe6c..de5be4a382 100644
--- a/packages/trpc/server/routers/viewer.tsx
+++ b/packages/trpc/server/routers/viewer.tsx
@@ -510,6 +510,7 @@ const loggedInViewerRouter = createProtectedRouter()
};
const passedBookingsFilter = bookingListingFilters[bookingListingByStatus];
const orderBy = bookingListingOrderby[bookingListingByStatus];
+
const bookingsQuery = await prisma.booking.findMany({
where: {
OR: [
@@ -523,6 +524,18 @@ const loggedInViewerRouter = createProtectedRouter()
},
},
},
+ {
+ eventType: {
+ team: {
+ members: {
+ some: {
+ userId: user.id,
+ role: "OWNER",
+ },
+ },
+ },
+ },
+ },
],
AND: [passedBookingsFilter],
},
@@ -550,6 +563,8 @@ const loggedInViewerRouter = createProtectedRouter()
user: {
select: {
id: true,
+ name: true,
+ email: true,
},
},
rescheduled: true,