mirror of
https://github.com/umami-software/umami.git
synced 2026-02-13 09:05:36 +01:00
41 lines
1.3 KiB
TypeScript
41 lines
1.3 KiB
TypeScript
import { ReactNode } from 'react';
|
|
import { Icon, DataTable, DataColumn, DataTableProps } from '@umami/react-zen';
|
|
import { LinkButton } from '@/components/common/LinkButton';
|
|
import { useMessages, useNavigation } from '@/components/hooks';
|
|
import { SquarePen } from '@/components/icons';
|
|
|
|
export interface WebsitesTableProps extends DataTableProps {
|
|
showActions?: boolean;
|
|
allowEdit?: boolean;
|
|
allowView?: boolean;
|
|
renderLink?: (row: any) => ReactNode;
|
|
}
|
|
|
|
export function WebsitesTable({ showActions, renderLink, ...props }: WebsitesTableProps) {
|
|
const { formatMessage, labels } = useMessages();
|
|
const { renderUrl } = useNavigation();
|
|
|
|
return (
|
|
<DataTable {...props}>
|
|
<DataColumn id="name" label={formatMessage(labels.name)}>
|
|
{renderLink}
|
|
</DataColumn>
|
|
<DataColumn id="domain" label={formatMessage(labels.domain)} />
|
|
{showActions && (
|
|
<DataColumn id="action" label=" " align="end">
|
|
{(row: any) => {
|
|
const websiteId = row.id;
|
|
|
|
return (
|
|
<LinkButton href={renderUrl(`/websites/${websiteId}/settings`)} variant="quiet">
|
|
<Icon>
|
|
<SquarePen />
|
|
</Icon>
|
|
</LinkButton>
|
|
);
|
|
}}
|
|
</DataColumn>
|
|
)}
|
|
</DataTable>
|
|
);
|
|
}
|