focusArea.tsx 2.5 KB

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