import React from 'react';
import { FormattedMessage } from 'react-intl';
import PageHeader from '../layout/PageHeader';
import DropDown from '../common/DropDown';
import MetricCard from './MetricCard';
import styles from './RealtimeHeader.module.css';
export default function RealtimeHeader({ websites, data, websiteId, onSelect }) {
const options = [
{ label: , value: 0 },
].concat(websites.map(({ name, website_id }) => ({ label: name, value: website_id })));
const { pageviews, sessions, events } = data;
const countries = sessions.reduce((obj, { country }) => {
if (country) {
if (!obj[country]) {
obj[country] = 1;
} else {
obj[country] += 1;
}
}
return obj;
}, {});
return (
<>
}
value={pageviews.length}
/>
}
value={sessions.length}
/>
}
value={events.length}
/>
}
value={Object.keys(countries).length}
/>
>
);
}