focusArea.tsx 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import Placeholder from 'sentry/components/placeholder';
  2. import {useReplayContext} from 'sentry/components/replays/replayContext';
  3. import useActiveReplayTab, {TabKey} from 'sentry/utils/replays/hooks/useActiveReplayTab';
  4. import useOrganization from 'sentry/utils/useOrganization';
  5. import Console from 'sentry/views/replays/detail/console';
  6. import DomMutations from 'sentry/views/replays/detail/domMutations';
  7. import IssueList from 'sentry/views/replays/detail/issueList';
  8. import MemoryChart from 'sentry/views/replays/detail/memoryChart';
  9. import NetworkList from 'sentry/views/replays/detail/network';
  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. networkSpans={replay?.getNetworkSpans()}
  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.issues:
  30. if (!replay) {
  31. return <Placeholder height="150px" />;
  32. }
  33. return (
  34. <IssueList
  35. replayId={replay.getReplay()?.id}
  36. projectId={replay.getReplay()?.project_id}
  37. />
  38. );
  39. case TabKey.dom:
  40. return (
  41. <DomMutations
  42. replay={replay}
  43. startTimestampMs={replay?.getReplay()?.started_at?.getTime() || 0}
  44. />
  45. );
  46. case TabKey.memory:
  47. return (
  48. <MemoryChart
  49. currentTime={currentTime}
  50. currentHoverTime={currentHoverTime}
  51. memorySpans={replay?.getMemorySpans()}
  52. setCurrentTime={setCurrentTime}
  53. setCurrentHoverTime={setCurrentHoverTime}
  54. startTimestampMs={replay?.getReplay()?.started_at?.getTime()}
  55. />
  56. );
  57. case TabKey.console:
  58. default:
  59. return (
  60. <Console
  61. breadcrumbs={replay?.getConsoleCrumbs()}
  62. startTimestampMs={replay?.getReplay()?.started_at?.getTime() || 0}
  63. />
  64. );
  65. }
  66. }
  67. export default FocusArea;