focusArea.tsx 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import styled from '@emotion/styled';
  2. import {useReplayContext} from 'sentry/components/replays/replayContext';
  3. import {space} from 'sentry/styles/space';
  4. import useActiveReplayTab, {TabKey} from 'sentry/utils/replays/hooks/useActiveReplayTab';
  5. import A11y from 'sentry/views/replays/detail/accessibility/index';
  6. import Breadcrumbs from 'sentry/views/replays/detail/breadcrumbs';
  7. import Console from 'sentry/views/replays/detail/console';
  8. import DomMutations from 'sentry/views/replays/detail/domMutations';
  9. import DomNodesChart from 'sentry/views/replays/detail/domNodesChart';
  10. import ErrorList from 'sentry/views/replays/detail/errorList/index';
  11. import FluidHeight from 'sentry/views/replays/detail/layout/fluidHeight';
  12. import MemoryChart from 'sentry/views/replays/detail/memoryChart';
  13. import NetworkList from 'sentry/views/replays/detail/network';
  14. import PerfTable from 'sentry/views/replays/detail/perfTable/index';
  15. import TagPanel from 'sentry/views/replays/detail/tagPanel';
  16. import Trace from 'sentry/views/replays/detail/trace/index';
  17. type Props = {};
  18. function FocusArea({}: Props) {
  19. const {getActiveTab} = useActiveReplayTab();
  20. const {replay} = useReplayContext();
  21. switch (getActiveTab()) {
  22. case TabKey.A11Y:
  23. return <A11y />;
  24. case TabKey.NETWORK:
  25. return <NetworkList />;
  26. case TabKey.TRACE:
  27. return <Trace />;
  28. case TabKey.PERF:
  29. return <PerfTable />;
  30. case TabKey.ERRORS:
  31. return <ErrorList />;
  32. case TabKey.DOM:
  33. return <DomMutations />;
  34. case TabKey.MEMORY:
  35. return (
  36. <MemoryTabWrapper>
  37. <MemoryChart />
  38. <DomNodesChart />
  39. </MemoryTabWrapper>
  40. );
  41. case TabKey.CONSOLE:
  42. return <Console />;
  43. case TabKey.TAGS:
  44. return <TagPanel />;
  45. case TabKey.BREADCRUMBS:
  46. default: {
  47. return (
  48. <Breadcrumbs
  49. frames={replay?.getChapterFrames()}
  50. startTimestampMs={replay?.getReplay()?.started_at?.getTime() || 0}
  51. />
  52. );
  53. }
  54. }
  55. }
  56. const MemoryTabWrapper = styled(FluidHeight)`
  57. justify-content: center;
  58. gap: ${space(1)};
  59. height: 100%;
  60. display: flex;
  61. `;
  62. export default FocusArea;