feat: enhance GoalStats component with user guidance for tracking goals and add documentation link
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
|
import Link from 'next/link'
|
||||||
import { formatNumber } from '@/lib/utils/format'
|
import { formatNumber } from '@/lib/utils/format'
|
||||||
|
import { BookOpenIcon, ArrowRightIcon } from '@ciphera-net/ui'
|
||||||
import type { GoalCountStat } from '@/lib/api/stats'
|
import type { GoalCountStat } from '@/lib/api/stats'
|
||||||
|
|
||||||
interface GoalStatsProps {
|
interface GoalStatsProps {
|
||||||
@@ -39,10 +41,25 @@ export default function GoalStats({ goalCounts, siteId, dateRange }: GoalStatsPr
|
|||||||
</div>
|
</div>
|
||||||
))
|
))
|
||||||
) : (
|
) : (
|
||||||
<div className="h-full flex flex-col items-center justify-center text-center px-4">
|
<div className="h-full flex flex-col items-center justify-center text-center px-6 py-8">
|
||||||
<p className="text-neutral-500 dark:text-neutral-400 text-sm">
|
<div className="max-w-sm w-full rounded-xl border-2 border-dashed border-neutral-200 dark:border-neutral-700 p-8 flex flex-col items-center gap-4">
|
||||||
No custom events in this period. Track goals with <code className="px-1.5 py-0.5 rounded bg-neutral-200 dark:bg-neutral-700 text-xs">pulse.track('event_name')</code> in your snippet.
|
<div className="rounded-full bg-neutral-100 dark:bg-neutral-800 p-4">
|
||||||
</p>
|
<BookOpenIcon className="w-8 h-8 text-neutral-500 dark:text-neutral-400" />
|
||||||
|
</div>
|
||||||
|
<h4 className="font-semibold text-neutral-900 dark:text-white">
|
||||||
|
Need help tracking goals?
|
||||||
|
</h4>
|
||||||
|
<p className="text-sm text-neutral-500 dark:text-neutral-400">
|
||||||
|
Add <code className="px-1.5 py-0.5 rounded bg-neutral-200 dark:bg-neutral-700 text-xs font-mono">pulse.track('event_name')</code> where actions happen on your site, then see counts here. Check our guide for step-by-step instructions.
|
||||||
|
</p>
|
||||||
|
<Link
|
||||||
|
href="/installation"
|
||||||
|
className="inline-flex items-center gap-1.5 text-sm font-medium text-brand-orange hover:text-brand-orange/90 hover:underline focus:outline-none focus:ring-2 focus:ring-brand-orange/20 rounded"
|
||||||
|
>
|
||||||
|
Read documentation
|
||||||
|
<ArrowRightIcon className="w-4 h-4" />
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user