fix bug and errors
This commit is contained in:
@@ -27,9 +27,11 @@ import { useInfiniteScroll } from "../hooks/useInfiniteScroll";
|
||||
import { useModals } from "../hooks/useModals";
|
||||
import { useFeedActions } from "../hooks/useFeedActions";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { CATEGORY_ITEM, CATEGORY_OTHER, CATEGORY_PET } from "../config/feedConstants";
|
||||
import { useProfile } from "../hooks/useProfile";
|
||||
import { useFullscreenAdTrigger } from "../hooks/useFullscreenAdTrigger";
|
||||
import FullscreenAdOverlay from "../components/FullscreenAdOverlay";
|
||||
import Toast from "../components/Toast";
|
||||
import type { ComponentType } from "react";
|
||||
|
||||
// Legacy .jsx-модули: TS инферирует их типы из JS неточно (бывают «странные»
|
||||
@@ -328,10 +330,13 @@ export default function MainFeed() {
|
||||
result = feed.ads;
|
||||
}
|
||||
|
||||
// Сравниваем с теми же значениями, что уходят на бэкенд (CATEGORIES),
|
||||
// а не с русскими литералами: интерфейс-то может быть на английском.
|
||||
if (activeNav === "items") {
|
||||
result = result.filter(ad => ["Вещь", "Другое"].includes(ad.category));
|
||||
result = result.filter((ad: AnyAds[number]) =>
|
||||
[CATEGORY_ITEM, CATEGORY_OTHER].includes(ad.category));
|
||||
} else if (activeNav === "pets") {
|
||||
result = result.filter(ad => ad.category === "Питомец");
|
||||
result = result.filter((ad: AnyAds[number]) => ad.category === CATEGORY_PET);
|
||||
}
|
||||
|
||||
if (typeFilter) {
|
||||
@@ -514,6 +519,14 @@ export default function MainFeed() {
|
||||
|
||||
{fullscreenAd && <FullscreenAdOverlay ad={fullscreenAd} onClose={closeFullscreenAd} />}
|
||||
|
||||
{/* Ошибки удаления/отметки «найдено»: без этого тоста неудачный запрос
|
||||
выглядел бы как «ничего не произошло». */}
|
||||
<Toast
|
||||
message={actions.error}
|
||||
type="error"
|
||||
onDismiss={actions.clearError}
|
||||
/>
|
||||
|
||||
<BottomNav
|
||||
activeTab={isMapView ? "map" : isSearchView ? "search" : "home"}
|
||||
hasFilters={hasActiveFilters}
|
||||
|
||||
Reference in New Issue
Block a user