mirror of
https://github.com/umami-software/umami.git
synced 2026-02-12 00:27:11 +01:00
Update teams features.
This commit is contained in:
parent
89f2fd601e
commit
656df4f846
23 changed files with 278 additions and 113 deletions
|
|
@ -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 }}>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue