2022-12-27 00:57:59 +00:00
|
|
|
import Link from 'next/link';
|
2023-04-12 20:40:19 +00:00
|
|
|
import { Button, Text, Icon, Icons } from 'react-basics';
|
|
|
|
|
import SettingsTable from 'components/common/SettingsTable';
|
2023-03-22 21:05:55 +00:00
|
|
|
import useMessages from 'hooks/useMessages';
|
2023-03-30 06:08:26 +00:00
|
|
|
import useConfig from 'hooks/useConfig';
|
2023-01-21 01:12:53 +00:00
|
|
|
|
|
|
|
|
export default function WebsitesTable({ data = [] }) {
|
2023-03-22 21:05:55 +00:00
|
|
|
const { formatMessage, labels } = useMessages();
|
2023-03-30 06:08:26 +00:00
|
|
|
const { openExternal } = useConfig();
|
2023-01-25 15:42:46 +00:00
|
|
|
|
|
|
|
|
const columns = [
|
2023-04-12 20:40:19 +00:00
|
|
|
{ name: 'name', label: formatMessage(labels.name) },
|
2023-01-31 05:44:07 +00:00
|
|
|
{ name: 'domain', label: formatMessage(labels.domain) },
|
2023-04-12 20:40:19 +00:00
|
|
|
{ name: 'action', label: ' ' },
|
2023-01-25 15:42:46 +00:00
|
|
|
];
|
|
|
|
|
|
2022-12-27 00:57:59 +00:00
|
|
|
return (
|
2023-04-12 20:40:19 +00:00
|
|
|
<SettingsTable columns={columns} data={data}>
|
|
|
|
|
{row => {
|
|
|
|
|
const { id } = row;
|
2022-12-27 00:57:59 +00:00
|
|
|
|
2023-04-12 20:40:19 +00: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 00:57:59 +00:00
|
|
|
);
|
|
|
|
|
}
|