refactor: event types infinite scroll (#15949)

* chore

* chore

* feat: paginated event types

* fix: event types page

* fix: k bar

* fix: event type order

* fix: type error

* chore: remove commented code

* chore: type err

* chore: type err and feedback

* feat: add old component

* chore: missing import

* fix: add isInfiniteScrollEnabled prop

* chore: type err

* chore: type error

* feat: auto fetch next page when button is in view

* Update packages/lib/server/repository/eventType.ts

* Update packages/lib/server/repository/eventType.ts

* chore: feedback

* fix: managed event types

* fix: Review fixes for event-types-infinite-scroll (#16047)

* Review fixes

* chore: missing import

---------

Co-authored-by: Udit Takkar <[email protected]>
Co-authored-by: Udit Takkar <[email protected]>

* chore: type error

* chore

* fix: delete event type

* fix: create event dialog

* fix: create and duplicate dialog

* chore: simplify return type

* fix: type

* chore: invalidate query

* chore: remove query

* fix duplicated event not showing.

---------

Co-authored-by: Peer Richelsen <[email protected]>
Co-authored-by: Hariom Balhara <[email protected]>
This commit is contained in:
authored and GitHub committed 2024-08-05 16:01:03 +04:00
1 parent 583661a15d
commit 45db5c0d5e
18 files changed
+1377 -59

No files matched your search

@@ -1,6 +1,7 @@
import type { GetServerSidePropsContext } from "next";
import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
import { ENABLE_INFINITE_EVENT_TYPES_FOR_ORG } from "@calcom/lib/constants";
import { ssrInit } from "@server/lib/ssr";
@@ -17,5 +18,9 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
};
}
return { props: { trpcState: ssr.dehydrate() } };
const isInfiniteScrollEnabled = session.user?.org?.slug
? ENABLE_INFINITE_EVENT_TYPES_FOR_ORG.includes(session.user.org.slug)
: false;
return { props: { trpcState: ssr.dehydrate(), isInfiniteScrollEnabled } };
};
+3 -2
View File
@@ -2,7 +2,7 @@ import React from "react";
const isInteractionObserverSupported = typeof window !== "undefined" && "IntersectionObserver" in window;
export const useInViewObserver = (onInViewCallback: () => void) => {
export const useInViewObserver = (onInViewCallback: () => void, root?: Element | Document | null) => {
const [node, setRef] = React.useState<HTMLElement | null>(null);
const onInViewCallbackRef = React.useRef(onInViewCallback);
@@ -23,7 +23,8 @@ export const useInViewObserver = (onInViewCallback: () => void) => {
}
},
{
root: document.body,
// We want to accept null as root
root: root !== undefined ? root : document.body,
}
);
observer.observe(node);