replayTableWrapper.tsx 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import {Fragment} from 'react';
  2. import ReplayClipPreviewPlayer from 'sentry/components/events/eventReplay/replayClipPreviewPlayer';
  3. import {useReplayContext} from 'sentry/components/replays/replayContext';
  4. import type {Group} from 'sentry/types/group';
  5. import useReplayReader from 'sentry/utils/replays/hooks/useReplayReader';
  6. import ReplayTable from 'sentry/views/replays/replayTable';
  7. import type {ReplayColumn} from 'sentry/views/replays/replayTable/types';
  8. type Props = {
  9. group: Group;
  10. orgSlug: string;
  11. pageLinks: string | null;
  12. replaySlug: string;
  13. selectedReplayIndex: number;
  14. setSelectedReplayIndex: (index: number) => void;
  15. visibleColumns: ReplayColumn[];
  16. overlayContent?: React.ReactNode;
  17. } & React.ComponentProps<typeof ReplayTable>;
  18. function ReplayTableWrapper({
  19. replaySlug,
  20. overlayContent,
  21. setSelectedReplayIndex,
  22. orgSlug,
  23. group,
  24. ...props
  25. }: Props) {
  26. const {selectedReplayIndex} = props;
  27. const {analyticsContext} = useReplayContext();
  28. const replayReaderData = useReplayReader({
  29. orgSlug,
  30. replaySlug,
  31. group,
  32. });
  33. return (
  34. <Fragment>
  35. <ReplayClipPreviewPlayer
  36. overlayContent={overlayContent}
  37. orgSlug={orgSlug}
  38. showNextAndPrevious
  39. handleForwardClick={
  40. props.replays && selectedReplayIndex + 1 < props.replays.length
  41. ? () => {
  42. setSelectedReplayIndex(selectedReplayIndex + 1);
  43. }
  44. : undefined
  45. }
  46. handleBackClick={
  47. selectedReplayIndex > 0
  48. ? () => {
  49. setSelectedReplayIndex(selectedReplayIndex - 1);
  50. }
  51. : undefined
  52. }
  53. analyticsContext={analyticsContext}
  54. isLarge
  55. {...replayReaderData}
  56. />
  57. <ReplayTable
  58. onClickPlay={setSelectedReplayIndex}
  59. fetchError={props.fetchError}
  60. isFetching={props.isFetching}
  61. replays={props.replays}
  62. sort={props.sort}
  63. visibleColumns={props.visibleColumns}
  64. />
  65. </Fragment>
  66. );
  67. }
  68. export default ReplayTableWrapper;