work on order type "select" in menu header
This commit is contained in:
@@ -14,7 +14,7 @@ import {
|
|||||||
useGetMenuQuery,
|
useGetMenuQuery,
|
||||||
useGetRestaurantDetailsQuery,
|
useGetRestaurantDetailsQuery,
|
||||||
} from "redux/api/others";
|
} from "redux/api/others";
|
||||||
import { useAppSelector } from "redux/hooks";
|
import { useAppSelector, useAppDispatch } from "redux/hooks";
|
||||||
import { default_image } from "utils/constants";
|
import { default_image } from "utils/constants";
|
||||||
import BackButton from "./components/BackButton";
|
import BackButton from "./components/BackButton";
|
||||||
import { CartButton } from "./components/CartButton/CartButton";
|
import { CartButton } from "./components/CartButton/CartButton";
|
||||||
@@ -28,10 +28,13 @@ import SearchButton from "./components/SearchButton";
|
|||||||
import styles from "./menu.module.css";
|
import styles from "./menu.module.css";
|
||||||
import { enumToSelectOptions } from "utils/helpers/helperFunctions.ts";
|
import { enumToSelectOptions } from "utils/helpers/helperFunctions.ts";
|
||||||
import { OrderType } from "pages/checkout/hooks/types.ts";
|
import { OrderType } from "pages/checkout/hooks/types.ts";
|
||||||
|
import { updateOrderType } from "features/order/orderSlice.ts";
|
||||||
|
|
||||||
function MenuPage() {
|
function MenuPage() {
|
||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
|
const dispatch = useAppDispatch();
|
||||||
const { isRTL } = useAppSelector((state) => state.locale);
|
const { isRTL } = useAppSelector((state) => state.locale);
|
||||||
|
const { orderType } = useAppSelector((state) => state.order);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { data: restaurant, isLoading: isLoadingRestaurant } =
|
const { data: restaurant, isLoading: isLoadingRestaurant } =
|
||||||
useGetRestaurantDetailsQuery("595", {
|
useGetRestaurantDetailsQuery("595", {
|
||||||
@@ -101,6 +104,10 @@ function MenuPage() {
|
|||||||
className={`${styles.headerFloatingBtn} ${styles.orderTypeSelectContainer}`}
|
className={`${styles.headerFloatingBtn} ${styles.orderTypeSelectContainer}`}
|
||||||
>
|
>
|
||||||
<Select
|
<Select
|
||||||
|
value={orderType}
|
||||||
|
onChange={(value) => {
|
||||||
|
dispatch(updateOrderType(value));
|
||||||
|
}}
|
||||||
options={orderTypeOptions}
|
options={orderTypeOptions}
|
||||||
variant="borderless"
|
variant="borderless"
|
||||||
size="small"
|
size="small"
|
||||||
|
|||||||
Reference in New Issue
Block a user