diff --git a/src/app/(main)/profile/LanguageSetting.tsx b/src/app/(main)/profile/LanguageSetting.tsx index efa9168e..86503713 100644 --- a/src/app/(main)/profile/LanguageSetting.tsx +++ b/src/app/(main)/profile/LanguageSetting.tsx @@ -1,5 +1,5 @@ import { useState } from 'react'; -import { Button, Dropdown, Item, Flexbox } from '@umami/react-zen'; +import { Button, Select, ListItem, Flexbox } from '@umami/react-zen'; import { useLocale, useMessages } from '@/components/hooks'; import { DEFAULT_LOCALE } from '@/lib/constants'; import { languages } from '@/lib/lang'; @@ -20,22 +20,19 @@ export function LanguageSetting() { const handleReset = () => saveLocale(DEFAULT_LOCALE); - const renderValue = (value: string | number) => languages?.[value]?.label; - return ( - saveLocale(val as string)} allowSearch={true} onSearch={setSearch} menuProps={{ className: styles.menu }} > - {item => {languages[item].label}} - - + {item => {languages[item].label}} + + ); } diff --git a/src/app/(main)/profile/TimezoneSetting.tsx b/src/app/(main)/profile/TimezoneSetting.tsx index c5dd851d..6a7e861d 100644 --- a/src/app/(main)/profile/TimezoneSetting.tsx +++ b/src/app/(main)/profile/TimezoneSetting.tsx @@ -1,5 +1,5 @@ import { useState } from 'react'; -import { Dropdown, Item, Button, Flexbox } from '@umami/react-zen'; +import { Row, Select, ListItem, Button } from '@umami/react-zen'; import { useTimezone, useMessages } from '@/components/hooks'; import { getTimezone } from '@/lib/date'; import styles from './TimezoneSetting.module.css'; @@ -17,19 +17,22 @@ export function TimezoneSetting() { const handleReset = () => saveTimezone(getTimezone()); return ( - - + + + ); } diff --git a/src/app/(main)/reports/[reportId]/FieldParameters.tsx b/src/app/(main)/reports/[reportId]/FieldParameters.tsx index 9c1ed938..024f8c65 100644 --- a/src/app/(main)/reports/[reportId]/FieldParameters.tsx +++ b/src/app/(main)/reports/[reportId]/FieldParameters.tsx @@ -1,7 +1,7 @@ import { useFields, useMessages } from '@/components/hooks'; import { Icons } from '@/components/icons'; import { useContext } from 'react'; -import { Button, FormRow, Icon, Popup, PopupTrigger } from '@umami/react-zen'; +import { Button, Row, Label, Icon, Popover, MenuTrigger } from '@umami/react-zen'; import { FieldSelectForm } from '../[reportId]/FieldSelectForm'; import { ParameterList } from '../[reportId]/ParameterList'; import { PopupForm } from '../[reportId]/PopupForm'; @@ -26,27 +26,26 @@ export function FieldParameters() { const AddButton = () => { return ( - + - - - !fields.find(f => f.name === name))} - onSelect={handleAdd} - showType={false} - /> - - - + + !fields.find(f => f.name === name))} + onSelect={handleAdd} + showType={false} + /> + + ); }; return ( - }> + + {fields.map(({ name }) => { return ( @@ -56,6 +55,7 @@ export function FieldParameters() { ); })} - + + ); } diff --git a/src/app/(main)/reports/[reportId]/FilterParameters.tsx b/src/app/(main)/reports/[reportId]/FilterParameters.tsx index 39f15d82..0c546c29 100644 --- a/src/app/(main)/reports/[reportId]/FilterParameters.tsx +++ b/src/app/(main)/reports/[reportId]/FilterParameters.tsx @@ -1,7 +1,7 @@ import { useContext } from 'react'; import { useMessages, useFormat, useFilters, useFields } from '@/components/hooks'; import { Icons } from '@/components/icons'; -import { Button, FormRow, Icon, Popup, PopupTrigger } from '@umami/react-zen'; +import { Button, Text, Row, Label, Icon, Popover, MenuTrigger } from '@umami/react-zen'; import { FilterSelectForm } from '../[reportId]/FilterSelectForm'; import { ParameterList } from '../[reportId]/ParameterList'; import { PopupForm } from '../[reportId]/PopupForm'; @@ -44,13 +44,13 @@ export function FilterParameters() { const AddButton = () => { return ( - + - + - - + + ); }; return ( - }> + <> + + + + {filters.map( ({ name, operator, value }: { name: string; operator: string; value: string }) => { @@ -90,7 +94,7 @@ export function FilterParameters() { }, )} - + ); } @@ -108,29 +112,27 @@ const FilterParameter = ({ const { operatorLabels } = useFilters(); return ( - +
{label}
{operatorLabels[operator]}
{value}
- + {(close: any) => ( - - - + )} - -
+ + ); }; diff --git a/src/app/(main)/reports/[reportId]/ReportMenu.tsx b/src/app/(main)/reports/[reportId]/ReportMenu.tsx index 2e5c5f24..22846d2a 100644 --- a/src/app/(main)/reports/[reportId]/ReportMenu.tsx +++ b/src/app/(main)/reports/[reportId]/ReportMenu.tsx @@ -1,8 +1,8 @@ import { useContext, useState } from 'react'; -import { ReportContext } from './Report'; -import styles from './ReportMenu.module.css'; import { Icon, Icons } from '@umami/react-zen'; import classNames from 'classnames'; +import { ReportContext } from './Report'; +import styles from './ReportMenu.module.css'; export function ReportMenu({ children }) { const [collapsed, setCollapsed] = useState(false); @@ -16,7 +16,7 @@ export function ReportMenu({ children }) {
setCollapsed(!collapsed)}> - +
{!collapsed && children} diff --git a/src/app/(main)/reports/funnel/FunnelStepAddForm.tsx b/src/app/(main)/reports/funnel/FunnelStepAddForm.tsx index 067adb6e..8069dc0f 100644 --- a/src/app/(main)/reports/funnel/FunnelStepAddForm.tsx +++ b/src/app/(main)/reports/funnel/FunnelStepAddForm.tsx @@ -1,6 +1,15 @@ import { useState } from 'react'; import { useMessages } from '@/components/hooks'; -import { Button, FormRow, TextField, Flexbox, Dropdown, Item } from '@umami/react-zen'; +import { + Button, + Column, + Row, + TextField, + Label, + Select, + ListItem, + FormButtons, +} from '@umami/react-zen'; import styles from './FunnelStepAddForm.module.css'; export interface FunnelStepAddFormProps { @@ -39,40 +48,34 @@ export function FunnelStepAddForm({ } }; - const renderTypeValue = (value: any) => { - return items.find(item => item.value === value)?.label; - }; - return ( - - - - setType(value)} - > - {({ value, label }) => { - return {label}; - }} - - - - - - - - + + ); } diff --git a/src/app/(main)/reports/goals/GoalsAddForm.tsx b/src/app/(main)/reports/goals/GoalsAddForm.tsx index cdeb526c..507e639e 100644 --- a/src/app/(main)/reports/goals/GoalsAddForm.tsx +++ b/src/app/(main)/reports/goals/GoalsAddForm.tsx @@ -1,6 +1,15 @@ import { useMessages } from '@/components/hooks'; import { useState } from 'react'; -import { Button, Dropdown, Flexbox, FormRow, Item, TextField } from '@umami/react-zen'; +import { + Button, + Row, + Column, + Select, + Label, + ListItem, + TextField, + FormButtons, +} from '@umami/react-zen'; import styles from './GoalsAddForm.module.css'; export function GoalsAddForm({ @@ -71,44 +80,43 @@ export function GoalsAddForm({ }; return ( - - - - setType(value)} - > - {({ value, label }) => { - return {label}; - }} - - handleChange(e, setValue)} - autoFocus={true} - autoComplete="off" - onKeyDown={handleKeyDown} - /> - - + + + + + handleChange(e, setValue)} + autoFocus={true} + autoComplete="off" + onKeyDown={handleKeyDown} + /> + {type === 'event-data' && ( - - - + + + - - + + )} - - + + + - - - - - - + + ); } diff --git a/src/app/(main)/reports/goals/GoalsParameters.tsx b/src/app/(main)/reports/goals/GoalsParameters.tsx index d387601f..75ec995a 100644 --- a/src/app/(main)/reports/goals/GoalsParameters.tsx +++ b/src/app/(main)/reports/goals/GoalsParameters.tsx @@ -4,18 +4,17 @@ import { formatNumber } from '@/lib/format'; import { useContext } from 'react'; import { Button, - Flexbox, Form, FormButtons, - FormRow, + FormField, Icon, - Popup, - PopupTrigger, - SubmitButton, + Popover, + MenuTrigger, + FormSubmitButton, + Column, } from '@umami/react-zen'; import { BaseParameters } from '../[reportId]/BaseParameters'; import { ParameterList } from '../[reportId]/ParameterList'; -import { PopupForm } from '../[reportId]/PopupForm'; import { ReportContext } from '../[reportId]/Report'; import { GoalsAddForm } from './GoalsAddForm'; import styles from './GoalsParameters.module.css'; @@ -60,25 +59,24 @@ export function GoalsParameters() { const AddGoalsButton = () => { return ( - + - - - - - - + + + + ); }; return (
- }> + + {goals.map( ( @@ -92,12 +90,12 @@ export function GoalsParameters() { index: number, ) => { return ( - + : } onRemove={() => handleRemoveGoals(index)} > - +
{goal.value}
{goal.type === 'event-data' && (
@@ -107,32 +105,28 @@ export function GoalsParameters() {
{formatMessage(labels.goal)}: {formatNumber(goal.goal)}
- + - - {(close: () => void) => ( - - - - )} - - + + {}, index)} + /> + + ); }, )} - + - + {formatMessage(labels.runQuery)} - + ); diff --git a/src/app/(main)/reports/insights/InsightsParameters.tsx b/src/app/(main)/reports/insights/InsightsParameters.tsx index 4677623c..fbaa9e34 100644 --- a/src/app/(main)/reports/insights/InsightsParameters.tsx +++ b/src/app/(main)/reports/insights/InsightsParameters.tsx @@ -1,6 +1,6 @@ import { useMessages } from '@/components/hooks'; import { useContext } from 'react'; -import { Form, FormButtons, SubmitButton } from '@umami/react-zen'; +import { Form, FormButtons, FormSubmitButton } from '@umami/react-zen'; import { BaseParameters } from '../[reportId]/BaseParameters'; import { ReportContext } from '../[reportId]/Report'; import { FieldParameters } from '../[reportId]/FieldParameters'; @@ -25,9 +25,9 @@ export function InsightsParameters() { {parametersSelected && } {parametersSelected && } - + {formatMessage(labels.runQuery)} - + ); diff --git a/src/app/(main)/reports/insights/InsightsTable.tsx b/src/app/(main)/reports/insights/InsightsTable.tsx index 0e06228a..9095ff9f 100644 --- a/src/app/(main)/reports/insights/InsightsTable.tsx +++ b/src/app/(main)/reports/insights/InsightsTable.tsx @@ -1,5 +1,5 @@ import { useContext, useEffect, useState } from 'react'; -import { GridTable, GridColumn } from '@umami/react-zen'; +import { DataTable, DataColumn } from '@umami/react-zen'; import { useFormat, useMessages } from '@/components/hooks'; import { ReportContext } from '../[reportId]/Report'; import { EmptyPlaceholder } from '@/components/common/EmptyPlaceholder'; @@ -24,50 +24,35 @@ export function InsightsTable() { } return ( - + {fields.map(({ name, label }) => { return ( - + {row => formatValue(row[name], name)} - + ); })} - - {row => row?.views?.toLocaleString()} - - - {row => row?.visits?.toLocaleString()} - - - {row => row?.visitors?.toLocaleString()} - - - {row => { + + {(row: any) => row?.views?.toLocaleString()} + + + {(row: any) => row?.visits?.toLocaleString()} + + + {(row: any) => row?.visitors?.toLocaleString()} + + + {(row: any) => { const n = (Math.min(row?.visits, row?.bounces) / row?.visits) * 100; return Math.round(+n) + '%'; }} - - - {row => { + + + {(row: any) => { const n = row?.totaltime / row?.visits; return `${+n < 0 ? '-' : ''}${formatShortTime(Math.abs(~~n), ['m', 's'], ' ')}`; }} - - + + ); } diff --git a/src/app/(main)/reports/journey/JourneyParameters.tsx b/src/app/(main)/reports/journey/JourneyParameters.tsx index cae2f645..0ee197e9 100644 --- a/src/app/(main)/reports/journey/JourneyParameters.tsx +++ b/src/app/(main)/reports/journey/JourneyParameters.tsx @@ -1,13 +1,12 @@ import { useContext } from 'react'; import { useMessages } from '@/components/hooks'; import { - Dropdown, + Select, Form, FormButtons, - FormInput, - FormRow, - Item, - SubmitButton, + FormField, + ListItem, + FormSubmitButton, TextField, } from '@umami/react-zen'; import { ReportContext } from '../[reportId]/Report'; @@ -33,28 +32,29 @@ export function JourneyParameters() { return (
- - - {item => {item}} - - - - - - - - - - - - + + + + + + + + + - + {formatMessage(labels.runQuery)} - + ); diff --git a/src/app/(main)/reports/retention/RetentionParameters.tsx b/src/app/(main)/reports/retention/RetentionParameters.tsx index 434848b3..0a534741 100644 --- a/src/app/(main)/reports/retention/RetentionParameters.tsx +++ b/src/app/(main)/reports/retention/RetentionParameters.tsx @@ -11,7 +11,6 @@ export function RetentionParameters() { const { id, parameters } = report || {}; const { websiteId, dateRange } = parameters || {}; - const { startDate } = dateRange || {}; const queryDisabled = !websiteId || !dateRange; const handleSubmit = (data: any, e: any) => { diff --git a/src/app/(main)/reports/revenue/RevenueParameters.tsx b/src/app/(main)/reports/revenue/RevenueParameters.tsx index d75caa0c..cf23b00e 100644 --- a/src/app/(main)/reports/revenue/RevenueParameters.tsx +++ b/src/app/(main)/reports/revenue/RevenueParameters.tsx @@ -1,15 +1,7 @@ import { useMessages } from '@/components/hooks'; import { useRevenueValues } from '@/components/hooks/queries/useRevenueValues'; import { useContext } from 'react'; -import { - Dropdown, - Form, - FormButtons, - FormInput, - FormRow, - Item, - SubmitButton, -} from '@umami/react-zen'; +import { Select, Form, FormButtons, FormField, ListItem, FormSubmitButton } from '@umami/react-zen'; import { BaseParameters } from '../[reportId]/BaseParameters'; import { ReportContext } from '../[reportId]/Report'; @@ -35,17 +27,20 @@ export function RevenueParameters() { return (
- - - item.currency)}> - {item => {item}} - - - + + + + - + {formatMessage(labels.runQuery)} - + ); diff --git a/src/components/input/WebsiteSelect.tsx b/src/components/input/WebsiteSelect.tsx index 453fd6ce..31338fe3 100644 --- a/src/components/input/WebsiteSelect.tsx +++ b/src/components/input/WebsiteSelect.tsx @@ -1,8 +1,7 @@ import { useState, Key } from 'react'; -import { Dropdown, Item } from '@umami/react-zen'; +import { Select, ListItem } from '@umami/react-zen'; import { useWebsite, useWebsites, useMessages } from '@/components/hooks'; import { Empty } from '@/components/common/Empty'; -import styles from './WebsiteSelect.module.css'; export function WebsiteSelect({ websiteId, @@ -21,10 +20,6 @@ export function WebsiteSelect({ const queryResult = useWebsites({ teamId }, { search, pageSize: 5 }); - const renderValue = () => { - return website?.name; - }; - const renderEmpty = () => { return ; }; @@ -39,20 +34,16 @@ export function WebsiteSelect({ }; return ( - - {({ id, name }) => {name}} - + {({ id, name }: any) => {name}} + ); }