2022-12-27 01:57:59 +01:00
|
|
|
import Link from 'next/link';
|
2023-04-12 22:40:19 +02:00
|
|
|
import { Button, Text, Icon, Icons } from 'react-basics';
|
|
|
|
import SettingsTable from 'components/common/SettingsTable';
|
2023-03-22 22:05:55 +01:00
|
|
|
import useMessages from 'hooks/useMessages';
|
2023-03-30 08:08:26 +02:00
|
|
|
import useConfig from 'hooks/useConfig';
|
2023-01-21 02:12:53 +01:00
|
|
|
|
|
|
|
export default function WebsitesTable({ data = [] }) {
|
2023-03-22 22:05:55 +01:00
|
|
|
const { formatMessage, labels } = useMessages();
|
2023-03-30 08:08:26 +02:00
|
|
|
const { openExternal } = useConfig();
|
2023-01-25 16:42:46 +01:00
|
|
|
|
|
|
|
const columns = [
|
2023-04-12 22:40:19 +02:00
|
|
|
{ name: 'name', label: formatMessage(labels.name) },
|
2023-01-31 06:44:07 +01:00
|
|
|
{ name: 'domain', label: formatMessage(labels.domain) },
|
2023-04-12 22:40:19 +02:00
|
|
|
{ name: 'action', label: ' ' },
|
2023-01-25 16:42:46 +01:00
|
|
|
];
|
|
|
|
|
2022-12-27 01:57:59 +01:00
|
|
|
return (
|
2023-04-12 22:40:19 +02:00
|
|
|
<SettingsTable columns={columns} data={data}>
|
|
|
|
{row => {
|
|
|
|
const { id } = row;
|
2022-12-27 01:57:59 +01:00
|
|
|
|
2023-04-12 22:40:19 +02:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<Link href={`/settings/websites/${id}`}>
|
|
|
|
<Button>
|
|
|
|
<Icon>
|
|
|
|
<Icons.Edit />
|
|
|
|
</Icon>
|
|
|
|
<Text>{formatMessage(labels.edit)}</Text>
|
|
|
|
</Button>
|
|
|
|
</Link>
|
|
|
|
<Link href={`/websites/${id}`} target={openExternal ? '_blank' : null}>
|
|
|
|
<Button>
|
|
|
|
<Icon>
|
|
|
|
<Icons.External />
|
|
|
|
</Icon>
|
|
|
|
<Text>{formatMessage(labels.view)}</Text>
|
|
|
|
</Button>
|
|
|
|
</Link>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}}
|
|
|
|
</SettingsTable>
|
2022-12-27 01:57:59 +01:00
|
|
|
);
|
|
|
|
}
|