added advertising
This commit is contained in:
@@ -29,6 +29,8 @@ import { useFeedActions } from "../hooks/useFeedActions";
|
||||
import { useFavorites } from "../hooks/useFavorites";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useProfile } from "../hooks/useProfile";
|
||||
import { useFullscreenAdTrigger } from "../hooks/useFullscreenAdTrigger";
|
||||
import FullscreenAdOverlay from "../components/FullscreenAdOverlay";
|
||||
import type { ComponentType } from "react";
|
||||
|
||||
// Legacy .jsx-модули: TS инферирует их типы из JS неточно (бывают «странные»
|
||||
@@ -103,6 +105,15 @@ export default function MainFeed() {
|
||||
const hasSearchParams = searchQuery.trim().length > 0 || selectedCities.length > 0;
|
||||
const searchPrompt = isSearchView && !hasSearchParams;
|
||||
|
||||
// Реклама показывается на главной ленте (без фильтров/городов). Эта же
|
||||
// переменная включает обычные AdSlot-карточки в ленте и полноэкранную рекламу.
|
||||
const showAds = activeNav === "home" && selectedCities.length === 0 && !searchQuery.trim();
|
||||
|
||||
// Полноэкранная реклама по активному скроллу — работает так же на всех
|
||||
// устройствах (явных ограничений desktop-only не было). Триггер: 20 секунд
|
||||
// суммарного активного скролла ленты.
|
||||
const { ad: fullscreenAd, close: closeFullscreenAd } = useFullscreenAdTrigger(20, showAds);
|
||||
|
||||
const feed = useFeedPosts();
|
||||
const myPosts = useMyPosts(user?.id);
|
||||
const cityFeed = useCityFeed(selectedCities);
|
||||
@@ -464,6 +475,7 @@ export default function MainFeed() {
|
||||
filteredAds={filteredAds}
|
||||
activeNav={activeNav}
|
||||
searchPrompt={searchPrompt}
|
||||
showAds={showAds}
|
||||
liked={liked}
|
||||
likeCountAdj={likeCountAdj}
|
||||
onLike={actions.toggleLike}
|
||||
@@ -555,6 +567,8 @@ export default function MainFeed() {
|
||||
/>
|
||||
)}
|
||||
|
||||
{fullscreenAd && <FullscreenAdOverlay ad={fullscreenAd} onClose={closeFullscreenAd} />}
|
||||
|
||||
<BottomNav
|
||||
activeTab={isMapView ? "map" : isSearchView ? "search" : "home"}
|
||||
hasFilters={hasActiveFilters}
|
||||
|
||||
Reference in New Issue
Block a user