import { StarFilled } from "@ant-design/icons"; import { Image, Select, Space } from "antd"; import { FloatingButton } from "components/FloatingButton/FloatingButton"; import LogoContainerIcon from "components/Icons/LogoContainerIcon"; import ImageWithFallback from "components/ImageWithFallback"; import LoyaltyCard from "components/LoyaltyCard/LoyaltyCard"; import ProText from "components/ProText"; import ProTitle from "components/ProTitle"; import { useScrollHandler } from "contexts/ScrollHandlerContext"; import useBreakPoint from "hooks/useBreakPoint"; import { useRestaurant } from "hooks/useRestaurant"; import { OrderType } from "pages/checkout/hooks/types.ts"; import { useTranslation } from "react-i18next"; import { useParams, useSearchParams } from "react-router-dom"; import { useGetMenuQuery, useGetRestaurantDetailsQuery, } from "redux/api/others"; import { useAppSelector } from "redux/hooks"; import { default_image } from "utils/constants"; import { enumToSelectOptions } from "utils/helpers/helperFunctions.ts"; import BackButton from "./components/BackButton"; import { CartButton } from "./components/CartButton/CartButton"; import { CategoriesList } from "./components/CategoriesList/CategoriesList"; import LocalStorageHandler from "./components/LocalStorageHandler"; import { MenuFooter } from "./components/MenuFooter/MenuFooter"; import { MenuList } from "./components/MenuList/MenuList"; import MenuSkeleton from "./components/MenuSkeleton/MenuSkeleton"; import ScrollEventHandler from "./components/ScrollEventHandler"; import SearchButton from "./components/SearchButton"; import styles from "./menu.module.css"; function MenuPage() { const { subdomain } = useParams(); // eslint-disable-next-line @typescript-eslint/no-unused-vars const [_, setSearchParams] = useSearchParams(); const { isRTL } = useAppSelector((state) => state.locale); const { orderType } = useAppSelector((state) => state.order); const { t } = useTranslation(); const { data: restaurant, isLoading: isLoadingRestaurant } = useGetRestaurantDetailsQuery(subdomain, { skip: !subdomain, }); const { data: menuData, isLoading: isLoadingMenu } = useGetMenuQuery( restaurant?.restautantId, { skip: !restaurant?.restautantId, }, ); const { categoryRefs } = useScrollHandler(); const { isMobile, isTablet, isDesktop } = useBreakPoint(); const isLoading = isLoadingRestaurant || isLoadingMenu; const orderTypeOptions = enumToSelectOptions(OrderType, t, "orderTypes"); // Automatically load restaurant taxes when restaurant data is available useRestaurant(restaurant); return ( <> {isLoading ? ( ) : (
{t("menu.restaurantLogo")}