index.tsx 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import {RouteComponentProps} from 'react-router';
  2. import Feature from 'sentry/components/acl/feature';
  3. import Alert from 'sentry/components/alert';
  4. import FeedbackWidget from 'sentry/components/feedback/widget/feedbackWidget';
  5. import * as Layout from 'sentry/components/layouts/thirds';
  6. import NoProjectMessage from 'sentry/components/noProjectMessage';
  7. import {t} from 'sentry/locale';
  8. import useOrganization from 'sentry/utils/useOrganization';
  9. type Props = RouteComponentProps<{}, {}> & {
  10. children: React.ReactNode;
  11. };
  12. export default function FeedbackContainer({children}: Props) {
  13. const organization = useOrganization();
  14. return (
  15. <Feature
  16. features="user-feedback-ui"
  17. organization={organization}
  18. renderDisabled={NoAccess}
  19. >
  20. <NoProjectMessage organization={organization}>
  21. <FeedbackWidget />
  22. {children}
  23. </NoProjectMessage>
  24. </Feature>
  25. );
  26. }
  27. function NoAccess() {
  28. return (
  29. <Layout.Page withPadding>
  30. <Alert type="warning">{t("You don't have access to this feature")}</Alert>
  31. </Layout.Page>
  32. );
  33. }