focusArea.tsx 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import {useReplayContext} from 'sentry/components/replays/replayContext';
  2. import useActiveReplayTab, {TabKey} from 'sentry/utils/replays/hooks/useActiveReplayTab';
  3. import useOrganization from 'sentry/utils/useOrganization';
  4. import Console from 'sentry/views/replays/detail/console';
  5. import DomMutations from 'sentry/views/replays/detail/domMutations';
  6. import ErrorList from 'sentry/views/replays/detail/errorList/index';
  7. import MemoryChart from 'sentry/views/replays/detail/memoryChart';
  8. import NetworkList from 'sentry/views/replays/detail/network';
  9. import Trace from 'sentry/views/replays/detail/trace/index';
  10. type Props = {};
  11. function FocusArea({}: Props) {
  12. const {getActiveTab} = useActiveReplayTab();
  13. const {currentTime, currentHoverTime, replay, setCurrentTime, setCurrentHoverTime} =
  14. useReplayContext();
  15. const organization = useOrganization();
  16. switch (getActiveTab()) {
  17. case TabKey.NETWORK:
  18. return (
  19. <NetworkList
  20. isNetworkDetailsSetup={Boolean(replay?.isNetworkDetailsSetup())}
  21. networkFrames={replay?.getNetworkFrames()}
  22. projectId={replay?.getReplay()?.project_id}
  23. startTimestampMs={replay?.getReplay()?.started_at?.getTime() || 0}
  24. />
  25. );
  26. case TabKey.TRACE:
  27. return <Trace organization={organization} replayRecord={replay?.getReplay()} />;
  28. case TabKey.ERRORS:
  29. return (
  30. <ErrorList
  31. errorFrames={replay?.getErrorFrames()}
  32. startTimestampMs={replay?.getReplay().started_at.getTime() ?? 0}
  33. />
  34. );
  35. case TabKey.DOM:
  36. return (
  37. <DomMutations
  38. replay={replay}
  39. startTimestampMs={replay?.getReplay()?.started_at?.getTime() || 0}
  40. />
  41. );
  42. case TabKey.MEMORY:
  43. return (
  44. <MemoryChart
  45. currentTime={currentTime}
  46. currentHoverTime={currentHoverTime}
  47. memoryFrames={replay?.getMemoryFrames()}
  48. setCurrentTime={setCurrentTime}
  49. setCurrentHoverTime={setCurrentHoverTime}
  50. startTimestampMs={replay?.getReplay()?.started_at?.getTime()}
  51. />
  52. );
  53. case TabKey.CONSOLE:
  54. default: {
  55. return (
  56. <Console
  57. frames={replay?.getConsoleFrames()}
  58. startTimestampMs={replay?.getReplay().started_at.getTime() || 0}
  59. />
  60. );
  61. }
  62. }
  63. }
  64. export default FocusArea;