All files / libs/lti/components/src/lib/participant-dashboard/end-employment-widget LtiEndEmploymentWidgetText.tsx

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

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                                                                             
import { css } from '@emotion/react';
import { memo } from 'react';
import { FormattedMessage } from 'react-intl';

import { Typography } from '@allshares/studio-design-system';
import { dayjs } from '@amalia/ext/dayjs';
import { type UserContract } from '@amalia/tenants/users/types';

interface LtiEndEmploymentWidgetTextProps {
  readonly user: Pick<UserContract, 'employmentEndedAt' | 'id'>;
}

export const LtiEndEmploymentWidgetText = memo(function LtiEndEmploymentWidgetText({
  user,
}: LtiEndEmploymentWidgetTextProps) {
  return (
    <Typography
      variant="bodyBaseRegular"
      css={(theme) => css`
        margin-right: 16px;
        font-style: italic;
        color: ${theme.ds.colors.gray[700]};
      `}
    >
      {dayjs.utc().isBefore(dayjs.utc(user.employmentEndedAt)) ? (
        <FormattedMessage
          defaultMessage="Employment will end on {date}"
          values={{ date: dayjs.utc(user.employmentEndedAt).format('ll') }}
        />
      ) : (
        <FormattedMessage
          defaultMessage="Employment ended on {date}"
          values={{ date: dayjs.utc(user.employmentEndedAt).format('ll') }}
        />
      )}
    </Typography>
  );
});