forked from PostHog/posthog
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: indicate when others have watched a recording (PostHog#29067)
- Loading branch information
1 parent
0665850
commit be54ed7
Showing
16 changed files
with
1,351 additions
and
2,508 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
frontend/src/scenes/session-recordings/player/sidebar/PlayerSidebarOverviewOtherWatchers.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { IconPeople } from '@posthog/icons' | ||
import { useValues } from 'kea' | ||
import { LemonSkeleton } from 'lib/lemon-ui/LemonSkeleton' | ||
import { ProfileBubbles } from 'lib/lemon-ui/ProfilePicture' | ||
|
||
import { SessionRecordingType } from '~/types' | ||
|
||
import { sessionRecordingPlayerLogic } from '../sessionRecordingPlayerLogic' | ||
|
||
function OtherWatchersLoading(): JSX.Element { | ||
return ( | ||
<div className="flex flex-row space-x-2 items-center justify-center px-2 py-1"> | ||
<IconPeople /> | ||
<LemonSkeleton.Row repeat={1} className="h-5" /> | ||
</div> | ||
) | ||
} | ||
|
||
function OtherWatchersDisplay({ metadata }: { metadata?: SessionRecordingType }): JSX.Element | null { | ||
if (!metadata?.viewers) { | ||
// to keep TS happy | ||
return null | ||
} | ||
|
||
const count = metadata.viewers.length | ||
const varyingText = count > 1 ? 'users have' : 'user has' | ||
const label = `${count} other ${varyingText} watched this recording.` | ||
return ( | ||
<div className="flex flex-row space-x-2 items-center justify-center px-2 py-1"> | ||
<ProfileBubbles people={metadata.viewers.map((v) => ({ email: v }))} /> | ||
<span>{label}</span> | ||
</div> | ||
) | ||
} | ||
|
||
function NoOtherWatchers(): JSX.Element { | ||
return ( | ||
<div className="flex flex-row space-x-2 items-center justify-center px-2 py-1"> | ||
<IconPeople /> | ||
<span>Nobody else has watched this recording.</span> | ||
</div> | ||
) | ||
} | ||
|
||
export function PlayerSidebarOverviewOtherWatchers(): JSX.Element { | ||
const { sessionPlayerMetaDataLoading, sessionPlayerMetaData } = useValues(sessionRecordingPlayerLogic) | ||
|
||
return ( | ||
<div className="rounded border bg-surface-primary"> | ||
{sessionPlayerMetaDataLoading ? ( | ||
<OtherWatchersLoading /> | ||
) : sessionPlayerMetaData?.viewers ? ( | ||
<OtherWatchersDisplay metadata={sessionPlayerMetaData} /> | ||
) : ( | ||
<NoOtherWatchers /> | ||
)} | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
frontend/src/scenes/session-recordings/playlist/SessionRecordingPreview.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.UnwatchedIndicator { | ||
&.UnwatchedIndicator--primary { | ||
background: var(--danger); | ||
} | ||
|
||
&.UnwatchedIndicator--secondary { | ||
background: var(--accent-primary); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.