Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(retention): highlight clicked interval column in the persons modal (#64021)

Georgis Andonis9cd2efa29cea
diff --git a/frontend/src/scenes/retention/RetentionModal.tsx b/frontend/src/scenes/retention/RetentionModal.tsx
index 2de9516c6d79..cdee6e69acdc 100644
--- a/frontend/src/scenes/retention/RetentionModal.tsx
+++ b/frontend/src/scenes/retention/RetentionModal.tsx
@@ -40,6 +40,7 @@ export function RetentionModal(): JSX.Element | null {
isCohortModalOpen,
theme,
retentionFilter,
+ selectedColumnIndex,
} = useValues(retentionModalLogic(insightProps))
const { closeModal, saveAsCohort, setIsCohortModalOpen } = useActions(retentionModalLogic(insightProps))
const { startExport } = useActions(exportsLogic)
@@ -178,7 +179,13 @@ export function RetentionModal(): JSX.Element | null {
<th>{capitalizeFirstLetter(aggregationTargetLabel.singular)}</th>
{row.values?.map((data: any, index: number) => {
return (
- <th key={index}>
+ <th
+ key={index}
+ className={clsx('!pl-2', {
+ 'RetentionTable__SelectedColumn--header':
+ index === selectedColumnIndex,
+ })}
+ >
<div>{data.label}</div>
<div>
{data.count}
@@ -231,7 +238,13 @@ export function RetentionModal(): JSX.Element | null {
.map((appearance: number, index: number) => {
const hasAppearance = !!appearance
return (
- <td key={index}>
+ <td
+ key={index}
+ className={clsx({
+ 'RetentionTable__SelectedColumn--cell':
+ index === selectedColumnIndex,
+ })}
+ >
<div
className={clsx(
'RetentionTable__Tab',
diff --git a/frontend/src/scenes/retention/RetentionTable.tsx b/frontend/src/scenes/retention/RetentionTable.tsx
index 26f41ac11f5b..57cb7b0a9d6b 100644
--- a/frontend/src/scenes/retention/RetentionTable.tsx
+++ b/frontend/src/scenes/retention/RetentionTable.tsx
@@ -198,6 +198,20 @@ export function RetentionTable({
return (
<td
key={columnIndex}
+ onClick={(e) => {
+ // Open the modal for this cohort and tell it which
+ // interval column was clicked so it can highlight it.
+ e.stopPropagation()
+ if (!inSharedMode) {
+ openModal(
+ rowIndex,
+ breakdownValue === NO_BREAKDOWN_VALUE
+ ? null
+ : breakdownValue,
+ columnIndex
+ )
+ }
+ }}
className={clsx({
'RetentionTable__SelectedColumn--cell':
columnIndex === selectedInterval,
diff --git a/frontend/src/scenes/retention/retentionModalLogic.ts b/frontend/src/scenes/retention/retentionModalLogic.ts
index 2ee19e0f7d1f..14b0d6c526ec 100644
--- a/frontend/src/scenes/retention/retentionModalLogic.ts
+++ b/frontend/src/scenes/retention/retentionModalLogic.ts
@@ -43,7 +43,11 @@ export const retentionModalLogic = kea<retentionModalLogicType>([
actions: [retentionPeopleLogic(props), ['loadPeople']],
})),
actions(() => ({
- openModal: (rowIndex: number, breakdownValue?: string | number | null) => ({ rowIndex, breakdownValue }),
+ openModal: (rowIndex: number, breakdownValue?: string | number | null, columnIndex?: number | null) => ({
+ rowIndex,
+ breakdownValue,
+ columnIndex,
+ }),
closeModal: true,
saveAsCohort: (cohortName: string) => ({ cohortName }),
setIsCohortModalOpen: (isOpen: boolean) => ({ isOpen }),
@@ -64,6 +68,14 @@ export const retentionModalLogic = kea<retentionModalLogicType>([
closeModal: () => null,
},
],
+ // The interval column of the cell the modal was opened from, so the modal can highlight it.
+ selectedColumnIndex: [
+ null as number | null,
+ {
+ openModal: (_, { columnIndex }: { columnIndex?: number | null }) => columnIndex ?? null,
+ closeModal: () => null,
+ },
+ ],
isCohortModalOpen: [
false,
{