Skip to content

Commit bb803a6

Browse files
committed
kevin loading component
1 parent 071080c commit bb803a6

File tree

3 files changed

+37
-20
lines changed

3 files changed

+37
-20
lines changed

src/app/judging/JudgingTable.tsx

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
"use client";
22

3-
import Image from "next/image";
43
import { useState } from "react";
54

65
import type { Schema } from "@/amplify/data/resource";
7-
import LoadingRing from "@/components/LoadingRing";
6+
import KevinLoadingRing from "@/components/KevinLoadingRing";
87
import { useUser } from "@/components/contexts/UserContext";
98
import ModalPopup from "@/components/judging/ModalPopup";
109
import ScoresTable from "@/components/judging/ScoresTable";
@@ -53,23 +52,10 @@ export default function JudgingTable({
5352
});
5453
const isFetching = roomIsFetching && teamsForRoomIsFetching;
5554
if (isFetching || !roomData || !teamsForRoomData) {
56-
return (
57-
<div className="m-4 flex h-full flex-col justify-center">
58-
<div className="-ml-4 flex justify-center">
59-
<LoadingRing />
60-
</div>
61-
62-
<Image
63-
src="/svgs/admin/Kevin.svg"
64-
alt="Kevin Icon"
65-
width={240}
66-
height={240}
67-
/>
68-
</div>
69-
);
55+
return <KevinLoadingRing />;
7056
}
7157
async function getFilteredTeamsCount() {
72-
// https://medium.com/@debbs119/array-filter-and-array-map-with-async-functions-9636e1ae8d6e --> why it need to map to a boolean array first
58+
// https://medium.com/@debbs119/array-filter-and-array-map-with-async-functions-9636e1ae8d6e --> why it needs to map to a boolean array first
7359
if (!teamsForRoomData) {
7460
return;
7561
}

src/components/Dashboard/Greetings.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
import { twMerge } from "tailwind-merge";
44

5-
import LoadingRing from "@/components/LoadingRing";
6-
75
import { UserType, useUser } from "../contexts/UserContext";
86
import Card from "./Card";
97

@@ -37,7 +35,12 @@ export default function Greetings({
3735

3836
<h1 className="text-3xl md:text-4xl lg:text-6xl">
3937
Hello,
40-
{user.isFetching && <LoadingRing />}
38+
{user.isFetching && (
39+
<span className={`capitalize italic ${nameColor}`}>
40+
{" "}
41+
Loading...
42+
</span>
43+
)}
4144
<span className={`capitalize italic ${nameColor}`}>
4245
{" "}
4346
{firstName} {lastName}!

src/components/KevinLoadingRing.tsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import Image from "next/image";
2+
3+
import LoadingRing from "@/components/LoadingRing";
4+
5+
export default function KevinLoadingRing() {
6+
return (
7+
<>
8+
<div className="m-4 flex h-full flex-col justify-center text-center text-2xl">
9+
<div className="-ml-4 mb-16 flex justify-center">
10+
<LoadingRing />
11+
</div>
12+
<Image
13+
className="animate-bounce"
14+
src="/svgs/admin/Kevin.svg"
15+
alt="Kevin Icon"
16+
width={240}
17+
height={240}
18+
/>
19+
<div className="ml-2 flex w-full items-center justify-center space-x-1">
20+
<span className="text-dark-pink">Loading</span>
21+
<span className=" mt-3 size-2 animate-pulse rounded-full bg-dark-pink delay-200"></span>
22+
<span className="delay-400 mt-3 size-2 animate-pulse rounded-full bg-dark-pink"></span>
23+
<span className="delay-600 mt-3 size-2 animate-pulse rounded-full bg-dark-pink"></span>
24+
</div>
25+
</div>
26+
</>
27+
);
28+
}

0 commit comments

Comments
 (0)