Goal/Funnel mobile friendly changes. Polish event-data filters UI/UX

This commit is contained in:
Francis Cao committed 2026-03-28 10:28:59 -07:00
1 parent 35680918c0
commit 09e5196ea3
12 files changed
+472 -343

No files matched your search

+26 -7
View File
@@ -18,6 +18,8 @@ export interface DialogButtonProps extends Omit<ButtonProps, 'children'> {
height?: string;
minWidth?: string;
minHeight?: string;
isOpen?: boolean;
onOpenChange?: (isOpen: boolean) => void;
children?: DialogProps['children'];
}
@@ -29,6 +31,8 @@ export function DialogButton({
height,
minWidth,
minHeight,
isOpen,
onOpenChange,
children,
...props
}: DialogButtonProps) {
@@ -39,29 +43,44 @@ export function DialogButton({
minWidth,
minHeight,
maxHeight: 'calc(100dvh - 40px)',
overflowY: 'auto',
padding: '32px',
};
if (isMobile) {
style.width = '100%';
style.height = '100%';
style.minWidth = undefined;
style.minHeight = undefined;
style.maxHeight = '100%';
style.overflowY = 'auto';
}
const dialog = (
<Dialog
variant={isMobile ? 'sheet' : undefined}
title={title === undefined ? label : title}
style={style}
>
{children}
</Dialog>
);
if (isOpen !== undefined) {
return (
<Modal isOpen={isOpen} onOpenChange={onOpenChange} isDismissable placement={isMobile ? 'fullscreen' : 'center'}>
{dialog}
</Modal>
);
}
return (
<DialogTrigger>
<Button {...props}>
<IconLabel icon={icon} label={label} />
</Button>
<Modal placement={isMobile ? 'fullscreen' : 'center'}>
<Dialog
variant={isMobile ? 'sheet' : undefined}
title={title === undefined ? label : title}
style={style}
>
{children}
</Dialog>
{dialog}
</Modal>
</DialogTrigger>
);
+1 -1
View File
@@ -112,7 +112,7 @@ export function FilterEditForm({ websiteId, onChange, onClose }: FilterEditFormP
</TabPanel>
</Tabs>
</Column>
<Row alignItems="center" justifyContent="space-between" gap>
<Row alignItems="center" justifyContent="space-between" gap style={isMobile ? { paddingBottom: '16px' } : undefined}>
<Button onPress={handleReset}>{t(labels.reset)}</Button>
<Row alignItems="center" justifyContent="flex-end" gridColumn="span 2" gap>
<Button onPress={onClose}>{t(labels.cancel)}</Button>
+11 -8
View File
@@ -1,22 +1,25 @@
import { Empty } from '@/components/common/Empty';
import { useMessages, useWebsiteValuesQuery } from '@/components/hooks';
import { ComboBox, type ComboBoxProps, ListItem, Loading, useDebounce } from '@umami/react-zen';
import { endOfDay, subMonths } from 'date-fns';
import { type SetStateAction, useMemo, useState } from 'react';
import { Empty } from '@/components/common/Empty';
import { useMessages, useWebsiteValuesQuery } from '@/components/hooks';
export interface LookupFieldProps extends ComboBoxProps {
export interface LookupFieldProps extends Omit<ComboBoxProps, 'onChange'> {
websiteId: string;
type: string;
value: string;
onChange: (value: string) => void;
/**
* `FormField` injects `onChange` via `cloneElement`, overwriting any custom handler.
* Use `onValueChange` for side effects that must survive that override.
*/
onValueChange?: (value: string) => void;
}
export function LookupField({ websiteId, type, value, onChange, onValueChange, ...props }: LookupFieldProps) {
export function LookupField({
websiteId,
type,
value,
onChange,
onValueChange,
...props
}: LookupFieldProps) {
const { t, messages } = useMessages();
const [search, setSearch] = useState(value);
const searchValue = useDebounce(search, 300);
+31 -12
View File
@@ -14,17 +14,28 @@ import { type ReactNode, useState } from 'react';
import { useMessages } from '@/components/hooks';
import { useDeleteQuery } from '@/components/hooks/queries/useDeleteQuery';
import { Edit, MoreHorizontal, Trash } from '@/components/icons';
import { DialogButton } from './DialogButton';
export function ReportEditButton({
id,
name,
type,
title,
width,
height,
minWidth,
minHeight,
children,
onDelete,
}: {
id: string;
name: string;
type: string;
title?: ReactNode;
width?: string;
height?: string;
minWidth?: string;
minHeight?: string;
onDelete?: () => void;
children: ({ close }: { close: () => void }) => ReactNode;
}) {
@@ -81,18 +92,26 @@ export function ReportEditButton({
</Menu>
</Popover>
</MenuTrigger>
<Modal isOpen={showEdit || showDelete} isDismissable={true}>
{showEdit && children({ close: handleClose })}
{showDelete && (
<AlertDialog
title={t(labels.delete)}
onConfirm={handleDelete}
onCancel={handleClose}
isDanger
>
<Row gap="1">{t(messages.confirmDelete, { target: name })}</Row>
</AlertDialog>
)}
<DialogButton
isOpen={showEdit}
onOpenChange={open => !open && handleClose()}
title={title}
width={width}
height={height}
minWidth={minWidth}
minHeight={minHeight}
>
{children}
</DialogButton>
<Modal isOpen={showDelete} isDismissable={true} onOpenChange={open => !open && handleClose()}>
<AlertDialog
title={t(labels.delete)}
onConfirm={handleDelete}
onCancel={handleClose}
isDanger
>
<Row gap="1">{t(messages.confirmDelete, { target: name })}</Row>
</AlertDialog>
</Modal>
</>
);