Merge branch 'dev' of https://github.com/umami-software/umami into dev
Some checks are pending
Create docker images (cloud) / Build, push, and deploy (push) Waiting to run
Node.js CI / build (postgresql, 18.18, 10) (push) Waiting to run

This commit is contained in:
Mike Cao 2025-12-03 18:39:45 -08:00
commit 1483241494
93 changed files with 3147 additions and 1296 deletions

View file

@ -1,8 +1,13 @@
import { Icon, Row, Text } from '@umami/react-zen';
import Link from 'next/link';
import Link, { type LinkProps } from 'next/link';
import type { ReactNode } from 'react';
import { ExternalLink as LinkIcon } from '@/components/icons';
export function ExternalLink({ href, children, ...props }) {
export function ExternalLink({
href,
children,
...props
}: LinkProps & { href: string; children: ReactNode }) {
return (
<Row alignItems="center" overflow="hidden" gap>
<Text title={href} truncate>

View file

@ -9,6 +9,7 @@ export interface LinkButtonProps extends ButtonProps {
scroll?: boolean;
variant?: any;
prefetch?: boolean;
asAnchor?: boolean;
children?: ReactNode;
}
@ -19,15 +20,22 @@ export function LinkButton({
target,
prefetch,
children,
asAnchor,
...props
}: LinkButtonProps) {
const { dir } = useLocale();
return (
<Button {...props} variant={variant} asChild>
<Link href={href} dir={dir} scroll={scroll} target={target} prefetch={prefetch}>
{children}
</Link>
{asAnchor ? (
<a href={href} target={target}>
{children}
</a>
) : (
<Link href={href} dir={dir} scroll={scroll} target={target} prefetch={prefetch}>
{children}
</Link>
)}
</Button>
);
}

View file

@ -1,5 +1,6 @@
import { Column, Grid, Heading, Icon, Row, Text } from '@umami/react-zen';
import type { ReactNode } from 'react';
import { LinkButton } from './LinkButton';
export function PageHeader({
title,
@ -7,6 +8,7 @@ export function PageHeader({
label,
icon,
showBorder = true,
titleHref,
children,
}: {
title: string;
@ -14,6 +16,7 @@ export function PageHeader({
label?: ReactNode;
icon?: ReactNode;
showBorder?: boolean;
titleHref?: string;
allowEdit?: boolean;
className?: string;
children?: ReactNode;
@ -33,7 +36,13 @@ export function PageHeader({
{icon}
</Icon>
)}
{title && <Heading size={{ xs: '2', md: '3', lg: '4' }}>{title}</Heading>}
{title && titleHref ? (
<LinkButton href={titleHref} variant="quiet">
<Heading size={{ xs: '2', md: '3', lg: '4' }}>{title}</Heading>
</LinkButton>
) : (
title && <Heading size={{ xs: '2', md: '3', lg: '4' }}>{title}</Heading>
)}
</Row>
{description && (
<Text color="muted" truncate style={{ maxWidth: 600 }} title={description}>
@ -41,7 +50,9 @@ export function PageHeader({
</Text>
)}
</Column>
<Row justifyContent="flex-end">{children}</Row>
<Row justifyContent="flex-end" alignItems="center">
{children}
</Row>
</Grid>
);
}