feat(api): add insights endpoints

This commit is contained in:
Carl-Gerhard Lindesvärd
2025-09-08 22:07:09 +02:00
parent d4a1eb88b8
commit df32bb04a0
21 changed files with 1340 additions and 416 deletions

View File

@@ -313,7 +313,6 @@ export default function OverviewTopDevices({
const query = api.overview.topGeneric.useQuery({
projectId,
interval,
range,
filters,
column: widget.key,

View File

@@ -6,8 +6,6 @@ import { ModalContent, ModalHeader } from '@/modals/Modal/Container';
import { api } from '@/trpc/client';
import type { IGetTopGenericInput } from '@openpanel/db';
import { ChevronRightIcon } from 'lucide-react';
import { useEffect } from 'react';
import { toast } from 'sonner';
import { SerieIcon } from '../report-chart/common/serie-icon';
import { Button } from '../ui/button';
import { ScrollArea } from '../ui/scroll-area';
@@ -36,7 +34,6 @@ export default function OverviewTopGenericModal({
startDate,
endDate,
range,
interval,
limit: 50,
column,
},

View File

@@ -2,9 +2,6 @@
import { useEventQueryFilters } from '@/hooks/useEventQueryFilters';
import { cn } from '@/utils/cn';
import { useState } from 'react';
import type { IChartType } from '@openpanel/validation';
import { useNumber } from '@/hooks/useNumerFormatter';
import { pushModal } from '@/modals';
@@ -30,7 +27,6 @@ interface OverviewTopGeoProps {
export default function OverviewTopGeo({ projectId }: OverviewTopGeoProps) {
const { interval, range, previous, startDate, endDate } =
useOverviewOptions();
const [chartType, setChartType] = useState<IChartType>('bar');
const [filters, setFilter] = useEventQueryFilters();
const isPageFilter = filters.find((filter) => filter.name === 'path');
const [widget, setWidget, widgets] = useOverviewWidgetV2('geo', {
@@ -52,7 +48,6 @@ export default function OverviewTopGeo({ projectId }: OverviewTopGeoProps) {
const query = api.overview.topGeneric.useQuery({
projectId,
interval,
range,
filters,
column: widget.key,

View File

@@ -34,7 +34,6 @@ export default function OverviewTopPagesModal({
endDate,
mode: 'page',
range,
interval: 'day',
limit: 50,
},
{

View File

@@ -4,9 +4,6 @@ import { useEventQueryFilters } from '@/hooks/useEventQueryFilters';
import { cn } from '@/utils/cn';
import { Globe2Icon } from 'lucide-react';
import { parseAsBoolean, useQueryState } from 'nuqs';
import { useState } from 'react';
import type { IChartType } from '@openpanel/validation';
import { pushModal } from '@/modals';
import { api } from '@/trpc/client';
@@ -15,7 +12,6 @@ import { Widget, WidgetBody } from '../widget';
import OverviewDetailsButton from './overview-details-button';
import { WidgetButtons, WidgetFooter, WidgetHead } from './overview-widget';
import {
OverviewWidgetTableBots,
OverviewWidgetTableLoading,
OverviewWidgetTablePages,
} from './overview-widget-table';
@@ -72,7 +68,6 @@ export default function OverviewTopPages({ projectId }: OverviewTopPagesProps) {
endDate,
mode: widget.key,
range,
interval,
});
const data = query.data;

View File

@@ -63,7 +63,6 @@ export default function OverviewTopSources({
const query = api.overview.topGeneric.useQuery({
projectId,
interval,
range,
filters,
column: widget.key,