tasko/components/activity-item.tsx

31 lines
925 B
TypeScript
Raw Normal View History

2024-02-16 01:49:19 +00:00
import { format } from 'date-fns';
import { AuditLog } from '@prisma/client';
2024-02-15 02:30:10 +00:00
2024-02-16 01:49:19 +00:00
import { generateLogMessage } from '@/lib/generate-log-message';
import { Avatar, AvatarImage } from '@/components/ui/avatar';
2024-02-15 02:30:10 +00:00
interface ActivityItemProps {
data: AuditLog;
}
export const ActivityItem = ({ data }: ActivityItemProps) => {
return (
2024-02-16 22:40:51 +00:00
<li className='flex items-center gap-x-2 pb-2'>
2024-02-16 01:49:19 +00:00
<Avatar className='h-8 w-8'>
2024-02-15 02:30:10 +00:00
<AvatarImage src={data.userImage} />
</Avatar>
2024-02-16 01:49:19 +00:00
<div className='flex flex-col space-y-0.5'>
<p className='text-sm text-muted-foreground'>
<span className='font-semibold lowercase text-neutral-700'>
2024-02-15 02:30:10 +00:00
{data.userName}
2024-02-16 01:49:19 +00:00
</span>{' '}
2024-02-15 02:30:10 +00:00
{generateLogMessage(data)}
</p>
2024-02-16 01:49:19 +00:00
<p className='text-xs text-muted-foreground'>
2024-02-15 02:30:10 +00:00
{format(new Date(data.createdAt), "MMM d, yyyy 'at' h:mm a")}
</p>
</div>
</li>
);
};