focusArea.tsx 2.4 KB

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