diff options
| author | Fuwn <[email protected]> | 2026-01-24 13:09:50 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-01-24 13:09:50 +0000 |
| commit | 396acf3bbbe00a192cb0ea0a9ccf91b1d8d2850b (patch) | |
| tree | b9df4ca6a70db45cfffbae6fdd7252e20fb8e93c /src/app/(main)/pixels/PixelsTable.tsx | |
| download | umami-main.tar.xz umami-main.zip | |
Created from https://vercel.com/new
Diffstat (limited to 'src/app/(main)/pixels/PixelsTable.tsx')
| -rw-r--r-- | src/app/(main)/pixels/PixelsTable.tsx | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/app/(main)/pixels/PixelsTable.tsx b/src/app/(main)/pixels/PixelsTable.tsx new file mode 100644 index 0000000..48a8458 --- /dev/null +++ b/src/app/(main)/pixels/PixelsTable.tsx @@ -0,0 +1,48 @@ +import { DataColumn, DataTable, type DataTableProps, Row } from '@umami/react-zen'; +import Link from 'next/link'; +import { DateDistance } from '@/components/common/DateDistance'; +import { ExternalLink } from '@/components/common/ExternalLink'; +import { useMessages, useNavigation, useSlug } from '@/components/hooks'; +import { PixelDeleteButton } from './PixelDeleteButton'; +import { PixelEditButton } from './PixelEditButton'; + +export function PixelsTable(props: DataTableProps) { + const { formatMessage, labels } = useMessages(); + const { renderUrl } = useNavigation(); + const { getSlugUrl } = useSlug('pixel'); + + return ( + <DataTable {...props}> + <DataColumn id="name" label={formatMessage(labels.name)}> + {({ id, name }: any) => { + return <Link href={renderUrl(`/pixels/${id}`)}>{name}</Link>; + }} + </DataColumn> + <DataColumn id="url" label="URL"> + {({ slug }: any) => { + const url = getSlugUrl(slug); + return ( + <ExternalLink href={url} prefetch={false}> + {url} + </ExternalLink> + ); + }} + </DataColumn> + <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; + + return ( + <Row> + <PixelEditButton pixelId={id} /> + <PixelDeleteButton pixelId={id} name={name} /> + </Row> + ); + }} + </DataColumn> + </DataTable> + ); +} |