editRulesModal.tsx 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import {Fragment} from 'react';
  2. import styled from '@emotion/styled';
  3. import type {EditOwnershipRulesModalOptions} from 'sentry/actionCreators/modal';
  4. import ExternalLink from 'sentry/components/links/externalLink';
  5. import {t, tct} from 'sentry/locale';
  6. import {space} from 'sentry/styles/space';
  7. import {useUser} from 'sentry/utils/useUser';
  8. import OwnerInput from 'sentry/views/settings/project/projectOwnership/ownerInput';
  9. interface EditOwnershipRulesModalProps extends EditOwnershipRulesModalOptions {
  10. onCancel: () => void;
  11. }
  12. export function EditOwnershipRules({ownership, ...props}: EditOwnershipRulesModalProps) {
  13. const user = useUser();
  14. const email = user?.email ?? '#team-slug';
  15. return (
  16. <Fragment>
  17. <Fragment>
  18. <Description>
  19. {tct(
  20. 'Assign issues based on custom rules. To learn more, [docs:read the docs].',
  21. {
  22. docs: (
  23. <ExternalLink href="https://docs.sentry.io/product/issues/issue-owners/" />
  24. ),
  25. }
  26. )}
  27. </Description>
  28. <StyledPre>
  29. # {t("Here's an example")}
  30. <br />
  31. path:src/views/checkout {email}
  32. <br />
  33. url:https://example.com/checkout {email}
  34. <br />
  35. tags.transaction:/checkout/:page {email}
  36. </StyledPre>
  37. </Fragment>
  38. {ownership && (
  39. <OwnerInput
  40. {...props}
  41. dateUpdated={ownership.lastUpdated}
  42. initialText={ownership.raw || ''}
  43. page="project_settings"
  44. />
  45. )}
  46. </Fragment>
  47. );
  48. }
  49. const StyledPre = styled('pre')`
  50. word-break: break-word;
  51. padding: ${space(2)};
  52. line-height: 1.6;
  53. color: ${p => p.theme.subText};
  54. `;
  55. const Description = styled('p')`
  56. margin-bottom: ${space(1)};
  57. `;