mirror of
https://github.com/umami-software/umami.git
synced 2026-02-11 16:17:13 +01:00
fix bounce checkbox for share page
This commit is contained in:
parent
f84b9f041d
commit
8f15741b68
2 changed files with 29 additions and 24 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
import { Column, Heading, Row, Text } from '@umami/react-zen';
|
import { Column, Heading, Row, Text } from '@umami/react-zen';
|
||||||
|
import { LoadingPanel } from 'dist';
|
||||||
import { Plus } from 'lucide-react';
|
import { Plus } from 'lucide-react';
|
||||||
import { useMessages, useWebsiteSharesQuery } from '@/components/hooks';
|
import { useMessages, useWebsiteSharesQuery } from '@/components/hooks';
|
||||||
import { DialogButton } from '@/components/input/DialogButton';
|
import { DialogButton } from '@/components/input/DialogButton';
|
||||||
|
|
@ -11,33 +12,36 @@ export interface WebsiteShareFormProps {
|
||||||
|
|
||||||
export function WebsiteShareForm({ websiteId }: WebsiteShareFormProps) {
|
export function WebsiteShareForm({ websiteId }: WebsiteShareFormProps) {
|
||||||
const { formatMessage, labels, messages } = useMessages();
|
const { formatMessage, labels, messages } = useMessages();
|
||||||
const { data } = useWebsiteSharesQuery({ websiteId });
|
const { data, error, isLoading } = useWebsiteSharesQuery({ websiteId });
|
||||||
|
|
||||||
const shares = data?.data || [];
|
const shares = data?.data || [];
|
||||||
const hasShares = shares.length > 0;
|
const hasShares = shares.length > 0;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Column gap="4">
|
<LoadingPanel data={data} isLoading={isLoading} error={error}>
|
||||||
<Row justifyContent="space-between" alignItems="center">
|
<Column gap="4">
|
||||||
<Heading>{formatMessage(labels.share)}</Heading>
|
<Row justifyContent="space-between" alignItems="center">
|
||||||
<DialogButton
|
<Heading>{formatMessage(labels.share)}</Heading>
|
||||||
icon={<Plus size={16} />}
|
<DialogButton
|
||||||
label={formatMessage(labels.add)}
|
icon={<Plus size={16} />}
|
||||||
title={formatMessage(labels.share)}
|
label={formatMessage(labels.add)}
|
||||||
variant="primary"
|
title={formatMessage(labels.share)}
|
||||||
width="600px"
|
variant="primary"
|
||||||
>
|
width="600px"
|
||||||
{({ close }) => <ShareEditForm websiteId={websiteId} onClose={close} />}
|
>
|
||||||
</DialogButton>
|
{({ close }) => <ShareEditForm websiteId={websiteId} onClose={close} />}
|
||||||
</Row>
|
</DialogButton>
|
||||||
{hasShares ? (
|
</Row>
|
||||||
<>
|
{hasShares ? (
|
||||||
<Text>{formatMessage(messages.shareUrl)}</Text>
|
<>
|
||||||
<SharesTable data={shares} />
|
<Text>{formatMessage(messages.shareUrl)}</Text>
|
||||||
</>
|
|
||||||
) : (
|
<SharesTable data={shares} />
|
||||||
<Text color="muted">{formatMessage(messages.noDataAvailable)}</Text>
|
</>
|
||||||
)}
|
) : (
|
||||||
</Column>
|
<Text color="muted">{formatMessage(messages.noDataAvailable)}</Text>
|
||||||
|
)}
|
||||||
|
</Column>
|
||||||
|
</LoadingPanel>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,8 @@ export function WebsiteFilterButton({
|
||||||
const { formatMessage, labels } = useMessages();
|
const { formatMessage, labels } = useMessages();
|
||||||
const { updateParams, pathname, router, query } = useNavigation();
|
const { updateParams, pathname, router, query } = useNavigation();
|
||||||
const [excludeBounce, setExcludeBounce] = useState(!!query.excludeBounce);
|
const [excludeBounce, setExcludeBounce] = useState(!!query.excludeBounce);
|
||||||
const isOverview = /^\/teams\/[^/]+\/websites\/[^/]+$/.test(pathname);
|
const isOverview =
|
||||||
|
/^\/teams\/[^/]+\/websites\/[^/]+$/.test(pathname) || /^\/share\/[^/]+$/.test(pathname);
|
||||||
|
|
||||||
const handleChange = ({ filters, segment, cohort }: any) => {
|
const handleChange = ({ filters, segment, cohort }: any) => {
|
||||||
const params = filtersArrayToObject(filters);
|
const params = filtersArrayToObject(filters);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue