browserOSIcons.tsx 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import {Fragment} from 'react';
  2. import Placeholder from 'sentry/components/placeholder';
  3. import ContextIcon from 'sentry/components/replays/contextIcon';
  4. import {useReplayContext} from 'sentry/components/replays/replayContext';
  5. import {Tooltip} from 'sentry/components/tooltip';
  6. export default function BrowserOSIcons({
  7. showBrowser = true,
  8. isLoading,
  9. }: {
  10. isLoading?: boolean;
  11. showBrowser?: boolean;
  12. }) {
  13. const {replay} = useReplayContext();
  14. const replayRecord = replay?.getReplay();
  15. return isLoading ? (
  16. <Placeholder width="50px" height="32px" />
  17. ) : (
  18. <Fragment>
  19. <Tooltip title={`${replayRecord?.os.name ?? ''} ${replayRecord?.os.version ?? ''}`}>
  20. <ContextIcon
  21. name={replayRecord?.os.name ?? ''}
  22. version={replayRecord?.os.version ?? undefined}
  23. showVersion
  24. />
  25. </Tooltip>
  26. {showBrowser && (
  27. <Tooltip
  28. title={`${replayRecord?.browser.name ?? ''} ${
  29. replayRecord?.browser.version ?? ''
  30. }`}
  31. >
  32. <ContextIcon
  33. name={replayRecord?.browser.name ?? ''}
  34. version={replayRecord?.browser.version ?? undefined}
  35. showVersion
  36. />
  37. </Tooltip>
  38. )}
  39. </Fragment>
  40. );
  41. }