Skip to content

Commit

Permalink
fix: fix home loading logic
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamguxiang committed Nov 3, 2024
1 parent bbb836a commit 71c4160
Showing 1 changed file with 33 additions and 33 deletions.
66 changes: 33 additions & 33 deletions app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,6 @@ export default function Page({
fetchPackages();
}, [fetchPackages]);

if (!packages) {
return (
<div className="flex items-center justify-center h-screen">
<Spinner label="Loading" size="lg" color="default" />
</div>
);
}

return (
<div className="container mx-auto max-w-7xl px-6 flex-grow">
<div>
Expand Down Expand Up @@ -134,36 +126,44 @@ export default function Page({
<PlatformSort platform={searchParams?.platform || "all"} />
</div>
<br />
<motion.div
initial="hidden"
animate="visible"
variants={{
hidden: { opacity: 1 },
visible: {
opacity: 1,
transition: {
staggerChildren: 0.3,
},
},
}}
>
{packages.items.map((item) => (
{!packages ? (
<div className="flex items-center justify-center ">
<Spinner label="Loading" size="lg" color="default" />
</div>
) : (
<>
<motion.div
key={item.updated}
initial="hidden"
animate="visible"
variants={{
hidden: { opacity: 0, y: 20 },
visible: { opacity: 1, y: 0 },
hidden: { opacity: 1 },
visible: {
opacity: 1,
transition: {
staggerChildren: 0.3,
},
},
}}
transition={{ duration: 0.5 }}
>
<PluginCard result={item} />
{packages.items.map((item) => (
<motion.div
key={item.updated}
variants={{
hidden: { opacity: 0, y: 20 },
visible: { opacity: 1, y: 0 },
}}
transition={{ duration: 0.5 }}
>
<PluginCard result={item} />
</motion.div>
))}
</motion.div>
))}
</motion.div>
<PaginationComponent
pageIndex={packages.pageIndex}
totalPages={packages.totalPages}
/>
<PaginationComponent
pageIndex={packages.pageIndex}
totalPages={packages.totalPages}
/>
</>
)}
</div>
);
}

0 comments on commit 71c4160

Please sign in to comment.