index.tsx 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import Feature from 'sentry/components/acl/feature';
  2. import AnalyticsArea from 'sentry/components/analyticsArea';
  3. import {Alert} from 'sentry/components/core/alert';
  4. import * as Layout from 'sentry/components/layouts/thirds';
  5. import {useRedirectNavV2Routes} from 'sentry/components/nav/useRedirectNavV2Routes';
  6. import NoProjectMessage from 'sentry/components/noProjectMessage';
  7. import Redirect from 'sentry/components/redirect';
  8. import {t} from 'sentry/locale';
  9. import type {RouteComponentProps} from 'sentry/types/legacyReactRouter';
  10. import useOrganization from 'sentry/utils/useOrganization';
  11. type Props = RouteComponentProps & {
  12. children: React.ReactNode;
  13. };
  14. export default function FeedbackContainer({children}: Props) {
  15. const organization = useOrganization();
  16. const redirectPath = useRedirectNavV2Routes({
  17. oldPathPrefix: '/feedback/',
  18. newPathPrefix: '/issues/feedback/',
  19. });
  20. if (redirectPath) {
  21. return <Redirect to={redirectPath} />;
  22. }
  23. return (
  24. <Feature
  25. features="user-feedback-ui"
  26. organization={organization}
  27. renderDisabled={NoAccess}
  28. >
  29. <AnalyticsArea name="feedback">
  30. <NoProjectMessage organization={organization}>{children}</NoProjectMessage>
  31. </AnalyticsArea>
  32. </Feature>
  33. );
  34. }
  35. function NoAccess() {
  36. return (
  37. <Layout.Page withPadding>
  38. <Alert.Container>
  39. <Alert type="warning">{t("You don't have access to this feature")}</Alert>
  40. </Alert.Container>
  41. </Layout.Page>
  42. );
  43. }