mirror of
https://github.com/umami-software/umami.git
synced 2026-02-13 09:05:36 +01:00
More updates to realtime.
This commit is contained in:
parent
28921a7cd5
commit
93b77672f3
28 changed files with 218 additions and 263 deletions
|
|
@ -1,18 +1,12 @@
|
|||
import { useIntl } from 'react-intl';
|
||||
import { Dropdown, Item } from 'react-basics';
|
||||
import MetricCard from 'components/metrics/MetricCard';
|
||||
import { labels } from 'components/messages';
|
||||
import styles from './RealtimeHeader.module.css';
|
||||
|
||||
export default function RealtimeHeader({ data, websiteId, websites, onSelect }) {
|
||||
export default function RealtimeHeader({ data = {} }) {
|
||||
const { formatMessage } = useIntl();
|
||||
|
||||
const { pageviews, sessions, events, countries } = data;
|
||||
|
||||
const renderValue = value => {
|
||||
return websites?.find(({ id }) => id === value)?.name;
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={styles.header}>
|
||||
<div className={styles.metrics}>
|
||||
|
|
@ -25,20 +19,10 @@ export default function RealtimeHeader({ data, websiteId, websites, onSelect })
|
|||
<MetricCard label={formatMessage(labels.events)} value={events?.length} hideComparison />
|
||||
<MetricCard
|
||||
label={formatMessage(labels.countries)}
|
||||
value={countries.length}
|
||||
value={countries?.length}
|
||||
hideComparison
|
||||
/>
|
||||
</div>
|
||||
<Dropdown
|
||||
items={websites}
|
||||
value={websiteId}
|
||||
renderValue={renderValue}
|
||||
onChange={onSelect}
|
||||
alignment="end"
|
||||
placeholder={formatMessage(labels.selectWebsite)}
|
||||
>
|
||||
{item => <Item key={item.id}>{item.name}</Item>}
|
||||
</Dropdown>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue