feat: add telemetry events chart
This commit is contained in:
parent
6f556f3e90
commit
941861f885
@ -1,10 +1,12 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { WebsiteMetricsTable } from '../../website/WebsiteMetricsTable';
|
import { WebsiteMetricsTable } from '../../website/WebsiteMetricsTable';
|
||||||
import { useGlobalRangeDate } from '../../../hooks/useGlobalRangeDate';
|
import { useGlobalRangeDate } from '../../../hooks/useGlobalRangeDate';
|
||||||
|
import { useTranslation } from '@i18next-toolkit/react';
|
||||||
|
|
||||||
export const WebsiteEventItem: React.FC<{
|
export const WebsiteEventItem: React.FC<{
|
||||||
websiteId: string;
|
websiteId: string;
|
||||||
}> = React.memo((props) => {
|
}> = React.memo((props) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
const { startDate, endDate } = useGlobalRangeDate();
|
const { startDate, endDate } = useGlobalRangeDate();
|
||||||
const startAt = startDate.valueOf();
|
const startAt = startDate.valueOf();
|
||||||
const endAt = endDate.valueOf();
|
const endAt = endDate.valueOf();
|
||||||
@ -13,7 +15,7 @@ export const WebsiteEventItem: React.FC<{
|
|||||||
<WebsiteMetricsTable
|
<WebsiteMetricsTable
|
||||||
websiteId={props.websiteId}
|
websiteId={props.websiteId}
|
||||||
type="event"
|
type="event"
|
||||||
title={['Events', 'Actions']}
|
title={[t('Events'), t('Actions')]}
|
||||||
startAt={startAt}
|
startAt={startAt}
|
||||||
endAt={endAt}
|
endAt={endAt}
|
||||||
/>
|
/>
|
||||||
|
@ -12,7 +12,7 @@ type MetricsItemType = AppRouterOutput['telemetry']['metrics'][number];
|
|||||||
interface MetricsTableProps {
|
interface MetricsTableProps {
|
||||||
telemetryId: string;
|
telemetryId: string;
|
||||||
title: [string, string];
|
title: [string, string];
|
||||||
type: 'source' | 'url' | 'referrer' | 'country';
|
type: 'source' | 'url' | 'event' | 'referrer' | 'country';
|
||||||
startAt: number;
|
startAt: number;
|
||||||
endAt: number;
|
endAt: number;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ export const TelemetryDetailPage: React.FC = React.memo(() => {
|
|||||||
/>
|
/>
|
||||||
</Card.Grid>
|
</Card.Grid>
|
||||||
|
|
||||||
<Card.Grid hoverable={false} className="!w-1/2 min-h-[470px]">
|
<Card.Grid hoverable={false} className="!w-1/3 min-h-[470px]">
|
||||||
<TelemetryMetricsTable
|
<TelemetryMetricsTable
|
||||||
telemetryId={telemetryId}
|
telemetryId={telemetryId}
|
||||||
type="source"
|
type="source"
|
||||||
@ -42,7 +42,17 @@ export const TelemetryDetailPage: React.FC = React.memo(() => {
|
|||||||
/>
|
/>
|
||||||
</Card.Grid>
|
</Card.Grid>
|
||||||
|
|
||||||
<Card.Grid hoverable={false} className="!w-1/2 min-h-[470px]">
|
<Card.Grid hoverable={false} className="!w-1/3 min-h-[470px]">
|
||||||
|
<TelemetryMetricsTable
|
||||||
|
telemetryId={telemetryId}
|
||||||
|
type="event"
|
||||||
|
title={[t('Events'), t('Views')]}
|
||||||
|
startAt={startAt}
|
||||||
|
endAt={endAt}
|
||||||
|
/>
|
||||||
|
</Card.Grid>
|
||||||
|
|
||||||
|
<Card.Grid hoverable={false} className="!w-1/3 min-h-[470px]">
|
||||||
<TelemetryMetricsTable
|
<TelemetryMetricsTable
|
||||||
telemetryId={telemetryId}
|
telemetryId={telemetryId}
|
||||||
type="country"
|
type="country"
|
||||||
|
@ -211,7 +211,7 @@ export const telemetryRouter = router({
|
|||||||
z
|
z
|
||||||
.object({
|
.object({
|
||||||
telemetryId: z.string(),
|
telemetryId: z.string(),
|
||||||
type: z.enum(['source', 'url', 'referrer', 'country']),
|
type: z.enum(['source', 'url', 'event', 'referrer', 'country']),
|
||||||
startAt: z.number(),
|
startAt: z.number(),
|
||||||
endAt: z.number(),
|
endAt: z.number(),
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user