Moved bounce filter to filter form.
This commit is contained in:
1 parent
2489601ae6
commit
877b453577
2 files changed
+22
-6
No files matched your search
@@ -1,3 +1,5 @@
|
||||
import { Checkbox, Row } from '@umami/react-zen';
|
||||
import { useState } from 'react';
|
||||
import { useMessages, useNavigation } from '@/components/hooks';
|
||||
import { ListFilter } from '@/components/icons';
|
||||
import { DialogButton } from '@/components/input/DialogButton';
|
||||
@@ -12,12 +14,18 @@ export function WebsiteFilterButton({
|
||||
alignment?: 'end' | 'center' | 'start';
|
||||
}) {
|
||||
const { formatMessage, labels } = useMessages();
|
||||
const { updateParams, router } = useNavigation();
|
||||
const { updateParams, router, query } = useNavigation();
|
||||
const [excludeBounce, setExcludeBounce] = useState(!!query.excludeBounce);
|
||||
|
||||
const handleChange = ({ filters, segment, cohort }: any) => {
|
||||
const params = filtersArrayToObject(filters);
|
||||
|
||||
const url = updateParams({ ...params, segment, cohort });
|
||||
const url = updateParams({
|
||||
...params,
|
||||
segment,
|
||||
cohort,
|
||||
excludeBounce: excludeBounce ? 'true' : undefined,
|
||||
});
|
||||
|
||||
router.push(url);
|
||||
};
|
||||
@@ -25,7 +33,18 @@ export function WebsiteFilterButton({
|
||||
return (
|
||||
<DialogButton icon={<ListFilter />} label={formatMessage(labels.filter)} variant="outline">
|
||||
{({ close }) => {
|
||||
return <FilterEditForm websiteId={websiteId} onChange={handleChange} onClose={close} />;
|
||||
return (
|
||||
<>
|
||||
<Row position="absolute" top="30px" right="30px">
|
||||
<Row alignItems="center" gap>
|
||||
<Checkbox value={excludeBounce ? 'true' : ''} onChange={setExcludeBounce}>
|
||||
{formatMessage(labels.excludeBounce)}
|
||||
</Checkbox>
|
||||
</Row>
|
||||
</Row>
|
||||
<FilterEditForm websiteId={websiteId} onChange={handleChange} onClose={close} />
|
||||
</>
|
||||
);
|
||||
}}
|
||||
</DialogButton>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user