replayClipPreviewWrapper.tsx 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import ReplayClipPreviewPlayer from 'sentry/components/events/eventReplay/replayClipPreviewPlayer';
  2. import {useReplayContext} from 'sentry/components/replays/replayContext';
  3. import type {Group} from 'sentry/types/group';
  4. import useReplayReader from 'sentry/utils/replays/hooks/useReplayReader';
  5. import type {ReplayColumn} from 'sentry/views/replays/replayTable/types';
  6. import type {ReplayListRecord} from 'sentry/views/replays/types';
  7. type Props = {
  8. group: Group;
  9. orgSlug: string;
  10. pageLinks: string | null;
  11. replaySlug: string;
  12. replays: ReplayListRecord[] | undefined;
  13. selectedReplayIndex: number;
  14. setSelectedReplayIndex: (index: number) => void;
  15. visibleColumns: ReplayColumn[];
  16. overlayContent?: React.ReactNode;
  17. };
  18. export function ReplayClipPreviewWrapper(props: Props) {
  19. const {selectedReplayIndex} = props;
  20. const {analyticsContext} = useReplayContext();
  21. const replayReaderData = useReplayReader({
  22. orgSlug: props.orgSlug,
  23. replaySlug: props.replaySlug,
  24. group: props.group,
  25. });
  26. return (
  27. <ReplayClipPreviewPlayer
  28. overlayContent={props.overlayContent}
  29. orgSlug={props.orgSlug}
  30. showNextAndPrevious
  31. handleForwardClick={
  32. props.replays && selectedReplayIndex + 1 < props.replays.length
  33. ? () => {
  34. props.setSelectedReplayIndex(selectedReplayIndex + 1);
  35. }
  36. : undefined
  37. }
  38. handleBackClick={
  39. selectedReplayIndex > 0
  40. ? () => {
  41. props.setSelectedReplayIndex(selectedReplayIndex - 1);
  42. }
  43. : undefined
  44. }
  45. analyticsContext={analyticsContext}
  46. isLarge
  47. {...replayReaderData}
  48. />
  49. );
  50. }