2023-02-15 02:23:20 +01:00
|
|
|
import MetricCard from 'components/metrics/MetricCard';
|
2023-03-22 22:05:55 +01:00
|
|
|
import useMessages from 'hooks/useMessages';
|
2023-02-15 02:23:20 +01:00
|
|
|
import styles from './RealtimeHeader.module.css';
|
|
|
|
|
2023-04-21 17:00:42 +02:00
|
|
|
export function RealtimeHeader({ data = {} }) {
|
2023-03-22 22:05:55 +01:00
|
|
|
const { formatMessage, labels } = useMessages();
|
2023-02-23 05:59:59 +01:00
|
|
|
const { pageviews, visitors, events, countries } = data;
|
2023-02-18 06:42:42 +01:00
|
|
|
|
2023-02-15 02:23:20 +01:00
|
|
|
return (
|
|
|
|
<div className={styles.header}>
|
|
|
|
<div className={styles.metrics}>
|
|
|
|
<MetricCard
|
2023-04-19 20:46:41 +02:00
|
|
|
className={styles.card}
|
|
|
|
label={formatMessage(labels.views)}
|
|
|
|
value={pageviews?.length}
|
|
|
|
hideComparison
|
|
|
|
/>
|
|
|
|
<MetricCard
|
|
|
|
className={styles.card}
|
2023-02-15 02:23:20 +01:00
|
|
|
label={formatMessage(labels.visitors)}
|
2023-02-18 06:42:42 +01:00
|
|
|
value={visitors?.length}
|
2023-02-15 02:23:20 +01:00
|
|
|
hideComparison
|
|
|
|
/>
|
|
|
|
<MetricCard
|
2023-04-19 20:46:41 +02:00
|
|
|
className={styles.card}
|
|
|
|
label={formatMessage(labels.events)}
|
|
|
|
value={events?.length}
|
|
|
|
hideComparison
|
|
|
|
/>
|
|
|
|
<MetricCard
|
|
|
|
className={styles.card}
|
2023-02-15 02:23:20 +01:00
|
|
|
label={formatMessage(labels.countries)}
|
2023-02-15 11:27:18 +01:00
|
|
|
value={countries?.length}
|
2023-02-15 02:23:20 +01:00
|
|
|
hideComparison
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2023-04-21 17:00:42 +02:00
|
|
|
|
|
|
|
export default RealtimeHeader;
|