diff --git a/prediqo_mobile/lib/features/home/presentation/home_screen.dart b/prediqo_mobile/lib/features/home/presentation/home_screen.dart index 2d09fa29..1e6665f9 100644 --- a/prediqo_mobile/lib/features/home/presentation/home_screen.dart +++ b/prediqo_mobile/lib/features/home/presentation/home_screen.dart @@ -387,12 +387,15 @@ class _HomeScreenState extends State { ); }, ), - const SizedBox(height: 12), - HomeAdCarousel( - ads: _heroAds, - loading: _adsLoading && _heroAds.isEmpty, - ), - const SizedBox(height: 22), + if ((_adsLoading && _heroAds.isEmpty) || + _heroAds.isNotEmpty) ...[ + const SizedBox(height: 12), + HomeAdCarousel( + ads: _heroAds, + loading: _adsLoading && _heroAds.isEmpty, + ), + const SizedBox(height: 22), + ], _SectionTitle( title: s.playNow, subtitle: s.playNowSubtitle, diff --git a/prediqo_mobile/lib/features/home/presentation/widgets/home_ad_carousel.dart b/prediqo_mobile/lib/features/home/presentation/widgets/home_ad_carousel.dart index eaa25cb7..3b10ef0d 100644 --- a/prediqo_mobile/lib/features/home/presentation/widgets/home_ad_carousel.dart +++ b/prediqo_mobile/lib/features/home/presentation/widgets/home_ad_carousel.dart @@ -2,7 +2,6 @@ import 'dart:async'; import 'package:flutter/material.dart'; import '../../../../core/theme/app_colors.dart'; import '../../../../data/models/advertisement_models.dart'; -import '../../../../l10n/app_strings.dart'; import '../../../../shared/widgets/pred_skeleton.dart'; import '../../utils/home_navigation.dart'; @@ -67,43 +66,14 @@ class _HomeAdCarouselState extends State { @override Widget build(BuildContext context) { - final s = context.strings; if (widget.ads.isNotEmpty) { return _buildCarousel(); } if (widget.loading) { return const PredSkeletonCarousel(height: 168); } - - final isDark = Theme.of(context).brightness == Brightness.dark; - return Container( - height: 168, - padding: const EdgeInsets.all(24), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(22), - gradient: LinearGradient( - begin: Alignment.topLeft, - end: Alignment.bottomRight, - colors: [ - AppColors.primary.withValues(alpha: isDark ? 0.22 : 0.14), - isDark ? AppColors.surfaceCard : Colors.white, - ], - ), - border: Border.all( - color: isDark ? AppColors.border : const Color(0xFFE2E8F0), - ), - ), - alignment: Alignment.center, - child: Text( - s.promotionsComingSoon, - textAlign: TextAlign.center, - style: Theme.of(context).textTheme.bodyMedium?.copyWith( - color: isDark - ? AppColors.textSecondary - : const Color(0xFF475569), - ), - ), - ); + // No campaigns published → reclaim vertical space (no placeholder card). + return const SizedBox.shrink(); } Widget _buildCarousel() { diff --git a/prediqo_mobile/lib/features/welcome/presentation/welcome_screen.dart b/prediqo_mobile/lib/features/welcome/presentation/welcome_screen.dart index 2cffc615..adc13d9d 100644 --- a/prediqo_mobile/lib/features/welcome/presentation/welcome_screen.dart +++ b/prediqo_mobile/lib/features/welcome/presentation/welcome_screen.dart @@ -522,14 +522,21 @@ class _WelcomeScreenState extends State { ], ), ).animate().fadeIn(duration: 400.ms).slideY(begin: 0.04, end: 0), - const SizedBox(height: 18), - // Soft-fail ads: empty/placeholder carousel, never a connection banner. - HomeAdCarousel( - ads: _heroAds, - loading: _adsLoading && _heroAds.isEmpty && _adsError == null, - onAdTap: (_) => _goLogin(), - ), - const SizedBox(height: 22), + if ((_adsLoading && + _heroAds.isEmpty && + _adsError == null) || + _heroAds.isNotEmpty) ...[ + const SizedBox(height: 18), + // Soft-fail ads: never a connection banner; hide when none published. + HomeAdCarousel( + ads: _heroAds, + loading: _adsLoading && + _heroAds.isEmpty && + _adsError == null, + onAdTap: (_) => _goLogin(), + ), + const SizedBox(height: 22), + ], Text( s.welcomeGamesTitle, style: Theme.of(context).textTheme.titleMedium?.copyWith( diff --git a/prediqo_mobile/test/home_section_load_test.dart b/prediqo_mobile/test/home_section_load_test.dart index f9b3a628..edb5f3d5 100644 --- a/prediqo_mobile/test/home_section_load_test.dart +++ b/prediqo_mobile/test/home_section_load_test.dart @@ -251,8 +251,8 @@ void main() { await tester.pump(); await tester.pump(const Duration(milliseconds: 500)); - // Soft-fail: empty promo placeholder, games remain; no ads SectionError. - expect(find.textContaining('promotions coming soon'), findsOneWidget); + // Soft-fail: ads band hidden (no placeholder), games remain; no ads SectionError. + expect(find.textContaining('promotions coming soon'), findsNothing); expect(find.text('Candle Predict'), findsOneWidget); expect(find.byKey(const Key('home_deposit_shortcut')), findsOneWidget); }); diff --git a/prediqo_web/src/features/landing/LandingPage.tsx b/prediqo_web/src/features/landing/LandingPage.tsx index 7716766f..7bc3b865 100644 --- a/prediqo_web/src/features/landing/LandingPage.tsx +++ b/prediqo_web/src/features/landing/LandingPage.tsx @@ -58,14 +58,17 @@ export function LandingPage() { useScrollReveal(); + const hasCampaigns = (heroQ.data?.length ?? 0) > 0; + const showCampaigns = heroQ.isLoading || hasCampaigns; + const navItems = useMemo( () => [ - { id: 'offers', label: t('landing.nav.offers') }, + ...(hasCampaigns ? [{ id: 'offers', label: t('landing.nav.offers') }] : []), { id: 'games', label: t('landing.nav.games') }, { id: 'live', label: t('landing.nav.live') }, { id: 'why', label: t('landing.nav.why') }, ], - [t] + [t, hasCampaigns] ); const whyItems = [ @@ -99,10 +102,12 @@ export function LandingPage() { - {/* Campaigns — carousel of all hero ads (parity with mobile) */} -
- -
+ {/* Campaigns — hidden entirely when none are published */} + {showCampaigns && ( +
+ +
+ )} diff --git a/prediqo_web/src/features/landing/components/LandingOffersCarousel.tsx b/prediqo_web/src/features/landing/components/LandingOffersCarousel.tsx index abc1ea75..28cd7669 100644 --- a/prediqo_web/src/features/landing/components/LandingOffersCarousel.tsx +++ b/prediqo_web/src/features/landing/components/LandingOffersCarousel.tsx @@ -56,7 +56,7 @@ export function LandingOffersCarousel({ ads, loading }: LandingOffersCarouselPro [count] ); - if (loading) { + if (loading && count === 0) { return (
@@ -65,14 +65,8 @@ export function LandingOffersCarousel({ ads, loading }: LandingOffersCarouselPro } if (count === 0) { - return ( -
-
-

{t('landing.offers.title')}

-

{t('landing.offers.empty')}

-
-
- ); + // No campaigns → reclaim the whole band (no empty placeholder). + return null; } const ad = ads[index]; diff --git a/prediqo_web/src/features/landing/landing.css b/prediqo_web/src/features/landing/landing.css index d06c7fe5..3ac28cba 100644 --- a/prediqo_web/src/features/landing/landing.css +++ b/prediqo_web/src/features/landing/landing.css @@ -507,22 +507,11 @@ background: var(--tl-emerald-bright); } -.tl-offers-carousel--loading .tl-offers-carousel__skeleton, -.tl-offers-carousel--empty .tl-offers-carousel__empty-inner { - min-height: clamp(200px, 28vh, 300px); +.tl-offers-carousel--loading .tl-offers-carousel__skeleton { + min-height: clamp(160px, 22vh, 240px); border-radius: 28px; border: 1px solid var(--tl-line); background: rgba(255, 255, 255, 0.03); -} - -.tl-offers-carousel--empty .tl-offers-carousel__empty-inner { - display: grid; - gap: 0.75rem; - align-content: center; - padding: clamp(1.5rem, 4vw, 2.5rem) 0; -} - -.tl-offers-carousel__skeleton { animation: tl-glow 2.4s ease-in-out infinite; } @@ -532,14 +521,19 @@ } .tl-offers-carousel__stage { - min-height: clamp(240px, 28vh, 320px); + min-height: 0; } .tl-offers-carousel__copy { - max-width: 36rem; - min-height: clamp(240px, 28vh, 320px); - align-content: end; - padding: clamp(1.75rem, 3vw, 2.75rem) clamp(1.75rem, 3vw, 2.5rem); + max-width: 40rem; + min-height: 0; + align-content: start; + padding: 1.75rem 1.85rem 1.85rem; + } + + /* Keep copy clear of the absolute prev/next controls (42px + gutters). */ + .tl-offers-carousel__stage:has(.tl-offers-carousel__nav) .tl-offers-carousel__copy { + padding-inline: 4.25rem; } }