diff --git a/src/app/(main)/reports/[reportId]/BaseParameters.tsx b/src/app/(main)/reports/[reportId]/BaseParameters.tsx index 1da70d2b..49c3347e 100644 --- a/src/app/(main)/reports/[reportId]/BaseParameters.tsx +++ b/src/app/(main)/reports/[reportId]/BaseParameters.tsx @@ -3,7 +3,7 @@ import { FormRow } from 'react-basics'; import { parseDateRange } from 'lib/date'; import DateFilter from 'components/input/DateFilter'; import WebsiteSelect from 'components/input/WebsiteSelect'; -import { useMessages, useTeamUrl } from 'components/hooks'; +import { useMessages, useTeamUrl, useWebsite } from 'components/hooks'; import { ReportContext } from './Report'; export interface BaseParametersProps { @@ -22,10 +22,11 @@ export function BaseParameters({ const { report, updateReport } = useContext(ReportContext); const { formatMessage, labels } = useMessages(); const { teamId } = useTeamUrl(); - const { parameters } = report || {}; const { websiteId, dateRange } = parameters || {}; const { value, startDate, endDate } = dateRange || {}; + const { data: website } = useWebsite(websiteId); + const { name } = website || {}; const handleWebsiteSelect = (websiteId: string) => { updateReport({ websiteId, parameters: { websiteId } }); @@ -39,8 +40,10 @@ export function BaseParameters({ <> {showWebsiteSelect && ( - {allowWebsiteSelect && ( + {allowWebsiteSelect ? ( + ) : ( + name )} )} diff --git a/src/app/(main)/reports/event-data/EventDataParameters.tsx b/src/app/(main)/reports/event-data/EventDataParameters.tsx index 2ee77a43..efa9fb67 100644 --- a/src/app/(main)/reports/event-data/EventDataParameters.tsx +++ b/src/app/(main)/reports/event-data/EventDataParameters.tsx @@ -29,7 +29,7 @@ function useFields(websiteId, startDate, endDate) { export function EventDataParameters() { const { report, runReport, updateReport, isRunning } = useContext(ReportContext); const { formatMessage, labels, messages } = useMessages(); - const { parameters } = report || {}; + const { id, parameters } = report || {}; const { websiteId, dateRange, fields, filters, groups } = parameters || {}; const { startDate, endDate } = dateRange || {}; const queryEnabled = websiteId && dateRange && fields?.length; @@ -93,7 +93,7 @@ export function EventDataParameters() { return (
- + {!hasData && } {parametersSelected && hasData && diff --git a/src/app/(main)/reports/funnel/FunnelParameters.tsx b/src/app/(main)/reports/funnel/FunnelParameters.tsx index c4f8f384..6eefbaae 100644 --- a/src/app/(main)/reports/funnel/FunnelParameters.tsx +++ b/src/app/(main)/reports/funnel/FunnelParameters.tsx @@ -22,7 +22,7 @@ export function FunnelParameters() { const { report, runReport, updateReport, isRunning } = useContext(ReportContext); const { formatMessage, labels } = useMessages(); - const { parameters } = report || {}; + const { id, parameters } = report || {}; const { websiteId, dateRange, urls } = parameters || {}; const queryDisabled = !websiteId || !dateRange || urls?.length < 2; @@ -62,7 +62,7 @@ export function FunnelParameters() { return ( - + - + {parametersSelected && parameterGroups.map(({ id, label }) => { return ( diff --git a/src/app/(main)/reports/retention/RetentionParameters.tsx b/src/app/(main)/reports/retention/RetentionParameters.tsx index 9bc1c548..f441177c 100644 --- a/src/app/(main)/reports/retention/RetentionParameters.tsx +++ b/src/app/(main)/reports/retention/RetentionParameters.tsx @@ -10,7 +10,7 @@ export function RetentionParameters() { const { report, runReport, isRunning, updateReport } = useContext(ReportContext); const { formatMessage, labels } = useMessages(); - const { parameters } = report || {}; + const { id, parameters } = report || {}; const { websiteId, dateRange } = parameters || {}; const { startDate } = dateRange || {}; const queryDisabled = !websiteId || !dateRange; @@ -30,7 +30,7 @@ export function RetentionParameters() { return ( - + diff --git a/src/app/(main)/settings/websites/[websiteId]/WebsiteData.tsx b/src/app/(main)/settings/websites/[websiteId]/WebsiteData.tsx index c75ef74b..44872f88 100644 --- a/src/app/(main)/settings/websites/[websiteId]/WebsiteData.tsx +++ b/src/app/(main)/settings/websites/[websiteId]/WebsiteData.tsx @@ -1,6 +1,6 @@ import { Button, Modal, ModalTrigger, ActionForm, useToasts } from 'react-basics'; import { useRouter } from 'next/navigation'; -import { useMessages, useModified } from 'components/hooks'; +import { useMessages, useModified, useTeamUrl } from 'components/hooks'; import WebsiteDeleteForm from './WebsiteDeleteForm'; import WebsiteResetForm from './WebsiteResetForm'; @@ -9,6 +9,7 @@ export function WebsiteData({ websiteId, onSave }: { websiteId: string; onSave?: const router = useRouter(); const { showToast } = useToasts(); const { touch } = useModified(); + const { teamId, renderTeamUrl } = useTeamUrl(); const handleReset = async () => { showToast({ message: formatMessage(messages.saved), variant: 'success' }); @@ -16,8 +17,13 @@ export function WebsiteData({ websiteId, onSave }: { websiteId: string; onSave?: }; const handleDelete = async () => { - touch('websites'); - router.push('/settings/websites'); + if (teamId) { + touch('teams:websites'); + router.push(renderTeamUrl('/settings/websites')); + } else { + touch('websites'); + router.push('/settings/websites'); + } }; return (