2023-12-03 11:07:03 +00:00
|
|
|
import MetricsTable, { MetricsTableProps } from './MetricsTable';
|
2022-04-10 10:51:43 +00:00
|
|
|
import FilterLink from 'components/common/FilterLink';
|
2024-01-29 02:33:40 +00:00
|
|
|
import { useMessages } from 'components/hooks';
|
2023-08-21 09:06:09 +00:00
|
|
|
import { useFormat } from 'components/hooks';
|
2020-08-23 02:05:07 +00:00
|
|
|
|
2023-12-03 11:07:03 +00:00
|
|
|
export function DevicesTable(props: MetricsTableProps) {
|
2023-03-22 21:05:55 +00:00
|
|
|
const { formatMessage, labels } = useMessages();
|
2023-08-07 22:02:50 +00:00
|
|
|
const { formatDevice } = useFormat();
|
2022-04-10 10:51:43 +00:00
|
|
|
|
|
|
|
|
function renderLink({ x: device }) {
|
|
|
|
|
return (
|
2023-08-07 22:02:50 +00:00
|
|
|
<FilterLink id="device" value={labels[device] && device} label={formatDevice(device)}>
|
2023-07-10 04:30:37 +00:00
|
|
|
<img
|
2023-09-29 12:29:22 +00:00
|
|
|
src={`${process.env.basePath}/images/device/${device?.toLowerCase() || 'unknown'}.png`}
|
2023-07-10 04:30:37 +00:00
|
|
|
alt={device}
|
|
|
|
|
width={16}
|
|
|
|
|
height={16}
|
|
|
|
|
/>
|
|
|
|
|
</FilterLink>
|
2022-04-10 10:51:43 +00:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-23 02:05:07 +00:00
|
|
|
return (
|
|
|
|
|
<MetricsTable
|
2020-10-11 08:33:26 +00:00
|
|
|
{...props}
|
2023-03-09 23:18:54 +00:00
|
|
|
title={formatMessage(labels.devices)}
|
2020-08-23 02:05:07 +00:00
|
|
|
type="device"
|
2023-03-09 23:18:54 +00:00
|
|
|
metric={formatMessage(labels.visitors)}
|
2022-04-10 10:51:43 +00:00
|
|
|
renderLabel={renderLink}
|
2020-08-23 02:05:07 +00:00
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
}
|
2023-04-21 15:00:42 +00:00
|
|
|
|
|
|
|
|
export default DevicesTable;
|