Skip to content

Commit f906238

Browse files
committed
Add loading and error messages
1 parent e6bf76b commit f906238

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

client/src/pages/index.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { placeholderGames } from "@/placeholderData";
1212
import { Button } from "../components/ui/button";
1313

1414
export default function Landing() {
15-
const { data, isPending, isError } = useEvents({
15+
const { data, isPending, isError, isFetching } = useEvents({
1616
type: "upcoming",
1717
pageSize: 100,
1818
});
@@ -147,8 +147,20 @@ export default function Landing() {
147147
</section>
148148

149149
<section className="bg-background px-10 py-20">
150+
{isFetching && !isPending && (
151+
<span className="text-sm text-gray-400">Loading...</span>
152+
)}
153+
154+
{isPending && <p>Loading events...</p>}
155+
156+
{isError && (
157+
<p className="text-red-500" role="alert">
158+
Failed to load events.
159+
</p>
160+
)}
150161
{!isPending && !isError && <EventCarousel items={events ?? []} />}
151162
</section>
163+
152164
{/* Leaving commented out until styling/design is confirmed. */}
153165
{/* <section className="bg-background px-4 py-10 md:px-10">
154166
<div className="flex w-full px-4">

0 commit comments

Comments
 (0)