2023-08-09 08:55:27 +00:00
|
|
|
import { usePathname, useSearchParams } from "next/navigation";
|
|
|
|
|
2023-10-20 23:47:05 +00:00
|
|
|
export default function useIsBookingPage(): boolean {
|
2023-08-09 08:55:27 +00:00
|
|
|
const pathname = usePathname();
|
2023-08-09 22:54:51 +00:00
|
|
|
const isBookingPage = ["/booking/", "/cancel", "/reschedule"].some((route) => pathname?.startsWith(route));
|
2023-08-09 08:55:27 +00:00
|
|
|
|
|
|
|
const searchParams = useSearchParams();
|
2023-10-20 23:47:05 +00:00
|
|
|
const userParam = Boolean(searchParams?.get("user"));
|
|
|
|
const teamParam = Boolean(searchParams?.get("team"));
|
2023-08-09 08:55:27 +00:00
|
|
|
|
2023-10-20 23:47:05 +00:00
|
|
|
return isBookingPage || userParam || teamParam;
|
2023-08-09 08:55:27 +00:00
|
|
|
}
|