mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2026-09-24 15:00:31 +08:00
Add loading delay
This commit is contained in:
@@ -38,13 +38,14 @@ type BuyButtonProps = {
|
||||
export function BuyButton(props: BuyButtonProps) {
|
||||
const { variant = 'main' } = props;
|
||||
|
||||
const [isFakeLoading, setIsFakeLoading] = useState(true);
|
||||
const [isLoginPopupOpen, setIsLoginPopupOpen] = useState(false);
|
||||
const [isVideoModalOpen, setIsVideoModalOpen] = useState(false);
|
||||
const toast = useToast();
|
||||
|
||||
const isTesting = getUrlParams()['testing'] === '1';
|
||||
|
||||
const { data: coursePricing, isLoading: isLoadingCourse } = useQuery(
|
||||
const { data: coursePricing, isLoading: isLoadingPrice } = useQuery(
|
||||
coursePriceOptions({ courseSlug: SQL_COURSE_SLUG }),
|
||||
queryClient,
|
||||
);
|
||||
@@ -138,8 +139,17 @@ export function BuyButton(props: BuyButtonProps) {
|
||||
deleteUrlParam(COURSE_PURCHASE_SUCCESS_PARAM);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const timer = setTimeout(() => {
|
||||
setIsFakeLoading(false);
|
||||
}, 500);
|
||||
|
||||
return () => clearTimeout(timer);
|
||||
}, []);
|
||||
|
||||
const isLoadingPricing =
|
||||
isLoadingCourse ||
|
||||
isFakeLoading ||
|
||||
isLoadingPrice ||
|
||||
!coursePricing ||
|
||||
isLoadingCourseProgress ||
|
||||
isCreatingCheckoutSession;
|
||||
|
||||
Reference in New Issue
Block a user