After improving the design for the web part7
This commit is contained in:
parent
2efc1d0d20
commit
a04465f265
@ -51,6 +51,9 @@ export function HomePage() {
|
|||||||
|
|
||||||
const liveCount = games.filter((g) => g.status === 'active').length;
|
const liveCount = games.filter((g) => g.status === 'active').length;
|
||||||
const featuredCount = games.filter((g) => g.isFeatured).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 () => {
|
const refreshAll = async () => {
|
||||||
await Promise.all([gamesQ.refetch(), heroQ.refetch(), stripQ.refetch()]);
|
await Promise.all([gamesQ.refetch(), heroQ.refetch(), stripQ.refetch()]);
|
||||||
@ -90,13 +93,16 @@ export function HomePage() {
|
|||||||
sx={{
|
sx={{
|
||||||
display: 'grid',
|
display: 'grid',
|
||||||
gap: 2.5,
|
gap: 2.5,
|
||||||
gridTemplateColumns: { xs: '1fr', lg: '1fr 300px' },
|
gridTemplateColumns: {
|
||||||
|
xs: '1fr',
|
||||||
|
lg: hasStrip ? '1fr 300px' : '1fr',
|
||||||
|
},
|
||||||
alignItems: 'start',
|
alignItems: 'start',
|
||||||
mb: 3,
|
mb: 3,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Stack spacing={2}>
|
<Stack spacing={2}>
|
||||||
<PromoCarousel ads={heroQ.data ?? []} loading={heroQ.isLoading} />
|
{showHero && <PromoCarousel ads={heroQ.data ?? []} loading={heroQ.isLoading} />}
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
@ -127,20 +133,24 @@ export function HomePage() {
|
|||||||
</Box>
|
</Box>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
<Box sx={{ display: { xs: 'none', lg: 'block' } }}>
|
{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' }}>
|
<Typography variant="overline" sx={{ opacity: 0.6, letterSpacing: 1.2, mb: 1, display: 'block' }}>
|
||||||
{t('home.promotions')}
|
{t('home.promotions')}
|
||||||
</Typography>
|
</Typography>
|
||||||
<PromoStrip ads={stripQ.data ?? []} />
|
<PromoStrip ads={stripQ.data ?? []} />
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
)}
|
||||||
|
|
||||||
<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
|
<Paper
|
||||||
elevation={0}
|
elevation={0}
|
||||||
|
|||||||
@ -40,7 +40,7 @@ export function PromoCarousel({ ads, loading }: Props) {
|
|||||||
return () => window.clearInterval(timer);
|
return () => window.clearInterval(timer);
|
||||||
}, [count]);
|
}, [count]);
|
||||||
|
|
||||||
if (loading) {
|
if (loading && count === 0) {
|
||||||
return (
|
return (
|
||||||
<Skeleton
|
<Skeleton
|
||||||
variant="rounded"
|
variant="rounded"
|
||||||
@ -49,25 +49,8 @@ export function PromoCarousel({ ads, loading }: Props) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count === 0) {
|
// No campaigns published → reclaim space (no empty placeholder).
|
||||||
return (
|
if (count === 0) return null;
|
||||||
<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>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const ad = ads[index];
|
const ad = ads[index];
|
||||||
const bg = ad.backgroundGradient || defaultGradient;
|
const bg = ad.backgroundGradient || defaultGradient;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user