Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat(timesheet): Add Skeleton Loader For Improved UI Feedback #3378

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -7,8 +8,10 @@ export function TimesheetView({ data, loading }: { data?: GroupedTimesheet[]; lo

if (loading || !data) {
return (
<div className="grow h-full w-full bg-[#FFFFFF] dark:bg-dark--theme flex items-center justify-center">
<p>{t('pages.timesheet.LOADING')}</p>
<div className="grow h-full w-full bg-[#FFFFFF] dark:bg-dark--theme">
{Array.from({ length: 10 }).map((_, index) => (
<TimesheetSkeleton key={index} />
))}
</div>
);
}
Expand Down
32 changes: 32 additions & 0 deletions apps/web/components/shared/skeleton/TimesheetSkeleton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React from 'react'
import Skeleton from './Skeleton'
import { clsxm } from '@/app/utils'

function TimesheetSkeleton() {
return (
<div className={clsxm(
'flex justify-between items-center w-full',
'bg-[#ffffffcc] dark:bg-dark--theme rounded-md border',
'border-gray-100 dark:border-gray-700 text-[#71717A] font-medium my-2 p-2 h-[50px] rounded-sm gap-x-2 px-2 py-2'
)}>
<div className='flex flex-col w-full gap-4'>
<div className='flex items-center justify-between gap-4'>
<Skeleton width={80} borderRadius={4} height={10} className="dark:bg-[#272930]" />
<Skeleton width={80} borderRadius={4} height={10} className="dark:bg-[#272930]" />
</div>
<div className='flex items-center justify-between gap-4 w-full'>
<div className='flex items-center gap-2'>
<Skeleton width={20} borderRadius={4} height={20} className="dark:bg-[#272930]" />
<Skeleton width={200} borderRadius={4} height={20} className="dark:bg-[#272930]" />
<Skeleton width={40} borderRadius={4} height={20} className="dark:bg-[#272930]" />
</div>
<div className='flex items-center gap-2'>
<Skeleton width={200} borderRadius={4} height={20} className="dark:bg-[#272930]" />
<Skeleton width={200} borderRadius={4} height={20} className="dark:bg-[#272930]" />
</div>
</div>
</div>
Innocent-Akim marked this conversation as resolved.
Show resolved Hide resolved
</div>
)
}
export default TimesheetSkeleton