Use local Link wrapper with cloud-mode prefetch default
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Column, Grid, Row, Text } from '@umami/react-zen';
|
||||
import Link from 'next/link';
|
||||
import Link from '@/components/common/Link';
|
||||
import { WebsiteNav } from '@/app/(main)/websites/[websiteId]/WebsiteNav';
|
||||
import { IconLabel } from '@/components/common/IconLabel';
|
||||
import { useMessages, useNavigation } from '@/components/hooks';
|
||||
|
||||
@@ -24,7 +24,7 @@ import {
|
||||
Tooltip,
|
||||
TooltipTrigger,
|
||||
} from '@umami/react-zen';
|
||||
import Link from 'next/link';
|
||||
import Link from '@/components/common/Link';
|
||||
|
||||
export function SideNav(props: any) {
|
||||
const { t, labels } = useMessages();
|
||||
|
||||
@@ -3,7 +3,7 @@ import { NavMenu } from '@/components/common/NavMenu';
|
||||
import { useMessages, useNavigation } from '@/components/hooks';
|
||||
import { ArrowLeft, Globe, User, Users } from '@/components/icons';
|
||||
import { Column, Focusable, Row, Tooltip, TooltipTrigger } from '@umami/react-zen';
|
||||
import Link from 'next/link';
|
||||
import Link from '@/components/common/Link';
|
||||
|
||||
export function AdminNav({ onItemClick }: { onItemClick?: () => void }) {
|
||||
const { t, labels } = useMessages();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { DataColumn, DataTable, Dialog, Icon, MenuItem, Modal, Row, Text } from '@umami/react-zen';
|
||||
import Link from 'next/link';
|
||||
import Link from '@/components/common/Link';
|
||||
import { useState } from 'react';
|
||||
import { DateDistance } from '@/components/common/DateDistance';
|
||||
import { useMessages } from '@/components/hooks';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { DataColumn, DataTable, Icon, MenuItem, Modal, Row, Text } from '@umami/react-zen';
|
||||
import Link from 'next/link';
|
||||
import Link from '@/components/common/Link';
|
||||
import { useState } from 'react';
|
||||
import { DateDistance } from '@/components/common/DateDistance';
|
||||
import { useMessages } from '@/components/hooks';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { DataColumn, DataTable, Dialog, Icon, MenuItem, Modal, Row, Text } from '@umami/react-zen';
|
||||
import Link from 'next/link';
|
||||
import Link from '@/components/common/Link';
|
||||
import { useState } from 'react';
|
||||
import { WebsiteDeleteForm } from '@/app/(main)/websites/[websiteId]/settings/WebsiteDeleteForm';
|
||||
import { DateDistance } from '@/components/common/DateDistance';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { DataColumn, DataTable, type DataTableProps, Row } from '@umami/react-zen';
|
||||
import Link from 'next/link';
|
||||
import Link from '@/components/common/Link';
|
||||
import { DateDistance } from '@/components/common/DateDistance';
|
||||
import { useMessages, useNavigation } from '@/components/hooks';
|
||||
import { BoardDeleteButton } from './BoardDeleteButton';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use client';
|
||||
import { Column } from '@umami/react-zen';
|
||||
import Link from 'next/link';
|
||||
import Link from '@/components/common/Link';
|
||||
import { BoardEditForm } from '@/app/(main)/boards/BoardEditForm';
|
||||
import { BoardShareDialog } from '@/app/(main)/boards/[boardId]/BoardShareDialog';
|
||||
import { IconLabel } from '@/components/common/IconLabel';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use client';
|
||||
import { Button, Column, Grid, Heading } from '@umami/react-zen';
|
||||
import Link from 'next/link';
|
||||
import Link from '@/components/common/Link';
|
||||
import Script from 'next/script';
|
||||
import { WebsiteChart } from '@/app/(main)/websites/[websiteId]/WebsiteChart';
|
||||
import { PageBody } from '@/components/common/PageBody';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { DataColumn, DataTable, type DataTableProps, Row } from '@umami/react-zen';
|
||||
import Link from 'next/link';
|
||||
import Link from '@/components/common/Link';
|
||||
import { DateDistance } from '@/components/common/DateDistance';
|
||||
import { ExternalLink } from '@/components/common/ExternalLink';
|
||||
import { useMessages, useNavigation, useSlug } from '@/components/hooks';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use client';
|
||||
import { Column } from '@umami/react-zen';
|
||||
import Link from 'next/link';
|
||||
import Link from '@/components/common/Link';
|
||||
import { LinkEditForm } from '@/app/(main)/links/LinkEditForm';
|
||||
import { LinkProvider } from '@/app/(main)/links/LinkProvider';
|
||||
import { LinkShareForm } from '@/app/(main)/links/[linkId]/LinkShareForm';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { DataColumn, DataTable, type DataTableProps, Row } from '@umami/react-zen';
|
||||
import Link from 'next/link';
|
||||
import Link from '@/components/common/Link';
|
||||
import { DateDistance } from '@/components/common/DateDistance';
|
||||
import { ExternalLink } from '@/components/common/ExternalLink';
|
||||
import { useMessages, useNavigation, useSlug } from '@/components/hooks';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use client';
|
||||
import { Column } from '@umami/react-zen';
|
||||
import Link from 'next/link';
|
||||
import Link from '@/components/common/Link';
|
||||
import { PixelEditForm } from '@/app/(main)/pixels/PixelEditForm';
|
||||
import { PixelProvider } from '@/app/(main)/pixels/PixelProvider';
|
||||
import { PixelShareForm } from '@/app/(main)/pixels/[pixelId]/PixelShareForm';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Column, Focusable, Row, Text, Tooltip, TooltipTrigger } from '@umami/react-zen';
|
||||
import Link from 'next/link';
|
||||
import Link from '@/components/common/Link';
|
||||
import { IconLabel } from '@/components/common/IconLabel';
|
||||
import { useMessages, useNavigation } from '@/components/hooks';
|
||||
import { ArrowLeft, Settings2, UserCircle, Users } from '@/components/icons';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import Link from 'next/link';
|
||||
import Link from '@/components/common/Link';
|
||||
import { DataGrid } from '@/components/common/DataGrid';
|
||||
import { useLoginQuery, useNavigation, useUserTeamsQuery } from '@/components/hooks';
|
||||
import { TeamsTable } from './TeamsTable';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { DataColumn, DataTable, Row } from '@umami/react-zen';
|
||||
import Link from 'next/link';
|
||||
import Link from '@/components/common/Link';
|
||||
import { TeamMemberEditButton } from '@/app/(main)/teams/[teamId]/TeamMemberEditButton';
|
||||
import { TeamMemberRemoveButton } from '@/app/(main)/teams/[teamId]/TeamMemberRemoveButton';
|
||||
import { useMessages } from '@/components/hooks';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Icon, Row } from '@umami/react-zen';
|
||||
import Link from 'next/link';
|
||||
import Link from '@/components/common/Link';
|
||||
import { DataGrid } from '@/components/common/DataGrid';
|
||||
import { useLoginQuery, useNavigation, useUserWebsitesQuery } from '@/components/hooks';
|
||||
import { Favicon } from '@/index';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Column, Focusable, Row, Text, Tooltip, TooltipTrigger } from '@umami/react-zen';
|
||||
import Link from 'next/link';
|
||||
import Link from '@/components/common/Link';
|
||||
import { IconLabel } from '@/components/common/IconLabel';
|
||||
import { useMessages, useNavigation, useWebsiteNavItems } from '@/components/hooks';
|
||||
import { ArrowLeft } from '@/components/icons';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { DataColumn, DataTable, type DataTableProps, Row } from '@umami/react-zen';
|
||||
import Link from 'next/link';
|
||||
import Link from '@/components/common/Link';
|
||||
import { CohortDeleteButton } from '@/app/(main)/websites/[websiteId]/cohorts/CohortDeleteButton';
|
||||
import { CohortEditButton } from '@/app/(main)/websites/[websiteId]/cohorts/CohortEditButton';
|
||||
import { DateDistance } from '@/components/common/DateDistance';
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
Row,
|
||||
Text,
|
||||
} from '@umami/react-zen';
|
||||
import Link from 'next/link';
|
||||
import Link from '@/components/common/Link';
|
||||
import { Avatar } from '@/components/common/Avatar';
|
||||
import { DateDistance } from '@/components/common/DateDistance';
|
||||
import { IconLabel } from '@/components/common/IconLabel';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Column, Heading, Row, SearchField, Text } from '@umami/react-zen';
|
||||
import Link from 'next/link';
|
||||
import Link from '@/components/common/Link';
|
||||
import { useMemo, useState } from 'react';
|
||||
import { FixedSizeList } from 'react-window';
|
||||
import { SessionModal } from '@/app/(main)/websites/[websiteId]/sessions/SessionModal';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Button, DataColumn, DataTable, type DataTableProps, Icon } from '@umami/react-zen';
|
||||
import { Play } from 'lucide-react';
|
||||
import Link from 'next/link';
|
||||
import Link from '@/components/common/Link';
|
||||
import { Avatar } from '@/components/common/Avatar';
|
||||
import { DateDistance } from '@/components/common/DateDistance';
|
||||
import { TypeIcon } from '@/components/common/TypeIcon';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { DataColumn, DataTable, type DataTableProps, Row } from '@umami/react-zen';
|
||||
import Link from 'next/link';
|
||||
import Link from '@/components/common/Link';
|
||||
import { SegmentDeleteButton } from '@/app/(main)/websites/[websiteId]/segments/SegmentDeleteButton';
|
||||
import { SegmentEditButton } from '@/app/(main)/websites/[websiteId]/segments/SegmentEditButton';
|
||||
import { DateDistance } from '@/components/common/DateDistance';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { DataColumn, DataTable, type DataTableProps } from '@umami/react-zen';
|
||||
import Link from 'next/link';
|
||||
import Link from '@/components/common/Link';
|
||||
import { Avatar } from '@/components/common/Avatar';
|
||||
import { DateDistance } from '@/components/common/DateDistance';
|
||||
import { TypeIcon } from '@/components/common/TypeIcon';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Row } from '@umami/react-zen';
|
||||
import Link from 'next/link';
|
||||
import Link from '@/components/common/Link';
|
||||
import { IconLabel } from '@/components/common/IconLabel';
|
||||
import { PageHeader } from '@/components/common/PageHeader';
|
||||
import { useMessages, useNavigation, useWebsite } from '@/components/hooks';
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
Tooltip,
|
||||
TooltipTrigger,
|
||||
} from '@umami/react-zen';
|
||||
import Link from 'next/link';
|
||||
import Link from '@/components/common/Link';
|
||||
import { ShareBranding } from './ShareBranding';
|
||||
|
||||
export function ShareNav({
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
import { Icon, Row, Text } from '@umami/react-zen';
|
||||
import Link, { type LinkProps } from 'next/link';
|
||||
import Link, { type LinkProps } from '@/components/common/Link';
|
||||
import type { ReactNode } from 'react';
|
||||
import { ExternalLink as LinkIcon } from '@/components/icons';
|
||||
|
||||
export function ExternalLink({
|
||||
href,
|
||||
children,
|
||||
prefetch = false,
|
||||
...props
|
||||
}: LinkProps & { href: string; children: ReactNode }) {
|
||||
return (
|
||||
<Row alignItems="center" overflow="hidden" gap>
|
||||
<Text title={href} truncate>
|
||||
<Link {...props} href={href} target="_blank">
|
||||
<Link {...props} href={href} target="_blank" prefetch={prefetch}>
|
||||
{children}
|
||||
</Link>
|
||||
</Text>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Icon, Row, Text } from '@umami/react-zen';
|
||||
import Link from 'next/link';
|
||||
import Link from '@/components/common/Link';
|
||||
import { type HTMLAttributes, type ReactNode, useState } from 'react';
|
||||
import { useMessages, useNavigation } from '@/components/hooks';
|
||||
import { ExternalLink } from '@/components/icons';
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import NextLink from 'next/link';
|
||||
import { type ComponentPropsWithoutRef, forwardRef } from 'react';
|
||||
|
||||
export type LinkProps = ComponentPropsWithoutRef<typeof NextLink>;
|
||||
const cloudMode = !!process.env.cloudMode;
|
||||
|
||||
const Link = forwardRef<HTMLAnchorElement, LinkProps>(function Link({ prefetch, ...props }, ref) {
|
||||
return <NextLink ref={ref} prefetch={cloudMode ? (prefetch ?? false) : prefetch} {...props} />;
|
||||
});
|
||||
|
||||
export default Link;
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Button, type ButtonProps } from '@umami/react-zen';
|
||||
import Link from 'next/link';
|
||||
import Link from '@/components/common/Link';
|
||||
import type { ReactNode } from 'react';
|
||||
import { useLocale } from '@/components/hooks';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Column, Heading, Row, Text } from '@umami/react-zen';
|
||||
import Link from 'next/link';
|
||||
import Link from '@/components/common/Link';
|
||||
import { IconLabel } from '@/components/common/IconLabel';
|
||||
|
||||
interface NavMenuData {
|
||||
|
||||
Reference in New Issue
Block a user