change food item type
This commit is contained in:
@@ -121,8 +121,8 @@ const MenuIndex = () => {
|
||||
const selectedCatId = selectedCategory === '0' ? null : selectedCategory;
|
||||
|
||||
const filtered = foods.filter((item) => {
|
||||
const matchesCategory = !selectedCatId || item.category?.id === selectedCatId;
|
||||
const itemName = item.name || item.title || item.foodName || "";
|
||||
const matchesCategory = !selectedCatId || item.category === selectedCatId;
|
||||
const itemName = item.title;
|
||||
const matchesSearch =
|
||||
!search || itemName.toLowerCase().includes(lowerSearch);
|
||||
|
||||
@@ -134,9 +134,7 @@ const MenuIndex = () => {
|
||||
content.toLowerCase().includes(lowerIngredients)
|
||||
);
|
||||
}
|
||||
// اگر محتویات وجود نداشت یا خالی بود، در توضیحات جستجو میکنیم
|
||||
const description = item.description || item.desc || "";
|
||||
return description.toLowerCase().includes(lowerIngredients);
|
||||
return item.desc.toLowerCase().includes(lowerIngredients);
|
||||
})();
|
||||
|
||||
const matchesDelivery = selectedDeliveryId === "0" ||
|
||||
@@ -151,9 +149,8 @@ const MenuIndex = () => {
|
||||
return [...filtered].sort((a, b) => {
|
||||
switch (sortingKey) {
|
||||
case "PopularityDescending":
|
||||
return (b.points ?? 0) - (a.points ?? 0);
|
||||
case "RateDescending":
|
||||
return (b.rate ?? 0) - (a.rate ?? 0);
|
||||
return 0;
|
||||
case "PriceAscending":
|
||||
return (a.price ?? 0) - (b.price ?? 0);
|
||||
case "PriceDescending":
|
||||
|
||||
Reference in New Issue
Block a user