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

@@ -30,15 +30,14 @@ function MenuPage() {
const { id } = useParams();
const { isRTL } = useAppSelector((state) => state.locale);
const { t } = useTranslation();
const { data: restaurantDetails, isLoading: isLoadingRestaurant } =
useGetRestaurantDetailsQuery(id, {
const { data: restaurant, isLoading: isLoadingRestaurant } =
useGetRestaurantDetailsQuery("595", {
skip: !id,
});
const { restaurant } = restaurantDetails || {};
const { data: menuData, isLoading: isLoadingMenu } = useGetMenuQuery(
restaurantDetails?.restaurant.id,
restaurant?.restautantId,
{
skip: !restaurantDetails?.restaurant.id,
skip: !restaurant?.restautantId,
},
);
const { categoryRefs } = useScrollHandler();
@@ -47,10 +46,7 @@ function MenuPage() {
return (
<>
<LocalStorageHandler
restaurantID={restaurant?.id || ""}
restaurantName={restaurant?.subdomain || ""}
/>
<LocalStorageHandler restaurantID={restaurant?.restautantId || ""} />
{isLoading ? (
<MenuSkeleton categoryCount={10} itemCount={30} variant="default" />
@@ -58,7 +54,7 @@ function MenuPage() {
<div className={styles.menuContainer}>
<div className={styles.restaurantHeader}>
<ImageWithFallback
src={restaurant?.coverm}
src={restaurant?.restaurant_cover}
fallbackSrc={default_image}
alt={t("menu.restaurantCover")}
className={styles.cover}
@@ -71,7 +67,7 @@ function MenuPage() {
/>
<Image
src={restaurant?.logom}
src={restaurant?.restaurant_logo}
alt={t("menu.restaurantLogo")}
className={styles.logo}
width={"100%"}
@@ -101,7 +97,7 @@ function MenuPage() {
<div className={`${styles.headerContainer}`}>
<div className={styles.contentWrapper}>
<ProTitle level={4} className={styles.restaurantTitle}>
{isRTL ? restaurant?.nameAR : restaurant?.name}
{isRTL ? restaurant?.nameAR : restaurant?.restautantName}
</ProTitle>
<div className={styles.ratingContainer}>
@@ -120,7 +116,8 @@ function MenuPage() {
<div className={`${styles.pageContainer}`}>
<Space direction="vertical" style={{ width: "100%", gap: 16 }}>
<div>
<LoyaltyCard />
{restaurant?.loyalty_stamps &&
restaurant?.is_loyalty_enabled && <LoyaltyCard />}
<CategoriesList categories={menuData?.categories || []} />
</div>