index.tsx 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import Feature from 'sentry/components/acl/feature';
  2. import {Alert} from 'sentry/components/alert';
  3. import * as Layout from 'sentry/components/layouts/thirds';
  4. import LoadingError from 'sentry/components/loadingError';
  5. import LoadingIndicator from 'sentry/components/loadingIndicator';
  6. import {t} from 'sentry/locale';
  7. import useOrganization from 'sentry/utils/useOrganization';
  8. import {useParams} from 'sentry/utils/useParams';
  9. import {useGroup} from 'sentry/views/issueDetails/useGroup';
  10. import GroupReplays from './groupReplays';
  11. function renderNoAccess() {
  12. return (
  13. <Layout.Page withPadding>
  14. <Alert type="warning">{t("You don't have access to this feature")}</Alert>
  15. </Layout.Page>
  16. );
  17. }
  18. function GroupReplaysWithGroup() {
  19. const params = useParams<{groupId: string}>();
  20. const {data: group, isPending, isError, refetch} = useGroup({groupId: params.groupId});
  21. if (isPending) {
  22. return <LoadingIndicator />;
  23. }
  24. if (isError) {
  25. return <LoadingError onRetry={refetch} />;
  26. }
  27. return <GroupReplays group={group} />;
  28. }
  29. function GroupReplaysContainer() {
  30. const organization = useOrganization();
  31. return (
  32. <Feature
  33. features="session-replay"
  34. organization={organization}
  35. renderDisabled={renderNoAccess}
  36. >
  37. <GroupReplaysWithGroup />
  38. </Feature>
  39. );
  40. }
  41. export default GroupReplaysContainer;