2024-07-29 02:51:14 +00:00
|
|
|
import Link from 'next/link';
|
2024-07-08 08:45:54 +00:00
|
|
|
import { GridColumn, GridTable, useBreakpoint } from 'react-basics';
|
2024-07-23 01:06:36 +00:00
|
|
|
import { useFormat, useMessages } from 'components/hooks';
|
2024-07-29 02:51:14 +00:00
|
|
|
import Profile from 'components/common/Profile';
|
2024-07-08 08:45:54 +00:00
|
|
|
|
|
|
|
|
export function SessionsTable({ data = [] }: { data: any[]; showDomain?: boolean }) {
|
|
|
|
|
const { formatMessage, labels } = useMessages();
|
|
|
|
|
const breakpoint = useBreakpoint();
|
2024-07-23 01:06:36 +00:00
|
|
|
const { formatValue } = useFormat();
|
2024-07-08 08:45:54 +00:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<GridTable data={data} cardMode={['xs', 'sm', 'md'].includes(breakpoint)}>
|
2024-07-29 02:51:14 +00:00
|
|
|
<GridColumn name="pic" label="" width="90px">
|
2024-07-29 08:38:36 +00:00
|
|
|
{row => <Profile key={row.id} seed={row.id} size={64} />}
|
2024-07-29 02:51:14 +00:00
|
|
|
</GridColumn>
|
|
|
|
|
<GridColumn name="id" label="ID">
|
2024-07-29 08:38:36 +00:00
|
|
|
{row => <Link href={`sessions/${row.id}`}>{row.id}</Link>}
|
2024-07-29 02:51:14 +00:00
|
|
|
</GridColumn>
|
2024-07-23 01:06:36 +00:00
|
|
|
<GridColumn name="country" label={formatMessage(labels.country)}>
|
|
|
|
|
{row => formatValue(row.country, 'country')}
|
|
|
|
|
</GridColumn>
|
2024-07-08 08:45:54 +00:00
|
|
|
<GridColumn name="city" label={formatMessage(labels.city)} />
|
2024-07-23 01:06:36 +00:00
|
|
|
<GridColumn name="browser" label={formatMessage(labels.browser)}>
|
|
|
|
|
{row => formatValue(row.browser, 'browser')}
|
|
|
|
|
</GridColumn>
|
2024-07-08 08:45:54 +00:00
|
|
|
<GridColumn name="os" label={formatMessage(labels.os)} />
|
2024-07-23 01:06:36 +00:00
|
|
|
<GridColumn name="device" label={formatMessage(labels.device)}>
|
|
|
|
|
{row => formatValue(row.device, 'device')}
|
|
|
|
|
</GridColumn>
|
2024-07-29 08:38:36 +00:00
|
|
|
<GridColumn name="lastAt" label={formatMessage(labels.lastSeen)}>
|
|
|
|
|
{row => row.lastAt}
|
2024-07-23 01:06:36 +00:00
|
|
|
</GridColumn>
|
2024-07-08 08:45:54 +00:00
|
|
|
</GridTable>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default SessionsTable;
|