add rstaurant opening hours
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import { PlusOutlined } from "@ant-design/icons";
|
||||
import { Button } from "antd";
|
||||
import { Button, message } from "antd";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useNavigate, useParams } from "react-router-dom";
|
||||
import { useAppSelector } from "redux/hooks.ts";
|
||||
import { useGetRestaurantDetailsQuery } from "redux/api/others";
|
||||
import { colors } from "ThemeConstants.ts";
|
||||
import styles from "./AddToCartButton.module.css";
|
||||
|
||||
@@ -12,6 +13,17 @@ export function AddToCartButton() {
|
||||
|
||||
const { subdomain } = useParams();
|
||||
const navigate = useNavigate();
|
||||
const { data: restaurant } = useGetRestaurantDetailsQuery(subdomain, {
|
||||
skip: !subdomain,
|
||||
});
|
||||
|
||||
const handleClick = () => {
|
||||
if (restaurant && !restaurant.isOpened) {
|
||||
message.warning(t("menu.restaurantIsClosed"));
|
||||
return;
|
||||
}
|
||||
navigate(`/${subdomain}/menu`);
|
||||
};
|
||||
|
||||
return (
|
||||
<Button
|
||||
@@ -20,9 +32,7 @@ export function AddToCartButton() {
|
||||
iconPosition="start"
|
||||
icon={<PlusOutlined title="add" className={styles.plusIcon} />}
|
||||
size="small"
|
||||
onClick={() => {
|
||||
navigate(`/${subdomain}/menu`);
|
||||
}}
|
||||
onClick={handleClick}
|
||||
className={`${styles.addButton} ${isRTL ? styles.addButtonRTL : styles.addButtonLTR}`}
|
||||
style={{ backgroundColor: colors.primary }}
|
||||
>
|
||||
|
||||
@@ -190,7 +190,7 @@ export default function ProductCard({ item }: Props) {
|
||||
height={90}
|
||||
/>
|
||||
|
||||
<AddToCartButton />
|
||||
{/* <AddToCartButton /> */}
|
||||
</Badge>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -474,6 +474,15 @@
|
||||
padding: 0 1rem;
|
||||
}
|
||||
|
||||
.openingHours {
|
||||
position: absolute;
|
||||
top: 190px;
|
||||
right: 10px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.restaurantTitle {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
@@ -693,4 +702,7 @@
|
||||
right: -10px !important;
|
||||
}
|
||||
|
||||
|
||||
:global(.ant-app-rtl) .openingHours {
|
||||
left: 10px;
|
||||
right: auto;
|
||||
}
|
||||
|
||||
@@ -126,6 +126,13 @@ function MenuPage() {
|
||||
{isRTL ? restaurant?.descriptionAR : restaurant?.description}
|
||||
</ProText>
|
||||
</div>
|
||||
|
||||
<ProText className={styles.openingHours}>
|
||||
{t("menu.openingHours", {
|
||||
openingTime: restaurant?.openingTime,
|
||||
closingTime: restaurant?.closingTime,
|
||||
})}
|
||||
</ProText>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -137,10 +144,7 @@ function MenuPage() {
|
||||
<CategoriesList categories={menuData?.categories || []} />
|
||||
</div>
|
||||
|
||||
<MenuList
|
||||
data={menuData}
|
||||
categoryRefs={categoryRefs}
|
||||
/>
|
||||
<MenuList data={menuData} categoryRefs={categoryRefs} />
|
||||
</Space>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user