fix(dashboard): able to filter on event names
This commit is contained in:
@@ -6,7 +6,10 @@ import { EventsTable } from '@/components/events/table';
|
|||||||
import { OverviewFiltersButtons } from '@/components/overview/filters/overview-filters-buttons';
|
import { OverviewFiltersButtons } from '@/components/overview/filters/overview-filters-buttons';
|
||||||
import { OverviewFiltersDrawer } from '@/components/overview/filters/overview-filters-drawer';
|
import { OverviewFiltersDrawer } from '@/components/overview/filters/overview-filters-drawer';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { useEventQueryFilters } from '@/hooks/useEventQueryFilters';
|
import {
|
||||||
|
useEventQueryFilters,
|
||||||
|
useEventQueryNamesFilter,
|
||||||
|
} from '@/hooks/useEventQueryFilters';
|
||||||
import { pushModal } from '@/modals';
|
import { pushModal } from '@/modals';
|
||||||
import { api } from '@/trpc/client';
|
import { api } from '@/trpc/client';
|
||||||
import { format } from 'date-fns';
|
import { format } from 'date-fns';
|
||||||
@@ -24,12 +27,14 @@ const Events = ({ projectId, profileId }: Props) => {
|
|||||||
'startDate',
|
'startDate',
|
||||||
parseAsIsoDateTime,
|
parseAsIsoDateTime,
|
||||||
);
|
);
|
||||||
|
const [eventNames] = useEventQueryNamesFilter();
|
||||||
|
|
||||||
const [endDate, setEndDate] = useQueryState('endDate', parseAsIsoDateTime);
|
const [endDate, setEndDate] = useQueryState('endDate', parseAsIsoDateTime);
|
||||||
const query = api.event.events.useInfiniteQuery(
|
const query = api.event.events.useInfiniteQuery(
|
||||||
{
|
{
|
||||||
projectId,
|
projectId,
|
||||||
filters,
|
filters,
|
||||||
|
events: eventNames,
|
||||||
profileId,
|
profileId,
|
||||||
startDate: startDate || undefined,
|
startDate: startDate || undefined,
|
||||||
endDate: endDate || undefined,
|
endDate: endDate || undefined,
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ export const eventRouter = createTRPCRouter({
|
|||||||
filters: z.array(zChartEventFilter).default([]),
|
filters: z.array(zChartEventFilter).default([]),
|
||||||
startDate: z.date().optional(),
|
startDate: z.date().optional(),
|
||||||
endDate: z.date().optional(),
|
endDate: z.date().optional(),
|
||||||
|
events: z.array(z.string()).optional(),
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.query(async ({ input }) => {
|
.query(async ({ input }) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user