Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sweepstake
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Arjun Jhukal
sweepstake
Commits
41097315
Commit
41097315
authored
Oct 08, 2025
by
Arjun Jhukal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated the banner code to handle error more effieicently
parent
f8ad2c84
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
83 deletions
+65
-83
page.tsx
src/app/(dashboard)/(user)/(outsideAuth)/page.tsx
+65
-83
No files found.
src/app/(dashboard)/(user)/(outsideAuth)/page.tsx
View file @
41097315
...
...
@@ -2,74 +2,87 @@ import Dashboard from "@/components/pages/dashboard";
import
UspSlider
from
"@/components/pages/dashboard/UspSlider"
;
import
ProtectedLink
from
"@/routes/ProtectedLink"
;
import
{
getAllGames
,
getSubGames
,
getUsp
}
from
"@/serverApi/game"
;
import
{
Tooltip
}
from
"@mui/material"
;
import
Image
from
"next/image"
;
import
DashboardProvider
from
"./DashboardProvider"
;
import
{
getBanners
,
getSubBanners
}
from
"@/serverApi/pages"
;
import
Image
from
"next/image"
;
import
Link
from
"next/link"
;
import
DashboardProvider
from
"./DashboardProvider"
;
export
default
async
function
Home
()
{
let
games
=
null
;
let
gamesError
=
null
;
let
usps
=
null
;
let
uspError
=
null
;
let
subGames
=
null
;
let
subGamesError
=
null
;
let
banners
=
null
;
let
bannersError
=
null
;
let
subBanners
=
null
;
let
subBannersError
=
null
;
// Fetch everything individually
try
{
games
=
await
getAllGames
();
}
catch
(
err
)
{
console
.
log
(
"❌ Failed to fetch games:"
,
err
);
return
<
p
className=
"text-red-500"
>
Failed to load games.
</
p
>;
}
if
(
!
games
?.
data
?.
data
||
!
Array
.
isArray
(
games
.
data
.
data
))
{
return
<
p
className=
"text-gray-500"
>
No games found.
</
p
>;
console
.
error
(
"❌ Failed to fetch games:"
,
err
);
gamesError
=
"Failed to load games."
;
}
try
{
usps
=
await
getUsp
();
}
catch
(
err
)
{
console
.
log
(
"❌ Failed to fetch games
:"
,
err
);
return
<
p
className=
"text-red-500"
>
Failed to load games.
</
p
>
;
console
.
error
(
"❌ Failed to fetch USP
:"
,
err
);
uspError
=
"Failed to load USPs."
;
}
try
{
subGames
=
await
getSubGames
();
}
catch
(
err
)
{
console
.
log
(
"❌ Failed to fetch
games:"
,
err
);
return
<
p
className=
"text-red-500"
>
Failed to load games.
</
p
>
;
console
.
error
(
"❌ Failed to fetch sub
games:"
,
err
);
subGamesError
=
"Failed to load trending games."
;
}
try
{
banners
=
await
getBanners
();
}
catch
(
err
)
{
console
.
log
(
"❌ Failed to fetch banner
:"
,
err
);
return
<
p
className=
"text-red-500"
>
Failed to load banner.
</
p
>
;
console
.
error
(
"❌ Failed to fetch banners
:"
,
err
);
bannersError
=
"Failed to load banners."
;
}
try
{
subBanners
=
await
getSubBanners
();
}
catch
(
err
)
{
console
.
log
(
"❌ Failed to fetch sub banner
:"
,
err
);
return
<
p
className=
"text-red-500"
>
Failed to load sub banner.
</
p
>
;
console
.
error
(
"❌ Failed to fetch sub banners
:"
,
err
);
subBannersError
=
"Failed to load sub banners."
;
}
// console.log({ subGames: subGames.data, usps })
return
(
<
DashboardProvider
>
<>
{
banners
?.
data
.
length
?
<
Dashboard
slides=
{
banners
.
data
}
/>
:
""
}
{
/* Banners */
}
{
bannersError
?
(
<
p
className=
"text-red-500"
>
{
bannersError
}
</
p
>
)
:
banners
?.
data
?.
length
?
(
<
Dashboard
slides=
{
banners
.
data
}
/>
)
:
null
}
{
/* Games */
}
{
gamesError
?
(
<
p
className=
"text-red-500"
>
{
gamesError
}
</
p
>
)
:
games
?.
data
?.
data
?.
length
?
(
<
div
className=
"grid gap-4 md:grid-cols-2 lg:grid-cols-4 2xl:grid-cols-5 mb-8"
>
{
games
?.
data
?
.
data
.
map
((
game
)
=>
(
{
games
.
data
.
data
.
map
((
game
)
=>
(
<
ProtectedLink
href=
{
`exclusive-games/${game.id}`
}
key=
{
game
.
id
}
className=
"col-span-1 "
>
className=
"col-span-1 "
>
<
div
className=
"flex items-center gap-3 py-2 px-6"
style=
{
{
borderRadius
:
"24px"
,
background
:
"rgba(255, 255, 255, 0.10)"
,
}
}
>
}
}
>
<
Image
src=
{
game
.
thumbnail
||
"/assets/images/fallback.png"
}
alt=
{
game
.
name
}
...
...
@@ -77,36 +90,46 @@ export default async function Home() {
height=
{
74
}
className=
"aspect-[1/1] object-cover group-hover:scale-105 transition-transform duration-300 rounded-full"
/>
<
strong
className=
"text-[14px]"
>
{
game
?.
name
}
</
strong
>
<
strong
className=
"text-[14px]"
>
{
game
.
name
}
</
strong
>
</
div
>
</
ProtectedLink
>
))
}
</
div
>
)
:
(
<
p
className=
"text-gray-500"
>
No games found.
</
p
>
)
}
{
/* Trending Games */
}
<
section
className=
"trending__games"
>
<
h2
className=
"text-[14px] mb-4"
>
Top 10 Trending Games
</
h2
>
{
subGamesError
?
(
<
p
className=
"text-red-500"
>
{
subGamesError
}
</
p
>
)
:
(
<
div
className=
"grid gap-4 grid-cols-2 md:grid-cols-3 lg:grid-cols-5 2xl:grid-cols-6 mb-8"
>
{
subGames
?.
data
?.
map
((
game
:
any
)
=>
(
<
ProtectedLink
href=
{
`exclusive-games/${game.id}`
}
key=
{
game
.
name
}
className=
"col-span-1 relative aspect-[1/1]"
>
className=
"col-span-1 relative aspect-[1/1]"
>
<
Image
src=
{
game
.
image_url
||
"/assets/images/fallback.png"
}
alt=
{
game
.
name
||
""
}
fill
className=
" rounded-[24px] lg:rounded-[32px] object-cover group-hover:scale-105 transition-transform duration-300
"
className=
"rounded-[24px] lg:rounded-[32px] object-cover group-hover:scale-105 transition-transform duration-300
"
/>
</
ProtectedLink
>
))
}
</
div
>
)
}
</
section
>
{
subBanners
?.
data
.
length
?
{
/* Sub Banners */
}
{
subBannersError
?
(
<
p
className=
"text-red-500"
>
{
subBannersError
}
</
p
>
)
:
subBanners
?.
data
?.
length
?
(
<
div
className=
"dashboard-card-wrapper grid grid-cols-2 gap-5 justify-center"
>
{
subBanners
?.
data
?.
length
>
0
&&
subBanners
.
data
.
map
((
subBanner
,
index
)
=>
(
{
subBanners
.
data
.
map
((
subBanner
,
index
)
=>
(
<
div
key=
{
subBanner
.
name
||
index
}
className=
"dashboard-card1 flex justify-between px-10 gap-2 rounded-[24px]"
...
...
@@ -118,8 +141,7 @@ export default async function Home() {
}
}
>
<
div
className=
"py-7 gap-6"
>
{
/* ✅ Render title if available */
}
{
subBanner
?.
name
&&
(
{
subBanner
.
name
&&
(
<
h1
className=
"text-[40px] mb-[8px]"
style=
{
{
...
...
@@ -131,9 +153,7 @@ export default async function Home() {
{
subBanner
.
name
}
</
h1
>
)
}
{
/* ✅ Render description if available */
}
{
subBanner
?.
description
&&
(
{
subBanner
.
description
&&
(
<
p
className=
"text-[13px] mb-[12px]"
style=
{
{
lineHeight
:
"120%"
,
color
:
"#FBD230"
}
}
...
...
@@ -141,9 +161,7 @@ export default async function Home() {
{
subBanner
.
description
}
</
p
>
)
}
{
/* ✅ Render CTA button if link exists */
}
{
subBanner
?.
cta_link
&&
(
{
subBanner
.
cta_link
&&
(
<
Link
href=
{
subBanner
.
cta_link
}
className=
"px-[18px] py-[11px] rounded-[28px] inline-block"
...
...
@@ -159,9 +177,7 @@ export default async function Home() {
</
Link
>
)
}
</
div
>
{
/* ✅ Render image only if available */
}
{
subBanner
?.
image_url
&&
(
{
subBanner
.
image_url
&&
(
<
div
className=
"dashboard-card-img aspect-[245/245]"
>
<
Image
src=
{
subBanner
.
image_url
}
...
...
@@ -174,49 +190,15 @@ export default async function Home() {
)
}
</
div
>
))
}
{
/* <div
className="dashboard-card2 flex px-[45px] gap-2 rounded-[24px]"
style={{
background: "rgba(255, 255, 255, 0.10)",
}}>
<div className="py-[45px] gap-6">
<h1
className="text-[40px] mb-[10px]"
style={{
color: "#1AF7FE",
letterSpacing: "-0.682px",
lineHeight: "96%",
}}>
Easy.Set.Play
</h1>
<p
className="text-[13px] mb-[12px]"
style={{ color: "#E7BCFE", lineHeight: "120%" }}>
Join the Fun today.
</p>
<a
href="#"
className="px-[18px] py-[11px] rounded-[28px] inline-block"
style={{
background:
"linear-gradient(270deg, #D620D9 0.09%, #B40EF0 95.19%)",
}}>
Play Now
</a>
</
div
>
<div className="dashboard-card-img ">
<img
src="/assets/images/card2.png"
alt=""
// className="w-[245px] h-[245px]"
className="h-auto max-w-full "
style={{ width: "245px", height: "245px" }}
/>
</div>
</div> */
}
</
div
>
:
null
}
<
UspSlider
uspData=
{
usps
.
data
||
[]
}
/>
)
:
null
}
{
/* USP Slider */
}
{
uspError
?
(
<
p
className=
"text-red-500"
>
{
uspError
}
</
p
>
)
:
(
<
UspSlider
uspData=
{
usps
?.
data
||
[]
}
/>
)
}
</>
</
DashboardProvider
>
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment