Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

Add DialogTrigger to overflow menus

Francis Caof073fb1996a6
diff --git a/src/app/(main)/websites/[websiteId]/(reports)/breakdown/BreakdownPage.tsx b/src/app/(main)/websites/[websiteId]/(reports)/breakdown/BreakdownPage.tsx
index eff072fde..e73ce10ef 100644
--- a/src/app/(main)/websites/[websiteId]/(reports)/breakdown/BreakdownPage.tsx
+++ b/src/app/(main)/websites/[websiteId]/(reports)/breakdown/BreakdownPage.tsx
@@ -1,23 +1,27 @@
'use client';
-import { useState } from 'react';
-import { Button, Column, Box, DialogTrigger, Popover, Dialog, IconLabel } from '@umami/react-zen';
-import { useDateRange, useMessages } from '@/components/hooks';
-import { ListCheck } from '@/components/icons';
+import { FieldSelectForm } from '@/app/(main)/websites/[websiteId]/(reports)/breakdown/FieldSelectForm';
+import { WebsiteControls } from '@/app/(main)/websites/[websiteId]/WebsiteControls';
import { Panel } from '@/components/common/Panel';
+import { useDateRange, useMessages, useMobile } from '@/components/hooks';
+import { ListCheck } from '@/components/icons';
+import { DialogButton } from '@/components/input/DialogButton';
+import { Column, Row } from '@umami/react-zen';
+import { useState } from 'react';
import { Breakdown } from './Breakdown';
-import { WebsiteControls } from '@/app/(main)/websites/[websiteId]/WebsiteControls';
-import { FieldSelectForm } from '@/app/(main)/websites/[websiteId]/(reports)/breakdown/FieldSelectForm';
export function BreakdownPage({ websiteId }: { websiteId: string }) {
const {
dateRange: { startDate, endDate },
} = useDateRange();
const [fields, setFields] = useState(['path']);
+ const { isMobile } = useMobile();
return (
<Column gap>
<WebsiteControls websiteId={websiteId} />
- <FieldsButton value={fields} onChange={setFields} />
+ <Row alignItems="center" justifyContent={isMobile ? 'flex-end' : 'flex-start'}>
+ <FieldsButton value={fields} onChange={setFields} />
+ </Row>
<Panel height="900px" overflow="auto" allowFullscreen>
<Breakdown
websiteId={websiteId}
@@ -34,19 +38,15 @@ const FieldsButton = ({ value, onChange }) => {
const { formatMessage, labels } = useMessages();
return (
- <Box>
- <DialogTrigger>
- <Button>
- <IconLabel icon={<ListCheck />}>{formatMessage(labels.fields)}</IconLabel>
- </Button>
- <Popover>
- <Dialog title={formatMessage(labels.fields)} style={{ width: 400 }}>
- {({ close }) => (
- <FieldSelectForm selectedFields={value} onChange={onChange} onClose={close} />
- )}
- </Dialog>
- </Popover>
- </DialogTrigger>
- </Box>
+ <DialogButton
+ icon={<ListCheck />}
+ label={formatMessage(labels.fields)}
+ width="800px"
+ minHeight="300px"
+ >
+ {({ close }) => {
+ return <FieldSelectForm selectedFields={value} onChange={onChange} onClose={close} />;
+ }}
+ </DialogButton>
);
};
diff --git a/src/app/(main)/websites/[websiteId]/cohorts/CohortAddButton.tsx b/src/app/(main)/websites/[websiteId]/cohorts/CohortAddButton.tsx
index 53bab8a15..737ab502c 100644
--- a/src/app/(main)/websites/[websiteId]/cohorts/CohortAddButton.tsx
+++ b/src/app/(main)/websites/[websiteId]/cohorts/CohortAddButton.tsx
@@ -12,7 +12,7 @@ export function CohortAddButton({ websiteId }: { websiteId: string }) {
label={formatMessage(labels.cohort)}
variant="primary"
width="800px"
- minHeight="300px"
+ height="calc(100dvh - 40px)"
>
{({ close }) => {
return <CohortEditForm websiteId={websiteId} onClose={close} />;
diff --git a/src/app/(main)/websites/[websiteId]/cohorts/CohortEditButton.tsx b/src/app/(main)/websites/[websiteId]/cohorts/CohortEditButton.tsx
index 693f31d77..48944677d 100644
--- a/src/app/(main)/websites/[websiteId]/cohorts/CohortEditButton.tsx
+++ b/src/app/(main)/websites/[websiteId]/cohorts/CohortEditButton.tsx
@@ -21,7 +21,7 @@ export function CohortEditButton({
variant="quiet"
title={formatMessage(labels.cohort)}
width="800px"
- minHeight="300px"
+ height="calc(100dvh - 40px)"
>
{({ close }) => {
return (
diff --git a/src/app/(main)/websites/[websiteId]/segments/SegmentAddButton.tsx b/src/app/(main)/websites/[websiteId]/segments/SegmentAddButton.tsx
index 052d3185b..aed63ac68 100644
--- a/src/app/(main)/websites/[websiteId]/segments/SegmentAddButton.tsx
+++ b/src/app/(main)/websites/[websiteId]/segments/SegmentAddButton.tsx
@@ -12,6 +12,7 @@ export function SegmentAddButton({ websiteId }: { websiteId: string }) {
label={formatMessage(labels.segment)}
variant="primary"
width="800px"
+ height="calc(100dvh - 40px)"
>
{({ close }) => {
return <SegmentEditForm websiteId={websiteId} onClose={close} />;
diff --git a/src/app/(main)/websites/[websiteId]/segments/SegmentEditButton.tsx b/src/app/(main)/websites/[websiteId]/segments/SegmentEditButton.tsx
index 6d422c95b..8c025772b 100644
--- a/src/app/(main)/websites/[websiteId]/segments/SegmentEditButton.tsx
+++ b/src/app/(main)/websites/[websiteId]/segments/SegmentEditButton.tsx
@@ -21,6 +21,7 @@ export function SegmentEditButton({
title={formatMessage(labels.segment)}
variant="quiet"
width="800px"
+ height="calc(100dvh - 40px)"
>
{({ close }) => {
return (