Skip to content

Commit

Permalink
Niceties
Browse files Browse the repository at this point in the history
  • Loading branch information
benjackwhite committed Dec 4, 2024
1 parent db0021c commit 3df86e6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Spinner, Tooltip } from '@posthog/lemon-ui'
import { BindLogic, useValues } from 'kea'
import { humanizeScope } from 'lib/components/ActivityLog/humanizeActivity'
import { metalyticsLogic } from 'lib/components/Metalytics/metalyticsLogic'
import { ProfileBubbles } from 'lib/lemon-ui/ProfilePicture/ProfileBubbles'
import { insightLogic } from 'scenes/insights/insightLogic'
Expand All @@ -9,7 +10,7 @@ import { NodeKind } from '~/queries/schema'
import { hogql } from '~/queries/utils'

export function SidePanelActivityMetalytics(): JSX.Element {
const { instanceId, viewCount, recentUserMembers, viewCountLoading, recentUsersLoading } =
const { scope, instanceId, viewCount, recentUserMembers, viewCountLoading, recentUsersLoading } =
useValues(metalyticsLogic)

if (!instanceId) {
Expand All @@ -21,34 +22,40 @@ export function SidePanelActivityMetalytics(): JSX.Element {
)
}

const humanizedScope = `this ${scope ? humanizeScope(scope, true) : 'app'}`

return (
<div className="space-y-4 ">
<p>
You are viewing "meta" analytics of how your organization members are interacting with{' '}
<b>{humanizedScope}</b>.
</p>
<div className="flex flex-wrap gap-4">
<Tooltip
title="The total number of times this scene has been viewed by members of your organization."
title={`The total number of times ${humanizedScope} has been viewed by members of your organization.`}
placement="top"
>
<div className="flex-1 p-4 border rounded bg-bg-light min-w-40">
<div className="text-sm text-muted">View count</div>
<div className="text-sm text-muted">Views</div>
<div className="text-2xl font-semibold">
{viewCountLoading ? <Spinner /> : viewCount?.views ?? 0}
</div>
</div>
</Tooltip>

<Tooltip
title="The total number of unique organization members who have viewed this scene."
title={`The total number of unique organization members who have viewed ${humanizedScope}.`}
placement="top"
>
<div className="flex-1 p-4 border rounded bg-bg-light min-w-40">
<div className="text-sm text-muted">Viewer count</div>
<div className="text-sm text-muted">Viewers</div>
<div className="text-2xl font-semibold">
{viewCountLoading ? <Spinner /> : viewCount?.users ?? 0}
</div>
</div>
</Tooltip>

<Tooltip title="The most recent 30 users who have viewed this scene." placement="top">
<Tooltip title={`The most recent 30 users who have viewed ${humanizedScope}.`} placement="top">
<div className="flex-1 p-4 border rounded bg-bg-light min-w-40">
<div className="text-sm text-muted">Recent viewers (30 days)</div>
{recentUsersLoading ? (
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lib/components/Metalytics/metalyticsLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export const metalyticsLogic = kea<metalyticsLogicType>([
(sceneActivityFilters) =>
sceneActivityFilters?.item_id ? `${sceneActivityFilters.scope}:${sceneActivityFilters.item_id}` : null,
],
scope: [(s) => [s.sceneActivityFilters], (sceneActivityFilters) => sceneActivityFilters?.scope],

recentUserMembers: [
(s) => [s.recentUsers, s.members],
Expand Down

0 comments on commit 3df86e6

Please sign in to comment.