focusArea.tsx 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. networkSpans={replay?.getNetworkSpans()}
  22. startTimestampMs={replay?.getReplay()?.started_at?.getTime() || 0}
  23. />
  24. );
  25. case TabKey.trace:
  26. if (!replay) {
  27. return <Placeholder height="150px" />;
  28. }
  29. return <Trace organization={organization} replayRecord={replay.getReplay()} />;
  30. case TabKey.issues:
  31. if (!replay) {
  32. return <Placeholder height="150px" />;
  33. }
  34. return (
  35. <IssueList
  36. replayId={replay.getReplay()?.id}
  37. projectId={replay.getReplay()?.project_id}
  38. />
  39. );
  40. case TabKey.dom:
  41. return (
  42. <DomMutations
  43. replay={replay}
  44. startTimestampMs={replay?.getReplay()?.started_at?.getTime() || 0}
  45. />
  46. );
  47. case TabKey.memory:
  48. return (
  49. <MemoryChart
  50. currentTime={currentTime}
  51. currentHoverTime={currentHoverTime}
  52. memorySpans={replay?.getMemorySpans()}
  53. setCurrentTime={setCurrentTime}
  54. setCurrentHoverTime={setCurrentHoverTime}
  55. startTimestampMs={replay?.getReplay()?.started_at?.getTime()}
  56. />
  57. );
  58. case TabKey.console:
  59. default:
  60. return (
  61. <Console
  62. breadcrumbs={replay?.getConsoleCrumbs()}
  63. startTimestampMs={replay?.getReplay()?.started_at?.getTime() || 0}
  64. />
  65. );
  66. }
  67. }
  68. export default FocusArea;