1- import { Fragment } from 'react' ;
1+ import { Fragment , useEffect } from 'react' ;
22import { Link } from 'react-router' ;
33import styled from '@emotion/styled' ;
4+ import * as Sentry from '@sentry/react' ;
45
6+ import AvatarList from 'sentry/components/avatar/avatarList' ;
57import ErrorCounts from 'sentry/components/replays/header/errorCounts' ;
68import HeaderPlaceholder from 'sentry/components/replays/header/headerPlaceholder' ;
79import { IconCursorArrow } from 'sentry/icons' ;
@@ -10,6 +12,7 @@ import {space} from 'sentry/styles/space';
1012import EventView from 'sentry/utils/discover/eventView' ;
1113import getRouteStringFromRoutes from 'sentry/utils/getRouteStringFromRoutes' ;
1214import { TabKey } from 'sentry/utils/replays/hooks/useActiveReplayTab' ;
15+ import useReplayViewedByData from 'sentry/utils/replays/hooks/useReplayViewedByData' ;
1316import { useLocation } from 'sentry/utils/useLocation' ;
1417import { useRoutes } from 'sentry/utils/useRoutes' ;
1518import type { ReplayError , ReplayRecord } from 'sentry/views/replays/types' ;
@@ -25,6 +28,16 @@ function ReplayMetaData({replayErrors, replayRecord, showDeadRageClicks = true}:
2528 const routes = useRoutes ( ) ;
2629 const referrer = getRouteStringFromRoutes ( routes ) ;
2730 const eventView = EventView . fromLocation ( location ) ;
31+ const viewersResult = useReplayViewedByData ( {
32+ projectSlug : replayRecord ?. project_id ,
33+ replayId : replayRecord ?. id ,
34+ } ) ;
35+
36+ useEffect ( ( ) => {
37+ if ( viewersResult . isError ) {
38+ Sentry . captureException ( viewersResult . error ) ;
39+ }
40+ } ) ;
2841
2942 const breadcrumbTab = {
3043 ...location ,
@@ -82,6 +95,14 @@ function ReplayMetaData({replayErrors, replayRecord, showDeadRageClicks = true}:
8295 < HeaderPlaceholder width = "20px" height = "16px" />
8396 ) }
8497 </ KeyMetricData >
98+ < KeyMetricLabel > { t ( 'Seen By' ) } </ KeyMetricLabel >
99+ < KeyMetricData >
100+ { viewersResult . isLoading ? (
101+ < HeaderPlaceholder width = "55px" height = "27px" />
102+ ) : (
103+ < AvatarList avatarSize = { 25 } users = { viewersResult . data ?. data . viewed_by } />
104+ ) }
105+ </ KeyMetricData >
85106 </ KeyMetrics >
86107 ) ;
87108}
0 commit comments