diff --git a/src/components/LoyaltyCard/LoyaltyCard.tsx b/src/components/LoyaltyCard/LoyaltyCard.tsx
index 556a6fc..3305ac6 100644
--- a/src/components/LoyaltyCard/LoyaltyCard.tsx
+++ b/src/components/LoyaltyCard/LoyaltyCard.tsx
@@ -1,8 +1,6 @@
import { Card, Col, Image, Row } from "antd";
-import PresentIcon from "components/Icons/cart/PresentIcon";
import { useTranslation } from "react-i18next";
import { Link, useParams } from "react-router-dom";
-import { useGetRestaurantDetailsQuery } from "redux/api/others";
import { ACCESS_TOKEN } from "utils/constants";
import { colors } from "ThemeConstants.ts";
import ProText from "../ProText";
@@ -12,7 +10,7 @@ import { useAppSelector } from "redux/hooks";
const LoyaltyCard = () => {
const { t } = useTranslation();
const { subdomain } = useParams();
- const { data: restaurant } = useGetRestaurantDetailsQuery(subdomain);
+ const { restaurant } = useAppSelector((state) => state.order);
const { isRTL } = useAppSelector((state) => state.locale);
const token = localStorage.getItem(ACCESS_TOKEN);
const loyaltyStamps = restaurant?.loyalty_stamps ?? 0;
diff --git a/src/components/privateRoute/PrivateRoute.tsx b/src/components/privateRoute/PrivateRoute.tsx
deleted file mode 100644
index d487095..0000000
--- a/src/components/privateRoute/PrivateRoute.tsx
+++ /dev/null
@@ -1,47 +0,0 @@
-import { Loader } from "components/Loader/Loader";
-import { Navigate, useParams } from "react-router-dom";
-import { useAppSelector } from "redux/hooks";
-
-export const PrivateRoute = ({
- children,
-}: // permission,
-{
- children: JSX.Element;
- permission?: string;
-}) => {
- const { token, loading } = useAppSelector((state) => state.auth);
- const { subdomain } = useParams();
-
- // const { data: user, isLoading: loadingUser } = useGetSignedUserInfoQuery();
-
- // useEffect(() => {
- // if (user) dispatch(setUser(user));
- // }, [dispatch, user]);
-
- if (loading) {
- return ;
- }
-
- // let newPermissions: any[] = [];
- // // aggregate the rules from multi
- // user?.roles?.forEach(
- // (r) => (newPermissions = [...newPermissions, ...r.permissions])
- // );
-
- // const userHasRequiredPermission = permission
- // ? !!newPermissions.find((p) => p.name === permission)
- // : true;
-
- console.log(token);
-
-
- if (!token) {
- return ;
- }
-
- // if (token && !userHasRequiredPermission) {
- // return ; // build your won access denied page (sth like 404)
- // }
-
- return children;
-};
diff --git a/src/hooks/useDetectBarcode.ts b/src/hooks/useDetectBarcode.ts
deleted file mode 100644
index c9fcfad..0000000
--- a/src/hooks/useDetectBarcode.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-import { useEffect, useState } from "react";
-
-export function useDetectBarcode() {
- const [barcode, setBarcode] = useState("");
- const [lastBarcode, setLastBarcode] = useState("");
-
- useEffect(() => {
- let interval: any;
-
- const handleKeydown = (evt: any) => {
- if (interval) clearInterval(interval);
-
- if (evt.code === "Enter") {
- if (barcode) handleBarcode(barcode);
- setBarcode("");
- return;
- }
-
- if (evt.key !== "Shift") setBarcode((prev) => prev + evt.key);
-
- interval = setInterval(() => setBarcode(""), 20);
- };
-
- // Adding the event listener when the component mounts
- document.addEventListener("keydown", handleKeydown);
-
- // Cleanup the event listener when the component unmounts
- return () => {
- document.removeEventListener("keydown", handleKeydown);
- if (interval) clearInterval(interval);
- };
- }, [barcode]);
-
- const handleBarcode = (scannedBarcode: string) => {
- setLastBarcode(scannedBarcode);
- };
-
- return lastBarcode;
-}
diff --git a/src/hooks/useSwipeUp.ts b/src/hooks/useSwipeUp.ts
deleted file mode 100644
index 120df75..0000000
--- a/src/hooks/useSwipeUp.ts
+++ /dev/null
@@ -1,52 +0,0 @@
-import { useRef, useState, useCallback } from "react";
-
-type Props = { isEnabled: boolean; swipeAction: () => void };
-
-export default function useSwipeUp({ isEnabled, swipeAction }: Props) {
- // Swipe detection
- const startYRef = useRef(0);
- const [isSwiping, setIsSwiping] = useState(false);
- const containerRef = useRef(null);
- // Touch event handlers for swipe detection
- const handleTouchStart = useCallback(
- (e: React.TouchEvent) => {
- if (!isEnabled) return;
- startYRef.current = e.touches[0].clientY;
- setIsSwiping(true);
- },
- [isEnabled],
- );
-
- /*
- const handleTouchMove = useCallback(
- (e: React.TouchEvent) => {
- if (!isSwiping) return;
- },
- [isSwiping],
- );
-*/
-
- const handleTouchEnd = useCallback(
- (e: React.TouchEvent) => {
- if (!isSwiping || !isEnabled) return;
-
- const endY = e.changedTouches[0].clientY;
- const deltaY = startYRef.current - endY;
- const threshold = 70; // Threshold to detect a swipe up
-
- if (deltaY > threshold) {
- // Swipe up detected
- swipeAction();
- }
-
- setIsSwiping(false);
- },
- [isSwiping, isEnabled],
- );
-
- return {
- containerRef,
- handleTouchStart,
- handleTouchEnd,
- };
-}
diff --git a/src/hooks/useTranslations.tsx b/src/hooks/useTranslations.tsx
deleted file mode 100644
index f213820..0000000
--- a/src/hooks/useTranslations.tsx
+++ /dev/null
@@ -1,7 +0,0 @@
-import { useAppSelector } from "redux/hooks";
-
-export function useTranslations() {
- const { isRTL } = useAppSelector((state) => state.locale);
- const nameProp = isRTL ? "arabic_name" : "name";
- return [nameProp] as const ;
-}
diff --git a/src/layouts/app/FooterNav.tsx b/src/layouts/app/FooterNav.tsx
deleted file mode 100644
index 1d79763..0000000
--- a/src/layouts/app/FooterNav.tsx
+++ /dev/null
@@ -1,13 +0,0 @@
-import { Layout } from 'antd';
-
-const { Footer } = Layout;
-
-type FooterNavProps = React.HTMLAttributes;
-
-const FooterNav = ({ ...others }: FooterNavProps) => {
- return (
-
- );
-};
-
-export default FooterNav;
diff --git a/src/layouts/app/useSidebarItems.tsx b/src/layouts/app/useSidebarItems.tsx
deleted file mode 100644
index 1502baa..0000000
--- a/src/layouts/app/useSidebarItems.tsx
+++ /dev/null
@@ -1,70 +0,0 @@
-import { BugFilled } from "@ant-design/icons";
-import { MenuProps } from "antd";
-import { PATHS } from "utils/constants";
-
-// import WarehouseIcon from "components/Icons/WarehouseIcon";
-import { useTranslation } from "react-i18next";
-import { Link } from "react-router-dom";
-
-export default function useSidebarItems() {
- type MenuItem = Required["items"][number] & {
- permission: string;
- children?: MenuItem[];
- };
- const { t } = useTranslation();
- // const [isAuth] = useAuth();
- const getItem = (
- label: React.ReactNode,
- key: React.Key,
- permission?: string,
- icon?: React.ReactNode,
- children?: MenuItem[],
- type?: "group"
- ): MenuItem => {
- return {
- key,
- icon,
- children,
- label,
- type,
- permission,
- } as MenuItem;
- };
-
- // Recursive function to filter items based on permissions
- const getGrantedItems = (items: any[]): MenuItem[] => {
- return items
- .filter(() => true)// Filter out items without permission
- .map((item: any) => {
- if (item.children) {
- // Recursively filter children
- return {
- ...item,
- children: getGrantedItems(item.children),
- };
- }
- return item;
- });
- };
-
- const items: MenuProps["items"] = [
- getItem(
- t("menu"),
- PATHS.menu,
- undefined,
-
-
-
-
-
- ),
- ];
-
- // if we have a menu with empty children after applying "getGrantedItems"
- // we going to remove it
- const grantedItems = getGrantedItems(items).filter(
- (i) => (i.children && i.children.length !== 0) || !i.children
- );
-
- return grantedItems;
-}
diff --git a/src/pages/cart/components/CartMobileTabletLayout.tsx b/src/pages/cart/components/CartMobileTabletLayout.tsx
index 0ff7597..245135b 100644
--- a/src/pages/cart/components/CartMobileTabletLayout.tsx
+++ b/src/pages/cart/components/CartMobileTabletLayout.tsx
@@ -33,7 +33,6 @@ export default function CartMobileTabletLayout({
const { items, orderType } = useAppSelector(selectCart);
const { isRTL } = useAppSelector((state) => state.locale);
const { subdomain } = useParams();
- const { pickup_type } = useAppSelector((state) => state.order.restaurant);
const { isMobile, isTablet } = useBreakPoint();
const getResponsiveClass = () => (isTablet ? "tablet" : "mobile");
const navigate = useNavigate();
diff --git a/src/pages/menu/page.tsx b/src/pages/menu/page.tsx
index 3302e05..b58cb3e 100644
--- a/src/pages/menu/page.tsx
+++ b/src/pages/menu/page.tsx
@@ -206,7 +206,7 @@ function MenuPage() {
border: "none",
}}
onClick={() => {
- if (table) callWaiter({
+ if (table) callWaiter({
table_id: table,
call_reason: "call_waiter",
}).unwrap().then(() => {
diff --git a/src/pages/restaurant/page.tsx b/src/pages/restaurant/page.tsx
index 38eb645..f5085a6 100644
--- a/src/pages/restaurant/page.tsx
+++ b/src/pages/restaurant/page.tsx
@@ -10,16 +10,13 @@ import styles from "./restaurant.module.css";
import RestaurantServices from "./RestaurantServices";
// Import the Client Component for localStorage handling
-import Ads1 from "components/Ads/Ads1";
import { OrderDetailsBottomSheet } from "components/CustomBottomSheet/orderDetailsSheet/OrderDetailsBottomSheet.tsx";
import { Loader } from "components/Loader/Loader";
import {
CART_STORAGE_KEYS,
updateOrderType,
} from "features/order/orderSlice.ts";
-import useBreakPoint from "hooks/useBreakPoint";
import { useRestaurant } from "hooks/useRestaurant";
-import useSwipeUp from "hooks/useSwipeUp";
import { OrderType } from "pages/checkout/hooks/types.ts";
import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
diff --git a/src/routes/routes.tsx b/src/routes/routes.tsx
index d71ea4e..20a9f6e 100644
--- a/src/routes/routes.tsx
+++ b/src/routes/routes.tsx
@@ -1,6 +1,5 @@
import { Grid } from "antd";
import { Loader } from "components/Loader/Loader";
-import { PrivateRoute } from "components/privateRoute/PrivateRoute";
import { PublicRoute } from "components/publicRoute/PublicRoute";
import { AppLayout } from "layouts";
import HeaderMenuDrawer from "layouts/app/HeaderMenuDrawer";
@@ -9,7 +8,7 @@ import CardDetailsPage from "pages/CardDetails/CardDetails";
import CartPage from "pages/cart/page";
import CheckoutPage from "pages/checkout/page";
import EGiftCardsPage from "pages/EGiftCards/EGiftCards";
-import { Error400Page, ErrorPage } from "pages/errors";
+import { ErrorPage } from "pages/errors";
import LoginPage from "pages/login/page";
import MenuPage from "pages/menu/page";
import OrderDetails from "pages/order/components/OrderDetails";
@@ -123,9 +122,9 @@ export const router = createHashRouter([
element: (
+
-
+
}
/>
),
@@ -195,20 +194,6 @@ export const router = createHashRouter([
},
],
},
- {
- path: "errors",
- errorElement: ,
- children: [
- {
- path: "400",
- element: (
-
-
-
- ),
- },
- ],
- },
]);
export default router;