Update teams features.

This commit is contained in:
Mike Cao 2023-02-01 18:39:54 -08:00
parent 89f2fd601e
commit 656df4f846
23 changed files with 278 additions and 113 deletions

View file

@ -14,12 +14,14 @@ import {
} from 'react-basics';
import { useIntl } from 'react-intl';
import { labels } from 'components/messages';
import { ROLES } from 'lib/constants';
export default function TeamsTable({ data = [] }) {
const { formatMessage } = useIntl();
const columns = [
{ name: 'name', label: formatMessage(labels.name), style: { flex: 2 } },
{ name: 'owner', label: formatMessage(labels.owner) },
{ name: 'action', label: ' ' },
];
@ -38,23 +40,27 @@ export default function TeamsTable({ data = [] }) {
{(row, keys, rowIndex) => {
const { id } = row;
row.action = (
<Flexbox flex={1} justifyContent="end">
<Link href={`/settings/teams/${id}`}>
<a>
<Button>
<Icon>
<Icons.ArrowRight />
</Icon>
<Text>{formatMessage(labels.settings)}</Text>
</Button>
</a>
</Link>
</Flexbox>
);
const rowData = {
...row,
owner: row.teamUsers.find(({ role }) => role === ROLES.teamOwner)?.user?.username,
action: (
<Flexbox flex={1} justifyContent="end">
<Link href={`/settings/teams/${id}`}>
<a>
<Button>
<Icon>
<Icons.ArrowRight />
</Icon>
<Text>{formatMessage(labels.settings)}</Text>
</Button>
</a>
</Link>
</Flexbox>
),
};
return (
<TableRow key={rowIndex} data={row} keys={keys}>
<TableRow key={rowIndex} data={rowData} keys={keys}>
{(data, key, colIndex) => {
return (
<TableCell key={colIndex} style={{ ...columns[colIndex]?.style }}>