index.tsx 805 B

123456789101112131415161718192021222324
  1. import {useRedirectNavV2Routes} from 'sentry/components/nav/useRedirectNavV2Routes';
  2. import NoProjectMessage from 'sentry/components/noProjectMessage';
  3. import Redirect from 'sentry/components/redirect';
  4. import type {RouteComponentProps} from 'sentry/types/legacyReactRouter';
  5. import useOrganization from 'sentry/utils/useOrganization';
  6. type Props = RouteComponentProps<{}, {}> & {
  7. children: React.ReactNode;
  8. };
  9. export default function ReplaysContainer({children}: Props) {
  10. const organization = useOrganization();
  11. const redirectPath = useRedirectNavV2Routes({
  12. oldPathPrefix: '/replays/',
  13. newPathPrefix: '/explore/replays/',
  14. });
  15. if (redirectPath) {
  16. return <Redirect to={redirectPath} />;
  17. }
  18. return <NoProjectMessage organization={organization}>{children}</NoProjectMessage>;
  19. }