From f5bf148b2b2f675d43b5940444bed9a970530e52 Mon Sep 17 00:00:00 2001 From: Francis Cao Date: Tue, 21 Oct 2025 21:59:20 -0700 Subject: [PATCH] add close button on session modal --- .../[websiteId]/sessions/SessionModal.tsx | 8 +++-- .../[websiteId]/sessions/SessionProfile.tsx | 32 +++++++++++++++++-- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/src/app/(main)/websites/[websiteId]/sessions/SessionModal.tsx b/src/app/(main)/websites/[websiteId]/sessions/SessionModal.tsx index e751743b..6c34b97b 100644 --- a/src/app/(main)/websites/[websiteId]/sessions/SessionModal.tsx +++ b/src/app/(main)/websites/[websiteId]/sessions/SessionModal.tsx @@ -29,9 +29,11 @@ export function SessionModal({ websiteId, ...props }: SessionModalProps) { > - - - + {({ close }) => ( + + close()} /> + + )} diff --git a/src/app/(main)/websites/[websiteId]/sessions/SessionProfile.tsx b/src/app/(main)/websites/[websiteId]/sessions/SessionProfile.tsx index f8c01137..e83c7957 100644 --- a/src/app/(main)/websites/[websiteId]/sessions/SessionProfile.tsx +++ b/src/app/(main)/websites/[websiteId]/sessions/SessionProfile.tsx @@ -1,4 +1,14 @@ -import { TextField, Row, Column, Tabs, TabList, Tab, TabPanel } from '@umami/react-zen'; +import { + TextField, + Row, + Column, + Tabs, + TabList, + Tab, + TabPanel, + Button, + Icon, +} from '@umami/react-zen'; import { Avatar } from '@/components/common/Avatar'; import { LoadingPanel } from '@/components/common/LoadingPanel'; import { useMessages, useWebsiteSessionQuery } from '@/components/hooks'; @@ -6,8 +16,17 @@ import { SessionActivity } from './SessionActivity'; import { SessionData } from './SessionData'; import { SessionInfo } from './SessionInfo'; import { SessionStats } from './SessionStats'; +import { X } from 'lucide-react'; -export function SessionProfile({ websiteId, sessionId }: { websiteId: string; sessionId: string }) { +export function SessionProfile({ + websiteId, + sessionId, + onClose, +}: { + websiteId: string; + sessionId: string; + onClose?: () => void; +}) { const { data, isLoading, error } = useWebsiteSessionQuery(websiteId, sessionId); const { formatMessage, labels } = useMessages(); @@ -21,6 +40,15 @@ export function SessionProfile({ websiteId, sessionId }: { websiteId: string; se > {data && ( + {onClose && ( + + + + )}