<commit_before>import React from 'react';
import { c } from 'ttag';
import PropTypes from 'prop-types';
import {
    useMembers,
    Alert,
    Button,
    PrimaryButton,
    Block,
    Table,
    TableHeader,
    TableBody,
    TableRow
} from 'react-components';

const AddressesSection = ({ domainAddresses, onRedirect }) => {
    const [members, loadingMembers] = useMembers();

    const getMemberName = (memberID) => {
        const { Name = '' } = members.find(({ ID }) => ID === memberID);
        return Name;
    };

    return (
        <>
            <Alert>{c('Info for domain modal')
                .t`Please add addresses to send and receive email with this domain.`}</Alert>
            <Block>
                <PrimaryButton className="mr1" onClick={() => onRedirect('/settings/addresses')}>{c('Action')
                    .t`Add address`}</PrimaryButton>
                <Button onClick={() => onRedirect('/settings/members')}>{c('Action').t`Add user`}</Button>
            </Block>
            {domainAddresses.length ? (
                <Table>
                    <TableHeader
                        cells={[c('Header for domain modal').t`User`, c('Header for domain modal').t`Address`]}
                    />
                    <TableBody loading={loadingMembers} colSpan={2}>
                        {members &&
                            domainAddresses.map(({ ID, Email, MemberID }) => {
                                return <TableRow key={ID} cells={[getMemberName(MemberID), Email]} />;
                            })}
                    </TableBody>
                </Table>
            ) : null}
        </>
    );
};

AddressesSection.propTypes = {
    domainAddresses: PropTypes.array.isRequired,
    onRedirect: PropTypes.func.isRequired<commit_msg>Fix MAILWEB-405 - Update text for addresses tab in domain config<commit_after>import React from 'react';
import { c } from 'ttag';
import PropTypes from 'prop-types';
import {
    useMembers,
    Alert,
    Button,
    PrimaryButton,
    Block,
    Table,
    TableHeader,
    TableBody,
    TableRow
} from 'react-components';

const AddressesSection = ({ domainAddresses, onRedirect }) => {
    const [members, loadingMembers] = useMembers();

    const getMemberName = (memberID) => {
        const { Name = '' } = members.find(({ ID }) => ID === memberID);
        return Name;
    };

    return (
        <>
            <Alert>{c('Info for domain modal')
                .t`Addresses must be connected to an user account. Click Add user to add a new user account with its own login and inbox that you can connect addresses to.`}</Alert>
            <Block>
                <PrimaryButton className="mr1" onClick={() => onRedirect('/settings/addresses')}>{c('Action')
                    .t`Add address`}</PrimaryButton>
                <Button onClick={() => onRedirect('/settings/members')}>{c('Action').t`Add user`}</Button>
            </Block>
            {domainAddresses.length ? (
                <Table>
                    <TableHeader
                        cells={[c('Header for domain modal').t`User`, c('Header for domain modal').t`Address`]}
                    />
                    <TableBody loading={loadingMembers} colSpan={2}>
                        {members &&
                            domainAddresses.map(({ ID, Email, MemberID }) => {
                                return <TableRow key={ID} cells={[getMemberName(MemberID), Email]} />;
                            })}
                    </TableBody>
                </Table>
            ) : null}
        </>
    );
};

AddressesSection.propTypes = {
    domainAddresses: PropTypes.array.isRequired,
    onRedirect: PropTypes.func.isRequired
{'fraction_non_alphanumeric': 0.1341758537241194, 'fraction_numerical': 0.0018822264049475664, 'mean_word_length': 1.7969924812030076, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2401248', 'n_tokens_mistral': 981, 'n_tokens_neox': 951, 'n_words': 232}