import React from 'react';
import {Table} from 'semantic-ui-react';
import {convertTime} from '../../../tools'

const ListItem = ({i18n, data}) => {
    let iotype = i18n&&i18n.getResource&&i18n.language ? i18n.getResource(i18n.language + '.translation.porttype') : [];

    let t = '';
    for(let i in iotype) {
        if(data.type == iotype[i].code) t = iotype[i].name;
    }

    return (
        <Table.Row>
            <Table.Cell>{data.devname}</Table.Cell>
            <Table.Cell>{data.aioname}</Table.Cell>
            <Table.Cell>{data.port}</Table.Cell>
            <Table.Cell>{t}</Table.Cell>
            <Table.Cell>{data.value}</Table.Cell>
            <Table.Cell>{convertTime(data.tst)}</Table.Cell>
        </Table.Row>
    )
}

export default ListItem;