update viewers page
This commit is contained in:
+6
-6
@@ -797,10 +797,10 @@ function viewerDashboard() {
|
|||||||
const activityLocationRows = db.prepare(`
|
const activityLocationRows = db.prepare(`
|
||||||
select
|
select
|
||||||
date(occurred_at) as date,
|
date(occurred_at) as date,
|
||||||
country,
|
coalesce(nullif(country, ''), '') as country,
|
||||||
city,
|
coalesce(nullif(city, ''), '') as city,
|
||||||
region,
|
coalesce(nullif(region, ''), '') as region,
|
||||||
timezone,
|
coalesce(nullif(timezone, ''), '') as timezone,
|
||||||
count(distinct visitor_id) as visitors
|
count(distinct visitor_id) as visitors
|
||||||
from viewer_events
|
from viewer_events
|
||||||
where occurred_at >= ?
|
where occurred_at >= ?
|
||||||
@@ -810,7 +810,7 @@ function viewerDashboard() {
|
|||||||
or region != ''
|
or region != ''
|
||||||
or (timezone != '' and timezone != 'Not shared')
|
or (timezone != '' and timezone != 'Not shared')
|
||||||
)
|
)
|
||||||
group by date(occurred_at), country, city, region, timezone
|
group by date(occurred_at), coalesce(nullif(country, ''), ''), coalesce(nullif(city, ''), ''), coalesce(nullif(region, ''), ''), coalesce(nullif(timezone, ''), '')
|
||||||
order by date asc, visitors desc
|
order by date asc, visitors desc
|
||||||
`).all(thirtyDaysSince)
|
`).all(thirtyDaysSince)
|
||||||
|
|
||||||
@@ -821,7 +821,7 @@ function viewerDashboard() {
|
|||||||
.join(', ')
|
.join(', ')
|
||||||
if (!label) continue
|
if (!label) continue
|
||||||
const current = locationsByDate.get(row.date) || []
|
const current = locationsByDate.get(row.date) || []
|
||||||
if (current.length < 4) current.push({ label, visitors: row.visitors || 0 })
|
current.push({ label, visitors: row.visitors || 0 })
|
||||||
locationsByDate.set(row.date, current)
|
locationsByDate.set(row.date, current)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-5
@@ -2129,11 +2129,13 @@ function MiniLineChart({ accent = 'text-fury-cyan', data, label, metric, stroke
|
|||||||
.join(', ')}
|
.join(', ')}
|
||||||
</span>
|
</span>
|
||||||
) : null}
|
) : null}
|
||||||
{metric === 'locations' && hoveredPoint.location_labels?.length ? (
|
{metric === 'locations' ? (
|
||||||
<span className="mt-1 block max-w-48 whitespace-normal font-normal text-bg/80">
|
<span className="mt-1 block max-w-64 whitespace-normal font-normal text-bg/80">
|
||||||
{hoveredPoint.location_labels
|
{hoveredPoint.location_labels?.length
|
||||||
.map((location) => `${location.label} (${formatNumber(location.visitors)})`)
|
? hoveredPoint.location_labels
|
||||||
.join(', ')}
|
.map((location) => `${location.label} (${formatNumber(location.visitors)})`)
|
||||||
|
.join(', ')
|
||||||
|
: 'No location labels stored for this day'}
|
||||||
</span>
|
</span>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user