Initial commit

This commit is contained in:
2025-10-04 18:22:24 +03:00
commit 2852c2c054
291 changed files with 38109 additions and 0 deletions

View File

@@ -0,0 +1,769 @@
.container {
display: flex;
-webkit-overflow-scrolling: touch;
scrollbar-width: none;
-ms-overflow-style: none;
position: sticky;
top: 0;
background: var(--ant-bg-container);
z-index: 10;
border-bottom: 1px solid var(--ant-color-border);
overflow: auto;
transition: all 0.3s ease;
}
.container::-webkit-scrollbar {
display: none;
}
.menuSections {
margin-bottom: 105px !important;
display: flex;
flex-direction: column;
gap: 12px;
padding: 0 1rem;
}
.menuSection:first-child h3 {
margin-top: 0px !important;
}
.menuSection h3 {
margin: 30px 0px 15px 0px;
transition: color 0.3s ease;
}
/* Enhanced responsive menu section headers */
@media (min-width: 769px) and (max-width: 1024px) {
.menuSection h3 {
margin: 40px 0px 20px 0px;
font-size: 24px;
}
}
@media (min-width: 1025px) {
.menuSection h3 {
margin: 50px 0px 25px 0px;
font-size: 28px;
}
}
.menuItemsGrid {
display: grid;
gap: 12px;
grid-template-columns: 1fr;
margin-bottom: 10px;
}
.menuItemsGridMobile {
gap: 12px;
grid-template-columns: 1fr;
}
.menuItemsGridTablet {
grid-template-columns: repeat(2, 1fr);
gap: 16px;
padding: 0 12px;
margin-bottom: 20px;
}
.menuItemsGridDesktop {
grid-template-columns: repeat(3, 1fr);
gap: 20px;
padding: 0 16px;
margin-bottom: 24px;
}
/* Enhanced responsive menu items grid */
@media (min-width: 1280px) {
.menuItemsGridDesktop {
grid-template-columns: repeat(3, 1fr);
gap: 24px;
padding: 0 20px;
margin-bottom: 28px;
}
}
.popularMenuItemsGrid {
display: flex;
gap: 16px;
overflow-x: hidden;
scroll-behavior: smooth;
padding: 8px 0;
-ms-overflow-style: none;
scrollbar-width: none;
}
.popularMenuItemsGrid::-webkit-scrollbar {
display: none;
}
.popularMenuItemImage {
width: 90px;
height: 90px;
object-fit: cover;
border-radius: 8px;
transition: transform 0.3s ease;
overflow: hidden;
}
.popularMenuItemImageMobile {
height: 90px;
overflow: hidden;
}
.popularMenuItemImageTablet {
height: 95px;
width: 120px;
overflow: hidden;
}
.popularMenuItemImageDesktop {
height: 120px;
width: 140px;
overflow: hidden;
}
.menuItemImage {
object-fit: cover;
border-radius: 8px;
transition: transform 0.3s ease;
overflow: hidden;
}
.menuItemImage:hover {
transform: scale(1.05);
}
/* Enhanced responsive menu item images */
@media (min-width: 769px) and (max-width: 1024px) {
.menuItemImage {
border-radius: 12px;
}
}
@media (min-width: 1025px) {
.menuItemImage {
border-radius: 16px;
}
}
.menuItemDetails {
flex: 1;
display: flex;
flex-direction: column;
gap: 8px;
}
.itemDescription {
/* font-size: 12px !important; */
transition: color 0.3s ease;
}
/* Enhanced responsive item descriptions */
@media (min-width: 769px) and (max-width: 1024px) {
.itemDescription {
font-size: 14px !important;
}
}
@media (min-width: 1025px) {
.itemDescription {
font-size: 16px !important;
}
}
/* Responsive adjustments */
@media (max-width: 768px) {
.container {
gap: 4px;
}
}
@media (min-width: 769px) and (max-width: 1024px) {
.container {
gap: 12px;
}
}
.pageContainer {
padding: 0 16px;
transition: all 0.3s ease;
}
/* Enhanced responsive page container */
@media (min-width: 769px) and (max-width: 1024px) {
.pageContainer {
padding: 24px;
}
}
@media (min-width: 1025px) {
.pageContainer {
padding: 32px;
max-width: 1200px;
margin: 0 auto;
}
}
/* Sidebar state adjustments */
.sidebarCollapsed .pageContainer {
margin-left: 80px;
}
.sidebarExpanded .pageContainer {
margin-left: 200px;
}
/* .itemDescriptionIcons path {
fill: 000044 !important;
} */
@media (max-width: 768px) {
.sidebarCollapsed .pageContainer,
.sidebarExpanded .pageContainer {
margin-left: 0;
}
}
/* Enhanced Dark theme styles */
:global(.darkApp) .itemName {
color: rgba(255, 255, 255, 0.95) !important;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
transition: color 0.3s ease;
}
:global(.darkApp) .itemName:hover {
color: var(--primary) !important;
}
:global(.darkApp) .itemDescription {
color: rgba(255, 255, 255, 0.75) !important;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
:global(.darkApp) .itemPrice {
color: var(--primary) !important;
font-weight: 600;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
/* Enhanced dark theme for menu sections */
:global(.darkApp) .menuSection h3 {
color: #ffffff;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
:global(.darkApp) .menuSection {
background-color: #0a0a0a;
color: #ffffff;
}
/* Enhanced dark theme for menu items */
:global(.darkApp) .menuItem {
background-color: #181818 !important;
border-color: #363636 !important;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
transition: all 0.3s ease;
}
:global(.darkApp) .menuItem:hover {
background-color: #363636 !important;
border-color: #424242 !important;
transform: translateY(-2px);
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}
/* Enhanced dark theme for popular menu items */
:global(.darkApp) .popularMenuItem {
background-color: #181818 !important;
border-color: #363636 !important;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
transition: all 0.3s ease;
}
:global(.darkApp) .popularMenuItem:hover {
background-color: #363636 !important;
border-color: #424242 !important;
transform: translateY(-2px);
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}
@keyframes activePulse {
0%,
100% {
opacity: 0.1;
}
50% {
opacity: 0.2;
}
}
@keyframes darkActivePulse {
0%,
100% {
opacity: 0.05;
}
50% {
opacity: 0.15;
}
}
@keyframes imageEntrance {
0% {
transform: scale(0.9) rotate(-2deg);
opacity: 0.7;
}
100% {
transform: scale(1) rotate(0deg);
opacity: 1;
}
}
@keyframes imageReturn {
0% {
transform: scale(0.95) rotate(-1deg);
opacity: 0.85;
}
100% {
transform: scale(1) rotate(0deg);
opacity: 1;
}
}
@keyframes cardEntrance {
0% {
transform: translateY(20px) scale(0.95);
opacity: 0.8;
}
100% {
transform: translateY(0) scale(1);
opacity: 1;
}
}
@keyframes cardReturn {
0% {
transform: translateY(-5px) scale(0.98);
opacity: 0.9;
}
100% {
transform: translateY(0) scale(1);
opacity: 1;
}
}
@keyframes glowPulse {
0%,
100% {
opacity: 0.3;
transform: scaleX(0.8);
}
50% {
opacity: 0.6;
transform: scaleX(1);
}
}
@keyframes glowFadeOut {
0% {
opacity: 0.1;
transform: scaleX(1);
}
100% {
opacity: 0;
transform: scaleX(0.8);
}
}
@keyframes slideDown {
0% {
transform: translateY(-100%) scale(0.95);
opacity: 0;
filter: blur(10px);
}
50% {
transform: translateY(-20%) scale(0.98);
opacity: 0.7;
filter: blur(5px);
}
100% {
transform: translateY(0) scale(1);
opacity: 1;
filter: blur(0);
}
}
@keyframes slideUp {
0% {
transform: translateY(-10px) scale(0.98);
opacity: 0.9;
filter: blur(2px);
}
50% {
transform: translateY(-5px) scale(0.99);
opacity: 0.95;
filter: blur(1px);
}
100% {
transform: translateY(0) scale(1);
opacity: 1;
filter: blur(0);
}
}
@keyframes darkGlowPulse {
0%,
100% {
opacity: 0.4;
transform: scaleX(0.8);
}
50% {
opacity: 0.7;
transform: scaleX(1);
}
}
@keyframes darkGlowFadeOut {
0% {
opacity: 0.2;
transform: scaleX(1);
}
100% {
opacity: 0;
transform: scaleX(0.8);
}
}
/* Enhanced dark theme for menu item images */
:global(.darkApp) .menuItemImage,
:global(.darkApp) .popularMenuItemImage {
border-color: rgba(255, 255, 255, 0.1);
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
/* Enhanced dark theme for add to cart buttons */
:global(.darkApp) .addToCartButton {
background-color: var(--primary) !important;
border-color: var(--primary) !important;
color: #000000 !important;
font-weight: 600;
transition: all 0.3s ease;
}
:global(.darkApp) .addToCartButton:hover {
background-color: #ffd633 !important;
border-color: #ffd633 !important;
transform: translateY(-1px);
box-shadow: 0 4px 8px rgba(255, 198, 0, 0.3);
}
/* Enhanced dark theme for quantity controls */
:global(.darkApp) .quantityControl {
background-color: rgba(42, 42, 42, 0.8);
border-color: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(8px);
}
:global(.darkApp) .quantityButton {
background-color: rgba(54, 54, 54, 0.8) !important;
border-color: rgba(255, 255, 255, 0.1) !important;
color: #ffffff !important;
transition: all 0.3s ease;
}
:global(.darkApp) .quantityButton:hover {
background-color: rgba(66, 66, 66, 0.9) !important;
border-color: var(--primary) !important;
}
:global(.darkApp) .quantityInput {
background-color: rgba(42, 42, 42, 0.8) !important;
border-color: rgba(255, 255, 255, 0.1) !important;
color: #ffffff !important;
text-align: center;
}
/* Enhanced dark theme for container backgrounds */
:global(.darkApp) .container {
background-color: #0a0a0a !important;
border-bottom-color: #363636 !important;
}
:global(.darkApp) .itemDescriptionIcons path {
fill: #ffffff;
}
/* Cart badge styles */
.cartBadge {
position: absolute;
top: -8px;
z-index: 2;
color: white;
border-radius: 50%;
min-width: 20px;
height: 20px;
display: flex;
align-items: center;
justify-content: center;
font-size: 12px;
font-weight: 600;
transition: all 0.3s ease;
border: none;
}
.cartBadge:hover {
transform: scale(1.1);
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}
.cartBadgeRTL {
left: -16px;
}
.cartBadgeLTR {
right: -8px;
}
/* Enhanced responsive cart badge */
@media (min-width: 769px) and (max-width: 1024px) {
.cartBadge {
min-width: 24px;
height: 24px;
font-size: 14px;
}
}
@media (min-width: 1025px) {
.cartBadge {
min-width: 28px;
height: 28px;
font-size: 16px;
}
}
/* RTL support for cart badge */
/* [dir="rtl"] .cartBadge {
right: auto;
left: -8px;
} */
/* Animation for newly added items */
@keyframes badgePulse {
0% {
transform: scale(1);
}
50% {
transform: scale(1.2);
}
100% {
transform: scale(1);
}
}
.cartBadge.animate {
animation: badgePulse 0.6s ease-in-out;
}
/* Enhanced dark theme animations */
:global(.darkApp) .menuItem,
:global(.darkApp) .popularMenuItem {
animation: fadeInUp 0.3s ease-out;
}
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* Smooth transitions for all elements */
.container *,
.menuItem *,
.popularMenuItem * {
transition: all 0.3s ease;
}
/* Enhanced responsive menu item cards */
@media (min-width: 769px) and (max-width: 1024px) {
.menuItem {
border-radius: 12px !important;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}
.menuItem:hover {
transform: translateY(-4px);
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15) !important;
}
}
@media (min-width: 1025px) {
.menuItem {
border-radius: 16px !important;
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1) !important;
}
.menuItem:hover {
transform: translateY(-6px);
box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15) !important;
}
}
/* Enhanced responsive focus states */
.menuItem:focus {
outline: 2px solid var(--primary);
outline-offset: 2px;
}
@media (min-width: 768px) {
.menuItem:focus {
outline-offset: 4px;
}
}
/* Enhanced responsive print styles */
@media print {
.menuItem {
box-shadow: none !important;
border: 1px solid #ccc !important;
}
}
/* Skeleton Loading Styles */
.skeletonContainer {
animation: skeletonPulse 1.5s ease-in-out infinite;
}
.skeletonContainer .ant-skeleton {
transition: all 0.3s ease;
}
.skeletonContainer .ant-skeleton-image {
border-radius: 8px;
overflow: hidden;
}
.skeletonContainer .ant-skeleton-input {
border-radius: 6px;
}
.skeletonContainer .ant-skeleton-button {
border-radius: 20px;
}
@keyframes skeletonPulse {
0% {
opacity: 1;
}
50% {
opacity: 0.7;
}
100% {
opacity: 1;
}
}
@keyframes skeletonShimmer {
0% {
background-position: -200px 0;
}
100% {
background-position: calc(200px + 100%) 0;
}
}
.skeletonContainer .ant-skeleton-active .ant-skeleton-input,
.skeletonContainer .ant-skeleton-active .ant-skeleton-image,
.skeletonContainer .ant-skeleton-active .ant-skeleton-button {
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
background-size: 200px 100%;
animation: skeletonShimmer 1.5s infinite;
}
/* Mobile-specific skeleton styles */
@media (max-width: 768px) {
.skeletonContainer .ant-skeleton {
margin-bottom: 12px;
}
.skeletonContainer .ant-skeleton-image {
border-radius: 4px;
}
.skeletonContainer .ant-skeleton-input {
border-radius: 4px;
}
.skeletonContainer .ant-skeleton-button {
border-radius: 16px;
}
}
/* Dark theme skeleton styles */
:global(.darkApp) .skeletonContainer .ant-skeleton-active .ant-skeleton-input,
:global(.darkApp) .skeletonContainer .ant-skeleton-active .ant-skeleton-image,
:global(.darkApp) .skeletonContainer .ant-skeleton-active .ant-skeleton-button {
background: linear-gradient(90deg, #181818 25%, #363636 50%, #181818 75%);
background-size: 200px 100%;
animation: skeletonShimmer 1.5s infinite;
}
:global(.darkApp) .skeletonContainer .ant-skeleton-input,
:global(.darkApp) .skeletonContainer .ant-skeleton-image,
:global(.darkApp) .skeletonContainer .ant-skeleton-button {
background-color: #181818;
border-color: #363636;
}
/* Tablet-specific skeleton styles */
@media (min-width: 769px) and (max-width: 1024px) {
.skeletonContainer {
padding: 24px;
}
.skeletonContainer .ant-skeleton {
margin-bottom: 16px;
}
.skeletonContainer .ant-skeleton-image {
border-radius: 6px;
}
.skeletonContainer .ant-skeleton-input {
border-radius: 5px;
}
.skeletonContainer .ant-skeleton-button {
border-radius: 18px;
}
}
.menuItemsGridSticky {
height: 60;
}
.heartButton {
position: absolute;
top: 5px;
left: 5px;
}
:global(.rtl) .heartButton {
right: 5px;
}
.productLink {
border-radius: 8px;
}
.categoryMenuItemImage {
width: 100%;
object-fit: cover;
border-radius: 8px;
text-align: center;
}

View File

@@ -0,0 +1,281 @@
import { Badge, Card, Grid } from "antd";
import ArabicPrice from "components/ArabicPrice";
import ImageWithFallback from "components/ImageWithFallback";
import { ItemDescriptionIcons } from "components/ItemDescriptionIcons/ItemDescriptionIcons";
import ProText from "components/ProText";
import ProTitle from "components/ProTitle";
import { useTranslation } from "react-i18next";
import { useNavigate } from "react-router-dom";
import { useAppSelector } from "redux/hooks";
import { colors } from "ThemeConstants";
import { Product } from "utils/types/appTypes";
import { AddToCart } from "../AddToCart";
import styles from "./MenuList.module.css";
interface MenuListProps {
data:
| {
products: Product[];
categories: { id: number; name: string; image?: string }[];
}
| undefined;
id: string;
categoryRefs: React.RefObject<{ [key: number]: HTMLDivElement | null }>;
}
const { useBreakpoint } = Grid;
export function MenuList({ data, categoryRefs }: MenuListProps) {
const { isRTL } = useAppSelector((state) => state.locale);
const products = data?.products;
const { xs, md } = useBreakpoint();
const { items } = useAppSelector((state) => state.order);
const restaurantName = localStorage.getItem("restaurantName");
const navigate = useNavigate();
const { t } = useTranslation();
const { themeName } = useAppSelector((state) => state.theme);
// Show error state if data exists but has no products
if (data && (!data.products || data.products.length === 0)) {
return (
<div
className={styles.menuSections}
style={{ padding: "40px", textAlign: "center" }}
>
<ProText type="secondary">{t("menu.noMenuItemsAvailable")}</ProText>
</div>
);
}
// Group products by category
const productsByCategory = products?.reduce((acc, product) => {
if (product.categoryId && !acc[product?.categoryId]) {
acc[product?.categoryId] = [];
}
acc[product?.categoryId || 0].push(product);
return acc;
}, {} as Record<number, Product[]>);
return (
<>
<div className={styles.menuSections}>
{data?.categories?.map((category) => {
const categoryProducts = productsByCategory?.[category.id] || [];
if (categoryProducts.length === 0) return null;
return (
<div
key={category.id}
ref={(el) => {
if (categoryRefs.current) {
categoryRefs.current[category.id] = el;
}
}}
style={{ marginBottom: "1rem" }}
>
<ImageWithFallback
src={category.image || "/default.png"}
fallbackSrc="/default.png"
alt={category.name}
width="100%"
height={130}
style={{
width: "100%",
objectFit: "cover",
borderRadius: 8,
overflow: "hidden",
}}
className={styles.categoryMenuItemImage}
loadingContainerStyle={{
width: "100%",
}}
/>
<ProTitle
style={{
fontSize: "1.25rem",
fontWeight: "bold",
marginBottom: "1rem",
textAlign: "center",
color: themeName === "dark" ? "#fff" : "#000044",
}}
level={5}
>
{isRTL ? category.name : category.name}
</ProTitle>
<div
style={{
display: "flex",
flexDirection: "column",
gap: "1rem",
}}
>
{categoryProducts.map((item: Product) => (
<div
key={item.id}
className={styles.productLink}
onClick={() => {
localStorage.setItem("product", JSON.stringify(item));
navigate(`/${restaurantName}/product/${item.id}`);
}}
>
<Card
key={item.id}
style={{
borderRadius: 8,
overflow: "hide",
}}
styles={{
body: {
display: "flex",
flexDirection: "column",
justifyContent: "space-between",
borderRadius: 8,
padding: item.description
? "16px 16px 8px 16px"
: "16px 16px 24px 16px",
overflow: "hide",
boxShadow:
"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.05)",
},
}}
>
<div
style={{
display: "flex",
alignItems: "center",
justifyContent: "space-between",
height: "100%",
gap: xs ? 10 : 16,
}}
>
<div
style={{
display: "flex",
flexDirection: "column",
justifyContent: "space-between",
gap: "0.5rem",
}}
>
<ProText
style={{
margin: 0,
display: "inline-block",
fontSize: xs ? "1rem" : 18,
fontWeight: 600,
letterSpacing: "-0.01em",
lineHeight: 1.2,
color: themeName === "dark" ? "#fff" : "#000044",
}}
>
{isRTL ? item.name : item.nameOther}
</ProText>
{item.description && (
<ProText
type="secondary"
className={styles.itemDescription}
style={{
display: "-webkit-box",
WebkitBoxOrient: "vertical",
WebkitLineClamp: xs ? 2 : 4,
overflow: "hidden",
textOverflow: "ellipsis",
wordWrap: "break-word",
overflowWrap: "break-word",
lineHeight: "1.5rem",
maxHeight: xs ? "3em" : "6.6em",
fontSize: xs ? "1rem" : 18,
letterSpacing: "0.01em",
}}
>
{item.description}
</ProText>
)}
<div>
{item.original_price !== item.price && (
<ArabicPrice
price={item.original_price}
strong
style={{
fontSize: xs ? "1rem" : 22,
fontWeight: 700,
color: colors.primary,
textDecoration: "line-through",
marginRight: isRTL ? 0 : 10,
marginLeft: isRTL ? 10 : 0,
}}
/>
)}
<ArabicPrice
price={item.price}
strong
style={{
fontSize: xs ? "1rem" : 22,
fontWeight: 700,
color: colors.primary,
}}
/>
</div>
<div
style={{
position: "relative",
...(isRTL ? { right: -5 } : {}),
}}
>
<ItemDescriptionIcons
className={styles.itemDescriptionIcons}
/>
</div>
</div>
<div style={{ position: "relative" }}>
<ImageWithFallback
src={item.image_small || "/default.png"}
fallbackSrc="/default.png"
alt={item.name}
className={`${styles.popularMenuItemImage} ${
xs
? styles.popularMenuItemImageMobile
: md
? styles.popularMenuItemImageTablet
: styles.popularMenuItemImageDesktop
}`}
width={90}
height={90}
/>
<AddToCart item={item} />
{items.find((i) => i.id === item.id) && (
<Badge
count={
items.find((i) => i.id === item.id)?.quantity
}
className={
styles.cartBadge +
" " +
(isRTL
? styles.cartBadgeRTL
: styles.cartBadgeLTR)
}
style={{
backgroundColor: colors.primary,
}}
title={`${
items.find((i) => i.id === item.id)?.quantity
} in cart`}
/>
)}
</div>
</div>
</Card>
</div>
))}
</div>
</div>
);
})}
</div>
</>
);
}