mirror of
https://github.com/umami-software/umami.git
synced 2026-02-23 22:15:35 +01:00
Redo events tab to show all events.
This commit is contained in:
parent
10f65cae68
commit
9c32057841
18 changed files with 152 additions and 66 deletions
43
src/app/(main)/websites/[websiteId]/events/EventsTable.tsx
Normal file
43
src/app/(main)/websites/[websiteId]/events/EventsTable.tsx
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
import { GridTable, GridColumn } from 'react-basics';
|
||||
import { useLocale, useMessages } from 'components/hooks';
|
||||
import Empty from 'components/common/Empty';
|
||||
import { formatDistance } from 'date-fns';
|
||||
import Profile from 'components/common/Profile';
|
||||
import Link from 'next/link';
|
||||
|
||||
export function EventsTable({ data = [] }) {
|
||||
const { dateLocale } = useLocale();
|
||||
const { formatMessage, labels } = useMessages();
|
||||
|
||||
if (data.length === 0) {
|
||||
return <Empty />;
|
||||
}
|
||||
|
||||
return (
|
||||
<GridTable data={data}>
|
||||
<GridColumn name="id" label="ID" />
|
||||
<GridColumn name="session" label={formatMessage(labels.session)}>
|
||||
{row => (
|
||||
<Link href={`/sessions/`}>
|
||||
<Profile seed={row.sessionId} size={64} />
|
||||
</Link>
|
||||
)}
|
||||
</GridColumn>
|
||||
<GridColumn name="eventName" label={formatMessage(labels.event)}>
|
||||
{row => formatMessage(row.eventName ? labels.triggeredEvent : labels.viewedPage)}
|
||||
</GridColumn>
|
||||
<GridColumn name="eventName" label={formatMessage(labels.name)} />
|
||||
<GridColumn name="urlPath" label={formatMessage(labels.path)} />
|
||||
<GridColumn name="created" label={formatMessage(labels.created)}>
|
||||
{row =>
|
||||
formatDistance(new Date(row.createdAt), new Date(), {
|
||||
addSuffix: true,
|
||||
locale: dateLocale,
|
||||
})
|
||||
}
|
||||
</GridColumn>
|
||||
</GridTable>
|
||||
);
|
||||
}
|
||||
|
||||
export default EventsTable;
|
||||
Loading…
Add table
Add a link
Reference in a new issue