After improving the design for the web part7

This commit is contained in:
Your Name 2026-11-06 19:49:11 +02:00
parent 2efc1d0d20
commit a04465f265
2 changed files with 24 additions and 31 deletions

View File

@ -51,6 +51,9 @@ export function HomePage() {
const liveCount = games.filter((g) => g.status === 'active').length;
const featuredCount = games.filter((g) => g.isFeatured).length;
const hasHero = (heroQ.data?.length ?? 0) > 0;
const showHero = heroQ.isLoading || hasHero;
const hasStrip = (stripQ.data?.length ?? 0) > 0;
const refreshAll = async () => {
await Promise.all([gamesQ.refetch(), heroQ.refetch(), stripQ.refetch()]);
@ -90,13 +93,16 @@ export function HomePage() {
sx={{
display: 'grid',
gap: 2.5,
gridTemplateColumns: { xs: '1fr', lg: '1fr 300px' },
gridTemplateColumns: {
xs: '1fr',
lg: hasStrip ? '1fr 300px' : '1fr',
},
alignItems: 'start',
mb: 3,
}}
>
<Stack spacing={2}>
<PromoCarousel ads={heroQ.data ?? []} loading={heroQ.isLoading} />
{showHero && <PromoCarousel ads={heroQ.data ?? []} loading={heroQ.isLoading} />}
<Box
sx={{
@ -127,20 +133,24 @@ export function HomePage() {
</Box>
</Stack>
{hasStrip && (
<Box sx={{ display: { xs: 'none', lg: 'block' } }}>
<Typography variant="overline" sx={{ opacity: 0.6, letterSpacing: 1.2, mb: 1, display: 'block' }}>
{t('home.promotions')}
</Typography>
<PromoStrip ads={stripQ.data ?? []} />
</Box>
)}
</Box>
{hasStrip && (
<Box sx={{ display: { xs: 'block', lg: 'none' }, mb: 3 }}>
<Typography variant="overline" sx={{ opacity: 0.6, letterSpacing: 1.2, mb: 1, display: 'block' }}>
{t('home.promotions')}
</Typography>
<PromoStrip ads={stripQ.data ?? []} />
</Box>
)}
<Paper
elevation={0}

View File

@ -40,7 +40,7 @@ export function PromoCarousel({ ads, loading }: Props) {
return () => window.clearInterval(timer);
}, [count]);
if (loading) {
if (loading && count === 0) {
return (
<Skeleton
variant="rounded"
@ -49,25 +49,8 @@ export function PromoCarousel({ ads, loading }: Props) {
);
}
if (count === 0) {
return (
<Paper
sx={{
p: { xs: 3, md: 4 },
borderRadius: 2,
minHeight: { xs: 200, md: 280 },
display: 'grid',
placeItems: 'center',
background: defaultGradient,
border: '1px solid rgba(255,255,255,0.08)',
}}
>
<Typography sx={{ opacity: 0.75, textAlign: 'center' }}>
New promotions coming soon — check back later.
</Typography>
</Paper>
);
}
// No campaigns published → reclaim space (no empty placeholder).
if (count === 0) return null;
const ad = ads[index];
const bg = ad.backgroundGradient || defaultGradient;