1+ import { Fragment } from 'react' ;
12import styled from '@emotion/styled' ;
3+ import { PlatformIcon } from 'platformicons' ;
24
35import { Flex } from 'sentry/components/core/layout' ;
46import { Tooltip } from 'sentry/components/core/tooltip' ;
57import Placeholder from 'sentry/components/placeholder' ;
8+ import CountTooltipContent from 'sentry/components/replays/countTooltipContent' ;
69import { useReplayContext } from 'sentry/components/replays/replayContext' ;
7- import ReplayPlatformIcon from 'sentry/components/replays/replayPlatformIcon ' ;
10+ import { t } from 'sentry/locale ' ;
811import { space } from 'sentry/styles/space' ;
12+ import { generatePlatformIconName } from 'sentry/utils/replays/generatePlatformIconName' ;
913
1014export default function BrowserOSIcons ( {
1115 showBrowser = true ,
@@ -17,33 +21,56 @@ export default function BrowserOSIcons({
1721 const { replay} = useReplayContext ( ) ;
1822 const replayRecord = replay ?. getReplay ( ) ;
1923
20- return isLoading ? (
21- < Placeholder width = "50px" height = "32px" />
22- ) : (
23- < Flex direction = "row-reverse" >
24- < Tooltip title = { `${ replayRecord ?. os . name ?? '' } ${ replayRecord ?. os . version ?? '' } ` } >
25- < ReplayPlatformIcon
26- name = { replayRecord ?. os . name ?? '' }
27- version = { replayRecord ?. os . version ?? undefined }
28- showVersion
29- />
24+ if ( isLoading ) {
25+ return < Placeholder width = "34px" height = "20px" /> ;
26+ }
27+
28+ if ( ! replayRecord ) {
29+ return (
30+ < Tooltip title = { t ( 'Unknown Device' ) } >
31+ < PlatformIcon platform = "unknown" size = "20px" />
3032 </ Tooltip >
31- { showBrowser && (
32- < Overlap >
33- < Tooltip
34- title = { `${ replayRecord ?. browser . name ?? '' } ${
35- replayRecord ?. browser . version ?? ''
36- } `}
37- >
38- < ReplayPlatformIcon
39- name = { replayRecord ?. browser . name ?? '' }
40- version = { replayRecord ?. browser . version ?? undefined }
41- showVersion
33+ ) ;
34+ }
35+
36+ return (
37+ < Tooltip
38+ title = {
39+ < CountTooltipContent >
40+ { showBrowser && (
41+ < Fragment >
42+ < dt > { t ( 'Browser:' ) } </ dt >
43+ < dd > { `${ replayRecord ?. browser . name ?? '' } ${ replayRecord ?. browser . version ?? '' } ` } </ dd >
44+ </ Fragment >
45+ ) }
46+ < dt > { t ( 'OS:' ) } </ dt >
47+ < dd >
48+ { replayRecord ?. os . name ?? '' } { replayRecord ?. os . version ?? '' }
49+ </ dd >
50+ </ CountTooltipContent >
51+ }
52+ >
53+ < Flex >
54+ { showBrowser && (
55+ < Overlap >
56+ < PlatformIcon
57+ platform = { generatePlatformIconName (
58+ replayRecord ?. browser . name ?? '' ,
59+ replayRecord ?. browser . version ?? undefined
60+ ) }
61+ size = "20px"
4262 />
43- </ Tooltip >
44- </ Overlap >
45- ) }
46- </ Flex >
63+ </ Overlap >
64+ ) }
65+ < PlatformIcon
66+ platform = { generatePlatformIconName (
67+ replayRecord ?. os . name ?? '' ,
68+ replayRecord ?. os . version ?? undefined
69+ ) }
70+ size = "20px"
71+ />
72+ </ Flex >
73+ </ Tooltip >
4774 ) ;
4875}
4976
0 commit comments