diff --git a/src/app/(main)/MobileNav.tsx b/src/app/(main)/MobileNav.tsx index a9d9e861..aaa25846 100644 --- a/src/app/(main)/MobileNav.tsx +++ b/src/app/(main)/MobileNav.tsx @@ -42,7 +42,7 @@ export function MobileNav() { {({ close }) => { return ( <> - + {links.map(link => { return ( diff --git a/src/app/(main)/websites/[websiteId]/WebsitePanels.tsx b/src/app/(main)/websites/[websiteId]/WebsitePanels.tsx index 4a666f10..a91d562e 100644 --- a/src/app/(main)/websites/[websiteId]/WebsitePanels.tsx +++ b/src/app/(main)/websites/[websiteId]/WebsitePanels.tsx @@ -1,13 +1,15 @@ import { Grid, Heading, Row, Tab, TabList, TabPanel, Tabs } from '@umami/react-zen'; import { GridRow } from '@/components/common/GridRow'; import { Panel } from '@/components/common/Panel'; -import { useMessages } from '@/components/hooks'; +import { useMessages, useNavigation } from '@/components/hooks'; +import { EventsChart } from '@/components/metrics/EventsChart'; import { MetricsTable } from '@/components/metrics/MetricsTable'; import { WeeklyTraffic } from '@/components/metrics/WeeklyTraffic'; import { WorldMap } from '@/components/metrics/WorldMap'; export function WebsitePanels({ websiteId }: { websiteId: string }) { const { formatMessage, labels } = useMessages(); + const { pathname } = useNavigation(); const tableProps = { websiteId, limit: 10, @@ -16,6 +18,7 @@ export function WebsitePanels({ websiteId }: { websiteId: string }) { metric: formatMessage(labels.visitors), }; const rowProps = { minHeight: '570px' }; + const isSharePage = pathname.includes('/share/'); return ( @@ -113,6 +116,25 @@ export function WebsitePanels({ websiteId }: { websiteId: string }) { + {isSharePage && ( + + + {formatMessage(labels.events)} + + + + + + + + )} ); } diff --git a/src/app/share/[slug]/[[...path]]/ShareNav.tsx b/src/app/share/[slug]/[[...path]]/ShareNav.tsx index 11cc2f9b..e6ca3865 100644 --- a/src/app/share/[slug]/[[...path]]/ShareNav.tsx +++ b/src/app/share/[slug]/[[...path]]/ShareNav.tsx @@ -129,7 +129,7 @@ export function ShareNav({ const items = allItems .map(section => ({ label: section.label, - items: section.items.filter(item => parameters[item.id] === true), + items: section.items.filter(item => parameters[item.id] !== false), })) .filter(section => section.items.length > 0); @@ -144,12 +144,12 @@ export function ShareNav({ position={isMobile ? undefined : 'fixed'} padding="3" width={isMobile ? '100%' : collapsed ? '60px' : '240px'} - maxHeight="100dvh" - height="100dvh" + maxHeight="100vh" + height="100vh" border={isMobile ? undefined : 'right'} borderColor={isMobile ? undefined : '4'} > - + {!collapsed && ( diff --git a/src/components/input/MobileMenuButton.tsx b/src/components/input/MobileMenuButton.tsx index a4713ae0..8498b05a 100644 --- a/src/components/input/MobileMenuButton.tsx +++ b/src/components/input/MobileMenuButton.tsx @@ -9,7 +9,7 @@ export function MobileMenuButton(props: DialogProps) { - + diff --git a/src/lib/detect.ts b/src/lib/detect.ts index 2e78a1f3..910d122b 100644 --- a/src/lib/detect.ts +++ b/src/lib/detect.ts @@ -10,16 +10,6 @@ import { safeDecodeURIComponent } from '@/lib/url'; const MAXMIND = 'maxmind'; const PROVIDER_HEADERS = [ - // Umami custom headers (cloud mode only) - ...(process.env.CLOUD_MODE - ? [ - { - countryHeader: 'x-umami-client-country', - regionHeader: 'x-umami-client-region', - cityHeader: 'x-umami-client-city', - }, - ] - : []), // Cloudflare headers { countryHeader: 'cf-ipcountry', @@ -76,13 +66,13 @@ function decodeHeader(s: string | undefined | null): string | undefined | null { return Buffer.from(s, 'latin1').toString('utf-8'); } -export async function getLocation(ip: string = '', headers: Headers, skipHeaders: boolean) { +export async function getLocation(ip: string = '', headers: Headers, hasPayloadIP: boolean) { // Ignore local ips if (!ip || (await isLocalhost(ip))) { return null; } - if (!skipHeaders && !process.env.SKIP_LOCATION_HEADERS) { + if (!hasPayloadIP && !process.env.SKIP_LOCATION_HEADERS) { for (const provider of PROVIDER_HEADERS) { const countryHeader = headers.get(provider.countryHeader); if (countryHeader) { diff --git a/src/lib/ip.ts b/src/lib/ip.ts index a78c7e56..a0e3a825 100644 --- a/src/lib/ip.ts +++ b/src/lib/ip.ts @@ -1,7 +1,6 @@ import ipaddr from 'ipaddr.js'; export const IP_ADDRESS_HEADERS = [ - ...(process.env.CLOUD_MODE ? ['x-umami-client-ip'] : []), // Umami custom header (cloud mode only) 'true-client-ip', // CDN 'cf-connecting-ip', // Cloudflare 'fastly-client-ip', // Fastly @@ -82,7 +81,7 @@ export function getIpAddress(headers: Headers) { } if (header === 'forwarded') { - const match = ip.match(/for=(\[?[0-9a-fA-F:.]+]?)/); + const match = ip.match(/for=(\[?[0-9a-fA-F:.]+\]?)/); if (match) { return resolveIp(match[1]);