All files / src/components/pages/group/group-descriptions/description-sections/description-profile index.tsx

0% Statements 0/45
0% Branches 0/1
0% Functions 0/1
0% Lines 0/45

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46                                                                                           
import Link from 'next/link';

import { ProfileImage } from '@/components/shared';
import { PendingBadge } from '@/components/ui';
import { GetGroupDetailsResponse } from '@/types/service/group';

interface Props {
  hostInfo: GetGroupDetailsResponse['createdBy'];
  groupId: number;
  conditions: {
    isHost: boolean;
    isPending: boolean;
    isFinished: boolean;
  };
}

export const DescriptionProfile = ({
  hostInfo: { userId, nickName, profileImage, profileMessage },
  conditions: { isHost, isPending, isFinished },
  groupId,
}: Props) => {
  const isEditable = isHost && !isFinished;

  return (
    <div className='flex-between w-full select-none'>
      <Link href={`/profile/${userId}`} className='flex gap-3'>
        <ProfileImage size='sm' src={profileImage} />
        <div className='flex flex-col justify-center *:line-clamp-1'>
          <p className='text-text-md-semibold text-gray-800'>{nickName}</p>
          {profileMessage && <p className='text-text-xs-regular text-gray-600'>{profileMessage}</p>}
        </div>
      </Link>
      {isFinished && <p className='text-text-xs-semibold pr-1 text-gray-500'>모임 마감</p>}
      {isPending && <PendingBadge children={'대기중'} variant='md' />}
      {isEditable && (
        <Link
          href={`/create-group/${groupId}`}
          className='text-text-xs-semibold text-mint-500 pr-1'
        >
          모임 수정하기
        </Link>
      )}
    </div>
  );
};