import React from 'react';
import { useTranslation } from 'react-i18next';
import { UserInformationProps } from '../utils/types';
import { UserInformationWrapper } from './style';
const UserInformation = (props: UserInformationProps): JSX.Element => {
const { t } = useTranslation();
const { extra, kdsLayout, deliveryAddress, comments, users } = props;
const taxId =
extra && extra['x-tax-id'] ? (
TAX-ID/NIP :
{extra['x-tax-id']}
) : null;
return (
{kdsLayout !== 'compact' && Object.keys(deliveryAddress).length > 0 && (
<>
{t('OS.KDS.Card.Address')}:
{` ${deliveryAddress.city}, ${deliveryAddress.street} ${
deliveryAddress.number
} ${deliveryAddress.door ? `/ ${deliveryAddress.door}` : ''}`}
>
)}
{comments &&
comments.map((comment) => (
{comment && comment.comment && comment.comment !== '' && (
{' '}
{t('OS.KDS.Card.Comment')}:
{comment.comment}
)}
))}
{kdsLayout !== 'compact' &&
users &&
users.map((user) => (
{user && user.phone && user.phone !== '' && (
<>
{' '}
{t('OS.KDS.Card.Phone')}:
+{user.phone}
>
)}
))}
{taxId}
);
};
export default UserInformation;