mirror of
https://github.com/umami-software/umami.git
synced 2026-02-11 08:07:12 +01:00
implement showActions to pixels/links for viewonly users.
This commit is contained in:
parent
57eef5866b
commit
2f998ff9d8
7 changed files with 76 additions and 36 deletions
|
|
@ -6,10 +6,15 @@ import { useMessages, useNavigation, useSlug } from '@/components/hooks';
|
|||
import { PixelDeleteButton } from './PixelDeleteButton';
|
||||
import { PixelEditButton } from './PixelEditButton';
|
||||
|
||||
export function PixelsTable(props: DataTableProps) {
|
||||
export interface PixelsTableProps extends DataTableProps {
|
||||
showActions?: boolean;
|
||||
}
|
||||
|
||||
export function PixelsTable({ showActions, ...props }: PixelsTableProps) {
|
||||
const { formatMessage, labels } = useMessages();
|
||||
const { renderUrl } = useNavigation();
|
||||
const { getSlugUrl } = useSlug('pixel');
|
||||
console.log(showActions);
|
||||
|
||||
return (
|
||||
<DataTable {...props}>
|
||||
|
|
@ -31,18 +36,20 @@ export function PixelsTable(props: DataTableProps) {
|
|||
<DataColumn id="created" label={formatMessage(labels.created)}>
|
||||
{(row: any) => <DateDistance date={new Date(row.createdAt)} />}
|
||||
</DataColumn>
|
||||
<DataColumn id="action" align="end" width="100px">
|
||||
{(row: any) => {
|
||||
const { id, name } = row;
|
||||
{showActions && (
|
||||
<DataColumn id="action" align="end" width="100px">
|
||||
{(row: any) => {
|
||||
const { id, name } = row;
|
||||
|
||||
return (
|
||||
<Row>
|
||||
<PixelEditButton pixelId={id} />
|
||||
<PixelDeleteButton pixelId={id} name={name} />
|
||||
</Row>
|
||||
);
|
||||
}}
|
||||
</DataColumn>
|
||||
return (
|
||||
<Row>
|
||||
<PixelEditButton pixelId={id} />
|
||||
<PixelDeleteButton pixelId={id} name={name} />
|
||||
</Row>
|
||||
);
|
||||
}}
|
||||
</DataColumn>
|
||||
)}
|
||||
</DataTable>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue