From 74b7fb3b5001818e5e8892340dce5d4fe2673f81 Mon Sep 17 00:00:00 2001 From: Innocent-akim Date: Thu, 28 Nov 2024 21:44:49 +0200 Subject: [PATCH] feat(timesheet): add skeleton loader for improved UI feedback --- .../[memberId]/components/TimesheetView.tsx | 7 ++-- .../shared/skeleton/TimesheetSkeleton.tsx | 32 +++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 apps/web/components/shared/skeleton/TimesheetSkeleton.tsx diff --git a/apps/web/app/[locale]/timesheet/[memberId]/components/TimesheetView.tsx b/apps/web/app/[locale]/timesheet/[memberId]/components/TimesheetView.tsx index 4fd852b36..ee72a1f79 100644 --- a/apps/web/app/[locale]/timesheet/[memberId]/components/TimesheetView.tsx +++ b/apps/web/app/[locale]/timesheet/[memberId]/components/TimesheetView.tsx @@ -1,4 +1,5 @@ import { GroupedTimesheet } from '@/app/hooks/features/useTimesheet'; +import TimesheetSkeleton from '@components/shared/skeleton/TimesheetSkeleton'; import { DataTableTimeSheet } from 'lib/features/integrations/calendar'; import { useTranslations } from 'next-intl'; @@ -7,8 +8,10 @@ export function TimesheetView({ data, loading }: { data?: GroupedTimesheet[]; lo if (loading || !data) { return ( -
-

{t('pages.timesheet.LOADING')}

+
+ {Array.from({ length: 10 }).map((_, index) => ( + + ))}
); } diff --git a/apps/web/components/shared/skeleton/TimesheetSkeleton.tsx b/apps/web/components/shared/skeleton/TimesheetSkeleton.tsx new file mode 100644 index 000000000..e0462c314 --- /dev/null +++ b/apps/web/components/shared/skeleton/TimesheetSkeleton.tsx @@ -0,0 +1,32 @@ +import React from 'react' +import Skeleton from './Skeleton' +import { clsxm } from '@/app/utils' + +function TimesheetSkeleton() { + return ( +
+
+
+ + +
+
+
+ + + +
+
+ + +
+
+
+
+ ) +} +export default TimesheetSkeleton