diff --git a/src/app/(main)/websites/[websiteId]/(reports)/revenue/RevenuePage.tsx b/src/app/(main)/websites/[websiteId]/(reports)/revenue/RevenuePage.tsx index 3e429c187..4dc19e012 100644 --- a/src/app/(main)/websites/[websiteId]/(reports)/revenue/RevenuePage.tsx +++ b/src/app/(main)/websites/[websiteId]/(reports)/revenue/RevenuePage.tsx @@ -1,13 +1,14 @@ 'use client'; import { Column } from '@umami/react-zen'; import { WebsiteControls } from '@/app/(main)/websites/[websiteId]/WebsiteControls'; -import { useDateRange } from '@/components/hooks'; +import { useDateRange, useTimezone } from '@/components/hooks'; import { Revenue } from './Revenue'; export function RevenuePage({ websiteId }: { websiteId: string }) { + const { timezone } = useTimezone(); const { dateRange: { startDate, endDate, unit }, - } = useDateRange(); + } = useDateRange({ timezone }); return ( diff --git a/src/app/(main)/websites/[websiteId]/sessions/SessionModal.tsx b/src/app/(main)/websites/[websiteId]/sessions/SessionModal.tsx index a387ec56e..dd9ce4690 100644 --- a/src/app/(main)/websites/[websiteId]/sessions/SessionModal.tsx +++ b/src/app/(main)/websites/[websiteId]/sessions/SessionModal.tsx @@ -10,9 +10,11 @@ export interface SessionModalProps extends ModalProps { export function SessionModal({ websiteId, ...props }: SessionModalProps) { const { router, + pathname, query: { session }, updateParams, } = useNavigation(); + const isSharePage = pathname.includes('/share/'); const handleOpenChange = (isOpen: boolean) => { if (!isOpen) { router.push(updateParams({ session: undefined })); @@ -32,7 +34,7 @@ export function SessionModal({ websiteId, ...props }: SessionModalProps) { {({ close }) => ( - close()} /> + close()} /> )} diff --git a/src/app/(main)/websites/[websiteId]/sessions/SessionProfile.tsx b/src/app/(main)/websites/[websiteId]/sessions/SessionProfile.tsx index 5f94defe5..9671c995e 100644 --- a/src/app/(main)/websites/[websiteId]/sessions/SessionProfile.tsx +++ b/src/app/(main)/websites/[websiteId]/sessions/SessionProfile.tsx @@ -23,10 +23,12 @@ import { SessionStats } from './SessionStats'; export function SessionProfile({ websiteId, sessionId, + showReplays = true, onClose, }: { websiteId: string; sessionId: string; + showReplays?: boolean; onClose?: () => void; }) { const { data, isLoading, error } = useWebsiteSessionQuery(websiteId, sessionId); @@ -65,7 +67,7 @@ export function SessionProfile({ {t(labels.activity)} {t(labels.properties)} - {t(labels.replays)} + {showReplays && {t(labels.replays)}} - - - + {showReplays && ( + + + + )} diff --git a/src/app/(main)/websites/[websiteId]/sessions/SessionsDataTable.tsx b/src/app/(main)/websites/[websiteId]/sessions/SessionsDataTable.tsx index 4b07a16c7..1b8f441a5 100644 --- a/src/app/(main)/websites/[websiteId]/sessions/SessionsDataTable.tsx +++ b/src/app/(main)/websites/[websiteId]/sessions/SessionsDataTable.tsx @@ -1,15 +1,20 @@ import { DataGrid } from '@/components/common/DataGrid'; -import { useWebsiteSessionsQuery } from '@/components/hooks'; +import { useNavigation, useWebsiteSessionsQuery } from '@/components/hooks'; import { SessionsTable } from './SessionsTable'; export function SessionsDataTable({ websiteId }: { websiteId: string }) { const queryResult = useWebsiteSessionsQuery(websiteId); + const { updateParams } = useNavigation(); return ( - {({ data }) => { - return ; - }} + {({ data }) => ( + updateParams({ session: row.id })} + /> + )} ); } diff --git a/src/app/(main)/websites/[websiteId]/sessions/SessionsPage.tsx b/src/app/(main)/websites/[websiteId]/sessions/SessionsPage.tsx index adce5ec9c..f891f2ad7 100644 --- a/src/app/(main)/websites/[websiteId]/sessions/SessionsPage.tsx +++ b/src/app/(main)/websites/[websiteId]/sessions/SessionsPage.tsx @@ -5,6 +5,7 @@ import { WebsiteControls } from '@/app/(main)/websites/[websiteId]/WebsiteContro import { Panel } from '@/components/common/Panel'; import { useMessages } from '@/components/hooks'; import { getItem, setItem } from '@/lib/storage'; +import { SessionModal } from './SessionModal'; import { SessionProperties } from './SessionProperties'; import { SessionsDataTable } from './SessionsDataTable'; @@ -22,6 +23,7 @@ export function SessionsPage({ websiteId }) { return ( + diff --git a/src/app/(main)/websites/[websiteId]/sessions/SessionsTable.tsx b/src/app/(main)/websites/[websiteId]/sessions/SessionsTable.tsx index b4c684a47..1f3d451a7 100644 --- a/src/app/(main)/websites/[websiteId]/sessions/SessionsTable.tsx +++ b/src/app/(main)/websites/[websiteId]/sessions/SessionsTable.tsx @@ -17,11 +17,7 @@ export function SessionsTable({ {(row: any) => ( - + )} diff --git a/src/app/share/ShareProvider.tsx b/src/app/share/ShareProvider.tsx index a09a3776e..60e989014 100644 --- a/src/app/share/ShareProvider.tsx +++ b/src/app/share/ShareProvider.tsx @@ -27,6 +27,7 @@ const ALL_SECTION_IDS = [ 'events', 'sessions', 'realtime', + 'performance', 'compare', 'breakdown', 'goals', @@ -59,7 +60,7 @@ export function ShareProvider({ slug, children }: { slug: string; children: Reac const isWebsiteShare = share?.shareType === ENTITY_TYPE.website; const allowedSections = isWebsiteShare && share?.parameters - ? ALL_SECTION_IDS.filter(id => share.parameters[id] !== false) + ? ALL_SECTION_IDS.filter(id => share.parameters[id] === true) : []; const shouldRedirect = isWebsiteShare && diff --git a/src/app/share/[slug]/[[...path]]/SharePage.tsx b/src/app/share/[slug]/[[...path]]/SharePage.tsx index 283b3f38f..750097aa1 100644 --- a/src/app/share/[slug]/[[...path]]/SharePage.tsx +++ b/src/app/share/[slug]/[[...path]]/SharePage.tsx @@ -23,7 +23,7 @@ import { useShare } from '@/components/hooks'; import { MobileMenuButton } from '@/components/input/MobileMenuButton'; import { ENTITY_TYPE } from '@/lib/constants'; import { Column, Grid, Row, useTheme } from '@umami/react-zen'; -import { usePathname } from 'next/navigation'; +import { usePathname, useRouter } from 'next/navigation'; import { useEffect, useState } from 'react'; import { ShareFooter } from './ShareFooter'; import { ShareNav } from './ShareNav'; @@ -69,9 +69,10 @@ export function SharePage() { }; const share = useShare(); const { setTheme } = useTheme(); + const router = useRouter(); const pathname = usePathname(); const path = getSharePath(pathname); - const { websiteId, boardId, pixelId, linkId, parameters = {}, shareType } = share; + const { slug, websiteId, boardId, pixelId, linkId, parameters = {}, shareType } = share; useEffect(() => { const url = new URL(window?.location?.href); @@ -102,9 +103,10 @@ export function SharePage() { // Check if the requested path is allowed const pageKey = path || ''; - const isAllowed = pageKey === '' || pageKey === 'overview' || parameters[pageKey] !== false; + const isAllowed = pageKey === '' || parameters[pageKey] === true; if (!isAllowed) { + router.replace(`/share/${slug}`); return null; } @@ -125,7 +127,7 @@ export function SharePage() { - +