From 3954ee0a976cb6ad7daf45a9f239f4ace4ba716f Mon Sep 17 00:00:00 2001 From: Usman Baig Date: Sun, 15 Mar 2026 13:27:20 +0100 Subject: [PATCH] refactor: restyle journey columns to match Pulse native patterns --- components/journeys/ColumnJourney.tsx | 125 +++++++++++--------------- 1 file changed, 54 insertions(+), 71 deletions(-) diff --git a/components/journeys/ColumnJourney.tsx b/components/journeys/ColumnJourney.tsx index 38e4ffb..e6efe61 100644 --- a/components/journeys/ColumnJourney.tsx +++ b/components/journeys/ColumnJourney.tsx @@ -115,41 +115,29 @@ function buildColumns( function ColumnHeader({ column, - color, }: { column: Column - color: string }) { return ( -
- - {column.index + 1} +
+ + Step {column.index + 1} -
- - {column.totalSessions.toLocaleString()} +
+ + {column.totalSessions.toLocaleString()} visitors -
- - visitors + {column.dropOffPercent !== 0 && ( + + {column.dropOffPercent > 0 ? '+' : ''} + {column.dropOffPercent}% - {column.dropOffPercent !== 0 && ( - - {column.dropOffPercent > 0 ? '+' : ''} - {column.dropOffPercent}% - - )} -
+ )}
- {/* Colored connector line from header to cards */} -
) } @@ -157,7 +145,6 @@ function ColumnHeader({ function PageRow({ page, colIndex, - colColor, columnTotal, maxCount, isSelected, @@ -166,13 +153,13 @@ function PageRow({ }: { page: ColumnPage colIndex: number - colColor: string columnTotal: number maxCount: number isSelected: boolean isOther: boolean onClick: () => void }) { + const pct = columnTotal > 0 ? Math.round((page.sessionCount / columnTotal) * 100) : 0 const barWidth = maxCount > 0 ? (page.sessionCount / maxCount) * 100 : 0 return ( @@ -185,29 +172,24 @@ function PageRow({ data-path={page.path} className={` group flex items-center justify-between w-full relative overflow-hidden - px-3 py-2.5 rounded-lg text-left transition-all + h-9 px-2 -mx-2 rounded-lg text-left transition-colors ${isOther ? 'cursor-default' : 'cursor-pointer'} - ${ - isSelected - ? 'border-l-[3px] border border-neutral-200 dark:border-neutral-700' - : isOther - ? 'border border-neutral-100 dark:border-neutral-800' - : 'border border-neutral-200 dark:border-neutral-700 hover:border-neutral-300 dark:hover:border-neutral-600 hover:shadow-sm' + ${isSelected + ? 'bg-brand-orange/10 dark:bg-brand-orange/10' + : isOther + ? '' + : 'hover:bg-neutral-50 dark:hover:bg-neutral-800/50' } `} - style={isSelected ? { borderLeftColor: colColor, backgroundColor: `${colColor}08` } : undefined} > {/* Background bar */} - {!isOther && !isSelected && ( + {!isOther && (
- )} - {isSelected && ( -
)} {isOther ? page.path : smartLabel(page.path)} - + {!isOther && ( + + {pct}% + + )} + - {page.sessionCount.toLocaleString()} - + : 'text-neutral-600 dark:text-neutral-400' + }`} + > + {page.sessionCount.toLocaleString()} + +
) } function JourneyColumn({ column, - color, selectedPath, exitCount, onSelect, }: { column: Column - color: string selectedPath: string | undefined exitCount: number onSelect: (path: string) => void }) { if (column.pages.length === 0 && exitCount === 0) { return ( -
- -
+
+ +
No onward traffic @@ -265,9 +250,9 @@ function JourneyColumn({ const maxCount = Math.max(...column.pages.map((p) => p.sessionCount), 0) return ( -
- -
+
+ +
{column.pages.map((page) => { const isOther = page.path === '(other)' return ( @@ -275,7 +260,6 @@ function JourneyColumn({ key={page.path} page={page} colIndex={column.index} - colColor={color} columnTotal={column.totalSessions} maxCount={maxCount} isSelected={selectedPath === page.path} @@ -290,12 +274,12 @@ function JourneyColumn({
- + (exit) - + {exitCount.toLocaleString()}
@@ -518,11 +502,10 @@ export default function ColumnJourney({ return ( {i > 0 && ( -
+
)} handleSelect(col.index, path)}