Add DialogTrigger to overflow menus
Some checks are pending
Node.js CI / build (postgresql, 18.18, 10) (push) Waiting to run

This commit is contained in:
Francis Cao 2025-10-29 12:38:52 -07:00
parent 72fba187db
commit f073fb1996
5 changed files with 26 additions and 24 deletions

View file

@ -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 { Panel } from '@/components/common/Panel';
import { Breakdown } from './Breakdown';
import { WebsiteControls } from '@/app/(main)/websites/[websiteId]/WebsiteControls';
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';
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>
);
};

View file

@ -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} />;

View file

@ -21,7 +21,7 @@ export function CohortEditButton({
variant="quiet"
title={formatMessage(labels.cohort)}
width="800px"
minHeight="300px"
height="calc(100dvh - 40px)"
>
{({ close }) => {
return (

View file

@ -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} />;

View file

@ -21,6 +21,7 @@ export function SegmentEditButton({
title={formatMessage(labels.segment)}
variant="quiet"
width="800px"
height="calc(100dvh - 40px)"
>
{({ close }) => {
return (