index.tsx 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import Feature from 'sentry/components/acl/feature';
  2. import {Alert} from 'sentry/components/core/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.Container>
  15. <Alert type="warning">{t("You don't have access to this feature")}</Alert>
  16. </Alert.Container>
  17. </Layout.Page>
  18. );
  19. }
  20. function GroupReplaysWithGroup() {
  21. const params = useParams<{groupId: string}>();
  22. const {data: group, isPending, isError, refetch} = useGroup({groupId: params.groupId});
  23. if (isPending) {
  24. return <LoadingIndicator />;
  25. }
  26. if (isError) {
  27. return <LoadingError onRetry={refetch} />;
  28. }
  29. return <GroupReplays group={group} />;
  30. }
  31. function GroupReplaysContainer() {
  32. const organization = useOrganization();
  33. return (
  34. <Feature
  35. features="session-replay"
  36. organization={organization}
  37. renderDisabled={renderNoAccess}
  38. >
  39. <GroupReplaysWithGroup />
  40. </Feature>
  41. );
  42. }
  43. export default GroupReplaysContainer;