diff --git a/frontend/__snapshots__/scenes-app-insights-error-empty-states--long-loading--light.png b/frontend/__snapshots__/scenes-app-insights-error-empty-states--long-loading--light.png index 208c245f98273..85e97d00c2662 100644 Binary files a/frontend/__snapshots__/scenes-app-insights-error-empty-states--long-loading--light.png and b/frontend/__snapshots__/scenes-app-insights-error-empty-states--long-loading--light.png differ diff --git a/frontend/src/scenes/funnels/funnelCorrelationDetailsLogic.test.ts b/frontend/src/scenes/funnels/funnelCorrelationDetailsLogic.test.ts index 9d807251d6761..2b3be404a5cd3 100644 --- a/frontend/src/scenes/funnels/funnelCorrelationDetailsLogic.test.ts +++ b/frontend/src/scenes/funnels/funnelCorrelationDetailsLogic.test.ts @@ -69,7 +69,7 @@ describe('funnelCorrelationDetailsLogic', () => { describe('correlationMatrixAndScore', () => { it('returns calculated values based on selected details', async () => { await expectLogic(logic, () => - logic.actions.setFunnelCorrelationDetails({ + logic.actions.openCorrelationDetailsModal({ event: { event: 'some event', elements: [], properties: {} }, success_people_url: '', failure_people_url: '', diff --git a/frontend/src/scenes/funnels/funnelCorrelationDetailsLogic.ts b/frontend/src/scenes/funnels/funnelCorrelationDetailsLogic.ts index ba55207cb746f..a906dbda37612 100644 --- a/frontend/src/scenes/funnels/funnelCorrelationDetailsLogic.ts +++ b/frontend/src/scenes/funnels/funnelCorrelationDetailsLogic.ts @@ -15,23 +15,31 @@ export const funnelCorrelationDetailsLogic = kea ({ payload }), + openCorrelationDetailsModal: (payload: FunnelCorrelation) => ({ payload }), + closeCorrelationDetailsModal: true, }), reducers({ - funnelCorrelationDetails: [ + correlationDetailsModalOpen: [ + false, + { + openCorrelationDetailsModal: () => true, + closeCorrelationDetailsModal: () => false, + }, + ], + correlationDetails: [ null as null | FunnelCorrelation, { - setFunnelCorrelationDetails: (_, { payload }) => payload, + openCorrelationDetailsModal: (_, { payload }) => payload, }, ], }), selectors({ correlationMatrixAndScore: [ - (s) => [s.funnelCorrelationDetails, s.steps], + (s) => [s.correlationDetails, s.steps], ( - funnelCorrelationDetails, + correlationDetails, steps ): { truePositive: number @@ -41,7 +49,7 @@ export const funnelCorrelationDetailsLogic = kea { - if (!funnelCorrelationDetails) { + if (!correlationDetails) { return { truePositive: 0, falsePositive: 0, @@ -54,8 +62,8 @@ export const funnelCorrelationDetailsLogic = kea setFunnelCorrelationDetails(record), + onClick: () => openCorrelationDetailsModal(record), }, ] : []), @@ -56,13 +56,13 @@ export const PropertyCorrelationActionsCell = ({ record }: { record: FunnelCorre const { insightProps } = useValues(insightLogic) const { isPropertyExcludedFromProject } = useValues(funnelPropertyCorrelationLogic(insightProps)) const { excludePropertyFromProject } = useActions(funnelPropertyCorrelationLogic(insightProps)) - const { setFunnelCorrelationDetails } = useActions(funnelCorrelationDetailsLogic(insightProps)) + const { openCorrelationDetailsModal } = useActions(funnelCorrelationDetailsLogic(insightProps)) const propertyName = (record.event.event || '').split('::')[0] const buttons: CorrelationActionsCellComponentButtonProps[] = [ { children: 'View correlation details', - onClick: () => setFunnelCorrelationDetails(record), + onClick: () => openCorrelationDetailsModal(record), }, { children: 'Exclude property from project', diff --git a/frontend/src/scenes/insights/views/Funnels/CorrelationMatrix.scss b/frontend/src/scenes/insights/views/Funnels/CorrelationMatrix.scss index 256c96fa8223e..cb20c81271fb2 100644 --- a/frontend/src/scenes/insights/views/Funnels/CorrelationMatrix.scss +++ b/frontend/src/scenes/insights/views/Funnels/CorrelationMatrix.scss @@ -1,53 +1,46 @@ -.correlation-matrix { - .ant-modal-body { - display: flex; - justify-content: center; - } - - .correlation-table-wrapper { - table { - margin: 0 auto; - border-spacing: 0; - border-collapse: separate; - border: 1px solid var(--border); - border-radius: var(--radius); - - td { - padding: 0.5rem 1rem; - text-align: center; - border-top: 1px solid var(--border); - border-left: 1px solid var(--border); - - .percentage { - padding-bottom: 0.25rem; - font-weight: bold; - } +.correlation-table-wrapper { + table { + margin: 0 auto; + border-spacing: 0; + border-collapse: separate; + border: 1px solid var(--border); + border-radius: var(--radius); + + td { + padding: 0.5rem 1rem; + text-align: center; + border-top: 1px solid var(--border); + border-left: 1px solid var(--border); + + .percentage { + padding-bottom: 0.25rem; + font-weight: bold; + } - &:first-child { - border-left: none; - } + &:first-child { + border-left: none; } + } - .table-title { - color: var(--muted-alt); + .table-title { + color: var(--muted-alt); - td { - border-top: none; - } + td { + border-top: none; } + } - thead, - .horizontal-header { - font-weight: bold; - color: var(--muted); - text-transform: uppercase; - background-color: var(--antd-table-background-dark); - } + thead, + .horizontal-header { + font-weight: bold; + color: var(--muted); + text-transform: uppercase; + background-color: var(--mid); + } - tbody { - td:not(.horizontal-header) { - text-align: right; - } + tbody { + td:not(.horizontal-header) { + text-align: right; } } } diff --git a/frontend/src/scenes/insights/views/Funnels/CorrelationMatrix.tsx b/frontend/src/scenes/insights/views/Funnels/CorrelationMatrix.tsx index 43bcf9e4cbcd1..eef1f07e5b151 100644 --- a/frontend/src/scenes/insights/views/Funnels/CorrelationMatrix.tsx +++ b/frontend/src/scenes/insights/views/Funnels/CorrelationMatrix.tsx @@ -1,7 +1,7 @@ import './CorrelationMatrix.scss' import { IconCheckCircle } from '@posthog/icons' -import { Button, Modal } from 'antd' +import { LemonButton, LemonModal } from '@posthog/lemon-ui' import clsx from 'clsx' import { useActions, useValues } from 'kea' import { PropertyKeyInfo } from 'lib/components/PropertyKeyInfo' @@ -22,22 +22,20 @@ import { FunnelCorrelationResultsType, FunnelCorrelationType } from '~/types' export function CorrelationMatrix(): JSX.Element { const { insightProps } = useValues(insightLogic) const { correlationsLoading } = useValues(funnelCorrelationLogic(insightProps)) - const { funnelCorrelationDetails, correlationMatrixAndScore } = useValues( + const { correlationDetailsModalOpen, correlationDetails, correlationMatrixAndScore } = useValues( funnelCorrelationDetailsLogic(insightProps) ) - const { setFunnelCorrelationDetails } = useActions(funnelCorrelationDetailsLogic(insightProps)) + const { closeCorrelationDetailsModal } = useActions(funnelCorrelationDetailsLogic(insightProps)) const { openCorrelationPersonsModal } = useActions(funnelPersonsModalLogic(insightProps)) - const actor = funnelCorrelationDetails?.result_type === FunnelCorrelationResultsType.Events ? 'event' : 'property' + const actor = correlationDetails?.result_type === FunnelCorrelationResultsType.Events ? 'event' : 'property' const action = - funnelCorrelationDetails?.result_type === FunnelCorrelationResultsType.Events - ? 'performed event' - : 'have property' + correlationDetails?.result_type === FunnelCorrelationResultsType.Events ? 'performed event' : 'have property' let displayName = <> - if (funnelCorrelationDetails) { - const { first_value, second_value } = parseDisplayNameForCorrelation(funnelCorrelationDetails) + if (correlationDetails) { + const { first_value, second_value } = parseDisplayNameForCorrelation(correlationDetails) displayName = ( <> @@ -63,16 +61,11 @@ export function CorrelationMatrix(): JSX.Element { ) - const dismiss = (): void => setFunnelCorrelationDetails(null) - return ( - Dismiss} - width={600} + Dismiss} title="Correlation details" >
@@ -80,7 +73,7 @@ export function CorrelationMatrix(): JSX.Element {
- ) : funnelCorrelationDetails ? ( + ) : correlationDetails ? ( <>

The table below displays the correlation details for users who {action} {displayName} @@ -93,7 +86,7 @@ export function CorrelationMatrix(): JSX.Element { - {funnelCorrelationDetails?.result_type === FunnelCorrelationResultsType.Events + {correlationDetails?.result_type === FunnelCorrelationResultsType.Events ? 'Performed event' : 'Has property'} @@ -119,7 +112,7 @@ export function CorrelationMatrix(): JSX.Element { ) : ( { - openCorrelationPersonsModal(funnelCorrelationDetails, true) + openCorrelationPersonsModal(correlationDetails, true) }} > {pluralize(truePositive, 'user', undefined, true)} @@ -141,7 +134,7 @@ export function CorrelationMatrix(): JSX.Element { ) : ( { - openCorrelationPersonsModal(funnelCorrelationDetails, false) + openCorrelationPersonsModal(correlationDetails, false) }} > {pluralize(falseNegative, 'user', undefined, true)} @@ -188,9 +181,8 @@ export function CorrelationMatrix(): JSX.Element {

- {capitalizeFirstLetter(funnelCorrelationDetails?.result_type || '')} {displayName}{' '} - has a{' '} - {funnelCorrelationDetails?.correlation_type === FunnelCorrelationType.Success ? ( + {capitalizeFirstLetter(correlationDetails?.result_type || '')} {displayName} has a{' '} + {correlationDetails?.correlation_type === FunnelCorrelationType.Success ? ( @@ -231,6 +223,6 @@ export function CorrelationMatrix(): JSX.Element { )}
- + ) } diff --git a/frontend/src/scenes/insights/views/Funnels/FunnelCorrelationTable.tsx b/frontend/src/scenes/insights/views/Funnels/FunnelCorrelationTable.tsx index ef5753d085697..0799143070013 100644 --- a/frontend/src/scenes/insights/views/Funnels/FunnelCorrelationTable.tsx +++ b/frontend/src/scenes/insights/views/Funnels/FunnelCorrelationTable.tsx @@ -113,7 +113,6 @@ export function FunnelCorrelationTable(): JSX.Element | null { ? 'have this event property' : 'do this event'}
- ) } @@ -233,6 +232,7 @@ export function FunnelCorrelationTable(): JSX.Element | null { + loadedEventCorrelationsTableOnce ? (