import useMessages from 'hooks/useMessages'; import useUser from 'hooks/useUser'; import Link from 'next/link'; import { Button, Flexbox, Icon, Icons, Table, TableBody, TableCell, TableColumn, TableHeader, TableRow, Text, } from 'react-basics'; import TeamWebsiteRemoveButton from './TeamWebsiteRemoveButton'; export default function TeamWebsitesTable({ data = [], onSave }) { const { formatMessage, labels } = useMessages(); const { user } = useUser(); const columns = [ { name: 'name', label: formatMessage(labels.name) }, { name: 'domain', label: formatMessage(labels.domain) }, { name: 'action', label: ' ' }, ]; return ( {(column, index) => { return ( {column.label} ); }} {(row, keys, rowIndex) => { const { id: teamWebsiteId } = row; const { id: websiteId, name, domain, userId } = row.website; const { teamUser } = row.team; const owner = teamUser[0]; const canRemove = user.id === userId || user.id === owner.userId; row.name = name; row.domain = domain; row.action = ( {canRemove && ( )} ); return ( {(data, key, colIndex) => { return ( {data[key]} ); }} ); }}
); }