Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

Unify empty states for props, goals and journeys (#6305)

Adam Rutkowski6c1978619d91
diff --git a/assets/js/dashboard/components/lazy-loader.js b/assets/js/dashboard/components/lazy-loader.js
index 774774c368..f8088f554f 100644
--- a/assets/js/dashboard/components/lazy-loader.js
+++ b/assets/js/dashboard/components/lazy-loader.js
@@ -15,5 +15,9 @@ export default function LazyLoader(props) {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [inView])
- return <div ref={ref}>{props.children}</div>
+ return (
+ <div ref={ref} className="flex-1 flex flex-col">
+ {props.children}
+ </div>
+ )
}
diff --git a/assets/js/dashboard/extra/exploration.js b/assets/js/dashboard/extra/exploration.js
index 477e97660d..355d2986d1 100644
--- a/assets/js/dashboard/extra/exploration.js
+++ b/assets/js/dashboard/extra/exploration.js
@@ -833,9 +833,16 @@ export function FunnelExploration() {
prevStepsLengthRef.current = steps.length
}, [steps.length])
+ const noData =
+ !initialLoading &&
+ !activeColumnLoading &&
+ steps.length === 0 &&
+ funnel.length === 0 &&
+ activeColumnResults.length === 0
+
return (
<LazyLoader onVisible={() => setInViewport(true)}>
- <div className="flex flex-col gap-4 pt-4">
+ <div className="flex-1 flex flex-col gap-4 pt-4">
<div className="flex flex-wrap items-center gap-x-3">
<h4 className="flex-1 text-base font-semibold dark:text-gray-100">
{funnel.length >= 2
@@ -872,68 +879,78 @@ export function FunnelExploration() {
</Tooltip>
</div>
- <div
- ref={containerRef}
- className="relative grid gap-6 overflow-x-auto -mx-5 px-5 -mb-3 pb-3 [scrollbar-width:thin] [scrollbar-color:theme(colors.gray.300)_transparent] dark:[scrollbar-color:theme(colors.gray.600)_transparent]"
- style={{
- gridTemplateColumns: `repeat(${gridColumns}, minmax(20rem, 1fr))`
- }}
- >
- {Array.from({ length: numColumns }, (_, i) => {
- const isActive = i === activeColumnIndex
- const isReachable = steps.length >= i
-
- return (
- <ExplorationColumn
- key={i}
- colIndex={i}
- header={columnHeader(i, direction)}
- active={isReachable}
- // Active column gets live results; previously-active (now
- // selected) columns get the candidate list that was visible at
- // the moment of selection so the user can switch options
- // without losing context. Pre-selected columns (e.g. populated
- // by interesting-funnel preload) have no frozen results and
- // fall back to a single-item display sourced from funnel data.
- results={
- isActive ? activeColumnResults : frozenColumnResults[i] || []
- }
- loading={
- isActive ? initialLoading || activeColumnLoading : false
- }
- selected={steps[i] || null}
- selectedVisitors={
- provisionalFunnelEntries[i]?.visitors ??
- funnel[i]?.visitors ??
- null
- }
- selectedConversionRate={
- provisionalFunnelEntries[i]?.conversion_rate ??
- funnel[i]?.conversion_rate ??
- null
- }
- maxVisitors={funnel[0]?.visitors ?? null}
- onSelect={(selected) => handleSelect(i, selected)}
- onFilterChange={isActive ? setActiveColumnFilter : () => {}}
- filter={isActive ? activeColumnFilter : ''}
- direction={direction}
- onDirectionChange={i === 0 ? handleDirectionSelect : undefined}
- headerConversionRate={
- funnel[i]?.conversion_rate != null
- ? i === 0
- ? '100%'
- : `${parseFloat(funnel[i].conversion_rate).toFixed(1)}%`
- : null
- }
- />
- )
- })}
- <PathConnectors
- key={connectorsKey}
- containerRef={containerRef}
- steps={steps}
- />
- </div>
+ {noData ? (
+ <div className="flex-1 flex items-center justify-center font-medium text-gray-500 dark:text-gray-400">
+ No data yet
+ </div>
+ ) : (
+ <div
+ ref={containerRef}
+ className="relative grid gap-6 overflow-x-auto -mx-5 px-5 -mb-3 pb-3 [scrollbar-width:thin] [scrollbar-color:theme(colors.gray.300)_transparent] dark:[scrollbar-color:theme(colors.gray.600)_transparent]"
+ style={{
+ gridTemplateColumns: `repeat(${gridColumns}, minmax(20rem, 1fr))`
+ }}
+ >
+ {Array.from({ length: numColumns }, (_, i) => {
+ const isActive = i === activeColumnIndex
+ const isReachable = steps.length >= i
+
+ return (
+ <ExplorationColumn
+ key={i}
+ colIndex={i}
+ header={columnHeader(i, direction)}
+ active={isReachable}
+ // Active column gets live results; previously-active (now
+ // selected) columns get the candidate list that was visible at
+ // the moment of selection so the user can switch options
+ // without losing context. Pre-selected columns (e.g. populated
+ // by interesting-funnel preload) have no frozen results and
+ // fall back to a single-item display sourced from funnel data.
+ results={
+ isActive
+ ? activeColumnResults
+ : frozenColumnResults[i] || []
+ }
+ loading={
+ isActive ? initialLoading || activeColumnLoading : false
+ }
+ selected={steps[i] || null}
+ selectedVisitors={
+ provisionalFunnelEntries[i]?.visitors ??
+ funnel[i]?.visitors ??
+ null
+ }
+ selectedConversionRate={
+ provisionalFunnelEntries[i]?.conversion_rate ??
+ funnel[i]?.conversion_rate ??
+ null
+ }
+ maxVisitors={funnel[0]?.visitors ?? null}
+ onSelect={(selected) => handleSelect(i, selected)}
+ onFilterChange={isActive ? setActiveColumnFilter : () => {}}
+ filter={isActive ? activeColumnFilter : ''}
+ direction={direction}
+ onDirectionChange={
+ i === 0 ? handleDirectionSelect : undefined
+ }
+ headerConversionRate={
+ funnel[i]?.conversion_rate != null
+ ? i === 0
+ ? '100%'
+ : `${parseFloat(funnel[i].conversion_rate).toFixed(1)}%`
+ : null
+ }
+ />
+ )
+ })}
+ <PathConnectors
+ key={connectorsKey}
+ containerRef={containerRef}
+ steps={steps}
+ />
+ </div>
+ )}
</div>
</LazyLoader>
)
diff --git a/assets/js/dashboard/stats/behaviours/index.js b/assets/js/dashboard/stats/behaviours/index.js
index 0487d22467..8ffca74f16 100644
--- a/assets/js/dashboard/stats/behaviours/index.js
+++ b/assets/js/dashboard/stats/behaviours/index.js
@@ -375,7 +375,7 @@ function Behaviours({ importedDataInView, setMode, mode }) {
function noDataYet() {
return (
- <div className="font-medium text-gray-500 dark:text-gray-400 py-12 text-center">
+ <div className="flex-1 flex items-center justify-center font-medium text-gray-500 dark:text-gray-400">
No data yet
</div>
)
@@ -383,7 +383,7 @@ function Behaviours({ importedDataInView, setMode, mode }) {
function featureUnavailable() {
return (
- <div className="font-medium text-gray-500 dark:text-gray-400 py-12 text-center">
+ <div className="flex-1 flex items-center justify-center font-medium text-gray-500 dark:text-gray-400">
This feature is unavailable
</div>
)
diff --git a/assets/js/dashboard/stats/behaviours/props.js b/assets/js/dashboard/stats/behaviours/props.js
index 30b2331219..8f7f8b7930 100644
--- a/assets/js/dashboard/stats/behaviours/props.js
+++ b/assets/js/dashboard/stats/behaviours/props.js
@@ -59,7 +59,7 @@ export default function Properties({ propKey, afterFetchData }) {
if (!propKey) {
return (
- <div className="font-medium text-gray-500 dark:text-gray-400 py-12 text-center">
+ <div className="flex-1 flex items-center justify-center font-medium text-gray-500 dark:text-gray-400">
No custom properties found
</div>
)