From c1c81687d80408815fe6006940748c3225eb53fa Mon Sep 17 00:00:00 2001 From: "santasri.pachhal" Date: Wed, 24 Jun 2026 00:22:34 +0530 Subject: [PATCH] feat(ticket): add skeleton loading state for ticket detail page --- .../components/TicketDetailSkeleton.tsx | 103 ++++++++++++++++++ src/app/(modules)/ticket/[ticketId]/page.tsx | 11 +- 2 files changed, 107 insertions(+), 7 deletions(-) create mode 100644 src/app/(modules)/ticket/[ticketId]/components/TicketDetailSkeleton.tsx diff --git a/src/app/(modules)/ticket/[ticketId]/components/TicketDetailSkeleton.tsx b/src/app/(modules)/ticket/[ticketId]/components/TicketDetailSkeleton.tsx new file mode 100644 index 0000000..714c079 --- /dev/null +++ b/src/app/(modules)/ticket/[ticketId]/components/TicketDetailSkeleton.tsx @@ -0,0 +1,103 @@ +'use client'; + +import { Skeleton } from '@/components/ui/skeleton'; + +function OverviewSkeletonField() { + return ( +
+ + +
+ ); +} + +function TimelineSkeletonItem({ isLast = false }: { isLast?: boolean }) { + return ( +
+ {!isLast ? ( + + ) : null} + +
+
+ + +
+ + +
+
+ ); +} + +export function TicketDetailSkeleton() { + return ( +
+
+
+
+ + +
+ +
+ +
+ + +
+
+ +
+
+
+
+ +
+
+ {Array.from({ length: 8 }).map((_, index) => ( + + ))} +
+
+ +
+
+ +
+ + + +
+
+ +
+ +
+
+ + +
+
+ + + +
+
+
+ + +
+
+ ); +} diff --git a/src/app/(modules)/ticket/[ticketId]/page.tsx b/src/app/(modules)/ticket/[ticketId]/page.tsx index cdd8a2c..45a9aef 100644 --- a/src/app/(modules)/ticket/[ticketId]/page.tsx +++ b/src/app/(modules)/ticket/[ticketId]/page.tsx @@ -1,11 +1,12 @@ 'use client'; import { useParams, useRouter } from 'next/navigation'; -import { ArrowLeft, Loader2 } from 'lucide-react'; +import { ArrowLeft } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { TicketDetailHeader } from './components/TicketDetailHeader'; +import { TicketDetailSkeleton } from './components/TicketDetailSkeleton'; import { TicketHistoryCard } from './components/TicketHistoryCard'; import { TicketOverviewCard } from './components/TicketOverviewCard'; @@ -27,11 +28,7 @@ export default function TicketDetailPage() { ); if (ticketQuery.isLoading) { - return ( -
- -
- ); + return ; } if (ticketQuery.isError || !ticket) { @@ -61,7 +58,7 @@ export default function TicketDetailPage() { -
+