Added report context. Removed report store.

This commit is contained in:
Mike Cao 2023-05-28 21:37:34 -07:00
parent bc37f5124e
commit bfb52eb678
31 changed files with 372 additions and 273 deletions

26
pages/realtime/[id].js Normal file
View file

@ -0,0 +1,26 @@
import { useRouter } from 'next/router';
import AppLayout from 'components/layout/AppLayout';
import RealtimeDashboard from 'components/pages/realtime/RealtimeDashboard';
import useMessages from 'hooks/useMessages';
import useApi from 'hooks/useApi';
export default function RealtimeDetailsPage() {
const router = useRouter();
const { id: websiteId } = router.query;
const { formatMessage, labels } = useMessages();
const { get, useQuery } = useApi();
const { data: website } = useQuery(['websites', websiteId], () => get(`/websites/${websiteId}`), {
enabled: !!websiteId,
});
const title = `${formatMessage(labels.realtime)}${website?.name ? ` - ${website.name}` : ''}`;
if (!websiteId) {
return null;
}
return (
<AppLayout title={title}>
<RealtimeDashboard key={websiteId} websiteId={websiteId} />
</AppLayout>
);
}