update restaurant details source & add loyalty icon

This commit is contained in:
2025-10-20 21:42:48 +03:00
parent c7f5620f5a
commit 6a6f92aefc
15 changed files with 305 additions and 205 deletions

View File

@@ -11,7 +11,7 @@ import ToRoomIcon from "components/Icons/ToRoomIcon";
import ProTitle from "components/ProTitle";
import { updateOrderType } from "features/order/orderSlice";
import { useTranslation } from "react-i18next";
import { Link } from "react-router-dom";
import { Link, useParams } from "react-router-dom";
import { useAppDispatch, useAppSelector } from "redux/hooks";
import styles from "./restaurant.module.css";
@@ -37,9 +37,9 @@ export default function RestaurantServices({
}: RestaurantServicesProps) {
const { t } = useTranslation();
const { isRTL } = useAppSelector((state) => state.locale);
const id = localStorage.getItem("restaurantName");
const { id } = useParams();
const dispatch = useAppDispatch();
const services = [
...((dineIn && [
{

View File

@@ -19,11 +19,12 @@ import LocalStorageHandler from "../menu/components/LocalStorageHandler";
export default function RestaurantPage() {
const param = useParams();
const { isRTL } = useAppSelector((state) => state.locale);
const { data, isLoading } = useGetRestaurantDetailsQuery(param.id, {
skip: !param.id,
});
const { restaurant, dineIn, pickup, delivery, gift, toOffice, toRoom } =
data || {};
const { data: restaurant, isLoading } = useGetRestaurantDetailsQuery(
"595",
{
skip: !param.id,
},
);
if (isLoading) {
return <Loader />;
@@ -34,8 +35,7 @@ export default function RestaurantPage() {
}
if (restaurant) {
localStorage.setItem("restaurantID", restaurant.id);
localStorage.setItem("restaurantName", restaurant.subdomain);
localStorage.setItem("restaurantID", restaurant.restautantId);
}
return (
@@ -48,7 +48,7 @@ export default function RestaurantPage() {
<div style={{ textAlign: "center", maxWidth: "100%" }}>
<div className={styles.logoContainer}>
<img
src={restaurant?.logom || ""}
src={restaurant?.restaurant_logo || ""}
alt="logo"
width={96}
height={96}
@@ -56,7 +56,7 @@ export default function RestaurantPage() {
/>
</div>
<ProTitle level={5} style={{ margin: 0 }}>
{isRTL ? restaurant?.nameAR : restaurant?.name}
{isRTL ? restaurant?.nameAR : restaurant?.restautantName}
</ProTitle>
<ProText style={{ fontSize: 14, margin: 0 }}>
{isRTL ? restaurant?.descriptionAR : restaurant?.description}
@@ -64,12 +64,12 @@ export default function RestaurantPage() {
</div>
<RestaurantServices
dineIn={dineIn}
pickup={pickup}
gift={gift}
delivery={delivery}
toRoom={toRoom}
toOffice={toOffice}
dineIn={restaurant?.dineIn}
pickup={restaurant?.pickup}
gift={restaurant?.gift}
delivery={restaurant?.delivery}
toRoom={restaurant?.toRoom}
toOffice={restaurant?.toOffice}
is_booking_enabled={restaurant?.is_booking_enabled === 1}
params={{ id: "1", locale: "en" }}
/>
@@ -85,8 +85,8 @@ export default function RestaurantPage() {
</div>
<LocalStorageHandler
restaurantID={restaurant.id}
restaurantName={restaurant.subdomain}
restaurantID={restaurant.restautantId}
restaurantName={restaurant.restautantName}
/>
</>
);