implement showActions to pixels/links for viewonly users.

This commit is contained in:
Francis Cao committed 2026-01-26 23:26:40 -08:00
1 parent 57eef5866b
commit 2f998ff9d8
7 files changed
+76 -36

No files matched your search

+19 -12
View File
@@ -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>
);
}