replayClipPreviewWrapper.tsx 1.7 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. replayReaderResult={replayReaderData}
  29. overlayContent={props.overlayContent}
  30. orgSlug={props.orgSlug}
  31. showNextAndPrevious
  32. handleForwardClick={
  33. props.replays && selectedReplayIndex + 1 < props.replays.length
  34. ? () => {
  35. props.setSelectedReplayIndex(selectedReplayIndex + 1);
  36. }
  37. : undefined
  38. }
  39. handleBackClick={
  40. selectedReplayIndex > 0
  41. ? () => {
  42. props.setSelectedReplayIndex(selectedReplayIndex - 1);
  43. }
  44. : undefined
  45. }
  46. analyticsContext={analyticsContext}
  47. isLarge
  48. />
  49. );
  50. }