Upgrade react-zen and migrate UI components to its updated APIs
This commit is contained in:
1 parent
f054830292
commit
6ac2b9377c
83 files changed
+1337
-506
No files matched your search
+26
-19
@@ -110,27 +110,34 @@ export function SideNav(props: any) {
|
||||
<Column gap="2">
|
||||
{links.map(({ id, path, label, icon }) => {
|
||||
const isSelected = pathname.startsWith(renderUrl(path, false));
|
||||
const content = (
|
||||
<Focusable>
|
||||
<Row
|
||||
alignItems="center"
|
||||
hover={{ backgroundColor: 'surface-sunken' }}
|
||||
backgroundColor={isSelected ? 'surface-sunken' : undefined}
|
||||
borderRadius
|
||||
minHeight="40px"
|
||||
>
|
||||
<IconLabel
|
||||
icon={icon}
|
||||
label={isCollapsed ? '' : label}
|
||||
weight={isSelected ? 'bold' : undefined}
|
||||
padding
|
||||
/>
|
||||
</Row>
|
||||
</Focusable>
|
||||
);
|
||||
return (
|
||||
<Link key={id} href={renderUrl(path, false)} role="button">
|
||||
<TooltipTrigger isDisabled={!isCollapsed} delay={0}>
|
||||
<Focusable>
|
||||
<Row
|
||||
alignItems="center"
|
||||
hover={{ backgroundColor: 'surface-sunken' }}
|
||||
backgroundColor={isSelected ? 'surface-sunken' : undefined}
|
||||
borderRadius
|
||||
minHeight="40px"
|
||||
>
|
||||
<IconLabel
|
||||
icon={icon}
|
||||
label={isCollapsed ? '' : label}
|
||||
weight={isSelected ? 'bold' : undefined}
|
||||
padding
|
||||
/>
|
||||
</Row>
|
||||
</Focusable>
|
||||
<Tooltip placement="right">{label}</Tooltip>
|
||||
</TooltipTrigger>
|
||||
{isCollapsed ? (
|
||||
<TooltipTrigger delay={0}>
|
||||
{content}
|
||||
<Tooltip placement="right">{label}</Tooltip>
|
||||
</TooltipTrigger>
|
||||
) : (
|
||||
content
|
||||
)}
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -11,19 +11,19 @@ import { WebsiteSelect } from '@/components/input/WebsiteSelect';
|
||||
export function TopNav() {
|
||||
const { websiteId, linkId, pixelId, boardId, teamId, router, renderUrl } = useNavigation();
|
||||
|
||||
const handleWebsiteChange = (value: string) => {
|
||||
const handleWebsiteChange = (value: string | number | null) => {
|
||||
router.push(renderUrl(`/websites/${value}`, false));
|
||||
};
|
||||
|
||||
const handleLinkChange = (value: string) => {
|
||||
const handleLinkChange = (value: string | number | null) => {
|
||||
router.push(renderUrl(`/links/${value}`, false));
|
||||
};
|
||||
|
||||
const handlePixelChange = (value: string) => {
|
||||
const handlePixelChange = (value: string | number | null) => {
|
||||
router.push(renderUrl(`/pixels/${value}`, false));
|
||||
};
|
||||
|
||||
const handleBoardChange = (value: string) => {
|
||||
const handleBoardChange = (value: string | number | null) => {
|
||||
router.push(renderUrl(`/boards/${value}`, false));
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { AlertBanner, Button, Column, Row } from '@umami/react-zen';
|
||||
import { Alert, AlertTitle, Button, Column, Row } from '@umami/react-zen';
|
||||
import { usePathname } from 'next/navigation';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import { useMessages } from '@/components/hooks';
|
||||
@@ -49,12 +49,15 @@ export function UpdateNotice({ user, config }) {
|
||||
return (
|
||||
<Column justifyContent="center" alignItems="center" position="fixed" top="10px" width="100%">
|
||||
<Row width="600px">
|
||||
<AlertBanner title={t(messages.newVersionAvailable, { version: `v${latest}` })}>
|
||||
<Button variant="primary" onPress={handleViewClick}>
|
||||
{t(labels.viewDetails)}
|
||||
</Button>
|
||||
<Button onPress={handleDismissClick}>{t(labels.dismiss)}</Button>
|
||||
</AlertBanner>
|
||||
<Alert style={{ width: '100%' }}>
|
||||
<AlertTitle>{t(messages.newVersionAvailable, { version: `v${latest}` })}</AlertTitle>
|
||||
<Row gap="3" paddingTop="2">
|
||||
<Button variant="primary" onPress={handleViewClick}>
|
||||
{t(labels.viewDetails)}
|
||||
</Button>
|
||||
<Button onPress={handleDismissClick}>{t(labels.dismiss)}</Button>
|
||||
</Row>
|
||||
</Alert>
|
||||
</Row>
|
||||
</Column>
|
||||
);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { DataColumn, DataTable, Dialog, Icon, MenuItem, Modal, Row, Text } from '@umami/react-zen';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { useState } from 'react';
|
||||
import { DateDistance } from '@/components/common/DateDistance';
|
||||
import Link from '@/components/common/Link';
|
||||
@@ -17,6 +18,7 @@ export function AdminTeamsTable({
|
||||
showActions?: boolean;
|
||||
}) {
|
||||
const { t, labels } = useMessages();
|
||||
const router = useRouter();
|
||||
const [deleteTeam, setDeleteTeam] = useState(null);
|
||||
|
||||
return (
|
||||
@@ -62,7 +64,10 @@ export function AdminTeamsTable({
|
||||
|
||||
return (
|
||||
<MenuButton>
|
||||
<MenuItem href={`/admin/teams/${id}`} data-test="link-button-edit">
|
||||
<MenuItem
|
||||
onAction={() => router.push(`/admin/teams/${id}`)}
|
||||
data-test="link-button-edit"
|
||||
>
|
||||
<Row alignItems="center" gap>
|
||||
<Icon>
|
||||
<Edit />
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { DataColumn, DataTable, Icon, MenuItem, Modal, Row, Text } from '@umami/react-zen';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { useState } from 'react';
|
||||
import { DateDistance } from '@/components/common/DateDistance';
|
||||
import Link from '@/components/common/Link';
|
||||
@@ -18,6 +19,7 @@ export function UsersTable({
|
||||
showActions?: boolean;
|
||||
}) {
|
||||
const { t, labels } = useMessages();
|
||||
const router = useRouter();
|
||||
const [deleteUser, setDeleteUser] = useState(null);
|
||||
|
||||
return (
|
||||
@@ -53,7 +55,10 @@ export function UsersTable({
|
||||
|
||||
return (
|
||||
<MenuButton>
|
||||
<MenuItem href={`/admin/users/${id}`} data-test="link-button-edit">
|
||||
<MenuItem
|
||||
onAction={() => router.push(`/admin/users/${id}`)}
|
||||
data-test="link-button-edit"
|
||||
>
|
||||
<Row alignItems="center" gap>
|
||||
<Icon>
|
||||
<Edit />
|
||||
|
||||
@@ -1,17 +1,27 @@
|
||||
'use client';
|
||||
import { Button, Column, Dialog, Modal, Row, Switch, Text, Tooltip, TooltipTrigger } from '@umami/react-zen';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
import {
|
||||
Button,
|
||||
Column,
|
||||
Dialog,
|
||||
Modal,
|
||||
Row,
|
||||
Switch,
|
||||
Text,
|
||||
Tooltip,
|
||||
TooltipTrigger,
|
||||
} from '@umami/react-zen';
|
||||
import { useState } from 'react';
|
||||
import { Badge } from '@/components/common/Badge';
|
||||
import { TypeConfirmationForm } from '@/components/common/TypeConfirmationForm';
|
||||
import {
|
||||
useDeleteQuery,
|
||||
useMessages,
|
||||
useUpdateQuery,
|
||||
useTwoFactorStatusQuery,
|
||||
useUserQuery,
|
||||
useTwoFactorUserStatusQuery,
|
||||
useUpdateQuery,
|
||||
useUserQuery,
|
||||
} from '@/components/hooks';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
|
||||
const CONFIRM_VALUE = 'RESET';
|
||||
|
||||
@@ -27,9 +37,11 @@ export function UserTwoFactorSettings({ userId }: { userId: string }) {
|
||||
const { data: userData } = useUserQuery(userId);
|
||||
|
||||
const { mutateAsync: setUserRequired } = useUpdateQuery(`/admin/users/${userId}/2fa`);
|
||||
const { mutateAsync: resetUserTwoFactor, isPending: isResetting, error: resetError } = useDeleteQuery(
|
||||
`/admin/users/${userId}/2fa`,
|
||||
);
|
||||
const {
|
||||
mutateAsync: resetUserTwoFactor,
|
||||
isPending: isResetting,
|
||||
error: resetError,
|
||||
} = useDeleteQuery(`/admin/users/${userId}/2fa`);
|
||||
|
||||
const twoFactorEnabled = !!(userTfaData as any)?.isEnabled;
|
||||
const twoFactorRequired = !!(userData as any)?.twoFactorRequired;
|
||||
@@ -62,7 +74,19 @@ export function UserTwoFactorSettings({ userId }: { userId: string }) {
|
||||
{t(messages.twoFactorRequireUserDescription)}
|
||||
</Text>
|
||||
|
||||
<TooltipTrigger isDisabled={!isGlobalRequired}>
|
||||
{isGlobalRequired ? (
|
||||
<TooltipTrigger>
|
||||
<Row alignItems="center" gap="3">
|
||||
<Switch
|
||||
isSelected={isGlobalRequired || twoFactorRequired}
|
||||
isDisabled={isGlobalRequired}
|
||||
onChange={handleToggle}
|
||||
/>
|
||||
<Text>{t(labels.twoFactorRequireUser)}</Text>
|
||||
</Row>
|
||||
<Tooltip>{t(labels.twoFactorGlobalActiveTooltip)}</Tooltip>
|
||||
</TooltipTrigger>
|
||||
) : (
|
||||
<Row alignItems="center" gap="3">
|
||||
<Switch
|
||||
isSelected={isGlobalRequired || twoFactorRequired}
|
||||
@@ -71,8 +95,7 @@ export function UserTwoFactorSettings({ userId }: { userId: string }) {
|
||||
/>
|
||||
<Text>{t(labels.twoFactorRequireUser)}</Text>
|
||||
</Row>
|
||||
<Tooltip>{t(labels.twoFactorGlobalActiveTooltip)}</Tooltip>
|
||||
</TooltipTrigger>
|
||||
)}
|
||||
|
||||
{twoFactorEnabled && (
|
||||
<Column gap="3">
|
||||
@@ -89,7 +112,7 @@ export function UserTwoFactorSettings({ userId }: { userId: string }) {
|
||||
)}
|
||||
</Column>
|
||||
|
||||
<Modal isOpen={showReset} isDismissable={true} onOpenChange={open => !open && setShowReset(false)}>
|
||||
<Modal isOpen={showReset} onOpenChange={open => !open && setShowReset(false)}>
|
||||
<Dialog title={t(labels.twoFactorReset)} style={{ width: 400 }}>
|
||||
<TypeConfirmationForm
|
||||
confirmationValue={CONFIRM_VALUE}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { DataColumn, DataTable, Dialog, Icon, MenuItem, Modal, Row, Text } from '@umami/react-zen';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { useState } from 'react';
|
||||
import { WebsiteDeleteForm } from '@/app/(main)/websites/[websiteId]/settings/WebsiteDeleteForm';
|
||||
import { DateDistance } from '@/components/common/DateDistance';
|
||||
@@ -11,6 +12,7 @@ import { decodePunycodeDomain } from '@/lib/format';
|
||||
|
||||
export function AdminWebsitesTable({ data = [], ...props }: { data: any[] }) {
|
||||
const { t, labels } = useMessages();
|
||||
const router = useRouter();
|
||||
const [deleteWebsite, setDeleteWebsite] = useState(null);
|
||||
|
||||
return (
|
||||
@@ -62,7 +64,10 @@ export function AdminWebsitesTable({ data = [], ...props }: { data: any[] }) {
|
||||
|
||||
return (
|
||||
<MenuButton>
|
||||
<MenuItem href={`/admin/websites/${id}`} data-test="link-button-edit">
|
||||
<MenuItem
|
||||
onAction={() => router.push(`/admin/websites/${id}`)}
|
||||
data-test="link-button-edit"
|
||||
>
|
||||
<Row alignItems="center" gap>
|
||||
<Icon>
|
||||
<Edit />
|
||||
|
||||
@@ -53,7 +53,9 @@ export function BoardCloneForm({
|
||||
}) {
|
||||
const { t, labels, messages, getErrorMessage } = useMessages();
|
||||
const { data: board, isLoading } = useBoardQuery(boardId);
|
||||
const { mutateAsync, error, isPending, touch, toast } = useUpdateQuery(`/boards/${boardId}/clone`);
|
||||
const { mutateAsync, error, isPending, touch, toast } = useUpdateQuery(
|
||||
`/boards/${boardId}/clone`,
|
||||
);
|
||||
const values = getDefaultValues(board);
|
||||
const boardType = getBoardType(board, { coerceDashboard: true });
|
||||
const resolvedTeamId = board?.teamId;
|
||||
@@ -95,8 +97,8 @@ export function BoardCloneForm({
|
||||
? t(labels.link)
|
||||
: t(labels.website);
|
||||
|
||||
const handleEntityChange = (value: string) => {
|
||||
setValue('entityId', value, { shouldDirty: true });
|
||||
const handleEntityChange = (value: string | number | null) => {
|
||||
setValue('entityId', (value as string) ?? '', { shouldDirty: true });
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -107,13 +107,13 @@ export function BoardEditForm({
|
||||
? t(labels.link)
|
||||
: t(labels.website);
|
||||
|
||||
const handleTypeChange = (value: string) => {
|
||||
const handleTypeChange = (value: string | number | null) => {
|
||||
setValue('type', value as BoardType, { shouldDirty: true });
|
||||
setValue('entityId', '', { shouldDirty: true });
|
||||
};
|
||||
|
||||
const handleEntityChange = (value: string) => {
|
||||
setValue('entityId', value, { shouldDirty: true });
|
||||
const handleEntityChange = (value: string | number | null) => {
|
||||
setValue('entityId', (value as string) ?? '', { shouldDirty: true });
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -97,7 +97,10 @@ export function BoardComponentSelect({
|
||||
const options = (entityType && field.optionsByEntityType?.[entityType]) ?? field.options;
|
||||
const currentValue = defaults[field.name];
|
||||
|
||||
if (options?.length && !options.some(option => String(option.value) === String(currentValue))) {
|
||||
if (
|
||||
options?.length &&
|
||||
!options.some(option => String(option.value) === String(currentValue))
|
||||
) {
|
||||
defaults[field.name] = options[0].value;
|
||||
}
|
||||
}
|
||||
@@ -308,7 +311,10 @@ export function BoardComponentSelect({
|
||||
<Text size="sm" color="muted">
|
||||
{t(labels.type)}
|
||||
</Text>
|
||||
<Select value={selectedEntityType} onChange={handleEntityTypeChange}>
|
||||
<Select
|
||||
value={selectedEntityType}
|
||||
onChange={value => handleEntityTypeChange(value as string)}
|
||||
>
|
||||
<ListItem id={BOARD_ENTITY_TYPES.website}>{t(labels.website)}</ListItem>
|
||||
<ListItem id={BOARD_ENTITY_TYPES.pixel}>{t(labels.pixel)}</ListItem>
|
||||
<ListItem id={BOARD_ENTITY_TYPES.link}>{t(labels.link)}</ListItem>
|
||||
@@ -327,21 +333,21 @@ export function BoardComponentSelect({
|
||||
pixelId={selectedEntityId}
|
||||
teamId={teamId}
|
||||
placeholder={t(labels.selectPixel)}
|
||||
onChange={setSelectedEntityId}
|
||||
onChange={value => setSelectedEntityId(value as string)}
|
||||
/>
|
||||
) : selectedEntityType === BOARD_ENTITY_TYPES.link ? (
|
||||
<LinkSelect
|
||||
linkId={selectedEntityId}
|
||||
teamId={teamId}
|
||||
placeholder={t(labels.selectLink)}
|
||||
onChange={setSelectedEntityId}
|
||||
onChange={value => setSelectedEntityId(value as string)}
|
||||
/>
|
||||
) : (
|
||||
<WebsiteSelect
|
||||
websiteId={selectedEntityId}
|
||||
teamId={teamId}
|
||||
placeholder={t(labels.selectWebsite)}
|
||||
onChange={setSelectedEntityId}
|
||||
onChange={value => setSelectedEntityId(value as string)}
|
||||
/>
|
||||
)}
|
||||
</Column>
|
||||
@@ -373,7 +379,7 @@ export function BoardComponentSelect({
|
||||
{field.type === 'select' && (
|
||||
<Select
|
||||
value={String(configValues[field.name] ?? field.defaultValue ?? '')}
|
||||
onChange={(value: string) => handleConfigChange(field.name, value)}
|
||||
onChange={value => handleConfigChange(field.name, value as string)}
|
||||
maxHeight={300}
|
||||
popoverProps={{ style: { width: 220 } }}
|
||||
>
|
||||
@@ -415,7 +421,7 @@ export function BoardComponentSelect({
|
||||
<>
|
||||
<Select
|
||||
value={String(configValues[field.name] ?? field.defaultValue ?? '')}
|
||||
onChange={(value: string) => handleConfigChange(field.name, value)}
|
||||
onChange={value => handleConfigChange(field.name, value as string)}
|
||||
maxHeight={300}
|
||||
popoverProps={{ style: { width: 220 } }}
|
||||
>
|
||||
|
||||
@@ -58,19 +58,29 @@ export function SettingsNav({
|
||||
return (
|
||||
<Column gap="2">
|
||||
<Link href={renderUrl('/websites', false)} role="button" onClick={onItemClick}>
|
||||
<TooltipTrigger isDisabled={!isCollapsed} delay={0}>
|
||||
<Focusable>
|
||||
<Row
|
||||
alignItems="center"
|
||||
hover={{ backgroundColor: 'surface-sunken' }}
|
||||
borderRadius
|
||||
minHeight="40px"
|
||||
>
|
||||
<IconLabel icon={<ArrowLeft />} label={isCollapsed ? '' : t(labels.back)} padding />
|
||||
</Row>
|
||||
</Focusable>
|
||||
<Tooltip placement="right">{t(labels.back)}</Tooltip>
|
||||
</TooltipTrigger>
|
||||
{(() => {
|
||||
const content = (
|
||||
<Focusable>
|
||||
<Row
|
||||
alignItems="center"
|
||||
hover={{ backgroundColor: 'surface-sunken' }}
|
||||
borderRadius
|
||||
minHeight="40px"
|
||||
>
|
||||
<IconLabel icon={<ArrowLeft />} label={isCollapsed ? '' : t(labels.back)} padding />
|
||||
</Row>
|
||||
</Focusable>
|
||||
);
|
||||
|
||||
return isCollapsed ? (
|
||||
<TooltipTrigger delay={0}>
|
||||
{content}
|
||||
<Tooltip placement="right">{t(labels.back)}</Tooltip>
|
||||
</TooltipTrigger>
|
||||
) : (
|
||||
content
|
||||
);
|
||||
})()}
|
||||
</Link>
|
||||
{items.map(({ label: sectionLabel, items: sectionItems }, index) => (
|
||||
<Column key={`${sectionLabel}${index}`} gap="1" marginBottom="1">
|
||||
@@ -81,27 +91,34 @@ export function SettingsNav({
|
||||
)}
|
||||
{sectionItems.map(({ id, path, label, icon }) => {
|
||||
const isSelected = selectedKey === id;
|
||||
const content = (
|
||||
<Focusable>
|
||||
<Row
|
||||
alignItems="center"
|
||||
hover={{ backgroundColor: 'surface-sunken' }}
|
||||
backgroundColor={isSelected ? 'surface-sunken' : undefined}
|
||||
borderRadius
|
||||
minHeight="40px"
|
||||
>
|
||||
<IconLabel
|
||||
icon={icon}
|
||||
label={isCollapsed ? '' : label}
|
||||
weight={isSelected ? 'bold' : undefined}
|
||||
padding
|
||||
/>
|
||||
</Row>
|
||||
</Focusable>
|
||||
);
|
||||
return (
|
||||
<Link key={id} href={path} role="button" onClick={onItemClick}>
|
||||
<TooltipTrigger isDisabled={!isCollapsed} delay={0}>
|
||||
<Focusable>
|
||||
<Row
|
||||
alignItems="center"
|
||||
hover={{ backgroundColor: 'surface-sunken' }}
|
||||
backgroundColor={isSelected ? 'surface-sunken' : undefined}
|
||||
borderRadius
|
||||
minHeight="40px"
|
||||
>
|
||||
<IconLabel
|
||||
icon={icon}
|
||||
label={isCollapsed ? '' : label}
|
||||
weight={isSelected ? 'bold' : undefined}
|
||||
padding
|
||||
/>
|
||||
</Row>
|
||||
</Focusable>
|
||||
<Tooltip placement="right">{label}</Tooltip>
|
||||
</TooltipTrigger>
|
||||
{isCollapsed ? (
|
||||
<TooltipTrigger delay={0}>
|
||||
{content}
|
||||
<Tooltip placement="right">{label}</Tooltip>
|
||||
</TooltipTrigger>
|
||||
) : (
|
||||
content
|
||||
)}
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -24,8 +24,7 @@ export function DateRangeSetting() {
|
||||
<DateFilter
|
||||
value={date}
|
||||
onChange={handleChange}
|
||||
placement="bottom start"
|
||||
style={{ minWidth: '250px' }}
|
||||
buttonProps={{ style: { minWidth: '250px' } }}
|
||||
/>
|
||||
<Button onPress={handleReset}>{t(labels.reset)}</Button>
|
||||
</Row>
|
||||
|
||||
@@ -34,7 +34,7 @@ export function LanguageSetting() {
|
||||
onSearch={setSearch}
|
||||
onOpenChange={handleOpen}
|
||||
maxHeight={480}
|
||||
style={{ minWidth: '250px' }}
|
||||
buttonProps={{ style: { minWidth: '250px' } }}
|
||||
>
|
||||
{items.map(item => (
|
||||
<ListItem key={item} id={item}>
|
||||
|
||||
@@ -30,7 +30,7 @@ export function TimezoneSetting() {
|
||||
onSearch={setSearch}
|
||||
onOpenChange={handleOpen}
|
||||
maxHeight={480}
|
||||
style={{ minWidth: '250px' }}
|
||||
buttonProps={{ style: { minWidth: '250px' } }}
|
||||
>
|
||||
{items.map((item: any) => (
|
||||
<ListItem key={item} id={item}>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
'use client';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
import { Column, Row, Switch, Text, Tooltip, TooltipTrigger } from '@umami/react-zen';
|
||||
import { useState } from 'react';
|
||||
import { Badge } from '@/components/common/Badge';
|
||||
@@ -8,7 +9,6 @@ import { Panel } from '@/components/common/Panel';
|
||||
import { useMessages, useTwoFactorStatusQuery } from '@/components/hooks';
|
||||
import { TwoFactorDisableModal } from '@/components/modals/TwoFactorDisableModal';
|
||||
import { TwoFactorSetupModal } from '@/components/modals/TwoFactorSetupModal';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
|
||||
export function UserSecurityPage() {
|
||||
const { t, labels, messages } = useMessages();
|
||||
@@ -61,7 +61,19 @@ export function UserSecurityPage() {
|
||||
<Text>{t(messages.twoFactorUserDescription)}</Text>
|
||||
)}
|
||||
|
||||
<TooltipTrigger isDisabled={!(isEnabled && isRequired)}>
|
||||
{isEnabled && isRequired ? (
|
||||
<TooltipTrigger>
|
||||
<Row alignItems="center" gap="3">
|
||||
<Switch
|
||||
isSelected={isEnabled}
|
||||
isDisabled={isEnabled && isRequired}
|
||||
onChange={handleToggle}
|
||||
/>
|
||||
<Text>{t(labels.twoFactorEnable)}</Text>
|
||||
</Row>
|
||||
<Tooltip>{t(messages.twoFactorRequiredMessage)}</Tooltip>
|
||||
</TooltipTrigger>
|
||||
) : (
|
||||
<Row alignItems="center" gap="3">
|
||||
<Switch
|
||||
isSelected={isEnabled}
|
||||
@@ -70,8 +82,7 @@ export function UserSecurityPage() {
|
||||
/>
|
||||
<Text>{t(labels.twoFactorEnable)}</Text>
|
||||
</Row>
|
||||
<Tooltip>{t(messages.twoFactorRequiredMessage)}</Tooltip>
|
||||
</TooltipTrigger>
|
||||
)}
|
||||
|
||||
{isEnabled && isRequired && (
|
||||
<Text size="sm" color="muted">
|
||||
|
||||
@@ -68,7 +68,7 @@ export function TeamEditForm({
|
||||
)}
|
||||
{allowEdit && (
|
||||
<FormButtons justifyContent="flex-end">
|
||||
<FormSubmitButton variant="primary" isPending={isPending}>
|
||||
<FormSubmitButton variant="primary" isLoading={isPending}>
|
||||
{t(labels.save)}
|
||||
</FormSubmitButton>
|
||||
</FormButtons>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
'use client';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
import { Column, Row, Switch, Text, Tooltip, TooltipTrigger } from '@umami/react-zen';
|
||||
import {
|
||||
useMessages,
|
||||
useUpdateQuery,
|
||||
useTwoFactorStatusQuery,
|
||||
useTeamQuery,
|
||||
useTwoFactorStatusQuery,
|
||||
useUpdateQuery,
|
||||
} from '@/components/hooks';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
|
||||
export function TeamTwoFactorSettings({ teamId }: { teamId: string }) {
|
||||
const { t, labels, messages } = useMessages();
|
||||
@@ -29,7 +29,19 @@ export function TeamTwoFactorSettings({ teamId }: { teamId: string }) {
|
||||
<Column gap="4">
|
||||
<Text weight="bold">{t(labels.twoFactorAuth)}</Text>
|
||||
|
||||
<TooltipTrigger isDisabled={!isGlobalRequired}>
|
||||
{isGlobalRequired ? (
|
||||
<TooltipTrigger>
|
||||
<Row alignItems="center" gap="3">
|
||||
<Switch
|
||||
isSelected={isGlobalRequired || twoFactorRequired}
|
||||
isDisabled={isGlobalRequired}
|
||||
onChange={handleToggle}
|
||||
/>
|
||||
<Text>{t(labels.twoFactorRequireTeam)}</Text>
|
||||
</Row>
|
||||
<Tooltip>{t(labels.twoFactorGlobalActiveTooltip)}</Tooltip>
|
||||
</TooltipTrigger>
|
||||
) : (
|
||||
<Row alignItems="center" gap="3">
|
||||
<Switch
|
||||
isSelected={isGlobalRequired || twoFactorRequired}
|
||||
@@ -38,8 +50,7 @@ export function TeamTwoFactorSettings({ teamId }: { teamId: string }) {
|
||||
/>
|
||||
<Text>{t(labels.twoFactorRequireTeam)}</Text>
|
||||
</Row>
|
||||
<Tooltip>{t(labels.twoFactorGlobalActiveTooltip)}</Tooltip>
|
||||
</TooltipTrigger>
|
||||
)}
|
||||
|
||||
<Text size="sm" color="muted">
|
||||
{t(messages.twoFactorRequireTeamDescription)}
|
||||
|
||||
@@ -26,14 +26,18 @@ export function Attribution({
|
||||
type,
|
||||
step,
|
||||
}: AttributionProps) {
|
||||
const { data, error, isLoading } = useResultQuery<any>('attribution', {
|
||||
websiteId,
|
||||
startDate,
|
||||
endDate,
|
||||
model,
|
||||
type,
|
||||
step,
|
||||
});
|
||||
const { data, error, isLoading } = useResultQuery<any>(
|
||||
'attribution',
|
||||
{
|
||||
websiteId,
|
||||
startDate,
|
||||
endDate,
|
||||
model,
|
||||
type,
|
||||
step,
|
||||
},
|
||||
{ enabled: !!step },
|
||||
);
|
||||
|
||||
const { t, labels } = useMessages();
|
||||
|
||||
|
||||
@@ -1,53 +1,96 @@
|
||||
'use client';
|
||||
import { Column, Grid, ListItem, SearchField, Select } from '@umami/react-zen';
|
||||
import { Column, Grid, Label, ListItem, Loading, Select } from '@umami/react-zen';
|
||||
import { useState } from 'react';
|
||||
import { WebsiteControls } from '@/app/(main)/websites/[websiteId]/WebsiteControls';
|
||||
import { useDateRange, useMessages } from '@/components/hooks';
|
||||
import { Empty } from '@/components/common/Empty';
|
||||
import { MultiSelect } from '@/components/common/MultiSelect';
|
||||
import { useDateRange, useMessages, useWebsiteValuesQuery } from '@/components/hooks';
|
||||
import { Attribution } from './Attribution';
|
||||
|
||||
export function AttributionPage({ websiteId }: { websiteId: string }) {
|
||||
const [model, setModel] = useState('first-click');
|
||||
const [type, setType] = useState('path');
|
||||
const [step, setStep] = useState('/');
|
||||
const [step, setStep] = useState('');
|
||||
const [search, setSearch] = useState('');
|
||||
const { t, labels } = useMessages();
|
||||
const {
|
||||
dateRange: { startDate, endDate },
|
||||
} = useDateRange();
|
||||
const { data, isLoading } = useWebsiteValuesQuery({
|
||||
websiteId,
|
||||
type,
|
||||
search,
|
||||
startDate,
|
||||
endDate,
|
||||
});
|
||||
const items = data?.filter(({ value }) => value) || [];
|
||||
|
||||
const handleTypeChange = (value: any) => {
|
||||
setType(value as string);
|
||||
setStep('');
|
||||
setSearch('');
|
||||
};
|
||||
|
||||
const handleStepChange = (values: string[]) => {
|
||||
setStep(values.filter(value => value !== step).pop() ?? '');
|
||||
};
|
||||
|
||||
return (
|
||||
<Column gap="6">
|
||||
<WebsiteControls websiteId={websiteId} />
|
||||
<Grid columns={{ base: '1fr', md: '1fr 1fr 1fr' }} gap>
|
||||
<Column>
|
||||
<Select label={t(labels.model)} value={model} defaultValue={model} onChange={setModel}>
|
||||
<Select
|
||||
label={t(labels.model)}
|
||||
value={model}
|
||||
defaultValue={model}
|
||||
onChange={value => setModel(value as string)}
|
||||
>
|
||||
<ListItem id="first-click">{t(labels.firstClick)}</ListItem>
|
||||
<ListItem id="last-click">{t(labels.lastClick)}</ListItem>
|
||||
</Select>
|
||||
</Column>
|
||||
<Column>
|
||||
<Select label={t(labels.type)} value={type} defaultValue={type} onChange={setType}>
|
||||
<Select
|
||||
label={t(labels.type)}
|
||||
value={type}
|
||||
defaultValue={type}
|
||||
onChange={handleTypeChange}
|
||||
>
|
||||
<ListItem id="path">{t(labels.viewedPage)}</ListItem>
|
||||
<ListItem id="event">{t(labels.triggeredEvent)}</ListItem>
|
||||
</Select>
|
||||
</Column>
|
||||
<Column>
|
||||
<SearchField
|
||||
label={t(labels.conversionStep)}
|
||||
value={step}
|
||||
defaultValue={step}
|
||||
onSearch={setStep}
|
||||
delay={1000}
|
||||
/>
|
||||
<Label>{t(labels.conversionStep)}</Label>
|
||||
<MultiSelect
|
||||
value={step ? [step] : []}
|
||||
onChange={handleStepChange}
|
||||
searchValue={search}
|
||||
onSearch={setSearch}
|
||||
renderEmptyState={() => (isLoading ? <Loading icon="dots" /> : <Empty />)}
|
||||
allowSearch
|
||||
>
|
||||
{items.map(({ value }) => (
|
||||
<ListItem key={value} id={value}>
|
||||
{value}
|
||||
</ListItem>
|
||||
))}
|
||||
</MultiSelect>
|
||||
</Column>
|
||||
</Grid>
|
||||
<Attribution
|
||||
websiteId={websiteId}
|
||||
startDate={startDate}
|
||||
endDate={endDate}
|
||||
model={model}
|
||||
type={type}
|
||||
step={step}
|
||||
/>
|
||||
{step ? (
|
||||
<Attribution
|
||||
websiteId={websiteId}
|
||||
startDate={startDate}
|
||||
endDate={endDate}
|
||||
model={model}
|
||||
type={type}
|
||||
step={step}
|
||||
/>
|
||||
) : (
|
||||
<Empty />
|
||||
)}
|
||||
</Column>
|
||||
);
|
||||
}
|
||||
@@ -63,15 +63,11 @@ function PropertySelect({
|
||||
aria-label="PropertySelect"
|
||||
items={properties}
|
||||
inputValue={value}
|
||||
style={{ width: '100%' }}
|
||||
onInputChange={v => {
|
||||
onInputValueChange={v => {
|
||||
setSearch(v);
|
||||
onChange?.(v);
|
||||
onPropertyChange?.(v);
|
||||
}}
|
||||
formValue="text"
|
||||
allowsEmptyCollection
|
||||
allowsCustomValue
|
||||
renderEmptyState={() =>
|
||||
isLoading ? (
|
||||
<Loading placement="center" icon="dots" />
|
||||
@@ -125,13 +121,9 @@ function ValueSelect({
|
||||
aria-label="ValueSelect"
|
||||
items={values}
|
||||
inputValue={value}
|
||||
style={{ width: '100%' }}
|
||||
onInputChange={v => {
|
||||
onInputValueChange={v => {
|
||||
onChange?.(v);
|
||||
}}
|
||||
formValue="text"
|
||||
allowsEmptyCollection
|
||||
allowsCustomValue
|
||||
renderEmptyState={() =>
|
||||
isLoading ? (
|
||||
<Loading placement="center" icon="dots" />
|
||||
@@ -158,7 +150,7 @@ function OperatorSelect({
|
||||
}) {
|
||||
const { t, labels } = useMessages();
|
||||
return (
|
||||
<Select value={value} onChange={onChange}>
|
||||
<Select value={value} onChange={v => onChange?.(v as string)}>
|
||||
<ListItem id="eq">{t(labels.is)}</ListItem>
|
||||
<ListItem id="neq">{t(labels.isNot)}</ListItem>
|
||||
<ListItem id="c">{t(labels.contains)}</ListItem>
|
||||
|
||||
@@ -18,14 +18,7 @@ interface FunnelProps {
|
||||
allowEdit?: boolean;
|
||||
}
|
||||
|
||||
export function Funnel({
|
||||
id,
|
||||
name,
|
||||
type,
|
||||
parameters,
|
||||
websiteId,
|
||||
allowEdit = true,
|
||||
}: FunnelProps) {
|
||||
export function Funnel({ id, name, type, parameters, websiteId, allowEdit = true }: FunnelProps) {
|
||||
const { t, labels } = useMessages();
|
||||
const { pathname } = useNavigation();
|
||||
const isSharePage = pathname.includes('/share/');
|
||||
@@ -134,8 +127,8 @@ export function Funnel({
|
||||
<Row alignItems="center" gap="6">
|
||||
<ProgressBar
|
||||
value={visitors || 0}
|
||||
minValue={0}
|
||||
maxValue={previous || 1}
|
||||
min={0}
|
||||
max={previous || 1}
|
||||
style={{ width: '100%' }}
|
||||
/>
|
||||
<Row minWidth="90px" justifyContent="end">
|
||||
|
||||
@@ -93,8 +93,8 @@ export function Goal({
|
||||
<Row alignItems="center" gap="6">
|
||||
<ProgressBar
|
||||
value={data?.num || 0}
|
||||
minValue={0}
|
||||
maxValue={data?.total || 1}
|
||||
min={0}
|
||||
max={data?.total || 1}
|
||||
style={{ width: '100%' }}
|
||||
/>
|
||||
<Text weight="bold" size="4xl">
|
||||
|
||||
@@ -228,24 +228,25 @@ export function Journey({ websiteId, steps, startStep, endStep, view }: JourneyP
|
||||
<Text truncate>{name}</Text>
|
||||
</Row>
|
||||
<div className={styles.count} title={nodeCount}>
|
||||
<TooltipTrigger
|
||||
delay={0}
|
||||
isDisabled={columnIndex === 0 || (selectedNode && !selected)}
|
||||
>
|
||||
<Focusable>
|
||||
<div>{formatLongNumber(nodeCount)}</div>
|
||||
</Focusable>
|
||||
<Tooltip placement="top" offset={20} showArrow>
|
||||
<Text transform="lowercase" color="red">
|
||||
{`${dropped}% ${t(labels.dropoff)}`}
|
||||
</Text>
|
||||
<Column>
|
||||
<Text transform="lowercase">
|
||||
{`${remaining}% ${t(labels.conversion)}`}
|
||||
{columnIndex === 0 || (selectedNode && !selected) ? (
|
||||
<div>{formatLongNumber(nodeCount)}</div>
|
||||
) : (
|
||||
<TooltipTrigger delay={0}>
|
||||
<Focusable>
|
||||
<div>{formatLongNumber(nodeCount)}</div>
|
||||
</Focusable>
|
||||
<Tooltip placement="top" sideOffset={20} showArrow>
|
||||
<Text transform="lowercase" color="red">
|
||||
{`${dropped}% ${t(labels.dropoff)}`}
|
||||
</Text>
|
||||
</Column>
|
||||
</Tooltip>
|
||||
</TooltipTrigger>
|
||||
<Column>
|
||||
<Text transform="lowercase">
|
||||
{`${remaining}% ${t(labels.conversion)}`}
|
||||
</Text>
|
||||
</Column>
|
||||
</Tooltip>
|
||||
</TooltipTrigger>
|
||||
)}
|
||||
</div>
|
||||
{columnIndex < columns.length &&
|
||||
lines.map(([fromIndex, nodeIndex], i) => {
|
||||
|
||||
@@ -39,7 +39,12 @@ export function JourneysPage({ websiteId }: { websiteId: string }) {
|
||||
<Column gap>
|
||||
<WebsiteControls websiteId={websiteId} />
|
||||
<Grid columns="repeat(3, 1fr)" gap>
|
||||
<Select label={t(labels.steps)} value={steps} defaultValue={steps} onChange={setSteps}>
|
||||
<Select
|
||||
label={t(labels.steps)}
|
||||
value={steps}
|
||||
defaultValue={steps}
|
||||
onChange={value => setSteps(Number(value))}
|
||||
>
|
||||
{JOURNEY_STEPS.map(step => (
|
||||
<ListItem key={step} id={step}>
|
||||
{step}
|
||||
|
||||
@@ -149,7 +149,7 @@ export function Performance({ websiteId, startDate, endDate, unit }: Performance
|
||||
<Select
|
||||
label="Percentile"
|
||||
value={selectedPercentile}
|
||||
onChange={(value: string) => setSelectedPercentile(value as 'p50' | 'p75' | 'p95')}
|
||||
onChange={value => setSelectedPercentile(value as 'p50' | 'p75' | 'p95')}
|
||||
>
|
||||
{PERCENTILES.map(({ id, label }) => (
|
||||
<ListItem key={id} id={id}>
|
||||
|
||||
@@ -92,9 +92,9 @@ export function Revenue({ websiteId, startDate, endDate, unit }: RevenueProps) {
|
||||
<Row justifyContent="end">
|
||||
<Select
|
||||
value={revenueChartMode}
|
||||
onChange={handleRevenueChartModeChange}
|
||||
popoverProps={{ placement: 'bottom right' }}
|
||||
style={{ width: 140 }}
|
||||
onChange={value => handleRevenueChartModeChange(value as RevenueChartMode)}
|
||||
popoverProps={{ side: 'bottom', align: 'end' }}
|
||||
buttonProps={{ style: { width: 140 } }}
|
||||
>
|
||||
<ListItem id="period">{t(labels.period)}</ListItem>
|
||||
<ListItem id="cumulative">{t(labels.cumulative)}</ListItem>
|
||||
|
||||
@@ -28,7 +28,7 @@ export function ExpandedViewModal({
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal isOpen={!!view} onOpenChange={handleOpenChange} isDismissable>
|
||||
<Modal isOpen={!!view} onOpenChange={handleOpenChange}>
|
||||
<Dialog
|
||||
style={{
|
||||
maxWidth: 1320,
|
||||
|
||||
@@ -36,13 +36,13 @@ export function WebsiteMenu({ websiteId }: { websiteId: string }) {
|
||||
<MoreHorizontal />
|
||||
</Icon>
|
||||
</Button>
|
||||
<Popover placement="bottom">
|
||||
<Menu onAction={handleAction}>
|
||||
<Popover side="bottom">
|
||||
<Menu>
|
||||
{menuItems.map(({ id, label, icon, seperator }, index) => {
|
||||
return (
|
||||
<Fragment key={index}>
|
||||
{seperator && <MenuSeparator />}
|
||||
<MenuItem id={id}>
|
||||
<MenuItem id={id} onAction={handleAction}>
|
||||
<Icon>{icon}</Icon>
|
||||
<Text>{label}</Text>
|
||||
</MenuItem>
|
||||
|
||||
@@ -20,19 +20,30 @@ export function WebsiteNav({
|
||||
return (
|
||||
<Column gap="2" marginTop={isCollapsed ? '2' : undefined}>
|
||||
<Link href={renderUrl('/websites', false)} role="button" onClick={onItemClick}>
|
||||
<TooltipTrigger isDisabled={!isCollapsed} delay={0}>
|
||||
<Focusable>
|
||||
<Row
|
||||
alignItems="center"
|
||||
hover={{ backgroundColor: 'surface-sunken' }}
|
||||
borderRadius
|
||||
minHeight="40px"
|
||||
>
|
||||
<IconLabel icon={<ArrowLeft />} label={isCollapsed ? '' : t(labels.back)} padding />
|
||||
</Row>
|
||||
</Focusable>
|
||||
<Tooltip placement="right">{t(labels.back)}</Tooltip>
|
||||
</TooltipTrigger>
|
||||
{isCollapsed ? (
|
||||
<TooltipTrigger delay={0}>
|
||||
<Focusable>
|
||||
<Row
|
||||
alignItems="center"
|
||||
hover={{ backgroundColor: 'surface-sunken' }}
|
||||
borderRadius
|
||||
minHeight="40px"
|
||||
>
|
||||
<IconLabel icon={<ArrowLeft />} label="" padding />
|
||||
</Row>
|
||||
</Focusable>
|
||||
<Tooltip placement="right">{t(labels.back)}</Tooltip>
|
||||
</TooltipTrigger>
|
||||
) : (
|
||||
<Row
|
||||
alignItems="center"
|
||||
hover={{ backgroundColor: 'surface-sunken' }}
|
||||
borderRadius
|
||||
minHeight="40px"
|
||||
>
|
||||
<IconLabel icon={<ArrowLeft />} label={t(labels.back)} padding />
|
||||
</Row>
|
||||
)}
|
||||
</Link>
|
||||
{items.map(({ label: sectionLabel, items: sectionItems }, index) => (
|
||||
<Column key={`${sectionLabel}${index}`} gap="1" marginBottom="1">
|
||||
@@ -45,25 +56,42 @@ export function WebsiteNav({
|
||||
const isSelected = selectedKey === id;
|
||||
return (
|
||||
<Link key={id} href={path} role="button" onClick={onItemClick}>
|
||||
<TooltipTrigger isDisabled={!isCollapsed} delay={0}>
|
||||
<Focusable>
|
||||
<Row
|
||||
alignItems="center"
|
||||
hover={{ backgroundColor: 'surface-sunken' }}
|
||||
backgroundColor={isSelected ? 'surface-sunken' : undefined}
|
||||
borderRadius
|
||||
minHeight="40px"
|
||||
>
|
||||
<IconLabel
|
||||
icon={icon}
|
||||
label={isCollapsed ? '' : label}
|
||||
weight={isSelected ? 'bold' : undefined}
|
||||
padding
|
||||
/>
|
||||
</Row>
|
||||
</Focusable>
|
||||
<Tooltip placement="right">{label}</Tooltip>
|
||||
</TooltipTrigger>
|
||||
{isCollapsed ? (
|
||||
<TooltipTrigger delay={0}>
|
||||
<Focusable>
|
||||
<Row
|
||||
alignItems="center"
|
||||
hover={{ backgroundColor: 'surface-sunken' }}
|
||||
backgroundColor={isSelected ? 'surface-sunken' : undefined}
|
||||
borderRadius
|
||||
minHeight="40px"
|
||||
>
|
||||
<IconLabel
|
||||
icon={icon}
|
||||
label=""
|
||||
weight={isSelected ? 'bold' : undefined}
|
||||
padding
|
||||
/>
|
||||
</Row>
|
||||
</Focusable>
|
||||
<Tooltip placement="right">{label}</Tooltip>
|
||||
</TooltipTrigger>
|
||||
) : (
|
||||
<Row
|
||||
alignItems="center"
|
||||
hover={{ backgroundColor: 'surface-sunken' }}
|
||||
backgroundColor={isSelected ? 'surface-sunken' : undefined}
|
||||
borderRadius
|
||||
minHeight="40px"
|
||||
>
|
||||
<IconLabel
|
||||
icon={icon}
|
||||
label={label}
|
||||
weight={isSelected ? 'bold' : undefined}
|
||||
padding
|
||||
/>
|
||||
</Row>
|
||||
)}
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -109,7 +109,7 @@ export function EventProperties({ websiteId }: { websiteId: string }) {
|
||||
<Label>{t(labels.event)}</Label>
|
||||
<Select
|
||||
value={eventName}
|
||||
onChange={handleEventChange}
|
||||
onChange={value => handleEventChange(value as string)}
|
||||
allowSearch
|
||||
searchValue={eventSearch}
|
||||
onSearch={setEventSearch}
|
||||
@@ -132,10 +132,8 @@ export function EventProperties({ websiteId }: { websiteId: string }) {
|
||||
<Label>{t(labels.property)}</Label>
|
||||
<ComboBox
|
||||
inputValue={propertyName}
|
||||
onInputChange={setPropertyName}
|
||||
onInputValueChange={setPropertyName}
|
||||
isDisabled={!eventName}
|
||||
allowsCustomValue
|
||||
allowsEmptyCollection
|
||||
>
|
||||
{properties.map((field: { propertyName: string }) => (
|
||||
<ListItem key={field.propertyName} id={field.propertyName}>
|
||||
|
||||
@@ -110,7 +110,7 @@ const PropertiesButton = props => {
|
||||
</Icon>
|
||||
</Row>
|
||||
</Button>
|
||||
<Popover placement="right">
|
||||
<Popover side="right">
|
||||
<Dialog>
|
||||
<EventData {...props} />
|
||||
</Dialog>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
'use client';
|
||||
import { Column, Dialog, Modal, type ModalProps } from '@umami/react-zen';
|
||||
import { Column, Dialog, Sheet, type SheetProps } from '@umami/react-zen';
|
||||
import { ReplayPlayback } from '@/app/(main)/websites/[websiteId]/replays/[replayId]/ReplayPlayback';
|
||||
import { useNavigation } from '@/components/hooks';
|
||||
import { buildPath } from '@/lib/url';
|
||||
import styles from './ReplayModal.module.css';
|
||||
|
||||
export interface ReplayModalProps extends ModalProps {
|
||||
export interface ReplayModalProps extends SheetProps {
|
||||
websiteId: string;
|
||||
replayId?: string;
|
||||
}
|
||||
@@ -34,17 +34,16 @@ export function ReplayModal({ websiteId, replayId, className, ...props }: Replay
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal
|
||||
<Sheet
|
||||
{...props}
|
||||
placement="bottom"
|
||||
offset="80px"
|
||||
side="bottom"
|
||||
size="calc(100dvh - 80px)"
|
||||
className={modalClassName}
|
||||
isOpen={!!activeReplayId}
|
||||
onOpenChange={handleOpenChange}
|
||||
isDismissable
|
||||
>
|
||||
<Column height="100%">
|
||||
<Dialog variant="sheet" className={styles.sheet}>
|
||||
<Dialog className={styles.sheet}>
|
||||
{({ close }) => (
|
||||
<Column padding="6">
|
||||
{activeReplayId && (
|
||||
@@ -54,6 +53,6 @@ export function ReplayModal({ websiteId, replayId, className, ...props }: Replay
|
||||
)}
|
||||
</Dialog>
|
||||
</Column>
|
||||
</Modal>
|
||||
</Sheet>
|
||||
);
|
||||
}
|
||||
@@ -76,7 +76,7 @@ export function ReplayPlayback({
|
||||
<Bookmark fill="none" />
|
||||
</Icon>
|
||||
</Button>
|
||||
<Popover placement="bottom end">
|
||||
<Popover side="bottom" align="end">
|
||||
<Dialog title={t(labels.saveReplay)} style={{ width: '300px' }}>
|
||||
{({ close }) => (
|
||||
<ReplaySaveForm
|
||||
|
||||
@@ -98,7 +98,7 @@ const PropertiesButton = props => {
|
||||
</Icon>
|
||||
</Row>
|
||||
</Button>
|
||||
<Popover placement="right">
|
||||
<Popover side="right">
|
||||
<Dialog>
|
||||
<EventData {...props} />
|
||||
</Dialog>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
'use client';
|
||||
import { Column, Dialog, Modal, type ModalProps } from '@umami/react-zen';
|
||||
import { Column, Dialog, Sheet, type SheetProps } from '@umami/react-zen';
|
||||
import { SessionProfile } from '@/app/(main)/websites/[websiteId]/sessions/SessionProfile';
|
||||
import { useNavigation } from '@/components/hooks';
|
||||
import styles from './SessionModal.module.css';
|
||||
|
||||
export interface SessionModalProps extends ModalProps {
|
||||
export interface SessionModalProps extends SheetProps {
|
||||
websiteId: string;
|
||||
}
|
||||
|
||||
@@ -23,17 +23,16 @@ export function SessionModal({ websiteId, className, ...props }: SessionModalPro
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal
|
||||
placement="bottom"
|
||||
offset="80px"
|
||||
<Sheet
|
||||
side="bottom"
|
||||
size="calc(100dvh - 80px)"
|
||||
className={[styles.modal, className].filter(Boolean).join(' ')}
|
||||
isOpen={!!session}
|
||||
onOpenChange={handleOpenChange}
|
||||
isDismissable
|
||||
{...props}
|
||||
>
|
||||
<Column height="100%">
|
||||
<Dialog variant="sheet" className="rounded-lg">
|
||||
<Dialog className="rounded-lg">
|
||||
{({ close }) => (
|
||||
<Column padding="10">
|
||||
<SessionProfile
|
||||
@@ -46,6 +45,6 @@ export function SessionModal({ websiteId, className, ...props }: SessionModalPro
|
||||
)}
|
||||
</Dialog>
|
||||
</Column>
|
||||
</Modal>
|
||||
</Sheet>
|
||||
);
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
'use client';
|
||||
import { Column, Dialog, Modal } from '@umami/react-zen';
|
||||
import { Column, Dialog, Sheet } from '@umami/react-zen';
|
||||
import { useRouter, useSearchParams } from 'next/navigation';
|
||||
import { buildPath } from '@/lib/url';
|
||||
import { SessionProfile } from './SessionProfile';
|
||||
import styles from './SessionModal.module.css';
|
||||
import { SessionProfile } from './SessionProfile';
|
||||
|
||||
export function SessionProfileModal({
|
||||
websiteId,
|
||||
@@ -29,21 +29,20 @@ export function SessionProfileModal({
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal
|
||||
placement="bottom"
|
||||
offset="80px"
|
||||
<Sheet
|
||||
side="bottom"
|
||||
size="calc(100dvh - 80px)"
|
||||
className={styles.modal}
|
||||
isOpen
|
||||
onOpenChange={handleOpenChange}
|
||||
isDismissable
|
||||
>
|
||||
<Column height="100%">
|
||||
<Dialog variant="sheet" className="rounded-lg">
|
||||
<Dialog className="rounded-lg">
|
||||
<Column padding="10">
|
||||
<SessionProfile websiteId={websiteId} sessionId={sessionId} onClose={closeModal} />
|
||||
</Column>
|
||||
</Dialog>
|
||||
</Column>
|
||||
</Modal>
|
||||
</Sheet>
|
||||
);
|
||||
}
|
||||
@@ -85,12 +85,7 @@ export function SessionProperties({ websiteId }: { websiteId: string }) {
|
||||
>
|
||||
<Column gap="1" style={{ minWidth: 0 }}>
|
||||
<Label>{t(labels.property)}</Label>
|
||||
<ComboBox
|
||||
inputValue={propertyName}
|
||||
onInputChange={setPropertyName}
|
||||
allowsCustomValue
|
||||
allowsEmptyCollection
|
||||
>
|
||||
<ComboBox inputValue={propertyName} onInputValueChange={setPropertyName}>
|
||||
{properties.map((field: { propertyName: string }) => (
|
||||
<ListItem key={field.propertyName} id={field.propertyName}>
|
||||
{field.propertyName}
|
||||
|
||||
@@ -52,7 +52,7 @@ export function SessionReplaysDataTable({
|
||||
)}
|
||||
<DataGrid query={queryResult} allowPaging>
|
||||
{({ data }) => (
|
||||
<SessionReplaysTable data={data} onPlay={handlePlay} selectedId={selectedId} />
|
||||
<SessionReplaysTable data={data} onPlay={handlePlay as any} selectedId={selectedId} />
|
||||
)}
|
||||
</DataGrid>
|
||||
</Column>
|
||||
|
||||
@@ -160,13 +160,12 @@ export function WebsiteReplaySettings({ websiteId }: { websiteId: string }) {
|
||||
{heatmapEnabled && (
|
||||
<Slider
|
||||
label={`Heatmap ${t(labels.sampleRate).toLowerCase()}`}
|
||||
minValue={0.05}
|
||||
maxValue={1}
|
||||
min={0.05}
|
||||
max={1}
|
||||
step={0.05}
|
||||
value={heatmapSampleRate}
|
||||
onChange={v => setHeatmapSampleRate(Array.isArray(v) ? v[0] : v)}
|
||||
showValue
|
||||
formatOptions={{ style: 'percent', maximumFractionDigits: 0 }}
|
||||
style={{ maxWidth: '360px' }}
|
||||
/>
|
||||
)}
|
||||
@@ -174,25 +173,32 @@ export function WebsiteReplaySettings({ websiteId }: { websiteId: string }) {
|
||||
<>
|
||||
<Slider
|
||||
label={`Replay ${t(labels.sampleRate).toLowerCase()}`}
|
||||
minValue={0.05}
|
||||
maxValue={1}
|
||||
min={0.05}
|
||||
max={1}
|
||||
step={0.05}
|
||||
value={sampleRate}
|
||||
onChange={v => setSampleRate(Array.isArray(v) ? v[0] : v)}
|
||||
showValue
|
||||
formatOptions={{ style: 'percent', maximumFractionDigits: 0 }}
|
||||
style={{ maxWidth: '360px' }}
|
||||
/>
|
||||
<Column gap="1">
|
||||
<Label>{t(labels.maskLevel)}</Label>
|
||||
<Select value={maskLevel} onChange={setMaskLevel} style={{ maxWidth: '360px' }}>
|
||||
<Select
|
||||
value={maskLevel}
|
||||
onChange={v => setMaskLevel(v as typeof maskLevel)}
|
||||
buttonProps={{ style: { maxWidth: '360px' } }}
|
||||
>
|
||||
<ListItem id="strict">strict</ListItem>
|
||||
<ListItem id="moderate">moderate</ListItem>
|
||||
</Select>
|
||||
</Column>
|
||||
<Column gap="1">
|
||||
<Label>{t(labels.maxDuration)}</Label>
|
||||
<Select value={maxDuration} onChange={setMaxDuration} style={{ maxWidth: '360px' }}>
|
||||
<Select
|
||||
value={maxDuration}
|
||||
onChange={v => setMaxDuration(v as string)}
|
||||
buttonProps={{ style: { maxWidth: '360px' } }}
|
||||
>
|
||||
<ListItem id="300000">5 minutes</ListItem>
|
||||
<ListItem id="600000">10 minutes</ListItem>
|
||||
<ListItem id="900000">15 minutes</ListItem>
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
Select,
|
||||
Text,
|
||||
} from '@umami/react-zen';
|
||||
import { type Key, useState } from 'react';
|
||||
import { useState } from 'react';
|
||||
import {
|
||||
useLoginQuery,
|
||||
useMessages,
|
||||
@@ -59,7 +59,7 @@ export function WebsiteTransferForm({
|
||||
);
|
||||
};
|
||||
|
||||
const handleChange = (key: Key) => {
|
||||
const handleChange = (key: string | number | null) => {
|
||||
setTeamId(key as string);
|
||||
};
|
||||
|
||||
@@ -74,7 +74,7 @@ export function WebsiteTransferForm({
|
||||
</Text>
|
||||
<FormField name="teamId">
|
||||
{!isTeamWebsite && (
|
||||
<Select onSelectionChange={handleChange} selectedKey={teamId}>
|
||||
<Select onChange={handleChange} value={teamId}>
|
||||
{items.map(({ id, name }) => {
|
||||
return (
|
||||
<ListItem key={`${id}`} id={`${id}`}>
|
||||
@@ -89,7 +89,7 @@ export function WebsiteTransferForm({
|
||||
<Button onPress={onClose}>{t(labels.cancel)}</Button>
|
||||
<FormSubmitButton
|
||||
variant="primary"
|
||||
isPending={isPending}
|
||||
isLoading={isPending}
|
||||
isDisabled={!isTeamWebsite && !teamId}
|
||||
>
|
||||
{t(labels.transfer)}
|
||||
|
||||
+1
-16
@@ -1,7 +1,6 @@
|
||||
'use client';
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
import { RouterProvider, ZenProvider } from '@umami/react-zen';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { NextIntlClientProvider } from 'next-intl';
|
||||
import { useEffect } from 'react';
|
||||
import { ErrorBoundary } from '@/components/common/ErrorBoundary';
|
||||
@@ -34,23 +33,9 @@ function MessagesProvider({ children }) {
|
||||
}
|
||||
|
||||
export function Providers({ children }) {
|
||||
const router = useRouter();
|
||||
|
||||
function navigate(url: string) {
|
||||
if (shouldUseNativeLink(url)) {
|
||||
window.location.href = url;
|
||||
} else {
|
||||
router.push(url);
|
||||
}
|
||||
}
|
||||
|
||||
function shouldUseNativeLink(url: string) {
|
||||
return url.startsWith('http');
|
||||
}
|
||||
|
||||
return (
|
||||
<ZenProvider>
|
||||
<RouterProvider navigate={navigate}>
|
||||
<RouterProvider>
|
||||
<MessagesProvider>
|
||||
<QueryClientProvider client={client}>
|
||||
<ErrorBoundary>{children}</ErrorBoundary>
|
||||
|
||||
@@ -177,26 +177,42 @@ export function ShareNav({
|
||||
const isSelected = selectedKey === id;
|
||||
return (
|
||||
<Link key={id} href={path} role="button" onClick={onItemClick}>
|
||||
<TooltipTrigger isDisabled={!collapsed} delay={0}>
|
||||
<Focusable>
|
||||
<Row
|
||||
alignItems="center"
|
||||
justifyContent={collapsed ? 'center' : undefined}
|
||||
hover={{ backgroundColor: 'surface-sunken' }}
|
||||
backgroundColor={isSelected ? 'surface-sunken' : undefined}
|
||||
borderRadius
|
||||
minHeight="40px"
|
||||
>
|
||||
<IconLabel
|
||||
icon={icon}
|
||||
label={collapsed ? '' : label}
|
||||
weight={isSelected ? 'bold' : undefined}
|
||||
{...(!collapsed && { padding: true })}
|
||||
/>
|
||||
</Row>
|
||||
</Focusable>
|
||||
<Tooltip placement="right">{label}</Tooltip>
|
||||
</TooltipTrigger>
|
||||
{collapsed ? (
|
||||
<TooltipTrigger delay={0}>
|
||||
<Focusable>
|
||||
<Row
|
||||
alignItems="center"
|
||||
justifyContent="center"
|
||||
hover={{ backgroundColor: 'surface-sunken' }}
|
||||
backgroundColor={isSelected ? 'surface-sunken' : undefined}
|
||||
borderRadius
|
||||
minHeight="40px"
|
||||
>
|
||||
<IconLabel
|
||||
icon={icon}
|
||||
label=""
|
||||
weight={isSelected ? 'bold' : undefined}
|
||||
/>
|
||||
</Row>
|
||||
</Focusable>
|
||||
<Tooltip placement="right">{label}</Tooltip>
|
||||
</TooltipTrigger>
|
||||
) : (
|
||||
<Row
|
||||
alignItems="center"
|
||||
hover={{ backgroundColor: 'surface-sunken' }}
|
||||
backgroundColor={isSelected ? 'surface-sunken' : undefined}
|
||||
borderRadius
|
||||
minHeight="40px"
|
||||
>
|
||||
<IconLabel
|
||||
icon={icon}
|
||||
label={label}
|
||||
weight={isSelected ? 'bold' : undefined}
|
||||
padding
|
||||
/>
|
||||
</Row>
|
||||
)}
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
|
||||
Reference in new issue
Block a user