Release 0.15.0-alpha #43
@@ -53,6 +53,7 @@ export default function BehaviorPage() {
|
|||||||
const [deadClicks, setDeadClicks] = useState<{ items: FrustrationElement[]; total: number }>({ items: [], total: 0 })
|
const [deadClicks, setDeadClicks] = useState<{ items: FrustrationElement[]; total: number }>({ items: [], total: 0 })
|
||||||
const [byPage, setByPage] = useState<FrustrationByPage[]>([])
|
const [byPage, setByPage] = useState<FrustrationByPage[]>([])
|
||||||
const [loading, setLoading] = useState(true)
|
const [loading, setLoading] = useState(true)
|
||||||
|
const [error, setError] = useState(false)
|
||||||
const refreshRef = useRef<ReturnType<typeof setInterval> | null>(null)
|
const refreshRef = useRef<ReturnType<typeof setInterval> | null>(null)
|
||||||
|
|
||||||
// Fetch dashboard data for scroll depth (goal_counts + stats)
|
// Fetch dashboard data for scroll depth (goal_counts + stats)
|
||||||
@@ -70,7 +71,9 @@ export default function BehaviorPage() {
|
|||||||
setRageClicks(rageData)
|
setRageClicks(rageData)
|
||||||
setDeadClicks(deadData)
|
setDeadClicks(deadData)
|
||||||
setByPage(pageData)
|
setByPage(pageData)
|
||||||
|
setError(false)
|
||||||
} catch {
|
} catch {
|
||||||
|
setError(true)
|
||||||
toast.error('Failed to load behavior data')
|
toast.error('Failed to load behavior data')
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
@@ -185,7 +188,8 @@ export default function BehaviorPage() {
|
|||||||
{/* By page breakdown */}
|
{/* By page breakdown */}
|
||||||
<FrustrationByPageTable pages={byPage} loading={loading} />
|
<FrustrationByPageTable pages={byPage} loading={loading} />
|
||||||
|
|
||||||
{/* Scroll depth + Frustration trend */}
|
{/* Scroll depth + Frustration trend — hide when data failed to load */}
|
||||||
|
{!error && (
|
||||||
<div className="grid gap-6 lg:grid-cols-2 mb-8">
|
<div className="grid gap-6 lg:grid-cols-2 mb-8">
|
||||||
<ScrollDepth
|
<ScrollDepth
|
||||||
goalCounts={dashboard?.goal_counts ?? []}
|
goalCounts={dashboard?.goal_counts ?? []}
|
||||||
@@ -193,6 +197,7 @@ export default function BehaviorPage() {
|
|||||||
/>
|
/>
|
||||||
<FrustrationTrend summary={summary} loading={loading} />
|
<FrustrationTrend summary={summary} loading={loading} />
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
<DatePicker
|
<DatePicker
|
||||||
isOpen={isDatePickerOpen}
|
isOpen={isDatePickerOpen}
|
||||||
|
|||||||
Reference in New Issue
Block a user