index.tsx 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import {Fragment} from 'react';
  2. import DetailsSplitDivider from 'sentry/components/replays/virtualizedGrid/detailsSplitDivider';
  3. import type {SpanFrame} from 'sentry/utils/replays/types';
  4. import {useResizableDrawer} from 'sentry/utils/useResizableDrawer';
  5. import useUrlParams from 'sentry/utils/useUrlParams';
  6. import NetworkDetailsContent from 'sentry/views/replays/detail/network/details/content';
  7. import NetworkDetailsTabs, {
  8. TabKey,
  9. } from 'sentry/views/replays/detail/network/details/tabs';
  10. type Props = {
  11. isSetup: boolean;
  12. item: null | SpanFrame;
  13. onClose: () => void;
  14. projectId: undefined | string;
  15. startTimestampMs: number;
  16. } & Omit<ReturnType<typeof useResizableDrawer>, 'size'>;
  17. function NetworkDetails({
  18. isHeld,
  19. isSetup,
  20. item,
  21. onClose,
  22. onDoubleClick,
  23. onMouseDown,
  24. projectId,
  25. startTimestampMs,
  26. }: Props) {
  27. const {getParamValue: getDetailTab} = useUrlParams('n_detail_tab', 'details');
  28. if (!item || !projectId) {
  29. return null;
  30. }
  31. const visibleTab = getDetailTab() as TabKey;
  32. return (
  33. <Fragment>
  34. <DetailsSplitDivider
  35. isHeld={isHeld}
  36. onClose={onClose}
  37. onDoubleClick={onDoubleClick}
  38. onMouseDown={onMouseDown}
  39. >
  40. <NetworkDetailsTabs underlined={false} />
  41. </DetailsSplitDivider>
  42. <NetworkDetailsContent
  43. isSetup={isSetup}
  44. item={item}
  45. projectId={projectId}
  46. startTimestampMs={startTimestampMs}
  47. visibleTab={visibleTab}
  48. />
  49. </Fragment>
  50. );
  51. }
  52. export default NetworkDetails;