mirror of
https://github.com/umami-software/umami.git
synced 2026-02-06 21:57:16 +01:00
Moved bounce filter to filter form.
This commit is contained in:
parent
2489601ae6
commit
877b453577
2 changed files with 22 additions and 6 deletions
|
|
@ -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>
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue