mirror of
https://github.com/umami-software/umami.git
synced 2026-02-24 14:35:35 +01:00
Fixed realtime page.
This commit is contained in:
parent
65ebd736b9
commit
c1d301ffdc
12 changed files with 83 additions and 450 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import { Key, useContext, useState } from 'react';
|
||||
import { useContext, useState } from 'react';
|
||||
import { Row } from '@umami/react-zen';
|
||||
import thenby from 'thenby';
|
||||
import { percentFilter } from '@/lib/filters';
|
||||
import { ListTable } from '@/components/metrics/ListTable';
|
||||
|
|
@ -12,19 +13,17 @@ export function RealtimeUrls({ data }: { data: RealtimeData }) {
|
|||
const website = useContext(WebsiteContext);
|
||||
const { formatMessage, labels } = useMessages();
|
||||
const { referrers, urls } = data || {};
|
||||
const [filter, setFilter] = useState<Key>(FILTER_REFERRERS);
|
||||
const [filter, setFilter] = useState(FILTER_REFERRERS);
|
||||
const limit = 15;
|
||||
|
||||
const buttons = [
|
||||
{
|
||||
id: 1,
|
||||
id: FILTER_REFERRERS,
|
||||
label: formatMessage(labels.referrers),
|
||||
key: FILTER_REFERRERS,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
id: FILTER_PAGES,
|
||||
label: formatMessage(labels.pages),
|
||||
key: FILTER_PAGES,
|
||||
},
|
||||
];
|
||||
|
||||
|
|
@ -63,7 +62,9 @@ export function RealtimeUrls({ data }: { data: RealtimeData }) {
|
|||
|
||||
return (
|
||||
<>
|
||||
<FilterButtons items={buttons} onSelect={setFilter} />
|
||||
<Row justifyContent="center">
|
||||
<FilterButtons items={buttons} value={filter} onChange={setFilter} />
|
||||
</Row>
|
||||
{filter === FILTER_REFERRERS && (
|
||||
<ListTable
|
||||
title={formatMessage(labels.referrers)}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue