1- import { useState } from 'react' ;
2- import { Column , Tabs , TabList , Tab , TabPanel , Row , Button } from '@umami/react-zen' ;
31import { useFilters , useMessages , useNavigation } from '@/components/hooks' ;
42import { FieldFilters } from '@/components/input/FieldFilters' ;
53import { SegmentFilters } from '@/components/input/SegmentFilters' ;
4+ import { Button , Column , Row , Tab , TabList , TabPanel , Tabs } from '@umami/react-zen' ;
5+ import { useState } from 'react' ;
66
77export interface FilterEditFormProps {
88 websiteId ?: string ;
@@ -13,6 +13,7 @@ export interface FilterEditFormProps {
1313export function FilterEditForm ( { websiteId, onChange, onClose } : FilterEditFormProps ) {
1414 const {
1515 query : { segment, cohort } ,
16+ pathname,
1617 } = useNavigation ( ) ;
1718 const { filters } = useFilters ( ) ;
1819 const { formatMessage, labels } = useMessages ( ) ;
@@ -22,6 +23,7 @@ export function FilterEditForm({ websiteId, onChange, onClose }: FilterEditFormP
2223 const panelProps = {
2324 style : { height : 500 } ,
2425 } ;
26+ const excludeFilters = pathname . includes ( '/pixels' ) || pathname . includes ( '/links' ) ;
2527
2628 const handleReset = ( ) => {
2729 setCurrentFilters ( [ ] ) ;
@@ -48,11 +50,20 @@ export function FilterEditForm({ websiteId, onChange, onClose }: FilterEditFormP
4850 < Tabs >
4951 < TabList >
5052 < Tab id = "fields" > { formatMessage ( labels . fields ) } </ Tab >
51- < Tab id = "segments" > { formatMessage ( labels . segments ) } </ Tab >
52- < Tab id = "cohorts" > { formatMessage ( labels . cohorts ) } </ Tab >
53+ { ! excludeFilters && (
54+ < >
55+ < Tab id = "segments" > { formatMessage ( labels . segments ) } </ Tab >
56+ < Tab id = "cohorts" > { formatMessage ( labels . cohorts ) } </ Tab >
57+ </ >
58+ ) }
5359 </ TabList >
5460 < TabPanel id = "fields" { ...panelProps } >
55- < FieldFilters websiteId = { websiteId } value = { currentFilters } onChange = { setCurrentFilters } />
61+ < FieldFilters
62+ websiteId = { websiteId }
63+ value = { currentFilters }
64+ onChange = { setCurrentFilters }
65+ exclude = { excludeFilters ? [ 'path' , 'title' , 'hostname' , 'tag' , 'event' ] : [ ] }
66+ />
5667 </ TabPanel >
5768 < TabPanel id = "segments" { ...panelProps } >
5869 < SegmentFilters
0 commit comments