diff --git a/package.json b/package.json index fb7dcf7c..d7cdf1cd 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,7 @@ "@react-spring/web": "^9.7.5", "@tanstack/react-query": "^5.68.0", "@umami/prisma-client": "^0.16.0", - "@umami/react-zen": "^0.76.0", + "@umami/react-zen": "^0.77.0", "@umami/redis-client": "^0.27.0", "bcryptjs": "^2.4.3", "chalk": "^4.1.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7a6f6f87..3bc058b1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -45,8 +45,8 @@ importers: specifier: ^0.16.0 version: 0.16.0(@prisma/client@6.5.0(prisma@6.5.0(typescript@5.8.2))(typescript@5.8.2))(@prisma/extension-read-replicas@0.4.0(@prisma/client@6.5.0(prisma@6.5.0(typescript@5.8.2))(typescript@5.8.2))) '@umami/react-zen': - specifier: ^0.76.0 - version: 0.76.0(@babel/core@7.26.9)(@types/react@19.0.10)(immer@9.0.21)(use-sync-external-store@1.5.0(react@19.0.0)) + specifier: ^0.77.0 + version: 0.77.0(@babel/core@7.26.9)(@types/react@19.0.10)(immer@9.0.21)(use-sync-external-store@1.5.0(react@19.0.0)) '@umami/redis-client': specifier: ^0.27.0 version: 0.27.0 @@ -1314,8 +1314,8 @@ packages: peerDependencies: '@dicebear/core': ^9.0.0 - '@emnapi/runtime@1.3.1': - resolution: {integrity: sha512-kEBmG8KyqtxJZv+ygbEim+KCGtIq1fC22Ms3S4ziXmYKm8uyoLX0MHONVKwp+9opg390VaKRNt4a7A9NwmpNhw==} + '@emnapi/runtime@1.4.0': + resolution: {integrity: sha512-64WYIf4UYcdLnbKn/umDlNjQDSS8AgZrI/R9+x5ilkUVFxXcA1Ebl+gQLc/6mERA4407Xof0R7wEyEuj091CVw==} '@esbuild/aix-ppc64@0.25.1': resolution: {integrity: sha512-kfYGy8IdzTGy+z0vFGvExZtxkFlA4zAxgKEahG9KE1ScBjpQnFsNOX8KTU5ojNru5ed5CVoJYXFtoxaq5nFbjQ==} @@ -2961,8 +2961,8 @@ packages: '@prisma/client': ^4.8.0 '@prisma/extension-read-replicas': ^0.3.0 - '@umami/react-zen@0.76.0': - resolution: {integrity: sha512-AjkRpJGPV514fo516csceh9kwQexfgZdZPli0bTui5FH9RObptgEev/ySW+x9dHWXJWch7GZ+81c+eNloX19YQ==} + '@umami/react-zen@0.77.0': + resolution: {integrity: sha512-tdoPdCMfPOhBMEiGXZ62zfTG8qjto7Ii+mWXNX2qdPjZ+SP5AB8wnQpqIGiXoUZUnP41iWw0GS97sTZq3xeEBQ==} '@umami/redis-client@0.27.0': resolution: {integrity: sha512-SbHTpxhgeZyTBUSp2zdZM+XUtpsaSL4Tad8QXIEhEtjWhvvfoornyT5kLuyYCVtzSAT4daALeGmOO1z6EE1KcA==} @@ -3329,8 +3329,8 @@ packages: caniuse-lite@1.0.30001702: resolution: {integrity: sha512-LoPe/D7zioC0REI5W73PeR1e1MLCipRGq/VkovJnd6Df+QVqT+vT33OXCp8QUd7kA7RZrHWxb1B36OQKI/0gOA==} - caniuse-lite@1.0.30001707: - resolution: {integrity: sha512-3qtRjw/HQSMlDWf+X79N206fepf4SOOU6SQLMaq/0KkZLmSjPxAkBOQQ+FxbHKfHmYLZFfdWsO3KA90ceHPSnw==} + caniuse-lite@1.0.30001709: + resolution: {integrity: sha512-NgL3vUTnDrPCZ3zTahp4fsugQ4dc7EKTSzwQDPEel6DMoMnfH2jhry9n2Zm8onbSR+f/QtKHFOA+iAQu4kbtWA==} caseless@0.12.0: resolution: {integrity: sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==} @@ -8404,7 +8404,7 @@ snapshots: dependencies: '@dicebear/core': 9.2.2 - '@emnapi/runtime@1.3.1': + '@emnapi/runtime@1.4.0': dependencies: tslib: 2.8.1 optional: true @@ -8740,7 +8740,7 @@ snapshots: '@img/sharp-wasm32@0.33.5': dependencies: - '@emnapi/runtime': 1.3.1 + '@emnapi/runtime': 1.4.0 optional: true '@img/sharp-win32-ia32@0.33.5': @@ -10646,7 +10646,7 @@ snapshots: transitivePeerDependencies: - supports-color - '@umami/react-zen@0.76.0(@babel/core@7.26.9)(@types/react@19.0.10)(immer@9.0.21)(use-sync-external-store@1.5.0(react@19.0.0))': + '@umami/react-zen@0.77.0(@babel/core@7.26.9)(@types/react@19.0.10)(immer@9.0.21)(use-sync-external-store@1.5.0(react@19.0.0))': dependencies: '@fontsource/jetbrains-mono': 5.2.5 '@react-aria/focus': 3.20.1(react-dom@19.1.0(react@19.1.0))(react@19.1.0) @@ -11120,13 +11120,13 @@ snapshots: caniuse-api@3.0.0: dependencies: browserslist: 4.24.4 - caniuse-lite: 1.0.30001707 + caniuse-lite: 1.0.30001709 lodash.memoize: 4.1.2 lodash.uniq: 4.5.0 caniuse-lite@1.0.30001702: {} - caniuse-lite@1.0.30001707: {} + caniuse-lite@1.0.30001709: {} caseless@0.12.0: {} @@ -13667,7 +13667,7 @@ snapshots: '@swc/counter': 0.1.3 '@swc/helpers': 0.5.15 busboy: 1.6.0 - caniuse-lite: 1.0.30001707 + caniuse-lite: 1.0.30001709 postcss: 8.4.31 react: 19.0.0 react-dom: 19.0.0(react@19.0.0) @@ -13692,7 +13692,7 @@ snapshots: '@swc/counter': 0.1.3 '@swc/helpers': 0.5.15 busboy: 1.6.0 - caniuse-lite: 1.0.30001707 + caniuse-lite: 1.0.30001709 postcss: 8.4.31 react: 19.1.0 react-dom: 19.1.0(react@19.1.0) diff --git a/src/app/(main)/settings/websites/[websiteId]/WebsiteTransferForm.tsx b/src/app/(main)/settings/websites/[websiteId]/WebsiteTransferForm.tsx index e4971adb..925bd193 100644 --- a/src/app/(main)/settings/websites/[websiteId]/WebsiteTransferForm.tsx +++ b/src/app/(main)/settings/websites/[websiteId]/WebsiteTransferForm.tsx @@ -57,6 +57,7 @@ export function WebsiteTransferForm({ }; const handleChange = (key: Key) => { + console.log('KEY', key); setTeamId(key as string); }; @@ -73,10 +74,10 @@ export function WebsiteTransferForm({ {!isTeamWebsite && ( - {items.map(({ id, name }) => { return ( - + {name} ); diff --git a/src/app/(main)/websites/[websiteId]/WebsiteCompareBar.tsx b/src/app/(main)/websites/[websiteId]/WebsiteCompareBar.tsx new file mode 100644 index 00000000..afb99cdb --- /dev/null +++ b/src/app/(main)/websites/[websiteId]/WebsiteCompareBar.tsx @@ -0,0 +1,5 @@ +import { Row } from '@umami/react-zen'; + +export function WebsiteCompareBar({ websiteId }: { websiteId: string }) { + return compare {websiteId}; +} diff --git a/src/app/(main)/websites/[websiteId]/WebsiteFilterButton.module.css b/src/app/(main)/websites/[websiteId]/WebsiteFilterButton.module.css deleted file mode 100644 index 80f101e3..00000000 --- a/src/app/(main)/websites/[websiteId]/WebsiteFilterButton.module.css +++ /dev/null @@ -1,3 +0,0 @@ -.button { - font-weight: 700; -} diff --git a/src/app/(main)/websites/[websiteId]/WebsiteFilterButton.tsx b/src/app/(main)/websites/[websiteId]/WebsiteFilterButton.tsx index aeed8abc..ccdcede3 100644 --- a/src/app/(main)/websites/[websiteId]/WebsiteFilterButton.tsx +++ b/src/app/(main)/websites/[websiteId]/WebsiteFilterButton.tsx @@ -2,7 +2,6 @@ import { Button, Icon, Icons, MenuTrigger, Popover, Text } from '@umami/react-ze import { FilterSelectForm } from '@/app/(main)/reports/[reportId]/FilterSelectForm'; import { useFields, useMessages, useNavigation, useDateRange } from '@/components/hooks'; import { OPERATOR_PREFIXES } from '@/lib/constants'; -import styles from './WebsiteFilterButton.module.css'; export function WebsiteFilterButton({ websiteId, @@ -28,7 +27,7 @@ export function WebsiteFilterButton({ return ( - - - - Compare dates - Share - - Settings - - - - )} + {allowEdit && } - {compareMode && items.map(item =>
{item.label}
)} + diff --git a/src/app/(main)/websites/[websiteId]/WebsiteMenu.tsx b/src/app/(main)/websites/[websiteId]/WebsiteMenu.tsx new file mode 100644 index 00000000..8f7a3331 --- /dev/null +++ b/src/app/(main)/websites/[websiteId]/WebsiteMenu.tsx @@ -0,0 +1,49 @@ +import { + Button, + Icon, + Icons, + Menu, + MenuItem, + MenuSeparator, + MenuTrigger, + Popover, + Text, +} from '@umami/react-zen'; +import { Fragment } from 'react'; +import { Lucide } from '@/components/icons'; +import { useMessages } from '@/components/hooks'; + +export function WebsiteMenu({ websiteId }: { websiteId: string }) { + const { formatMessage, labels } = useMessages(); + + const menuItems = [ + { label: formatMessage(labels.compare), icon: }, + { label: formatMessage(labels.share), icon: }, + { label: formatMessage(labels.edit), icon: , seperator: true }, + ]; + + return ( + + + + + {menuItems.map(({ label, icon, seperator }, index) => { + return ( + + {seperator && } + + {icon} + {label} + + + ); + })} + + + + ); +} diff --git a/src/components/hooks/index.ts b/src/components/hooks/index.ts index 0966fff5..6f738838 100644 --- a/src/components/hooks/index.ts +++ b/src/components/hooks/index.ts @@ -1,3 +1,4 @@ +export * from './queries/useActiveUsersQuery'; export * from './queries/useEventDataEventsQuery'; export * from './queries/useEventDataPropertiesQuery'; export * from './queries/useEventDataValuesQuery'; diff --git a/src/components/hooks/queries/useActiveUsersQuery.ts b/src/components/hooks/queries/useActiveUsersQuery.ts new file mode 100644 index 00000000..3b4b025d --- /dev/null +++ b/src/components/hooks/queries/useActiveUsersQuery.ts @@ -0,0 +1,15 @@ +import { useApi } from '../useApi'; +import { UseQueryOptions } from '@tanstack/react-query'; + +export function useActyiveUsersQuery( + websiteId: string, + options?: Omit, +) { + const { get, useQuery } = useApi(); + return useQuery({ + queryKey: ['websites:active', websiteId], + queryFn: () => get(`/websites/${websiteId}/active`), + enabled: !!websiteId, + ...options, + }); +} diff --git a/src/components/hooks/useDateRange.ts b/src/components/hooks/useDateRange.ts index 23ad20af..f8a8adae 100644 --- a/src/components/hooks/useDateRange.ts +++ b/src/components/hooks/useDateRange.ts @@ -7,12 +7,7 @@ import { DateRange } from '@/lib/types'; import { useLocale } from './useLocale'; import { useApi } from './useApi'; -export function useDateRange(websiteId?: string): { - dateRange: DateRange; - saveDateRange: (value: string | DateRange) => void; - dateCompare: string; - saveDateCompare: (value: string) => void; -} { +export function useDateRange(websiteId?: string) { const { get } = useApi(); const { locale } = useLocale(); const websiteConfig = useWebsites(state => state[websiteId]?.dateRange); diff --git a/src/components/hooks/useWebsite.ts b/src/components/hooks/useWebsite.ts index daaf057b..69a477d2 100644 --- a/src/components/hooks/useWebsite.ts +++ b/src/components/hooks/useWebsite.ts @@ -2,7 +2,5 @@ import { WebsiteContext } from '@/app/(main)/websites/[websiteId]/WebsiteProvide import { useContext } from 'react'; export function useWebsite() { - const website = useContext(WebsiteContext); - - return website; + return useContext(WebsiteContext); } diff --git a/src/components/input/DateFilter.module.css b/src/components/input/DateFilter.module.css deleted file mode 100644 index bd9ec1a8..00000000 --- a/src/components/input/DateFilter.module.css +++ /dev/null @@ -1,3 +0,0 @@ -.dropdown span { - white-space: nowrap; -} diff --git a/src/components/input/DateFilter.tsx b/src/components/input/DateFilter.tsx index b55168e5..f72c7404 100644 --- a/src/components/input/DateFilter.tsx +++ b/src/components/input/DateFilter.tsx @@ -95,7 +95,7 @@ export function DateFilter({ return ( <>