mirror of
https://github.com/umami-software/umami.git
synced 2026-02-07 06:07:17 +01:00
Pixel/link metrics pages.
This commit is contained in:
parent
789b8b36d8
commit
8e766e2db7
42 changed files with 530 additions and 49 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import { ReactNode } from 'react';
|
||||
import { Heading, Icon, Row, RowProps, Text } from '@umami/react-zen';
|
||||
import { Heading, Icon, Row, RowProps, Text, Column } from '@umami/react-zen';
|
||||
|
||||
export function PageHeader({
|
||||
title,
|
||||
|
|
@ -26,11 +26,13 @@ export function PageHeader({
|
|||
width="100%"
|
||||
{...props}
|
||||
>
|
||||
<Row alignItems="center" gap="3">
|
||||
{icon && <Icon size="md">{icon}</Icon>}
|
||||
{title && <Heading size="4">{title}</Heading>}
|
||||
<Column>
|
||||
<Row alignItems="center" gap="3">
|
||||
{icon && <Icon size="md">{icon}</Icon>}
|
||||
{title && <Heading size="4">{title}</Heading>}
|
||||
</Row>
|
||||
{description && <Text color="muted">{description}</Text>}
|
||||
</Row>
|
||||
</Column>
|
||||
<Row justifyContent="flex-end">{children}</Row>
|
||||
</Row>
|
||||
);
|
||||
|
|
|
|||
6
src/components/hooks/context/useLink.ts
Normal file
6
src/components/hooks/context/useLink.ts
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import { LinkContext } from '@/app/(main)/links/LinkProvider';
|
||||
import { useContext } from 'react';
|
||||
|
||||
export function useLink() {
|
||||
return useContext(LinkContext);
|
||||
}
|
||||
6
src/components/hooks/context/usePixel.ts
Normal file
6
src/components/hooks/context/usePixel.ts
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import { PixelContext } from '@/app/(main)/pixels/PixelProvider';
|
||||
import { useContext } from 'react';
|
||||
|
||||
export function usePixel() {
|
||||
return useContext(PixelContext);
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import { TeamContext } from '@/app/(main)/teams/[teamId]/TeamProvider';
|
||||
import { TeamContext } from '@/app/(main)/teams/TeamProvider';
|
||||
import { useContext } from 'react';
|
||||
|
||||
export function useTeam() {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import { WebsiteContext } from '@/app/(main)/websites/[websiteId]/WebsiteProvider';
|
||||
import { WebsiteContext } from '@/app/(main)/websites/WebsiteProvider';
|
||||
import { useContext } from 'react';
|
||||
|
||||
export function useWebsite() {
|
||||
|
|
@ -1,5 +1,11 @@
|
|||
'use client';
|
||||
|
||||
// Context hooks
|
||||
export * from './context/useLink';
|
||||
export * from './context/usePixel';
|
||||
export * from './context/useTeam';
|
||||
export * from './context/useWebsite';
|
||||
|
||||
// Query hooks
|
||||
export * from './queries/useActiveUsersQuery';
|
||||
export * from './queries/useDeleteQuery';
|
||||
|
|
@ -70,7 +76,6 @@ export * from './useNavigation';
|
|||
export * from './usePagedQuery';
|
||||
export * from './usePageParameters';
|
||||
export * from './useRegionNames';
|
||||
export * from './useSlug';
|
||||
export * from './useSticky';
|
||||
export * from './useTeam';
|
||||
export * from './useTimezone';
|
||||
export * from './useWebsite';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
import { useApi, useModified } from '@/components/hooks';
|
||||
import { useApi } from '../useApi';
|
||||
import { useModified } from '../useModified';
|
||||
import { useToast } from '@umami/react-zen';
|
||||
|
||||
export function useUpdateQuery(path: string, params?: Record<string, any>) {
|
||||
const { post, useMutation } = useApi();
|
||||
|
|
@ -6,6 +8,7 @@ export function useUpdateQuery(path: string, params?: Record<string, any>) {
|
|||
mutationFn: (data: Record<string, any>) => post(path, { ...data, ...params }),
|
||||
});
|
||||
const { touch } = useModified();
|
||||
const { toast } = useToast();
|
||||
|
||||
return { mutate, isPending, error, touch };
|
||||
return { mutate, isPending, error, touch, toast };
|
||||
}
|
||||
|
|
|
|||
14
src/components/hooks/useSlug.ts
Normal file
14
src/components/hooks/useSlug.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import { useConfig } from '@/components/hooks/useConfig';
|
||||
import { LINKS_URL, PIXELS_URL } from '@/lib/constants';
|
||||
|
||||
export function useSlug(type: 'link' | 'pixel') {
|
||||
const { linksUrl, pixelsUrl } = useConfig();
|
||||
|
||||
const hostUrl = type === 'link' ? linksUrl || LINKS_URL : pixelsUrl || PIXELS_URL;
|
||||
|
||||
const getSlugUrl = (slug: string) => {
|
||||
return `${hostUrl}/${slug}`;
|
||||
};
|
||||
|
||||
return { getSlugUrl, hostUrl };
|
||||
}
|
||||
|
|
@ -358,7 +358,7 @@ export const labels = defineMessages({
|
|||
|
||||
export const messages = defineMessages({
|
||||
error: { id: 'message.error', defaultMessage: 'Something went wrong.' },
|
||||
saved: { id: 'message.saved', defaultMessage: 'Saved.' },
|
||||
saved: { id: 'message.saved', defaultMessage: 'Saved successfully.' },
|
||||
noUsers: { id: 'message.no-users', defaultMessage: 'There are no users.' },
|
||||
userDeleted: { id: 'message.user-deleted', defaultMessage: 'User deleted.' },
|
||||
noDataAvailable: { id: 'message.no-data-available', defaultMessage: 'No data available.' },
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { WebsiteContext } from '@/app/(main)/websites/[websiteId]/WebsiteProvider';
|
||||
import { WebsiteContext } from '@/app/(main)/websites/WebsiteProvider';
|
||||
import { FilterButtons } from '@/components/input/FilterButtons';
|
||||
import { FilterLink } from '@/components/common/FilterLink';
|
||||
import { useMessages, useNavigation } from '@/components/hooks';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue