Skip to content

Commit ce58a67

Browse files
committed
feat(ui): Add loading skeleton to student submissions in the grading tab
1 parent 59f755e commit ce58a67

File tree

3 files changed

+41
-2
lines changed

3 files changed

+41
-2
lines changed

src/screens/edit-student-grade/components/grading-sidebar/submissions/GradingSubmissionsSummary.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { CustomError } from "@/components/CustomError";
22
import { EmptyContentText } from "@/components/EmptyContentText";
3+
import { StudentSubmissionsSkeleton } from "@/screens/edit-student-grade/skeletons/StudentSubmissionsSkeleton";
34
import { getProgressOfStudentService } from "@/services/laboratories/ger-progress-of-student.service";
45
import { useQuery } from "@tanstack/react-query";
56
import { toast } from "sonner";
@@ -42,8 +43,7 @@ export const GradingSubmissionsSummary = ({
4243

4344
// Handle loading state
4445
if (isLoadingSubmissionsSummary) {
45-
// TODO: Replace this with a proper loading component
46-
return <div>Loading...</div>;
46+
return <StudentSubmissionsSkeleton />;
4747
}
4848

4949
// Handle error state
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { Skeleton } from "@/components/ui/skeleton";
2+
3+
export const StudentSubmissionSummaryCardSkeleton = () => {
4+
return (
5+
<div className="flex flex-wrap justify-between gap-2 rounded-md border p-4 shadow-sm">
6+
<div className="flex flex-col gap-2">
7+
<Skeleton className="h-6 w-24" />
8+
<span className="flex items-center gap-1 capitalize text-black/75">
9+
<Skeleton className="h-3 w-3 rounded-full" />
10+
<Skeleton className="h-5 w-12" />
11+
</span>
12+
</div>
13+
<div className="flex items-center">
14+
<Skeleton className="h-10 w-10" />
15+
</div>
16+
</div>
17+
);
18+
};
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { Skeleton } from "@/components/ui/skeleton";
2+
3+
import { StudentSubmissionSummaryCardSkeleton } from "./StudentSubmissionSummaryCardSkeleton";
4+
5+
const submissionCardsToRender = Array.from({ length: 3 }, (_, index) => index);
6+
7+
export const StudentSubmissionsSkeleton = () => {
8+
return (
9+
<div className="flex flex-col gap-2">
10+
<Skeleton className="h-7 w-1/3" />
11+
<Skeleton className="h-12 w-full" />
12+
<ul className="flex flex-col gap-4">
13+
{submissionCardsToRender.map((_, index) => (
14+
<li key={`student-submission-skeleton-${index}`}>
15+
<StudentSubmissionSummaryCardSkeleton />
16+
</li>
17+
))}
18+
</ul>
19+
</div>
20+
);
21+
};

0 commit comments

Comments
 (0)